public void testStartBridgeWithJTATransactionAlreadyRunning() throws Exception { BridgeImpl bridge = null; Transaction toResume = null; Transaction started = null; TransactionManager mgr = TransactionManagerLocator.getInstance().locate(); try { toResume = mgr.suspend(); mgr.begin(); started = mgr.getTransaction(); final int NUM_MESSAGES = 10; bridge = new BridgeImpl( cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); bridge.start(); this.sendMessages(cf0, sourceTopic, 0, NUM_MESSAGES, false); this.checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES); } finally { if (started != null) { try { started.rollback(); } catch (Exception e) { log.error("Failed to rollback", e); } } if (toResume != null) { try { mgr.resume(toResume); } catch (Exception e) { log.error("Failed to resume", e); } } if (bridge != null) { bridge.stop(); } } }