Fixed failing unit tests: Changed the queues used to unique names so that one test won't interfere with another; also changed JMSPublisherConsumerTest to JMSPublisherConsumerIT since it is an integration test between the publisher and consumer with ActiveMQ as the broker

This commit is contained in:
Mark Payne 2018-03-02 08:44:25 -05:00
parent eb844d8c6f
commit b4a4cc564e
2 changed files with 9 additions and 9 deletions

View File

@ -43,11 +43,11 @@ import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.jms.support.JmsHeaders;
public class JMSPublisherConsumerTest {
public class JMSPublisherConsumerIT {
@Test
public void validateBytesConvertedToBytesMessageOnSend() throws Exception {
final String destinationName = "testQueue";
final String destinationName = "validateBytesConvertedToBytesMessageOnSend";
JmsTemplate jmsTemplate = CommonTest.buildJmsTemplateForDestination(false);
try {
@ -66,7 +66,7 @@ public class JMSPublisherConsumerTest {
@Test
public void validateJmsHeadersAndPropertiesAreTransferredFromFFAttributes() throws Exception {
final String destinationName = "testQueue";
final String destinationName = "validateJmsHeadersAndPropertiesAreTransferredFromFFAttributes";
JmsTemplate jmsTemplate = CommonTest.buildJmsTemplateForDestination(false);
try {
@ -95,7 +95,7 @@ public class JMSPublisherConsumerTest {
*/
@Test(expected = IllegalStateException.class)
public void validateFailOnUnsupportedMessageType() throws Exception {
final String destinationName = "testQueue";
final String destinationName = "validateFailOnUnsupportedMessageType";
JmsTemplate jmsTemplate = CommonTest.buildJmsTemplateForDestination(false);
try {
@ -120,7 +120,7 @@ public class JMSPublisherConsumerTest {
@Test
public void validateConsumeWithCustomHeadersAndProperties() throws Exception {
final String destinationName = "testQueue";
final String destinationName = "validateConsumeWithCustomHeadersAndProperties";
JmsTemplate jmsTemplate = CommonTest.buildJmsTemplateForDestination(false);
try {
@ -156,7 +156,7 @@ public class JMSPublisherConsumerTest {
@Test(timeout = 20000)
public void testMultipleThreads() throws Exception {
String destinationName = "testQueue";
String destinationName = "testMultipleThreads";
JmsTemplate publishTemplate = CommonTest.buildJmsTemplateForDestination(false);
final CountDownLatch consumerTemplateCloseCount = new CountDownLatch(4);
@ -213,7 +213,7 @@ public class JMSPublisherConsumerTest {
@Test(timeout = 10000)
public void validateMessageRedeliveryWhenNotAcked() throws Exception {
String destinationName = "testQueue";
String destinationName = "validateMessageRedeliveryWhenNotAcked";
JmsTemplate jmsTemplate = CommonTest.buildJmsTemplateForDestination(false);
try {
JMSPublisher publisher = new JMSPublisher((CachingConnectionFactory) jmsTemplate.getConnectionFactory(), jmsTemplate, mock(ComponentLog.class));

View File

@ -43,7 +43,7 @@ public class PublishJMSTest {
public void validateSuccessfulPublishAndTransferToSuccess() throws Exception {
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
final String destinationName = "fooQueue";
final String destinationName = "validateSuccessfulPublishAndTransferToSuccess";
PublishJMS pubProc = new PublishJMS();
TestRunner runner = TestRunners.newTestRunner(pubProc);
JMSConnectionFactoryProviderDefinition cs = mock(JMSConnectionFactoryProviderDefinition.class);
@ -128,7 +128,7 @@ public class PublishJMSTest {
runner.enableControllerService(cs);
runner.setProperty(PublishJMS.CF_SERVICE, "cfProvider");
runner.setProperty(PublishJMS.DESTINATION, "fooQueue");
runner.setProperty(PublishJMS.DESTINATION, "validateFailedPublishAndTransferToFailure");
runner.enqueue("Hello Joe".getBytes());