@After public void tearDown() { if (this.repeats.isFinalizing()) { this.brokerIsRunning.removeTestQueues(); } }
@Before public void init() { if (!repeatProcessor.isInitialized()) { logger.info("Initializing at start of test"); connectionFactory = createConnectionFactory(); listener = new CloseConnectionListener(); } }
@Before public void declareQueue() { if (repeat.isInitialized()) { // Important to prevent concurrent re-initialization return; } connectionFactory = new CachingConnectionFactory(); connectionFactory.setHost("localhost"); connectionFactory.setChannelCacheSize(repeat.getConcurrency()); connectionFactory.setPort(BrokerTestUtils.getPort()); template.setConnectionFactory(connectionFactory); }
@After public void clear() throws Exception { if (repeatProcessor.isFinalizing()) { // Wait for broker communication to finish before trying to stop container Thread.sleep(300L); logger.info("Shutting down at end of test"); if (container != null) { container.shutdown(); } if (connectionFactory != null) { ((DisposableBean) connectionFactory).destroy(); } this.brokerIsRunning.removeTestQueues(); } }
@After public void cleanUp() { if (!repeat.isFinalizing()) { return; } this.template.stop(); this.connectionFactory.destroy(); this.brokerIsRunning.removeTestQueues(); }