From 51cb5dfb184985f50c01c2aa53bbc31d0d060e8d Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon (cshannon)" Date: Wed, 31 Jan 2018 07:58:40 -0500 Subject: [PATCH] ARTEMIS-1647 - Add plugin support for binding creation and removal Adds callbacks to ActiveMQServerPlugin for binding add and remove events --- .../core/postoffice/impl/PostOfficeImpl.java | 52 ++++++++++++++++--- .../server/impl/RemotingServiceImpl.java | 8 ++- .../core/server/cluster/ClusterManager.java | 8 ++- .../artemis/core/server/impl/QueueImpl.java | 12 ++--- .../core/server/impl/ServerConsumerImpl.java | 16 ++++-- .../core/server/impl/ServerSessionImpl.java | 39 ++++++++++---- .../server/plugin/ActiveMQServerPlugin.java | 48 +++++++++++++++++ .../integration/plugin/AmqpPluginTest.java | 9 +++- .../integration/plugin/CorePluginTest.java | 25 +++++---- .../plugin/MethodCalledVerifier.java | 30 +++++++++++ .../integration/plugin/MqttPluginTest.java | 7 ++- .../plugin/OpenwirePluginTest.java | 7 ++- .../integration/plugin/StompPluginTest.java | 8 ++- 13 files changed, 220 insertions(+), 49 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java index 356674bef8..be4a0d51a6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java @@ -433,7 +433,10 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding private boolean internalAddressInfo(AddressInfo addressInfo, boolean reload) throws Exception { synchronized (addressLock) { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeAddAddress(addressInfo, reload) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeAddAddress(addressInfo, reload)); + } + boolean result; if (reload) { result = addressManager.reloadAddressInfo(addressInfo); @@ -446,7 +449,9 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (!addressInfo.isInternal()) { managementService.registerAddress(addressInfo); } - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterAddAddress(addressInfo, reload) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterAddAddress(addressInfo, reload)); + } } catch (Exception e) { e.printStackTrace(); } @@ -520,9 +525,14 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding public AddressInfo updateAddressInfo(SimpleString addressName, EnumSet routingTypes) throws Exception { synchronized (addressLock) { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeUpdateAddress(addressName, routingTypes) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeUpdateAddress(addressName, routingTypes)); + } + final AddressInfo address = addressManager.updateAddressInfo(addressName, routingTypes); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterUpdateAddress(address) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterUpdateAddress(address)); + } return address; } @@ -531,14 +541,19 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding @Override public AddressInfo removeAddressInfo(SimpleString address) throws Exception { synchronized (addressLock) { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeRemoveAddress(address) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeRemoveAddress(address)); + } + final Bindings bindingsForAddress = getDirectBindings(address); if (bindingsForAddress.getBindings().size() > 0) { throw ActiveMQMessageBundle.BUNDLE.addressHasBindings(address); } managementService.unregisterAddress(address); final AddressInfo addressInfo = addressManager.removeAddressInfo(address); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterRemoveAddress(address, addressInfo) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterRemoveAddress(address, addressInfo)); + } return addressInfo; } @@ -571,6 +586,10 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding // even though failover is complete @Override public synchronized void addBinding(final Binding binding) throws Exception { + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeAddBinding(binding)); + } + addressManager.addBinding(binding); TypedProperties props = new TypedProperties(); @@ -600,6 +619,11 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding } managementService.sendNotification(new Notification(uid, CoreNotificationType.BINDING_ADDED, props)); + + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterAddBinding(binding)); + } + } @Override @@ -607,6 +631,10 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding Transaction tx, boolean deleteData) throws Exception { + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeRemoveBinding(uniqueName, tx, deleteData)); + } + addressSettingsRepository.clearCache(); Binding binding = addressManager.removeBinding(uniqueName, tx); @@ -652,6 +680,10 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding binding.close(); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterRemoveBinding(binding, tx, deleteData) ); + } + return binding; } @@ -772,7 +804,9 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding message.cleanupInternalProperties(); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeMessageRoute(message, context, direct, rejectDuplicates) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeMessageRoute(message, context, direct, rejectDuplicates)); + } Bindings bindings = addressManager.getBindingsForRoutingAddress(context.getAddress(message)); @@ -859,7 +893,9 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding context.getTransaction().commit(); } - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterMessageRoute(message, context, direct, rejectDuplicates, result) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterMessageRoute(message, context, direct, rejectDuplicates, result)); + } return result; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java index 94c776c40c..5af9657c3e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java @@ -515,7 +515,9 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif ConnectionEntry entry = protocol.createConnectionEntry((Acceptor) component, connection); try { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterCreateConnection(entry.connection) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterCreateConnection(entry.connection)); + } } catch (ActiveMQException t) { logger.warn("Error executing afterCreateConnection plugin method: {}", t.getMessage(), t); throw new IllegalStateException(t.getMessage(), t.getCause()); @@ -543,7 +545,9 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif RemotingConnection removedConnection = removeConnection(connectionID); if (removedConnection != null) { try { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDestroyConnection(removedConnection) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterDestroyConnection(removedConnection)); + } } catch (ActiveMQException t) { logger.warn("Error executing afterDestroyConnection plugin method: {}", t.getMessage(), t); conn.connection.fail(t); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java index 4b34561928..82e7b8d59a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java @@ -406,7 +406,9 @@ public final class ClusterManager implements ActiveMQComponent { return; } - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeDeployBridge(config) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeDeployBridge(config)); + } Queue queue = (Queue) binding.getBindable(); @@ -481,7 +483,9 @@ public final class ClusterManager implements ActiveMQComponent { bridge.start(); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDeployBridge(bridge) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterDeployBridge(bridge)); + } } public static class IncomingInterceptorLookingForExceptionMessage implements Interceptor { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index fd136529e5..a454be0a34 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -1147,8 +1147,8 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { messagesAcknowledged.incrementAndGet(); } - if (server != null) { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.messageAcknowledged(ref, reason) : null); + if (server != null && server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.messageAcknowledged(ref, reason)); } } @@ -1185,8 +1185,8 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { messagesAcknowledged.incrementAndGet(); } - if (server != null) { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.messageAcknowledged(ref, reason) : null); + if (server != null && server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.messageAcknowledged(ref, reason)); } } @@ -1272,9 +1272,9 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { acknowledge(ref, AckReason.EXPIRED); } - if (server != null) { + if (server != null && server.hasBrokerPlugins()) { final SimpleString expiryAddress = messageExpiryAddress; - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.messageExpired(ref, expiryAddress) : null); + server.callBrokerPlugins(plugin -> plugin.messageExpired(ref, expiryAddress)); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java index e1c6c8dab4..45dd05c8c3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java @@ -444,7 +444,9 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { try { Message message = reference.getMessage(); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeDeliver(this, reference) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeDeliver(this, reference)); + } if (message.isLargeMessage() && supportLargeMessage) { if (largeMessageDeliverer == null) { @@ -462,7 +464,9 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { } finally { lockDelivery.readLock().unlock(); callback.afterDelivery(); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDeliver(this, reference) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterDeliver(this, reference)); + } } } @@ -478,7 +482,9 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { logger.trace("ServerConsumerImpl::" + this + " being closed with failed=" + failed, new Exception("trace")); } - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeCloseConsumer(this, failed) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeCloseConsumer(this, failed)); + } setStarted(false); @@ -537,7 +543,9 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { managementService.sendNotification(notification); } - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterCloseConsumer(this, failed) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterCloseConsumer(this, failed)); + } } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java index a2fb9332f9..a3e817b7f6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java @@ -356,7 +356,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } synchronized (this) { if (!closed) { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeCloseSession(this, failed) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeCloseSession(this, failed)); + } } this.setStarted(false); if (closed) @@ -410,7 +412,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener { closed = true; - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterCloseSession(this, failed) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterCloseSession(this, failed)); + } } } @@ -466,13 +470,17 @@ public class ServerSessionImpl implements ServerSession, FailureListener { Filter filter = FilterImpl.createFilter(filterString); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeCreateConsumer(consumerID, (QueueBinding) binding, - filterString, browseOnly, supportLargeMessage) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeCreateConsumer(consumerID, (QueueBinding) binding, + filterString, browseOnly, supportLargeMessage)); + } ServerConsumer consumer = new ServerConsumerImpl(consumerID, this, (QueueBinding) binding, filter, started, browseOnly, storageManager, callback, preAcknowledge, strictUpdateDeliveryCount, managementService, supportLargeMessage, credits, server); consumers.put(consumer.getID(), consumer); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterCreateConsumer(consumer) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterCreateConsumer(consumer)); + } if (!browseOnly) { TypedProperties props = new TypedProperties(); @@ -1356,7 +1364,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener { message = msg; } - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeSend(this, tx, message, direct, noAutoCreateQueue) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeSend(this, tx, message, direct, noAutoCreateQueue)); + } // If the protocol doesn't support flow control, we have no choice other than fail the communication if (!this.getRemotingConnection().isSupportsFlowControl() && pagingManager.isDiskFull()) { @@ -1365,7 +1375,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { throw exception; } - RoutingStatus result = RoutingStatus.OK; + final RoutingStatus result; //large message may come from StompSession directly, in which //case the id header already generated. if (!message.isLargeMessage()) { @@ -1402,8 +1412,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener { result = doSend(tx, message, address, direct, noAutoCreateQueue); } - final RoutingStatus finalResult = result; - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterSend(this, tx, message, direct, noAutoCreateQueue, finalResult) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterSend(this, tx, message, direct, noAutoCreateQueue, result)); + } return result; } @@ -1435,12 +1446,18 @@ public class ServerSessionImpl implements ServerSession, FailureListener { @Override public void addMetaData(String key, String data) throws Exception { - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeSessionMetadataAdded(this, key, data) : null); + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.beforeSessionMetadataAdded(this, key, data)); + } + if (metaData == null) { metaData = new HashMap<>(); } metaData.put(key, data); - server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterSessionMetadataAdded(this, key, data) : null); + + if (server.hasBrokerPlugins()) { + server.callBrokerPlugins(plugin -> plugin.afterSessionMetadataAdded(this, key, data)); + } } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java index e095e0fb10..25e759fc89 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java @@ -26,6 +26,7 @@ import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.persistence.OperationContext; +import org.apache.activemq.artemis.core.postoffice.Binding; import org.apache.activemq.artemis.core.postoffice.QueueBinding; import org.apache.activemq.artemis.core.postoffice.RoutingStatus; import org.apache.activemq.artemis.core.security.SecurityAuth; @@ -43,6 +44,9 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.SessionCallback; import org.apache.activemq.artemis.utils.critical.CriticalComponent; +/** + * + */ public interface ActiveMQServerPlugin { @@ -331,6 +335,50 @@ public interface ActiveMQServerPlugin { } + /** + * Before a binding is added + * + * @param binding + * @throws ActiveMQException + */ + default void beforeAddBinding(Binding binding) throws ActiveMQException { + + } + + /** + * After a binding has been added + * + * @param binding The newly added binding + * @throws ActiveMQException + */ + default void afterAddBinding(Binding binding) throws ActiveMQException { + + } + + /** + * Before a binding is removed + * + * @param uniqueName + * @param tx + * @param deleteData + * @throws ActiveMQException + */ + default void beforeRemoveBinding(SimpleString uniqueName, Transaction tx, boolean deleteData) throws ActiveMQException { + + } + + /** + * After a binding is removed + * + * @param binding + * @param tx + * @param deleteData + * @throws ActiveMQException + */ + default void afterRemoveBinding(Binding binding, Transaction tx, boolean deleteData) throws ActiveMQException { + + } + /** * Before a message is sent * diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/AmqpPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/AmqpPluginTest.java index 2990074877..bcde01885b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/AmqpPluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/AmqpPluginTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.plugin; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CREATE_CONNECTION; @@ -28,8 +29,10 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_DESTROY_CONNECTION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CREATE_CONSUMER; @@ -39,6 +42,7 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_DEPLOY_BRIDGE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_ACKED; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_EXPIRED; @@ -99,13 +103,14 @@ public class AmqpPluginTest extends AmqpClientTestSupport { receiver.close(); connection.close(); - verifier.validatePluginMethodsEquals(0, MESSAGE_EXPIRED, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE); + verifier.validatePluginMethodsEquals(0, MESSAGE_EXPIRED, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE, + BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); verifier.validatePluginMethodsAtLeast(1, AFTER_CREATE_CONNECTION, AFTER_DESTROY_CONNECTION, BEFORE_CREATE_SESSION, AFTER_CREATE_SESSION, BEFORE_CLOSE_SESSION, AFTER_CLOSE_SESSION, BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_MESSAGE_ROUTE, AFTER_MESSAGE_ROUTE, BEFORE_DELIVER, AFTER_DELIVER, - BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); + BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING); } @Test(timeout = 60000) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java index a89b43a85b..abac09c01c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.plugin; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CREATE_CONNECTION; @@ -29,10 +30,12 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_DESTROY_QUEUE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_SESSION_METADATA_ADDED; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_UPDATE_ADDRESS; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CREATE_CONSUMER; @@ -43,6 +46,7 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_DESTROY_QUEUE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_SESSION_METADATA_ADDED; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_UPDATE_ADDRESS; @@ -126,10 +130,11 @@ public class CorePluginTest extends JMSTestBase { verifier.validatePluginMethodsEquals(0, MESSAGE_EXPIRED, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE, BEFORE_DESTROY_QUEUE, AFTER_DESTROY_QUEUE, BEFORE_UPDATE_ADDRESS, AFTER_UPDATE_ADDRESS, - BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS); + BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS, BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); verifier.validatePluginMethodsEquals(1, AFTER_CREATE_CONNECTION, AFTER_DESTROY_CONNECTION, BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER, - BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); + BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, BEFORE_ADD_BINDING, AFTER_ADD_BINDING, MESSAGE_ACKED, BEFORE_SEND, + AFTER_SEND, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); verifier.validatePluginMethodsEquals(2, BEFORE_CREATE_SESSION, AFTER_CREATE_SESSION, BEFORE_CLOSE_SESSION, AFTER_CLOSE_SESSION); verifier.validatePluginMethodsAtLeast(1, BEFORE_MESSAGE_ROUTE, @@ -151,7 +156,7 @@ public class CorePluginTest extends JMSTestBase { server.destroyQueue(new SimpleString(queue.getQueueName())); verifier.validatePluginMethodsEquals(1, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, BEFORE_DESTROY_QUEUE, - AFTER_DESTROY_QUEUE, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); + AFTER_DESTROY_QUEUE, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); } @Test @@ -167,7 +172,7 @@ public class CorePluginTest extends JMSTestBase { AFTER_DESTROY_QUEUE, BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS); verifier.validatePluginMethodsEquals(2, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, BEFORE_ADD_ADDRESS, - AFTER_ADD_ADDRESS); + AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING); } @Test @@ -181,12 +186,12 @@ public class CorePluginTest extends JMSTestBase { //before/add address called just once to remove autocreated destination verifier.validatePluginMethodsEquals(1, BEFORE_DESTROY_QUEUE, - AFTER_DESTROY_QUEUE, BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS); + AFTER_DESTROY_QUEUE, BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS, BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); //Before/Add address are called twice because of the autocreated destination and the //created destination in the before method verifier.validatePluginMethodsEquals(2, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, BEFORE_ADD_ADDRESS, - AFTER_ADD_ADDRESS); + AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING); } @Test @@ -210,12 +215,12 @@ public class CorePluginTest extends JMSTestBase { conn.close(); verifier.validatePluginMethodsEquals(0, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE, - BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS); + BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS, BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); verifier.validatePluginMethodsAtLeast(1, AFTER_CREATE_CONNECTION, AFTER_DESTROY_CONNECTION, BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER, BEFORE_SESSION_METADATA_ADDED, AFTER_SESSION_METADATA_ADDED, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_MESSAGE_ROUTE, - AFTER_MESSAGE_ROUTE, MESSAGE_EXPIRED, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); + AFTER_MESSAGE_ROUTE, MESSAGE_EXPIRED, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING); verifier.validatePluginMethodsEquals(2, BEFORE_CREATE_SESSION, AFTER_CREATE_SESSION, BEFORE_CLOSE_SESSION, AFTER_CLOSE_SESSION); @@ -243,12 +248,12 @@ public class CorePluginTest extends JMSTestBase { conn.close(); verifier.validatePluginMethodsEquals(0, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE, - BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS); + BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS, BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); verifier.validatePluginMethodsAtLeast(1, AFTER_CREATE_CONNECTION, AFTER_DESTROY_CONNECTION, BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_MESSAGE_ROUTE, AFTER_MESSAGE_ROUTE, BEFORE_DELIVER, AFTER_DELIVER, MESSAGE_EXPIRED, BEFORE_ADD_ADDRESS, - AFTER_ADD_ADDRESS); + AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING); verifier.validatePluginMethodsEquals(2, BEFORE_CREATE_SESSION, AFTER_CREATE_SESSION, BEFORE_CLOSE_SESSION, AFTER_CLOSE_SESSION); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java index f18e1be982..8e343ca902 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java @@ -20,6 +20,7 @@ import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.persistence.OperationContext; +import org.apache.activemq.artemis.core.postoffice.Binding; import org.apache.activemq.artemis.core.postoffice.QueueBinding; import org.apache.activemq.artemis.core.postoffice.RoutingStatus; import org.apache.activemq.artemis.core.security.SecurityAuth; @@ -80,6 +81,10 @@ public class MethodCalledVerifier implements ActiveMQServerPlugin { public static final String AFTER_CREATE_QUEUE = "afterCreateQueue"; public static final String BEFORE_DESTROY_QUEUE = "beforeDestroyQueue"; public static final String AFTER_DESTROY_QUEUE = "afterDestroyQueue"; + public static final String BEFORE_ADD_BINDING = "beforeAddBinding"; + public static final String AFTER_ADD_BINDING = "afterAddBinding"; + public static final String BEFORE_REMOVE_BINDING = "beforeRemoveBinding"; + public static final String AFTER_REMOVE_BINDING = "afterRemoveBinding"; public static final String MESSAGE_EXPIRED = "messageExpired"; public static final String MESSAGE_ACKED = "messageAcknowledged"; public static final String BEFORE_SEND = "beforeSend"; @@ -241,6 +246,31 @@ public class MethodCalledVerifier implements ActiveMQServerPlugin { methodCalled(AFTER_DESTROY_QUEUE); } + @Override + public void beforeAddBinding(Binding binding) throws ActiveMQException { + Preconditions.checkNotNull(binding); + methodCalled(BEFORE_ADD_BINDING); + } + + @Override + public void afterAddBinding(Binding binding) throws ActiveMQException { + Preconditions.checkNotNull(binding); + methodCalled(AFTER_ADD_BINDING); + } + + @Override + public void beforeRemoveBinding(SimpleString uniqueName, Transaction tx, boolean deleteData) + throws ActiveMQException { + Preconditions.checkNotNull(uniqueName); + methodCalled(BEFORE_REMOVE_BINDING); + } + + @Override + public void afterRemoveBinding(Binding binding, Transaction tx, boolean deleteData) throws ActiveMQException { + Preconditions.checkNotNull(binding); + methodCalled(AFTER_REMOVE_BINDING); + } + @Override public void messageExpired(MessageReference message, SimpleString messageExpiryAddress) { Preconditions.checkNotNull(message); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java index 2c68858cce..6026d634c1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java @@ -28,6 +28,7 @@ import org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTTestSuppo import org.junit.Test; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CREATE_CONNECTION; @@ -39,8 +40,10 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_DESTROY_CONNECTION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CREATE_CONSUMER; @@ -50,6 +53,7 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_DEPLOY_BRIDGE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_ACKED; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_EXPIRED; @@ -116,7 +120,8 @@ public class MqttPluginTest extends MQTTTestSupport { AFTER_CREATE_SESSION, BEFORE_CLOSE_SESSION, AFTER_CLOSE_SESSION, BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_MESSAGE_ROUTE, AFTER_MESSAGE_ROUTE, BEFORE_DELIVER, - AFTER_DELIVER, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); + AFTER_DELIVER, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING, + BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); } @Test(timeout = 60 * 1000) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/OpenwirePluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/OpenwirePluginTest.java index 2440cc6da7..fa7052dafd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/OpenwirePluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/OpenwirePluginTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.plugin; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CREATE_CONNECTION; @@ -28,9 +29,11 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_DESTROY_CONNECTION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_SESSION_METADATA_ADDED; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CREATE_CONSUMER; @@ -40,6 +43,7 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_DEPLOY_BRIDGE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_SESSION_METADATA_ADDED; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_ACKED; @@ -110,7 +114,8 @@ public class OpenwirePluginTest extends BasicOpenWireTest { AFTER_CREATE_SESSION, BEFORE_CLOSE_SESSION, AFTER_CLOSE_SESSION, BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_MESSAGE_ROUTE, AFTER_MESSAGE_ROUTE, BEFORE_DELIVER, - AFTER_DELIVER, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); + AFTER_DELIVER, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING, + BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/StompPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/StompPluginTest.java index 708e96827b..f527e794c1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/StompPluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/StompPluginTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.plugin; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CREATE_CONNECTION; @@ -29,8 +30,10 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_DESTROY_CONNECTION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_ADD_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_CONSUMER; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CLOSE_SESSION; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_CREATE_CONSUMER; @@ -40,6 +43,7 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_DEPLOY_BRIDGE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_MESSAGE_ROUTE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_ADDRESS; +import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_REMOVE_BINDING; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.BEFORE_SEND; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_ACKED; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_EXPIRED; @@ -126,12 +130,12 @@ public class StompPluginTest extends StompTestBase { newConn.disconnect(); - verifier.validatePluginMethodsEquals(0, MESSAGE_EXPIRED, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE); + verifier.validatePluginMethodsEquals(0, MESSAGE_EXPIRED, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE, BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); verifier.validatePluginMethodsAtLeast(1, AFTER_CREATE_CONNECTION, AFTER_DESTROY_CONNECTION, BEFORE_CREATE_SESSION, AFTER_CREATE_SESSION, BEFORE_CLOSE_SESSION, AFTER_CLOSE_SESSION, BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_MESSAGE_ROUTE, AFTER_MESSAGE_ROUTE, BEFORE_DELIVER, - AFTER_DELIVER, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); + AFTER_DELIVER, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING); } catch (Throwable e) { fail(e.getMessage());