summaryrefslogtreecommitdiff
path: root/java/systests
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2010-07-22 17:27:24 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2010-07-22 17:27:24 +0000
commitc05f958148125dddd1736e222883d15e384609b8 (patch)
treea9a52da407ce44c31905ed9e938dad2d6fe61c27 /java/systests
parent9d84eb76dd4285c292deee61a691b4887870208d (diff)
downloadqpid-python-c05f958148125dddd1736e222883d15e384609b8.tar.gz
QPID-2752
Added a test case to create and LVQ from the JMS client using the addressing syntax. Fixed a few bugs in QpidQueueOptions.java. Modified the MapAccessor to allow any value to be retrieved as a String. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@966763 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/client/queue/LVQTest.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/client/queue/LVQTest.java b/java/systests/src/main/java/org/apache/qpid/test/client/queue/LVQTest.java
new file mode 100644
index 0000000000..38906d0f53
--- /dev/null
+++ b/java/systests/src/main/java/org/apache/qpid/test/client/queue/LVQTest.java
@@ -0,0 +1,64 @@
+package org.apache.qpid.test.client.queue;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.qpid.test.client.destination.AddressBasedDestinationTest;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LVQTest extends QpidBrokerTestCase
+{
+ private static final Logger _logger = LoggerFactory.getLogger(LVQTest.class);
+ private Connection _connection;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ _connection = getConnection() ;
+ _connection.start();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ _connection.close();
+ super.tearDown();
+ }
+
+ public void testLVQQueue() throws Exception
+ {
+ String addr = "ADDR:my-lvq-queue; {create: always, " +
+ "node: {x-bindings: [{exchange : 'amq.direct', key : test}], " +
+ "x-declare:{'qpid.last_value_queue':1}}}";
+
+ Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
+
+ Destination dest = ssn.createQueue(addr);
+ MessageConsumer consumer = ssn.createConsumer(dest);
+ MessageProducer prod = ssn.createProducer(ssn.createQueue("ADDR:amq.direct/test"));
+
+ for (int i=0; i<40; i++)
+ {
+ Message msg = ssn.createTextMessage(String.valueOf(i));
+ msg.setStringProperty("qpid.LVQ_key", String.valueOf(i%10));
+ prod.send(msg);
+ }
+
+ for (int i=0; i<10; i++)
+ {
+ TextMessage msg = (TextMessage)consumer.receive(500);
+ assertEquals("The last value is not reflected","3" + i,msg.getText());
+ }
+
+ assertNull("There should not be anymore messages",consumer.receive(500));
+ }
+
+}