ARTEMIS-577 & ARTEMIS-596 Fixing API compatibility.

This is also fixing a build issue.
This commit is contained in:
Clebert Suconic 2016-06-27 11:36:13 -04:00
parent 06adc4f071
commit 5dc5a242bb
9 changed files with 155 additions and 48 deletions

View File

@ -706,6 +706,25 @@ public interface ActiveMQServerControl {
@Parameter(name = "user", desc = "User name") String user, @Parameter(name = "user", desc = "User name") String user,
@Parameter(name = "password", desc = "User password") String password) throws Exception; @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) @Operation(desc = "Destroy a bridge", impact = MBeanOperationInfo.ACTION)
void destroyBridge(@Parameter(name = "name", desc = "Name of the bridge") String name) throws Exception; void destroyBridge(@Parameter(name = "name", desc = "Name of the bridge") String name) throws Exception;

View File

@ -108,4 +108,8 @@ public interface JMSBridge extends ActiveMQComponent {
void setPasswordCodec(String codec); void setPasswordCodec(String codec);
JMSBridge setBridgeName(String name);
String getBridgeName();
} }

View File

@ -84,7 +84,7 @@ public final class JMSBridgeImpl implements JMSBridge {
private final Object lock = new Object(); private final Object lock = new Object();
private String bridgeName; private String bridgeName = "N/A";
private String sourceUsername; private String sourceUsername;
@ -195,8 +195,7 @@ public final class JMSBridgeImpl implements JMSBridge {
executor = createExecutor(); executor = createExecutor();
} }
public JMSBridgeImpl(final String bridgeName, public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory targetCff, final ConnectionFactoryFactory targetCff,
final DestinationFactory sourceDestinationFactory, final DestinationFactory sourceDestinationFactory,
final DestinationFactory targetDestinationFactory, final DestinationFactory targetDestinationFactory,
@ -214,11 +213,10 @@ public final class JMSBridgeImpl implements JMSBridge {
final String clientID, final String clientID,
final boolean addMessageIDInHeader) { 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, public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory targetCff, final ConnectionFactoryFactory targetCff,
final DestinationFactory sourceDestinationFactory, final DestinationFactory sourceDestinationFactory,
final DestinationFactory targetDestinationFactory, final DestinationFactory targetDestinationFactory,
@ -237,11 +235,10 @@ public final class JMSBridgeImpl implements JMSBridge {
final boolean addMessageIDInHeader, final boolean addMessageIDInHeader,
final MBeanServer mbeanServer, final MBeanServer mbeanServer,
final String objectName) { 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, public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory targetCff, final ConnectionFactoryFactory targetCff,
final DestinationFactory sourceDestinationFactory, final DestinationFactory sourceDestinationFactory,
final DestinationFactory targetDestinationFactory, final DestinationFactory targetDestinationFactory,
@ -299,8 +296,6 @@ public final class JMSBridgeImpl implements JMSBridge {
this.failoverTimeout = failoverTimeout; this.failoverTimeout = failoverTimeout;
this.bridgeName = bridgeName;
checkParams(); checkParams();
if (mbeanServer != null) { if (mbeanServer != null) {
@ -330,6 +325,17 @@ public final class JMSBridgeImpl implements JMSBridge {
// ActiveMQComponent overrides -------------------------------------------------- // ActiveMQComponent overrides --------------------------------------------------
@Override
public JMSBridgeImpl setBridgeName(String name) {
this.bridgeName = name;
return this;
}
@Override
public String getBridgeName() {
return bridgeName;
}
@Override @Override
public synchronized void start() throws Exception { public synchronized void start() throws Exception {
synchronized (stoppingGuard) { synchronized (stoppingGuard) {

View File

@ -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 @Override
public void destroyBridge(final String name) throws Exception { public void destroyBridge(final String name) throws Exception {
checkStarted(); checkStarted();

View File

@ -55,7 +55,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
activeMQServer = jmsServer1; activeMQServer = jmsServer1;
ConnectionFactoryFactory factInUse0 = cff0; ConnectionFactoryFactory factInUse0 = cff0;
ConnectionFactoryFactory factInUse1 = cff1; 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); addActiveMQComponent(bridge);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());

View File

@ -95,7 +95,7 @@ public class JMSBridgeClusteredTest extends ClusteredBridgeTestBase {
//even number //even number
final int batchSize = 4; 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(); txMgr = newTransactionManager();
bridge.setTransactionManager(txMgr); bridge.setTransactionManager(txMgr);
@ -154,7 +154,7 @@ public class JMSBridgeClusteredTest extends ClusteredBridgeTestBase {
DestinationFactory sourceQueueFactory = sourceServer.getDestinationFactory(sourceQueueName); DestinationFactory sourceQueueFactory = sourceServer.getDestinationFactory(sourceQueueName);
DestinationFactory targetQueueFactory = targetServer.getDestinationFactory(targetQueueName); 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(); txMgr = newTransactionManager();
bridge.setTransactionManager(txMgr); bridge.setTransactionManager(txMgr);

View File

@ -107,7 +107,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
public void testRetryConnectionOnStartup() throws Exception { public void testRetryConnectionOnStartup() throws Exception {
jmsServer1.stop(); 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()); bridge.setTransactionManager(newTransactionManager());
addActiveMQComponent(bridge); addActiveMQComponent(bridge);
bridge.start(); bridge.start();
@ -133,7 +133,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
public void testStopBridgeWithFailureWhenStarted() throws Exception { public void testStopBridgeWithFailureWhenStarted() throws Exception {
jmsServer1.stop(); 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.setTransactionManager(newTransactionManager());
bridge.start(); bridge.start();
@ -168,7 +168,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
factInUse1 = cff1xa; 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); addActiveMQComponent(bridge);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());
bridge.start(); bridge.start();
@ -223,7 +223,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
public void performCrashDestinationStopBridge() throws Exception { public void performCrashDestinationStopBridge() throws Exception {
ConnectionFactoryFactory factInUse0 = cff0; ConnectionFactoryFactory factInUse0 = cff0;
ConnectionFactoryFactory factInUse1 = cff1; 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); addActiveMQComponent(bridge);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());
@ -294,7 +294,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
DummyTransaction tx = new DummyTransaction(); DummyTransaction tx = new DummyTransaction();
tm.tx = tx; 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); addActiveMQComponent(bridge);
bridge.setTransactionManager(tm); bridge.setTransactionManager(tm);
@ -379,7 +379,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
* Verify all messages are received * Verify all messages are received
*/ */
private void performCrashAndReconnectDestCrashBeforePrepare(final boolean persistent) throws Exception { 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); addActiveMQComponent(bridge);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());

View File

@ -335,7 +335,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); bridge.start();
@ -414,7 +414,7 @@ public class JMSBridgeTest extends BridgeTestBase {
String clientID = null; String clientID = null;
try { 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"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -425,7 +425,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -436,7 +436,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -447,7 +447,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -458,7 +458,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -469,7 +469,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -480,7 +480,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -491,7 +491,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -513,7 +513,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); bridge.start();
@ -577,7 +577,7 @@ public class JMSBridgeTest extends BridgeTestBase {
String selector = "vegetable='radish'"; 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(); bridge.start();
@ -652,7 +652,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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.setUseMaskedPassword(true);
@ -726,7 +726,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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.setUseMaskedPassword(true);
bridge.setPasswordCodec(codec.getClass().getName() + ";key=bridgekey"); bridge.setPasswordCodec(codec.getClass().getName() + ";key=bridgekey");
@ -812,7 +812,7 @@ public class JMSBridgeTest extends BridgeTestBase {
final int NUM_MESSAGES = 10; 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(); bridge.start();
sendMessages(cf0, sourceTopic, 0, NUM_MESSAGES, false, largeMessage); sendMessages(cf0, sourceTopic, 0, NUM_MESSAGES, false, largeMessage);
@ -859,7 +859,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); bridge.start();
@ -890,7 +890,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); bridge.start();
@ -932,7 +932,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); bridge.start();
@ -1107,7 +1107,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); bridge.start();
@ -1255,7 +1255,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); bridge.start();
@ -1339,7 +1339,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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(); bridge.start();
@ -1409,7 +1409,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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(); bridge.start();
@ -1477,7 +1477,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { 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(); bridge.start();
@ -1542,7 +1542,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); bridge.start();
@ -1599,7 +1599,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; 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(); 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 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(); 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 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(); bridge.start();
@ -1731,7 +1731,7 @@ public class JMSBridgeTest extends BridgeTestBase {
JMSBridgeImpl bridge = null; JMSBridgeImpl bridge = null;
try { 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(); bridge.start();
} }
finally { finally {
@ -1747,7 +1747,7 @@ public class JMSBridgeTest extends BridgeTestBase {
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName objectName = new ObjectName("example.jmsbridge:service=JMSBridge"); 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)); Assert.assertTrue(mbeanServer.isRegistered(objectName));

View File

@ -644,6 +644,29 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
return ActiveMQServerControlUsingCoreTest.toStringArray((Object[]) proxy.retrieveAttributeValue("divertNames")); 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 @Override
public void createBridge(String name, public void createBridge(String name,
String queueName, String queueName,