Skip to content

Commit

Permalink
Fix: seemingly equal ClientConfigurationData's objects end up not bei…
Browse files Browse the repository at this point in the history
…ng equal (apache#10091)

* fixed equals for the ClientConfigurationData (found while fixing tests in pulsar-adapters repo)

* added test/repro

* CR feedback
  • Loading branch information
dlg99 authored Apr 5, 2021
1 parent 6792e2f commit 8a2c5cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public class ClientConfigurationData implements Serializable, Cloneable {

public Authentication getAuthentication() {
if (authentication == null) {
this.authentication = new AuthenticationDisabled();
this.authentication = AuthenticationDisabled.INSTANCE;
}
return authentication;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,16 @@ public void testLoadSecretParams() {
Assert.fail();
}
}

@Test
public void testEquals() {
ClientConfigurationData confData1 = new ClientConfigurationData();
confData1.setServiceUrl("pulsar://unknown:6650");

ClientConfigurationData confData2 = new ClientConfigurationData();
confData2.setServiceUrl("pulsar://unknown:6650");

assertEquals(confData1, confData2);
assertEquals(confData1.hashCode(), confData2.hashCode());
}
}

0 comments on commit 8a2c5cc

Please sign in to comment.