ARTEMIS-3363 Fix TransportConfiguration extraParams equals
This commit is contained in:
parent
84ffa9b37a
commit
14f8e8d5ab
|
@ -222,9 +222,8 @@ public class TransportConfiguration implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty and null extraProps maps are equivalent so the condition to check if two extraProps maps are equal is:
|
// Empty and null extraProps maps are equivalent so the condition to check if two extraProps maps are not equal is:
|
||||||
// (extraProps == that.extraProps) || (extraProps != null && ((extraProps.isEmpty() && that.extraProps == null) || extraProps.equals(that.extraProps)))
|
if ((extraProps != that.extraProps) && (extraProps != null || !that.extraProps.isEmpty()) && (that.extraProps != null || !extraProps.isEmpty()) && (extraProps == null || that.extraProps == null || !extraProps.equals(that.extraProps))) {
|
||||||
if ((extraProps != that.extraProps) && (extraProps == null || ((!extraProps.isEmpty() || that.extraProps != null) && !extraProps.equals(that.extraProps)))) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,24 @@ public class TransportConfigurationTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testExtraParamsEquals() {
|
||||||
|
final String name = "";
|
||||||
|
final String className = this.getClass().getName();
|
||||||
|
final Map<String, Object> params = Collections.emptyMap();
|
||||||
|
final Map<String, Object> extraParams = Collections.singletonMap("key", "foo");
|
||||||
|
|
||||||
|
Assert.assertEquals(new TransportConfiguration(className, params, name, null), new TransportConfiguration(className, params, name, null));
|
||||||
|
Assert.assertEquals(new TransportConfiguration(className, params, name, null), new TransportConfiguration(className, params, name, Collections.emptyMap()));
|
||||||
|
Assert.assertEquals(new TransportConfiguration(className, params, name, Collections.emptyMap()), new TransportConfiguration(className, params, name, null));
|
||||||
|
Assert.assertEquals(new TransportConfiguration(className, params, name, extraParams), new TransportConfiguration(className, params, name, extraParams));
|
||||||
|
Assert.assertEquals(new TransportConfiguration(className, params, name, extraParams), new TransportConfiguration(className, params, name, new HashMap<>(extraParams)));
|
||||||
|
|
||||||
|
Assert.assertNotEquals(new TransportConfiguration(className, params, name, null), new TransportConfiguration(className, params, name, extraParams));
|
||||||
|
Assert.assertNotEquals(new TransportConfiguration(className, params, name, Collections.emptyMap()), new TransportConfiguration(className, params, name, extraParams));
|
||||||
|
Assert.assertNotEquals(new TransportConfiguration(className, params, name, extraParams), new TransportConfiguration(className, params, name, Collections.singletonMap("key", "too")));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToStringObfuscatesPasswords() {
|
public void testToStringObfuscatesPasswords() {
|
||||||
HashMap<String, Object> params = new HashMap<>();
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
|
|
Loading…
Reference in New Issue