Author: clebert.suconic(a)jboss.com
Date: 2009-09-04 13:34:23 -0400 (Fri, 04 Sep 2009)
New Revision: 7938
Modified:
trunk/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java
Log:
Adding small test on delivery count
Modified: trunk/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java 2009-09-03
22:28:19 UTC (rev 7937)
+++ trunk/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java 2009-09-04
17:34:23 UTC (rev 7938)
@@ -275,6 +275,89 @@
}
}
+
+ public void testDeliveryCount() throws Exception
+ {
+ final int messageSize = (int)(3.5 *
ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
+
+ ClientSession session = null;
+
+ try
+ {
+ server = createServer(true);
+
+ server.start();
+
+ ClientSessionFactory sf = createInVMFactory();
+
+ session = sf.createSession(false, false, false);
+
+ session.createQueue(ADDRESS, ADDRESS, true);
+
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ Message clientFile = createLargeClientMessage(session, messageSize, true);
+ producer.send(clientFile);
+
+ session.commit();
+
+ session.start();
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ ClientMessage msg = consumer.receive(10000);
+ assertNotNull(msg);
+ msg.acknowledge();
+ assertEquals(1, msg.getDeliveryCount());
+ for (int i = 0 ; i < messageSize; i++)
+ {
+ assertEquals(getSamplebyte(i), msg.getBody().readByte());
+ }
+ session.rollback();
+
+ session.close();
+
+ session = sf.createSession(false, false, false);
+ session.start();
+
+ consumer = session.createConsumer(ADDRESS);
+ msg = consumer.receive(10000);
+ assertNotNull(msg);
+ msg.acknowledge();
+ for (int i = 0 ; i < messageSize; i++)
+ {
+ assertEquals(getSamplebyte(i), msg.getBody().readByte());
+ }
+ assertEquals(2, msg.getDeliveryCount());
+ msg.acknowledge();
+ consumer.close();
+
+ session.commit();
+
+ validateNoFilesOnLargeDir();
+ }
+ finally
+ {
+ try
+ {
+ server.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+
+ try
+ {
+ session.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ }
+
+
public void testDLAOnExpiry() throws Exception
{
final int messageSize = (int)(3.5 *
ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
Show replies by date