NO-JIRA Add some additional validation.

This commit is contained in:
Timothy Bish 2016-11-10 12:45:37 -05:00
parent 1a75e0f33a
commit 097c0e7eae
1 changed files with 12 additions and 2 deletions

View File

@ -18,6 +18,7 @@ package org.apache.activemq.transport.amqp.interop;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -171,6 +172,7 @@ public class AmqpScheduledMessageTest extends AmqpClientTestSupport {
assertEquals(0, brokerService.getAdminView().getQueues().length); assertEquals(0, brokerService.getAdminView().getQueues().length);
AmqpSender sender = session.createSender("queue://" + getTestName()); AmqpSender sender = session.createSender("queue://" + getTestName());
AmqpReceiver receiver = session.createReceiver("queue://" + getTestName());
// Get the Queue View early to avoid racing the delivery. // Get the Queue View early to avoid racing the delivery.
assertEquals(1, brokerService.getAdminView().getQueues().length); assertEquals(1, brokerService.getAdminView().getQueues().length);
@ -184,20 +186,28 @@ public class AmqpScheduledMessageTest extends AmqpClientTestSupport {
sender.send(message); sender.send(message);
sender.close(); sender.close();
receiver.flow(1);
// Read the message with short timeout, shouldn't get it. // Read the message with short timeout, shouldn't get it.
try { try {
readMessages(getTestName(), 1, false, 1000); assertNull(receiver.receive(1, TimeUnit.SECONDS));
fail("Should not read the message"); fail("Should not read the message");
} catch (Throwable ex) { } catch (Throwable ex) {
} }
// Read the message with long timeout, should get it. // Read the message with long timeout, should get it.
AmqpMessage delivered = null;
try { try {
readMessages(getTestName(), 1, false, 10000); delivered = receiver.receive(10, TimeUnit.SECONDS);
} catch (Throwable ex) { } catch (Throwable ex) {
fail("Should read the message"); fail("Should read the message");
} }
assertNotNull(delivered);
Long msgDeliveryTime = (Long) delivered.getMessageAnnotation("x-opt-delivery-delay");
assertNotNull(msgDeliveryTime);
assertEquals(delay, msgDeliveryTime.longValue());
connection.close(); connection.close();
} }