fix assertion on discarded count

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@943877 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-05-13 13:10:49 +00:00
parent 429869d034
commit c909e965c7
1 changed files with 3 additions and 1 deletions

View File

@ -118,12 +118,13 @@ public class MessageEvictionTest {
Session advisorySession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
final MessageConsumer consumer = advisorySession.createConsumer(discardedAdvisoryDestination);
consumer.setMessageListener(new MessageListener() {
int advisoriesReceived = 0;
public void onMessage(Message message) {
try {
LOG.info("advisory:" + message);
ActiveMQMessage activeMQMessage = (ActiveMQMessage) message;
assertNotNull(activeMQMessage.getStringProperty(AdvisorySupport.MSG_PROPERTY_CONSUMER_ID));
assertEquals(1, activeMQMessage.getIntProperty(AdvisorySupport.MSG_PROPERTY_DISCARDED_COUNT));
assertEquals(++advisoriesReceived, activeMQMessage.getIntProperty(AdvisorySupport.MSG_PROPERTY_DISCARDED_COUNT));
message.acknowledge();
advisoryIsGood.countDown();
} catch (JMSException e) {
@ -164,6 +165,7 @@ public class MessageEvictionTest {
try {
// very slow, only ack once
doAck.await(60, TimeUnit.SECONDS);
LOG.info("acking: " + message.getJMSMessageID());
message.acknowledge();
} catch (Exception e) {
e.printStackTrace();