From 5dc5a242bbf1eab6cc8c025f16606095ce224b73 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Mon, 27 Jun 2016 11:36:13 -0400 Subject: [PATCH] ARTEMIS-577 & ARTEMIS-596 Fixing API compatibility. This is also fixing a build issue. --- .../management/ActiveMQServerControl.java | 19 +++++++ .../artemis/jms/bridge/JMSBridge.java | 4 ++ .../jms/bridge/impl/JMSBridgeImpl.java | 28 ++++++---- .../impl/ActiveMQServerControlImpl.java | 55 ++++++++++++++++++ .../byteman/JMSBridgeReconnectionTest.java | 2 +- .../jms/bridge/JMSBridgeClusteredTest.java | 4 +- .../jms/bridge/JMSBridgeReconnectionTest.java | 12 ++-- .../extras/jms/bridge/JMSBridgeTest.java | 56 +++++++++---------- .../ActiveMQServerControlUsingCoreTest.java | 23 ++++++++ 9 files changed, 155 insertions(+), 48 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java index de9bc9fab9..8ec70e47d9 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java @@ -706,6 +706,25 @@ public interface ActiveMQServerControl { @Parameter(name = "user", desc = "User name") String user, @Parameter(name = "password", desc = "User password") String password) throws Exception; + @Operation(desc = "Create a Bridge", impact = MBeanOperationInfo.ACTION) + void createBridge(@Parameter(name = "name", desc = "Name of the bridge") String name, + @Parameter(name = "queueName", desc = "Name of the source queue") String queueName, + @Parameter(name = "forwardingAddress", desc = "Forwarding address") String forwardingAddress, + @Parameter(name = "filterString", desc = "Filter of the brdige") String filterString, + @Parameter(name = "transformerClassName", desc = "Class name of the bridge transformer") String transformerClassName, + @Parameter(name = "retryInterval", desc = "Connection retry interval") long retryInterval, + @Parameter(name = "retryIntervalMultiplier", desc = "Connection retry interval multiplier") double retryIntervalMultiplier, + @Parameter(name = "initialConnectAttempts", desc = "Number of initial connection attempts") int initialConnectAttempts, + @Parameter(name = "reconnectAttempts", desc = "Number of reconnection attempts") int reconnectAttempts, + @Parameter(name = "useDuplicateDetection", desc = "Use duplicate detection") boolean useDuplicateDetection, + @Parameter(name = "confirmationWindowSize", desc = "Confirmation window size") int confirmationWindowSize, + @Parameter(name = "clientFailureCheckPeriod", desc = "Period to check client failure") long clientFailureCheckPeriod, + @Parameter(name = "staticConnectorNames", desc = "comma separated list of connector names or name of discovery group if 'useDiscoveryGroup' is set to true") String connectorNames, + @Parameter(name = "useDiscoveryGroup", desc = "use discovery group") boolean useDiscoveryGroup, + @Parameter(name = "ha", desc = "Is it using HA") boolean ha, + @Parameter(name = "user", desc = "User name") String user, + @Parameter(name = "password", desc = "User password") String password) throws Exception; + @Operation(desc = "Destroy a bridge", impact = MBeanOperationInfo.ACTION) void destroyBridge(@Parameter(name = "name", desc = "Name of the bridge") String name) throws Exception; diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/JMSBridge.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/JMSBridge.java index a7e67c2379..8e16aabcdf 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/JMSBridge.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/JMSBridge.java @@ -108,4 +108,8 @@ public interface JMSBridge extends ActiveMQComponent { void setPasswordCodec(String codec); + JMSBridge setBridgeName(String name); + + String getBridgeName(); + } \ No newline at end of file diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java index 53cd09de31..157305ccdd 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java @@ -84,7 +84,7 @@ public final class JMSBridgeImpl implements JMSBridge { private final Object lock = new Object(); - private String bridgeName; + private String bridgeName = "N/A"; private String sourceUsername; @@ -195,8 +195,7 @@ public final class JMSBridgeImpl implements JMSBridge { executor = createExecutor(); } - public JMSBridgeImpl(final String bridgeName, - final ConnectionFactoryFactory sourceCff, + public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff, final ConnectionFactoryFactory targetCff, final DestinationFactory sourceDestinationFactory, final DestinationFactory targetDestinationFactory, @@ -214,11 +213,10 @@ public final class JMSBridgeImpl implements JMSBridge { final String clientID, final boolean addMessageIDInHeader) { - this(bridgeName,sourceCff, targetCff, sourceDestinationFactory, targetDestinationFactory, sourceUsername, sourcePassword, targetUsername, targetPassword, selector, failureRetryInterval, maxRetries, qosMode, maxBatchSize, maxBatchTime, subName, clientID, addMessageIDInHeader, null, null); + this(sourceCff, targetCff, sourceDestinationFactory, targetDestinationFactory, sourceUsername, sourcePassword, targetUsername, targetPassword, selector, failureRetryInterval, maxRetries, qosMode, maxBatchSize, maxBatchTime, subName, clientID, addMessageIDInHeader, null, null); } - public JMSBridgeImpl(final String bridgeName, - final ConnectionFactoryFactory sourceCff, + public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff, final ConnectionFactoryFactory targetCff, final DestinationFactory sourceDestinationFactory, final DestinationFactory targetDestinationFactory, @@ -237,11 +235,10 @@ public final class JMSBridgeImpl implements JMSBridge { final boolean addMessageIDInHeader, final MBeanServer mbeanServer, final String objectName) { - this(bridgeName,sourceCff, targetCff, sourceDestinationFactory, targetDestinationFactory, sourceUsername, sourcePassword, targetUsername, targetPassword, selector, failureRetryInterval, maxRetries, qosMode, maxBatchSize, maxBatchTime, subName, clientID, addMessageIDInHeader, mbeanServer, objectName, DEFAULT_FAILOVER_TIMEOUT); + this(sourceCff, targetCff, sourceDestinationFactory, targetDestinationFactory, sourceUsername, sourcePassword, targetUsername, targetPassword, selector, failureRetryInterval, maxRetries, qosMode, maxBatchSize, maxBatchTime, subName, clientID, addMessageIDInHeader, mbeanServer, objectName, DEFAULT_FAILOVER_TIMEOUT); } - public JMSBridgeImpl(final String bridgeName, - final ConnectionFactoryFactory sourceCff, + public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff, final ConnectionFactoryFactory targetCff, final DestinationFactory sourceDestinationFactory, final DestinationFactory targetDestinationFactory, @@ -299,8 +296,6 @@ public final class JMSBridgeImpl implements JMSBridge { this.failoverTimeout = failoverTimeout; - this.bridgeName = bridgeName; - checkParams(); if (mbeanServer != null) { @@ -330,6 +325,17 @@ public final class JMSBridgeImpl implements JMSBridge { // ActiveMQComponent overrides -------------------------------------------------- + @Override + public JMSBridgeImpl setBridgeName(String name) { + this.bridgeName = name; + return this; + } + + @Override + public String getBridgeName() { + return bridgeName; + } + @Override public synchronized void start() throws Exception { synchronized (stoppingGuard) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java index 8202f144aa..710bb0ed7d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java @@ -1766,6 +1766,61 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active } } + + @Override + public void createBridge(final String name, + final String queueName, + final String forwardingAddress, + final String filterString, + final String transformerClassName, + final long retryInterval, + final double retryIntervalMultiplier, + final int initialConnectAttempts, + final int reconnectAttempts, + final boolean useDuplicateDetection, + final int confirmationWindowSize, + final long clientFailureCheckPeriod, + final String staticConnectorsOrDiscoveryGroup, + boolean useDiscoveryGroup, + final boolean ha, + final String user, + final String password) throws Exception { + checkStarted(); + + clearIO(); + + try { + BridgeConfiguration config = new BridgeConfiguration() + .setName(name) + .setQueueName(queueName) + .setForwardingAddress(forwardingAddress) + .setFilterString(filterString) + .setTransformerClassName(transformerClassName) + .setClientFailureCheckPeriod(clientFailureCheckPeriod) + .setRetryInterval(retryInterval) + .setRetryIntervalMultiplier(retryIntervalMultiplier) + .setInitialConnectAttempts(initialConnectAttempts) + .setReconnectAttempts(reconnectAttempts) + .setUseDuplicateDetection(useDuplicateDetection) + .setConfirmationWindowSize(confirmationWindowSize) + .setHA(ha) + .setUser(user) + .setPassword(password); + + if (useDiscoveryGroup) { + config.setDiscoveryGroupName(staticConnectorsOrDiscoveryGroup); + } + else { + config.setStaticConnectors(toList(staticConnectorsOrDiscoveryGroup)); + } + + server.deployBridge(config); + } + finally { + blockOnIO(); + } + } + @Override public void destroyBridge(final String name) throws Exception { checkStarted(); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/JMSBridgeReconnectionTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/JMSBridgeReconnectionTest.java index b27a54bacb..7848f04a7b 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/JMSBridgeReconnectionTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/JMSBridgeReconnectionTest.java @@ -55,7 +55,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase { activeMQServer = jmsServer1; ConnectionFactoryFactory factInUse0 = cff0; ConnectionFactoryFactory factInUse1 = cff1; - final JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false); + final JMSBridgeImpl bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false).setBridgeName("test-bridge"); addActiveMQComponent(bridge); bridge.setTransactionManager(newTransactionManager()); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeClusteredTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeClusteredTest.java index 183dcb4c67..f04f5909bf 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeClusteredTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeClusteredTest.java @@ -95,7 +95,7 @@ public class JMSBridgeClusteredTest extends ClusteredBridgeTestBase { //even number final int batchSize = 4; - bridge = new JMSBridgeImpl("test-bridge",sourceCFF, targetCFF, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, mode, batchSize, -1, null, null, false); + bridge = new JMSBridgeImpl(sourceCFF, targetCFF, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, mode, batchSize, -1, null, null, false).setBridgeName("test-bridge"); txMgr = newTransactionManager(); bridge.setTransactionManager(txMgr); @@ -154,7 +154,7 @@ public class JMSBridgeClusteredTest extends ClusteredBridgeTestBase { DestinationFactory sourceQueueFactory = sourceServer.getDestinationFactory(sourceQueueName); DestinationFactory targetQueueFactory = targetServer.getDestinationFactory(targetQueueName); - bridge = new JMSBridgeImpl("test-bridge",sourceCFF, targetCFF, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, mode, 10, 1000, null, null, false); + bridge = new JMSBridgeImpl(sourceCFF, targetCFF, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, mode, 10, 1000, null, null, false).setBridgeName("test-bridge"); txMgr = newTransactionManager(); bridge.setTransactionManager(txMgr); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeReconnectionTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeReconnectionTest.java index 9af2d4c747..a665b57d74 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeReconnectionTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeReconnectionTest.java @@ -107,7 +107,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase { public void testRetryConnectionOnStartup() throws Exception { jmsServer1.stop(); - JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false); + JMSBridgeImpl bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false).setBridgeName("test-bridge"); bridge.setTransactionManager(newTransactionManager()); addActiveMQComponent(bridge); bridge.start(); @@ -133,7 +133,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase { public void testStopBridgeWithFailureWhenStarted() throws Exception { jmsServer1.stop(); - JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 500, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false); + JMSBridgeImpl bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 500, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false).setBridgeName("test-bridge"); bridge.setTransactionManager(newTransactionManager()); bridge.start(); @@ -168,7 +168,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase { factInUse1 = cff1xa; } - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, qosMode, 10, -1, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, qosMode, 10, -1, null, null, false).setBridgeName("test-bridge"); addActiveMQComponent(bridge); bridge.setTransactionManager(newTransactionManager()); bridge.start(); @@ -223,7 +223,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase { public void performCrashDestinationStopBridge() throws Exception { ConnectionFactoryFactory factInUse0 = cff0; ConnectionFactoryFactory factInUse1 = cff1; - final JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false); + final JMSBridgeImpl bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false).setBridgeName("test-bridge"); addActiveMQComponent(bridge); bridge.setTransactionManager(newTransactionManager()); @@ -294,7 +294,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase { DummyTransaction tx = new DummyTransaction(); tm.tx = tx; - JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false); + JMSBridgeImpl bridge = new JMSBridgeImpl(cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false).setBridgeName("test-bridge"); addActiveMQComponent(bridge); bridge.setTransactionManager(tm); @@ -379,7 +379,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase { * Verify all messages are received */ private void performCrashAndReconnectDestCrashBeforePrepare(final boolean persistent) throws Exception { - JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false); + JMSBridgeImpl bridge = new JMSBridgeImpl(cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false).setBridgeName("test-bridge"); addActiveMQComponent(bridge); bridge.setTransactionManager(newTransactionManager()); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java index 701df9616e..17f364c7ef 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java @@ -335,7 +335,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, NUM_MESSAGES, -1, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, NUM_MESSAGES, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -414,7 +414,7 @@ public class JMSBridgeTest extends BridgeTestBase { String clientID = null; try { - bridge = new JMSBridgeImpl("test-bridge",null, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); + bridge = new JMSBridgeImpl(null, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false).setBridgeName("test-bridge"); fail("expected exception"); } catch (IllegalArgumentException e) { @@ -425,7 +425,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",cff0, null, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); + bridge = new JMSBridgeImpl(cff0, null, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false).setBridgeName("test-bridge"); fail("expected exception"); } catch (IllegalArgumentException e) { @@ -436,7 +436,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, null, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); + bridge = new JMSBridgeImpl(cff0, cff1, null, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false).setBridgeName("test-bridge"); fail("expected exception"); } catch (IllegalArgumentException e) { @@ -447,7 +447,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false).setBridgeName("test-bridge"); fail("expected exception"); } catch (IllegalArgumentException e) { @@ -458,7 +458,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, -2, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, -2, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false).setBridgeName("test-bridge"); fail("expected exception"); } catch (IllegalArgumentException e) { @@ -469,7 +469,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, -1, 10, qosMode, batchSize, maxBatchTime, subName, clientID, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, -1, 10, qosMode, batchSize, maxBatchTime, subName, clientID, false).setBridgeName("test-bridge"); fail("expected exception"); } catch (IllegalArgumentException e) { @@ -480,7 +480,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, 0, maxBatchTime, subName, clientID, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, 0, maxBatchTime, subName, clientID, false).setBridgeName("test-bridge"); fail("expected exception"); } catch (IllegalArgumentException e) { @@ -491,7 +491,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, -2, subName, clientID, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, -2, subName, clientID, false).setBridgeName("test-bridge"); fail("expected exception"); } catch (IllegalArgumentException e) { @@ -513,7 +513,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -577,7 +577,7 @@ public class JMSBridgeTest extends BridgeTestBase { String selector = "vegetable='radish'"; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, selector, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, selector, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -652,7 +652,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, "guest", mask, "guest", mask, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, "guest", mask, "guest", mask, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false).setBridgeName("test-bridge"); bridge.setUseMaskedPassword(true); @@ -726,7 +726,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, "guest", mask, "guest", mask, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, "guest", mask, "guest", mask, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false).setBridgeName("test-bridge"); bridge.setUseMaskedPassword(true); bridge.setPasswordCodec(codec.getClass().getName() + ";key=bridgekey"); @@ -812,7 +812,7 @@ public class JMSBridgeTest extends BridgeTestBase { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); sendMessages(cf0, sourceTopic, 0, NUM_MESSAGES, false, largeMessage); @@ -859,7 +859,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, batchSize, -1, null, null, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, batchSize, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -890,7 +890,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, batchSize, -1, "subTest", "clientid123", false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, batchSize, -1, "subTest", "clientid123", false).setBridgeName("test-bridge"); bridge.start(); @@ -932,7 +932,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, on); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, on); bridge.start(); @@ -1107,7 +1107,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, messageIDInHeader); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, messageIDInHeader).setBridgeName("test-bridge"); bridge.start(); @@ -1255,7 +1255,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); + bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -1339,7 +1339,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, batchSize, -1, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, batchSize, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -1409,7 +1409,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, 2, maxBatchTime, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, 2, maxBatchTime, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -1477,7 +1477,7 @@ public class JMSBridgeTest extends BridgeTestBase { } try { - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, batchSize, -1, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, batchSize, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -1542,7 +1542,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, NUM_MESSAGES, -1, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, NUM_MESSAGES, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -1599,7 +1599,7 @@ public class JMSBridgeTest extends BridgeTestBase { try { final int NUM_MESSAGES = 10; - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, NUM_MESSAGES, -1, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, NUM_MESSAGES, -1, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -1658,7 +1658,7 @@ public class JMSBridgeTest extends BridgeTestBase { final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 3000, 10, qosMode, MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 3000, 10, qosMode, MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false).setBridgeName("test-bridge"); bridge.start(); @@ -1698,7 +1698,7 @@ public class JMSBridgeTest extends BridgeTestBase { final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it - bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 3000, 10, qosMode, MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false); + bridge = new JMSBridgeImpl(factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 3000, 10, qosMode, MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false); bridge.start(); @@ -1731,7 +1731,7 @@ public class JMSBridgeTest extends BridgeTestBase { JMSBridgeImpl bridge = null; try { - bridge = new JMSBridgeImpl("test-bridge",cff0, cff0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 3000, 10, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10000, 3000, null, null, false); + bridge = new JMSBridgeImpl(cff0, cff0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 3000, 10, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10000, 3000, null, null, false).setBridgeName("test-bridge"); bridge.start(); } finally { @@ -1747,7 +1747,7 @@ public class JMSBridgeTest extends BridgeTestBase { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); ObjectName objectName = new ObjectName("example.jmsbridge:service=JMSBridge"); - JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0, cff0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false, mbeanServer, objectName.getCanonicalName()); + JMSBridgeImpl bridge = new JMSBridgeImpl(cff0, cff0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false, mbeanServer, objectName.getCanonicalName()).setBridgeName("test-bridge"); Assert.assertTrue(mbeanServer.isRegistered(objectName)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java index 0eb77d4b95..2f979cc111 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java @@ -644,6 +644,29 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes return ActiveMQServerControlUsingCoreTest.toStringArray((Object[]) proxy.retrieveAttributeValue("divertNames")); } + @Override + public void createBridge(String name, + String queueName, + String forwardingAddress, + String filterString, + String transformerClassName, + long retryInterval, + double retryIntervalMultiplier, + int initialConnectAttempts, + int reconnectAttempts, + boolean useDuplicateDetection, + int confirmationWindowSize, + int producerWindowSize, + long clientFailureCheckPeriod, + String connectorNames, + boolean useDiscovery, + boolean ha, + String user, + String password) throws Exception { + proxy.invokeOperation("createBridge", name, queueName, forwardingAddress, filterString, transformerClassName, retryInterval, retryIntervalMultiplier, initialConnectAttempts, reconnectAttempts, useDuplicateDetection, confirmationWindowSize, producerWindowSize, clientFailureCheckPeriod, connectorNames, useDiscovery, ha, user, password); + } + + @Override public void createBridge(String name, String queueName,