NO-JIRA fix Intermittent failures in artemis-junit
This commit is contained in:
parent
57cfb5d192
commit
2cf7c32128
|
@ -41,6 +41,13 @@ public class ThreadLeakCheckRule extends ExternalResource {
|
||||||
|
|
||||||
private static Set<String> knownThreads = new HashSet<>();
|
private static Set<String> knownThreads = new HashSet<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
addKownThread("MemoryPoolMXBean notification dispatcher");
|
||||||
|
addKownThread("threadDeathWatcher");
|
||||||
|
addKownThread("SeedGenerator Thread");
|
||||||
|
addKownThread("Attach Listener");
|
||||||
|
}
|
||||||
|
|
||||||
boolean enabled = true;
|
boolean enabled = true;
|
||||||
|
|
||||||
private Map<Thread, StackTraceElement[]> previousThreads;
|
private Map<Thread, StackTraceElement[]> previousThreads;
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
public class ActiveMQDynamicProducerResourceTest {
|
public class ActiveMQDynamicProducerResourceTest {
|
||||||
|
@ -44,9 +43,6 @@ public class ActiveMQDynamicProducerResourceTest {
|
||||||
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
||||||
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
||||||
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
||||||
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
||||||
|
@ -63,14 +59,8 @@ public class ActiveMQDynamicProducerResourceTest {
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_QUEUE_ONE), sentOne);
|
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_QUEUE_ONE), sentOne);
|
||||||
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_QUEUE_TWO), sentTwo);
|
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_QUEUE_TWO), sentTwo);
|
||||||
Wait.waitFor(new Wait.Condition() {
|
Wait.assertEquals(1L, () -> server.getMessageCount(TEST_QUEUE_ONE), 30_000, 10);
|
||||||
@Override
|
Wait.assertEquals(1L, () -> server.getMessageCount(TEST_QUEUE_TWO), 30_000, 10);
|
||||||
public boolean isSatisfied() throws Exception {
|
|
||||||
return server.getMessageCount(TEST_QUEUE_ONE) == 1 && server.getMessageCount(TEST_QUEUE_TWO) == 1;
|
|
||||||
}
|
|
||||||
}, 5000, 100);
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_QUEUE_ONE), 1, server.getMessageCount(TEST_QUEUE_ONE));
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_QUEUE_TWO), 1, server.getMessageCount(TEST_QUEUE_TWO));
|
|
||||||
|
|
||||||
ClientMessage receivedOne = server.receiveMessage(TEST_QUEUE_ONE);
|
ClientMessage receivedOne = server.receiveMessage(TEST_QUEUE_ONE);
|
||||||
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_QUEUE_ONE), receivedOne);
|
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_QUEUE_ONE), receivedOne);
|
||||||
|
|
|
@ -37,9 +37,6 @@ public class ActiveMQDynamicProducerResourceWithoutAddressExceptionTest {
|
||||||
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
||||||
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
||||||
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
||||||
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
public class ActiveMQDynamicProducerResourceWithoutAddressTest {
|
public class ActiveMQDynamicProducerResourceWithoutAddressTest {
|
||||||
|
@ -45,9 +44,6 @@ public class ActiveMQDynamicProducerResourceWithoutAddressTest {
|
||||||
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
||||||
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
||||||
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
||||||
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
||||||
|
@ -71,14 +67,8 @@ public class ActiveMQDynamicProducerResourceWithoutAddressTest {
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_QUEUE_ONE), sentOne);
|
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_QUEUE_ONE), sentOne);
|
||||||
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_QUEUE_TWO), sentTwo);
|
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_QUEUE_TWO), sentTwo);
|
||||||
Wait.waitFor(new Wait.Condition() {
|
Wait.assertEquals(1L, ()-> server.getMessageCount(TEST_QUEUE_ONE), 30_000, 10);
|
||||||
@Override
|
Wait.assertEquals(1L, ()-> server.getMessageCount(TEST_QUEUE_TWO), 30_000, 10);
|
||||||
public boolean isSatisfied() throws Exception {
|
|
||||||
return server.getMessageCount(TEST_QUEUE_ONE) == 1 && server.getMessageCount(TEST_QUEUE_TWO) == 1;
|
|
||||||
}
|
|
||||||
}, 5000, 100);
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_QUEUE_ONE), 1, server.getMessageCount(TEST_QUEUE_ONE));
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_QUEUE_TWO), 1, server.getMessageCount(TEST_QUEUE_TWO));
|
|
||||||
|
|
||||||
ClientMessage receivedOne = server.receiveMessage(TEST_QUEUE_ONE);
|
ClientMessage receivedOne = server.receiveMessage(TEST_QUEUE_ONE);
|
||||||
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_QUEUE_ONE), receivedOne);
|
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_QUEUE_ONE), receivedOne);
|
||||||
|
|
|
@ -43,9 +43,6 @@ public class ActiveMQProducerResourceTest {
|
||||||
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
||||||
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
||||||
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
||||||
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
||||||
|
|
|
@ -37,12 +37,6 @@ public class EmbeddedActiveMQResourceCustomConfigurationTest {
|
||||||
static final String TEST_QUEUE = "test.queue";
|
static final String TEST_QUEUE = "test.queue";
|
||||||
static final String TEST_ADDRESS = "test.address";
|
static final String TEST_ADDRESS = "test.address";
|
||||||
|
|
||||||
static {
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("SeedGenerator Thread");
|
|
||||||
}
|
|
||||||
|
|
||||||
CoreQueueConfiguration queueConfiguration = new CoreQueueConfiguration().setAddress(TEST_ADDRESS).setName(TEST_QUEUE);
|
CoreQueueConfiguration queueConfiguration = new CoreQueueConfiguration().setAddress(TEST_ADDRESS).setName(TEST_QUEUE);
|
||||||
Configuration customConfiguration = new ConfigurationImpl().setPersistenceEnabled(false).setSecurityEnabled(true).addQueueConfiguration(queueConfiguration);
|
Configuration customConfiguration = new ConfigurationImpl().setPersistenceEnabled(false).setSecurityEnabled(true).addQueueConfiguration(queueConfiguration);
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,6 @@ public class EmbeddedActiveMQResourceFileConfigurationTest {
|
||||||
static final String TEST_QUEUE = "test.queue";
|
static final String TEST_QUEUE = "test.queue";
|
||||||
static final String TEST_ADDRESS = "test.address";
|
static final String TEST_ADDRESS = "test.address";
|
||||||
|
|
||||||
static {
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("SeedGenerator Thread");
|
|
||||||
}
|
|
||||||
|
|
||||||
private EmbeddedActiveMQResource server = new EmbeddedActiveMQResource("embedded-artemis-server.xml");
|
private EmbeddedActiveMQResource server = new EmbeddedActiveMQResource("embedded-artemis-server.xml");
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
public class EmbeddedActiveMQResourceTest {
|
public class EmbeddedActiveMQResourceTest {
|
||||||
|
@ -45,9 +44,6 @@ public class EmbeddedActiveMQResourceTest {
|
||||||
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
||||||
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
||||||
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
||||||
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
public EmbeddedActiveMQResource server = new EmbeddedActiveMQResource();
|
||||||
|
@ -65,13 +61,7 @@ public class EmbeddedActiveMQResourceTest {
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_ADDRESS), sent);
|
assertNotNull(String.format(ASSERT_SENT_FORMAT, TEST_ADDRESS), sent);
|
||||||
Wait.waitFor(new Wait.Condition() {
|
Wait.assertEquals(1L, () -> server.getMessageCount(TEST_QUEUE), 30_000, 10);
|
||||||
@Override
|
|
||||||
public boolean isSatisfied() throws Exception {
|
|
||||||
return server.getMessageCount(TEST_QUEUE) == 1;
|
|
||||||
}
|
|
||||||
}, 5000, 100);
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_QUEUE), 1, server.getMessageCount(TEST_QUEUE));
|
|
||||||
|
|
||||||
ClientMessage received = server.receiveMessage(TEST_QUEUE);
|
ClientMessage received = server.receiveMessage(TEST_QUEUE);
|
||||||
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_ADDRESS), received);
|
assertNotNull(String.format(ASSERT_RECEIVED_FORMAT, TEST_ADDRESS), received);
|
||||||
|
|
|
@ -43,12 +43,6 @@ public class EmbeddedJMSResourceMultipleFileConfigurationTest {
|
||||||
static final String ASSERT_PUSHED_FORMAT = "Message should have been pushed a message to %s";
|
static final String ASSERT_PUSHED_FORMAT = "Message should have been pushed a message to %s";
|
||||||
static final String ASSERT_COUNT_FORMAT = "Unexpected message count in destination %s";
|
static final String ASSERT_COUNT_FORMAT = "Unexpected message count in destination %s";
|
||||||
|
|
||||||
static {
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("SeedGenerator Thread");
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmbeddedJMSResource jmsServer = new EmbeddedJMSResource("embedded-artemis-minimal-server.xml", "embedded-artemis-jms-only.xml");
|
public EmbeddedJMSResource jmsServer = new EmbeddedJMSResource("embedded-artemis-minimal-server.xml", "embedded-artemis-jms-only.xml");
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
public class EmbeddedJMSResourceQueueTest {
|
public class EmbeddedJMSResourceQueueTest {
|
||||||
|
@ -47,10 +46,6 @@ public class EmbeddedJMSResourceQueueTest {
|
||||||
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
||||||
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
||||||
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
||||||
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("SeedGenerator Thread");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmbeddedJMSResource jmsServer = new EmbeddedJMSResource();
|
public EmbeddedJMSResource jmsServer = new EmbeddedJMSResource();
|
||||||
|
@ -63,13 +58,7 @@ public class EmbeddedJMSResourceQueueTest {
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
assertNotNull(String.format(ASSERT_PUSHED_FORMAT, TEST_DESTINATION_NAME), pushed);
|
assertNotNull(String.format(ASSERT_PUSHED_FORMAT, TEST_DESTINATION_NAME), pushed);
|
||||||
Wait.waitFor(new Wait.Condition() {
|
Wait.assertEquals(1L, () -> jmsServer.getMessageCount(TEST_DESTINATION_NAME), (long)30_000, (long)10);
|
||||||
@Override
|
|
||||||
public boolean isSatisfied() throws Exception {
|
|
||||||
return jmsServer.getMessageCount(TEST_DESTINATION_NAME) == 1;
|
|
||||||
}
|
|
||||||
}, 5000, 100);
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_DESTINATION_NAME), 1, jmsServer.getMessageCount(TEST_DESTINATION_NAME));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -43,12 +43,6 @@ public class EmbeddedJMSResourceSingleFileConfigurationTest {
|
||||||
static final String ASSERT_PUSHED_FORMAT = "Message should have been pushed a message to %s";
|
static final String ASSERT_PUSHED_FORMAT = "Message should have been pushed a message to %s";
|
||||||
static final String ASSERT_COUNT_FORMAT = "Unexpected message count in destination %s";
|
static final String ASSERT_COUNT_FORMAT = "Unexpected message count in destination %s";
|
||||||
|
|
||||||
static {
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("SeedGenerator Thread");
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmbeddedJMSResource jmsServer = new EmbeddedJMSResource("embedded-artemis-jms-server.xml");
|
public EmbeddedJMSResource jmsServer = new EmbeddedJMSResource("embedded-artemis-jms-server.xml");
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
public class EmbeddedJMSResourceTopicTest {
|
public class EmbeddedJMSResourceTopicTest {
|
||||||
|
@ -54,10 +53,6 @@ public class EmbeddedJMSResourceTopicTest {
|
||||||
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
TEST_PROPERTIES = new HashMap<String, Object>(2);
|
||||||
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
TEST_PROPERTIES.put("PropertyOne", "Property Value 1");
|
||||||
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
TEST_PROPERTIES.put("PropertyTwo", "Property Value 2");
|
||||||
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("SeedGenerator Thread");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmbeddedJMSResource jmsServer = new EmbeddedJMSResource();
|
public EmbeddedJMSResource jmsServer = new EmbeddedJMSResource();
|
||||||
|
@ -84,13 +79,7 @@ public class EmbeddedJMSResourceTopicTest {
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
assertNotNull(String.format(ASSERT_PUSHED_FORMAT, TEST_DESTINATION_NAME), pushed);
|
assertNotNull(String.format(ASSERT_PUSHED_FORMAT, TEST_DESTINATION_NAME), pushed);
|
||||||
Wait.waitFor(new Wait.Condition() {
|
Wait.assertEquals(1L, () -> jmsServer.getMessageCount(TEST_DESTINATION_NAME), (long)30_000, (long)10);
|
||||||
@Override
|
|
||||||
public boolean isSatisfied() throws Exception {
|
|
||||||
return jmsServer.getMessageCount(TEST_DESTINATION_NAME) == 1;
|
|
||||||
}
|
|
||||||
}, 5000, 100);
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_DESTINATION_NAME), 1, jmsServer.getMessageCount(TEST_DESTINATION_NAME));
|
|
||||||
|
|
||||||
consumer.close();
|
consumer.close();
|
||||||
session.close();
|
session.close();
|
||||||
|
|
|
@ -39,11 +39,6 @@ public class MultipleEmbeddedActiveMQResourcesTest {
|
||||||
static final String ASSERT_RECEIVED_FORMAT = "Message should have been received from %s";
|
static final String ASSERT_RECEIVED_FORMAT = "Message should have been received from %s";
|
||||||
static final String ASSERT_COUNT_FORMAT = "Unexpected message count in queue %s";
|
static final String ASSERT_COUNT_FORMAT = "Unexpected message count in queue %s";
|
||||||
|
|
||||||
static {
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmbeddedActiveMQResource serverOne = new EmbeddedActiveMQResource(0);
|
public EmbeddedActiveMQResource serverOne = new EmbeddedActiveMQResource(0);
|
||||||
|
|
||||||
public EmbeddedActiveMQResource serverTwo = new EmbeddedActiveMQResource(1);
|
public EmbeddedActiveMQResource serverTwo = new EmbeddedActiveMQResource(1);
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.RuleChain;
|
import org.junit.rules.RuleChain;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
public class MultipleEmbeddedJMSResourcesTest {
|
public class MultipleEmbeddedJMSResourcesTest {
|
||||||
|
@ -36,11 +35,6 @@ public class MultipleEmbeddedJMSResourcesTest {
|
||||||
static final String ASSERT_PUSHED_FORMAT = "Message should have been pushed a message to %s";
|
static final String ASSERT_PUSHED_FORMAT = "Message should have been pushed a message to %s";
|
||||||
static final String ASSERT_COUNT_FORMAT = "Unexpected message count in destination %s";
|
static final String ASSERT_COUNT_FORMAT = "Unexpected message count in destination %s";
|
||||||
|
|
||||||
static {
|
|
||||||
ThreadLeakCheckRule.addKownThread("MemoryPoolMXBean notification dispatcher");
|
|
||||||
ThreadLeakCheckRule.addKownThread("threadDeathWatcher");
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmbeddedJMSResource jmsServerOne = new EmbeddedJMSResource(0);
|
public EmbeddedJMSResource jmsServerOne = new EmbeddedJMSResource(0);
|
||||||
|
|
||||||
public EmbeddedJMSResource jmsServerTwo = new EmbeddedJMSResource(1);
|
public EmbeddedJMSResource jmsServerTwo = new EmbeddedJMSResource(1);
|
||||||
|
@ -58,15 +52,8 @@ public class MultipleEmbeddedJMSResourcesTest {
|
||||||
|
|
||||||
Message pushedTwo = jmsServerTwo.pushMessage(TEST_QUEUE_TWO, TEST_BODY);
|
Message pushedTwo = jmsServerTwo.pushMessage(TEST_QUEUE_TWO, TEST_BODY);
|
||||||
assertNotNull(String.format(ASSERT_PUSHED_FORMAT, TEST_QUEUE_TWO), pushedTwo);
|
assertNotNull(String.format(ASSERT_PUSHED_FORMAT, TEST_QUEUE_TWO), pushedTwo);
|
||||||
|
Wait.assertEquals(1L, () -> jmsServerOne.getMessageCount(TEST_QUEUE_ONE), 30_000, 10);
|
||||||
Wait.waitFor(new Wait.Condition() {
|
Wait.assertEquals(1L, () -> jmsServerTwo.getMessageCount(TEST_QUEUE_TWO), 30_000, 10);
|
||||||
@Override
|
|
||||||
public boolean isSatisfied() throws Exception {
|
|
||||||
return jmsServerOne.getMessageCount(TEST_QUEUE_ONE) == 1 && jmsServerTwo.getMessageCount(TEST_QUEUE_TWO) == 1;
|
|
||||||
}
|
|
||||||
}, 5000, 100);
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_QUEUE_ONE), 1, jmsServerOne.getMessageCount(TEST_QUEUE_ONE));
|
|
||||||
assertEquals(String.format(ASSERT_COUNT_FORMAT, TEST_QUEUE_TWO), 1, jmsServerTwo.getMessageCount(TEST_QUEUE_TWO));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue