* Send some more messages
* Verify all messages are received
*/
private void testCrashAndReconnectDestBasic(int qosMode, boolean persistent) throws Exception
{
Bridge bridge = null;
try
{
bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
"/ConnectionFactory", "/ConnectionFactory", null, null, null, null,
null, 1000, -1, qosMode, 10, -1, null, null, false);
bridge.start();
final int NUM_MESSAGES = 10;
//Send some messages
sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2 , persistent);
//Verify none are received
checkEmpty(targetQueue, 1);
//Now crash the dest server
log.info("About to crash server");
ServerManagement.kill(1);
//Wait a while before starting up to simulate the dest being down for a while
log.info("Waiting 5 secs before bringing server back up");
Thread.sleep(5000);
log.info("Done wait");
//Restart the server
log.info("Restarting server");
ServerManagement.start(1, "all", false);
ServerManagement.deployQueue("targetQueue", 1);
setUpAdministeredObjects();
//Send some more messages
log.info("Sending more messages");
sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES / 2, persistent);
log.info("Sent messages");
checkMessagesReceived(cf1, targetQueue, qosMode, NUM_MESSAGES, false);
}
finally
{
if (bridge != null)
{
try
{
bridge.stop();
}
catch (Exception e)
{
log.error("Failed to stop bridge", e);
}