@Test public void testEquality() throws Exception { final KerberosToken token = EasyMock.createMock(KerberosToken.class); SaslConnectionParams params1 = testUser .doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(token)); SaslConnectionParams params2 = testUser .doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(token)); assertEquals(params1, params2); assertEquals(params1.hashCode(), params2.hashCode()); final DelegationTokenImpl delToken1 = new DelegationTokenImpl(new byte[0], new AuthenticationTokenIdentifier("user", 1, 10L, 20L, "instanceid")); SaslConnectionParams params3 = testUser .doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(delToken1)); assertNotEquals(params1, params3); assertNotEquals(params1.hashCode(), params3.hashCode()); assertNotEquals(params2, params3); assertNotEquals(params2.hashCode(), params3.hashCode()); final DelegationTokenImpl delToken2 = new DelegationTokenImpl(new byte[0], new AuthenticationTokenIdentifier("user", 1, 10L, 20L, "instanceid")); SaslConnectionParams params4 = testUser .doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(delToken2)); assertNotEquals(params1, params4); assertNotEquals(params1.hashCode(), params4.hashCode()); assertNotEquals(params2, params4); assertNotEquals(params2.hashCode(), params4.hashCode()); assertEquals(params3, params4); assertEquals(params3.hashCode(), params4.hashCode()); }
@Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(23, 29); hcb.append(kerberosServerPrimary).append(saslProperties).append(qop.hashCode()) .append(principal).append(mechanism).append(callbackHandler); return hcb.toHashCode(); }
SaslConnectionParams { @Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(23, 29); hcb.append(kerberosServerPrimary).append(saslProperties).append(qop.hashCode()) .append(principal).append(mechanism).append(callbackHandler); return hcb.toHashCode(); } }
SaslConnectionParams { @Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(23, 29); hcb.append(kerberosServerPrimary).append(saslProperties).append(qop.hashCode()) .append(principal).append(mechanism).append(callbackHandler); return hcb.toHashCode(); } SaslConnectionParams(AccumuloConfiguration conf, AuthenticationToken token);  SaslConnectionParams(Properties properties, AuthenticationToken token); }
SaslConnectionParams { @Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(23, 29); hcb.append(kerberosServerPrimary).append(saslProperties).append(qop.hashCode()) .append(principal).append(mechanism).append(callbackHandler); return hcb.toHashCode(); } SaslConnectionParams(AccumuloConfiguration conf, AuthenticationToken token);  SaslConnectionParams(Properties properties, AuthenticationToken token); static SaslConnectionParams from(AccumuloConfiguration config, AuthenticationToken token); Map<String,String> getSaslProperties(); QualityOfProtection getQualityOfProtection(); String getKerberosServerPrimary(); String getPrincipal(); SaslMechanism getMechanism(); CallbackHandler getCallbackHandler(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); static String getDefaultRealm(); }
SaslConnectionParams { @Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(23, 29); hcb.append(kerberosServerPrimary).append(saslProperties).append(qop.hashCode()) .append(principal).append(mechanism).append(callbackHandler); return hcb.toHashCode(); } SaslConnectionParams(AccumuloConfiguration conf, AuthenticationToken token);  SaslConnectionParams(Properties properties, AuthenticationToken token); static SaslConnectionParams from(AccumuloConfiguration config, AuthenticationToken token); Map<String,String> getSaslProperties(); QualityOfProtection getQualityOfProtection(); String getKerberosServerPrimary(); String getPrincipal(); SaslMechanism getMechanism(); CallbackHandler getCallbackHandler(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); static String getDefaultRealm();  }