Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes sonar issues #40

Merged
merged 10 commits into from
Dec 21, 2016
Merged

Fixes sonar issues #40

merged 10 commits into from
Dec 21, 2016

Conversation

kwatral
Copy link
Contributor

@kwatral kwatral commented Dec 19, 2016

Fixed some most important sonar issues: https://sonarqube.com/component_issues?id=com.cognifide.aet%3Aaet-root#resolved=false|types=BUG

I hereby agree to the terms of the AET Contributor License Agreement.

public boolean equals(Object o) {
HarNameValuePair obj = (HarNameValuePair) o;
@Override
public boolean equals(Object other) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messagesManager.activate(Collections.emptyMap());
messagesManager.remove("correlation-company-correlation-12345");

verify(mockedConnection, times(1)).invoke(objectName, "removeMatchingMessages",
new Object[]{"JMSCorrelationID='correlation-company-correlation-12345'"},
new String[]{"java.lang.String"});
}

@Test(expected = AETException.class)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it covered somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wasn't, but I restored and fixed it

MBeanServerConnection connection = MessagesHelper.setupConnection(jmxUrl);
for (ObjectName queue : MessagesHelper.getAetQueuesObjects(connection)) {
String queueName = queue.getKeyProperty(MessagesHelper.DESTINATION_NAME_PROPERTY);
jmxc = getJmxConnection(jmxUrl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JMXConnector implements Closeable so it may be auto-closed via try-with-resources.

@@ -53,7 +53,7 @@ public void addParameters(Map<String, String> parameters) {
}

public Map<String, String> getParameters() {
return parameters != null ? ImmutableMap.copyOf(parameters) : Collections.<String, String>emptyMap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure, that this change does not cause NPE when Operation instance is created using reflections (e.g. by GSON). Case here is when e.g. processing suite first time and there are no patterns in DB yet. Please check this case.

public class SerializingOperationTest {

@Test
public void testSerialization() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


Gson gson = new Gson();
String json = gson.toJson(operationInput);
Operation operationOutput = gson.fromJson(json, Operation.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create Operation instance from te json file that is e.g. read from the resources, not created before from Operation instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added from string

@malaskowski
Copy link
Contributor

Please see AET Contributing Rules Creating Pull Requests section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants