[
https://issues.apache.org/jira/browse/ARTEMIS-5141?focusedWorklogId=943066&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-943066
]
ASF GitHub Bot logged work on ARTEMIS-5141:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 11/Nov/24 10:04
Start Date: 11/Nov/24 10:04
Worklog Time Spent: 10m
Work Description: brusdev commented on code in PR #5333:
URL: https://github.com/apache/activemq-artemis/pull/5333#discussion_r1836287191
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java:
##########
@@ -233,6 +235,64 @@ public void testRedeployConnector() throws Exception {
}
}
+ @Test
+ public void testRedeployPlugin() throws Exception {
+ Path brokerXML = getTestDirfile().toPath().resolve("broker.xml");
+ URL url1 =
RedeployTest.class.getClassLoader().getResource("reload-plugin.xml");
+ URL url2 =
RedeployTest.class.getClassLoader().getResource("reload-plugin-updated.xml");
+ Files.copy(url1.openStream(), brokerXML);
+
+ EmbeddedActiveMQ embeddedActiveMQ = new EmbeddedActiveMQ();
+ embeddedActiveMQ.setConfigResourcePath(brokerXML.toUri().toString());
+ embeddedActiveMQ.start();
+
+ final ReusableLatch latch = new ReusableLatch(1);
+
+ Runnable tick = latch::countDown;
+
+ embeddedActiveMQ.getActiveMQServer().getReloadManager().setTick(tick);
+
+ try {
+ latch.await(10, TimeUnit.SECONDS);
+
+ assertEquals(0,
embeddedActiveMQ.getActiveMQServer().getBrokerPlugins().size());
+
+ embeddedActiveMQ.getActiveMQServer().registerBrokerPlugin(new
NotificationActiveMQServerPlugin());
+
+ assertEquals(1,
embeddedActiveMQ.getActiveMQServer().getBrokerPlugins().size());
+
assertTrue(embeddedActiveMQ.getActiveMQServer().getBrokerPlugins().stream()
+ .anyMatch(plugin ->
+ plugin instanceof NotificationActiveMQServerPlugin));
+
+ Files.copy(url2.openStream(), brokerXML,
StandardCopyOption.REPLACE_EXISTING);
+ brokerXML.toFile().setLastModified(System.currentTimeMillis() + 1000);
+ latch.setCount(1);
+ embeddedActiveMQ.getActiveMQServer().getReloadManager().setTick(tick);
+ latch.await(10, TimeUnit.SECONDS);
+
+ assertEquals(2,
embeddedActiveMQ.getActiveMQServer().getBrokerPlugins().size());
+
assertTrue(embeddedActiveMQ.getActiveMQServer().getBrokerPlugins().stream()
+ .anyMatch(plugin ->
+ plugin instanceof
NotificationActiveMQServerPlugin));
+
assertTrue(embeddedActiveMQ.getActiveMQServer().getBrokerPlugins().stream()
+ .anyMatch(plugin ->
+ plugin instanceof
LoggingActiveMQServerPlugin));
+
+ Files.copy(url1.openStream(), brokerXML,
StandardCopyOption.REPLACE_EXISTING);
+ brokerXML.toFile().setLastModified(System.currentTimeMillis() + 1000);
+ latch.setCount(1);
+ embeddedActiveMQ.getActiveMQServer().getReloadManager().setTick(tick);
+ latch.await(10, TimeUnit.SECONDS);
+
+ assertEquals(1,
embeddedActiveMQ.getActiveMQServer().getBrokerPlugins().size());
Review Comment:
Why is `embeddedActiveMQ.getActiveMQServer().getBrokerPlugins().size() == 1`
after the configuration reload?
Issue Time Tracking
-------------------
Worklog Id: (was: 943066)
Time Spent: 20m (was: 10m)
> Add or remove plugins on configuration reload
> ---------------------------------------------
>
> Key: ARTEMIS-5141
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5141
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Reporter: Anton Roskvist
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Ability to add or remove individual plugins defined in configuration on
> configuration reload
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact