rvais commented on code in PR #4488:
URL: https://github.com/apache/activemq-artemis/pull/4488#discussion_r1262352459
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java:
##########
@@ -257,6 +257,32 @@ public void testSecurityCacheSizes() throws Exception {
Wait.assertEquals(usingCore() ? 8 : 1, () ->
serverControl.getAuthorizationCacheSize());
}
+ @Test
+ public void testClearingSecurityCaches() throws Exception {
+ ActiveMQServerControl serverControl = createManagementControl();
+
+ ServerLocator loc = createInVMNonHALocator();
+ ClientSessionFactory csf = createSessionFactory(loc);
+ ClientSession session = csf.createSession("myUser", "myPass", false,
true, false, false, 0);
+ session.start();
+
+ final String address = "ADDRESS";
+ serverControl.createAddress(address, "MULTICAST");
+ ClientProducer producer = session.createProducer(address);
+ ClientMessage m = session.createMessage(true);
+ m.putStringProperty("hello", "world");
+ producer.send(m);
+
+ Assert.assertTrue(serverControl.getAuthenticationCacheSize() > 0);
+ Wait.assertTrue(() -> serverControl.getAuthorizationCacheSize() > 0);
+
+ serverControl.clearAuthenticationCache();
+ serverControl.clearAuthorizationCache();
+
+ Assert.assertEquals(usingCore() ? 1 : 0,
serverControl.getAuthenticationCacheSize());
Review Comment:
I am unsure what this assertion actually does...?! Test doesn't seem to be
parametrized and doesn't seem to contain anything that would influence the
return value of "usingCore" method. If the return value doesn't change, why the
ternal operator is used in the first place? The same applies for the condition
below. What these actually assert?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]