@Test public void testHashCodeReturnsSameValueOnRepeatedCall() { AmqpBridgeOptions options = new AmqpBridgeOptions(); options.addEnabledSaslMechanism("PLAIN"); assertEquals("Options should have same hash code for both calls", options.hashCode(), options.hashCode()); }
@Test(timeout = 20000) public void testRestrictSaslMechanisms(TestContext context) throws Exception { AmqpBridgeOptions options = new AmqpBridgeOptions(); // Try with the wrong password, with anonymous access disabled, expect start to fail doStartWithGivenCredentialsTestImpl(context, options, USERNAME_GUEST, "wrongpassword", false); // Try with the wrong password, with anonymous access enabled, expect start still to fail anonymousAccessAllowed = true; restartBroker(); doStartWithGivenCredentialsTestImpl(context, options, USERNAME_GUEST, "wrongpassword", false); // Now restrict the allows SASL mechanisms to ANONYMOUS, then expect start to succeed as it wont use the invalid // credentials options.addEnabledSaslMechanism("ANONYMOUS"); doStartWithGivenCredentialsTestImpl(context, options, USERNAME_GUEST, "wrongpassword", true); }