ARTEMIS-995 adding teardown in a few tests

This commit is contained in:
Clebert Suconic 2017-02-24 10:44:36 -05:00
parent 0c64cbfa4e
commit baee0038dc
9 changed files with 40 additions and 6 deletions

View File

@ -68,6 +68,8 @@ public class ActiveMQConsumerResourceTest {
ClientMessage received = consumer.receiveMessage();
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_ADDRESS), received);
server.stop();
}
@Test

View File

@ -77,6 +77,8 @@ public class ActiveMQDynamicProducerResourceTest {
ClientMessage receivedTwo = server.receiveMessage(TEST_QUEUE_TWO);
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_QUEUE_TWO), receivedTwo);
server.stop();
}
@Test

View File

@ -21,6 +21,7 @@ import java.util.Map;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@ -45,6 +46,11 @@ public class ActiveMQDynamicProducerResourceWithoutAddressExceptionTest {
ActiveMQDynamicProducerResource producer = new ActiveMQDynamicProducerResource(server.getVmURL());
@After
public void tear() {
server.stop();
}
@Rule
public RuleChain ruleChain = RuleChain.outerRule(new ThreadLeakCheckRule()).around(server).around(producer);

View File

@ -85,6 +85,8 @@ public class ActiveMQDynamicProducerResourceWithoutAddressTest {
ClientMessage receivedTwo = server.receiveMessage(TEST_QUEUE_TWO);
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_QUEUE_TWO), receivedTwo);
server.stop();
}
@Test

View File

@ -55,6 +55,7 @@ public class ActiveMQProducerResourceTest {
@Rule
public RuleChain ruleChain = RuleChain.outerRule(new ThreadLeakCheckRule()).around(server).around(producer);
ClientMessage sent = null;
@After

View File

@ -22,6 +22,7 @@ import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
import org.apache.activemq.artemis.core.server.Queue;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
@ -50,6 +51,11 @@ public class EmbeddedActiveMQResourceCustomConfigurationTest {
@Rule
public RuleChain rulechain = RuleChain.outerRule(new ThreadLeakCheckRule()).around(server);
@After
public void tear() {
server.stop();
}
@Test
public void testCustomConfiguration() throws Exception {
Configuration configuration = server.getServer().getActiveMQServer().getConfiguration();

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.junit;
import java.util.List;
import org.apache.activemq.artemis.core.server.Queue;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
@ -43,6 +44,11 @@ public class EmbeddedActiveMQResourceFileConfigurationTest {
@Rule
public RuleChain rulechain = RuleChain.outerRule(new ThreadLeakCheckRule()).around(server);
@After
public void tear() {
server.stop();
}
@Test
public void testConfiguredQueue() throws Exception {
assertNotNull(TEST_QUEUE + " should exist", server.locateQueue(TEST_QUEUE));

View File

@ -75,6 +75,8 @@ public class EmbeddedActiveMQResourceTest {
ClientMessage received = server.receiveMessage(TEST_QUEUE);
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_ADDRESS), received);
server.stop();
}
@Test

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.junit;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@ -56,6 +57,12 @@ public class MultipleEmbeddedActiveMQResourcesTest {
serverTwo.createQueue(TEST_ADDRESS_TWO, TEST_QUEUE_TWO);
}
@After
public void tearDown() {
serverOne.stop();
serverTwo.stop();
}
@Test
public void testMultipleServers() throws Exception {
ClientMessage sentOne = serverOne.sendMessage(TEST_ADDRESS_ONE, TEST_BODY);