*/
private void testCrashAndReconnectDestBasic(final QualityOfServiceMode qosMode,
final boolean persistent,
final boolean largeMessage) throws Exception
{
JMSBridgeImpl bridge = null;
ConnectionFactoryFactory factInUse0 = cff0;
ConnectionFactoryFactory factInUse1 = cff1;
if (qosMode.equals(QualityOfServiceMode.ONCE_AND_ONLY_ONCE))
{
factInUse0 = cff0xa;
factInUse1 = cff1xa;
}
try
{
bridge = new JMSBridgeImpl(factInUse0,
factInUse1,
sourceQueueFactory,
targetQueueFactory,
null,
null,
null,
null,
null,
1000,
-1,
qosMode,
10,
-1,
null,
null,
false);
bridge.setTransactionManager(newTransactionManager());
bridge.start();
final int NUM_MESSAGES = 10;
// Send some messages
sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2, persistent, largeMessage);
// Verify none are received
checkEmpty(targetQueue, 1);
// Now crash the dest server
JMSBridgeReconnectionTest.log.info("About to crash server");
jmsServer1.stop();
// Wait a while before starting up to simulate the dest being down for a while
JMSBridgeReconnectionTest.log.info("Waiting 5 secs before bringing server back up");
Thread.sleep(10000);
JMSBridgeReconnectionTest.log.info("Done wait");
// Restart the server
JMSBridgeReconnectionTest.log.info("Restarting server");
jmsServer1.start();
jmsServer1.createQueue(false, "targetQueue", null, true, "queue/targetQueue");
createQueue("targetQueue", 1);
setUpAdministeredObjects();
// Send some more messages
JMSBridgeReconnectionTest.log.info("Sending more messages");
sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES / 2, persistent, largeMessage);
JMSBridgeReconnectionTest.log.info("Sent messages");
checkMessagesReceived(cf1, targetQueue, qosMode, NUM_MESSAGES, false, largeMessage);
}
finally
{
if (bridge != null)
{
try
{
bridge.stop();
}
catch (Exception e)
{
JMSBridgeReconnectionTest.log.error("Failed to stop bridge", e);
}