NO-JIRA JMS Tests with ReceiveNoWait for assertNull

This commit is contained in:
Clebert Suconic 2020-04-16 18:29:02 -04:00
parent a5b2afabe2
commit 931fac2d7c
12 changed files with 42 additions and 53 deletions

View File

@ -328,7 +328,7 @@ public class AcknowledgementTest extends JMSTestCase {
consumerSess.recover();
Message m = consumer.receive(200);
Message m = consumer.receiveNoWait();
ProxyAssertSupport.assertNull(m);
}
@ -384,7 +384,7 @@ public class AcknowledgementTest extends JMSTestCase {
log.trace("Session recover called");
m = consumer.receive(200);
m = consumer.receiveNoWait();
log.trace("Message is:" + m);
@ -519,13 +519,11 @@ public class AcknowledgementTest extends JMSTestCase {
log.trace("Session recover called");
m = consumer.receive(200);
m = consumer.receiveNoWait();
log.trace("Message is:" + m);
ProxyAssertSupport.assertNull(m);
// Thread.sleep(3000000);
}
@Test
@ -575,7 +573,7 @@ public class AcknowledgementTest extends JMSTestCase {
log.trace("Session recover called");
m = consumer.receive(200);
m = consumer.receiveNoWait();
log.trace("Message is:" + m);
@ -681,7 +679,7 @@ public class AcknowledgementTest extends JMSTestCase {
log.trace("Session recover called");
m = consumer.receive(200);
m = consumer.receiveNoWait();
log.trace("Message is:" + m);

View File

@ -95,7 +95,7 @@ public class ConnectionClosedTest extends JMSTestCase {
ProxyAssertSupport.assertEquals("hello", tm.getText());
}
Message m = sub2.receive(200);
Message m = sub2.receiveNoWait();
ProxyAssertSupport.assertNull(m);

View File

@ -94,7 +94,7 @@ public class DurableSubscriptionTest extends JMSTestCase {
TextMessage tm = (TextMessage) durable.receive(1000);
ProxyAssertSupport.assertEquals("k", tm.getText());
Message m = durable.receive(1000);
Message m = durable.receiveNoWait();
ProxyAssertSupport.assertNull(m);
durable.close();
@ -197,7 +197,7 @@ public class DurableSubscriptionTest extends JMSTestCase {
conn.start();
Message m = durable.receive(1000);
Message m = durable.receiveNoWait();
ProxyAssertSupport.assertNull(m);
durable.close();
@ -266,7 +266,7 @@ public class DurableSubscriptionTest extends JMSTestCase {
conn.start();
Message m = durable.receive(1000);
Message m = durable.receiveNoWait();
// the durable subscription is destroyed and re-created. The red square message stored by
// the previous durable subscription is lost and (hopefully) garbage collected.
@ -327,7 +327,7 @@ public class DurableSubscriptionTest extends JMSTestCase {
MessageConsumer ds = s.createDurableSubscriber(ActiveMQServerTestCase.topic1, "uzzi");
conn.start();
ProxyAssertSupport.assertNull(ds.receive(1000));
ProxyAssertSupport.assertNull(ds.receiveNoWait());
ds.close();

View File

@ -1558,7 +1558,7 @@ public class MessageConsumerTest extends JMSTestCase {
MessageConsumer topicConsumer = consumerSession.createConsumer(ActiveMQServerTestCase.topic1);
Message m = topicConsumer.receive(1000);
Message m = topicConsumer.receiveNoWait();
ProxyAssertSupport.assertNull(m);
} finally {
@ -1601,7 +1601,7 @@ public class MessageConsumerTest extends JMSTestCase {
}
}, "Producer").start();
ProxyAssertSupport.assertNull(topicConsumer.receive(1500));
ProxyAssertSupport.assertNull(topicConsumer.receiveNoWait());
} finally {
if (producerConnection != null) {
producerConnection.close();
@ -1895,7 +1895,7 @@ public class MessageConsumerTest extends JMSTestCase {
}, "closing thread");
closerThread.start();
ProxyAssertSupport.assertNull(topicConsumer.receive(1500));
ProxyAssertSupport.assertNull(topicConsumer.receiveNoWait());
// wait for the closing thread to finish
boolean closed = latch.await(5000, TimeUnit.MILLISECONDS);
@ -2644,7 +2644,7 @@ public class MessageConsumerTest extends JMSTestCase {
conn.start();
Message msg = cons.receive(3000);
Message msg = cons.receiveNoWait();
ProxyAssertSupport.assertNull(msg);
@ -2707,7 +2707,7 @@ public class MessageConsumerTest extends JMSTestCase {
ProxyAssertSupport.assertEquals("nurse!", tm2.getText());
// but tm1 should not be redelivered
tm1 = (TextMessage) cons1.receive(1500);
tm1 = (TextMessage) cons1.receiveNoWait();
ProxyAssertSupport.assertNull(tm1);
} finally {
if (conn1 != null) {
@ -2962,7 +2962,7 @@ public class MessageConsumerTest extends JMSTestCase {
MessageConsumer durable4 = sess3.createDurableSubscriber(ActiveMQServerTestCase.topic1, "mySubscription1");
Message m = durable4.receive(1000);
Message m = durable4.receiveNoWait();
ProxyAssertSupport.assertNull(m);
durable3.close();
@ -3047,7 +3047,7 @@ public class MessageConsumerTest extends JMSTestCase {
sess4 = conn4.createSession(false, Session.AUTO_ACKNOWLEDGE);
durable = sess4.createDurableSubscriber(ActiveMQServerTestCase.topic1, "mySubscription");
TextMessage tm = (TextMessage) durable.receive(1000);
TextMessage tm = (TextMessage) durable.receiveNoWait();
ProxyAssertSupport.assertNull(tm);
conn4.close();
@ -3079,7 +3079,7 @@ public class MessageConsumerTest extends JMSTestCase {
sess6 = conn6.createSession(false, Session.AUTO_ACKNOWLEDGE);
durable = sess6.createDurableSubscriber(ActiveMQServerTestCase.topic1, "mySubscription");
TextMessage tm3 = (TextMessage) durable.receive(1000);
TextMessage tm3 = (TextMessage) durable.receiveNoWait();
ProxyAssertSupport.assertNull(tm3);
durable.close();
@ -3233,7 +3233,7 @@ public class MessageConsumerTest extends JMSTestCase {
conn2.start();
TextMessage tm = (TextMessage) durable2.receive(1500);
TextMessage tm = (TextMessage) durable2.receiveNoWait();
ProxyAssertSupport.assertNull(tm);
durable2.close();

View File

@ -730,12 +730,12 @@ public class MessageProducerTest extends JMSTestCase {
queueProducer.send(ps.createMessage());
assertNotNull(queueConsumer.receive(1000));
assertNull(topicConsumer.receive(1000));
assertNull(topicConsumer.receiveNoWait());
MessageProducer topicProducer = ps.createProducer(topic);
topicProducer.send(ps.createMessage());
assertNull(queueConsumer.receive(1000));
assertNull(queueConsumer.receiveNoWait());
assertNotNull(topicConsumer.receive(1000));
}

View File

@ -256,7 +256,7 @@ public class PersistenceTest extends JMSTestCase {
ProxyAssertSupport.assertEquals("a", t.getText());
}
{
TextMessage t = (TextMessage) cons.receive(500);
TextMessage t = (TextMessage) cons.receiveNoWait();
ProxyAssertSupport.assertNull(t);
}
} finally {

View File

@ -234,7 +234,7 @@ public class TransactedSessionTest extends JMSTestCase {
producer.send(m);
}
Message m = consumer.receive(500);
Message m = consumer.receiveNoWait();
ProxyAssertSupport.assertNull(m);
} finally {
if (conn != null) {
@ -340,7 +340,7 @@ public class TransactedSessionTest extends JMSTestCase {
consumer = consumerSess.createConsumer(queue1);
conn.start();
Message m = consumer.receive(500);
Message m = consumer.receiveNoWait();
ProxyAssertSupport.assertNull(m);
} finally {
@ -381,7 +381,7 @@ public class TransactedSessionTest extends JMSTestCase {
producerSess.rollback();
Message m = consumer.receive(500);
Message m = consumer.receiveNoWait();
ProxyAssertSupport.assertNull(m);
} finally {
@ -865,7 +865,7 @@ public class TransactedSessionTest extends JMSTestCase {
consumer = consumerSess.createConsumer(queue1);
conn.start();
Message m = consumer.receive(500);
Message m = consumer.receiveNoWait();
ProxyAssertSupport.assertNull(m);
} finally {
@ -906,7 +906,7 @@ public class TransactedSessionTest extends JMSTestCase {
producerSess.rollback();
Message m = consumer.receive(500);
Message m = consumer.receiveNoWait();
ProxyAssertSupport.assertNull(m);
} finally {

View File

@ -50,7 +50,7 @@ public class ExpiredMessageTest extends JMSTestCase {
conn.start();
ProxyAssertSupport.assertNull(cons.receive(2000));
ProxyAssertSupport.assertNull(cons.receiveNoWait());
conn.close();
}
@ -84,7 +84,7 @@ public class ExpiredMessageTest extends JMSTestCase {
ProxyAssertSupport.assertEquals(livingMessage.getText(), ((TextMessage) receivedMessage).getText());
// we do not receive the expiring message
ProxyAssertSupport.assertNull(cons.receive(1000));
ProxyAssertSupport.assertNull(cons.receiveNoWait());
conn.close();
}
@ -109,7 +109,7 @@ public class ExpiredMessageTest extends JMSTestCase {
MessageConsumer cons = session.createConsumer(queue1);
conn.start();
ProxyAssertSupport.assertNull(cons.receive(2000));
ProxyAssertSupport.assertNull(cons.receiveNoWait());
conn.close();
}

View File

@ -89,7 +89,7 @@ public class JMSExpirationHeaderTest extends MessageHeaderTestBase {
// DeliveryImpl is asynch - need to give enough time to get to the consumer
Thread.sleep(2000);
ProxyAssertSupport.assertNull(queueConsumer.receive(100));
ProxyAssertSupport.assertNull(queueConsumer.receiveNoWait());
}
@Test
@ -280,7 +280,7 @@ public class JMSExpirationHeaderTest extends MessageHeaderTestBase {
// DeliveryImpl is asynch - need to give enough time to get to the consumer
Thread.sleep(2000);
ProxyAssertSupport.assertNull(queueConsumer.receive(100));
ProxyAssertSupport.assertNull(queueConsumer.receiveNoWait());
// Need to check message isn't still in queue

View File

@ -124,7 +124,7 @@ public class JMSPriorityHeaderTest extends ActiveMQServerTestCase {
ProxyAssertSupport.assertEquals("a", t.getText());
}
{
TextMessage t = (TextMessage) cons.receive(500);
TextMessage t = (TextMessage) cons.receiveNoWait();
ProxyAssertSupport.assertNull(t);
}

View File

@ -135,7 +135,7 @@ public abstract class MessageTestBase extends ActiveMQServerTestCase {
r.acknowledge();
ProxyAssertSupport.assertNull(queueCons.receive(100));
ProxyAssertSupport.assertNull(queueCons.receiveNoWait());
}

View File

@ -80,7 +80,7 @@ public class SelectorTest extends ActiveMQServerTestCase {
ProxyAssertSupport.assertEquals(redMessage.getJMSMessageID(), rec.getJMSMessageID());
ProxyAssertSupport.assertEquals("red", rec.getStringProperty("color"));
ProxyAssertSupport.assertNull(redConsumer.receive(3000));
ProxyAssertSupport.assertNull(redConsumer.receiveNoWait());
redConsumer.close();
@ -211,15 +211,6 @@ public class SelectorTest extends ActiveMQServerTestCase {
ProxyAssertSupport.assertEquals("kermit the frog", m.getStringProperty("beatle"));
}
// m = cons2.receiveNoWait();
//
// if (m != null)
// {
// log.info("got " + m.getStringProperty("beatle") + " j: " + m.getIntProperty("wibble"));
// }
//ProxyAssertSupport.assertNull(m);
} finally {
if (conn != null) {
conn.close();
@ -466,27 +457,27 @@ public class SelectorTest extends ActiveMQServerTestCase {
Message r1 = cons1.receive(500);
ProxyAssertSupport.assertNotNull(r1);
Message n = cons1.receive(500);
Message n = cons1.receiveNoWait();
ProxyAssertSupport.assertNull(n);
Message r2 = cons2.receive(500);
ProxyAssertSupport.assertNotNull(r2);
n = cons2.receive(500);
n = cons2.receiveNoWait();
ProxyAssertSupport.assertNull(n);
Message r3 = cons3.receive(500);
ProxyAssertSupport.assertNotNull(r3);
n = cons3.receive(500);
n = cons3.receiveNoWait();
ProxyAssertSupport.assertNull(n);
Message r4 = cons4.receive(500);
ProxyAssertSupport.assertNotNull(r4);
n = cons4.receive(500);
n = cons4.receiveNoWait();
ProxyAssertSupport.assertNull(n);
Message r5 = cons5.receive(500);
ProxyAssertSupport.assertNotNull(r5);
n = cons5.receive(500);
n = cons5.receiveNoWait();
ProxyAssertSupport.assertNull(n);
ProxyAssertSupport.assertEquals("john", r1.getStringProperty("beatle"));
@ -618,7 +609,7 @@ public class SelectorTest extends ActiveMQServerTestCase {
ProxyAssertSupport.assertEquals(DeliveryMode.PERSISTENT, msg.getJMSDeliveryMode());
ProxyAssertSupport.assertEquals("Persistent", msg.getText());
ProxyAssertSupport.assertNull(persistentConsumer.receive(1000));
ProxyAssertSupport.assertNull(persistentConsumer.receiveNoWait());
persistentConsumer.close();