From c05f958148125dddd1736e222883d15e384609b8 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Thu, 22 Jul 2010 17:27:24 +0000 Subject: 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 --- .../client/messaging/address/AddressHelper.java | 7 +++---- .../client/messaging/address/QpidQueueOptions.java | 21 +++++++++------------ 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'java/client/src') diff --git a/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java b/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java index 12758c2d88..989e0c6fbd 100644 --- a/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java +++ b/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java @@ -66,6 +66,7 @@ public class AddressHelper public static final String QUEUE = "queue"; public static final String KEY = "key"; public static final String ARGUMENTS = "arguments"; + public static final String RELIABILITY = "reliability"; private Address address; private Accessor addressProps; @@ -142,13 +143,11 @@ public class AddressHelper if (args.getString(QpidQueueOptions.QPID_LAST_VALUE_QUEUE) != null) { - options.setOrderingPolicy(args.getString(QpidQueueOptions.QPID_LAST_VALUE_QUEUE)); - options.setLvqKey(args.getString(QpidQueueOptions.QPID_LVQ_KEY)); + options.setOrderingPolicy(QpidQueueOptions.QPID_LAST_VALUE_QUEUE); } else if (args.getString(QpidQueueOptions.QPID_LAST_VALUE_QUEUE_NO_BROWSE) != null) { - options.setOrderingPolicy(args.getString(QpidQueueOptions.QPID_LAST_VALUE_QUEUE_NO_BROWSE)); - options.setLvqKey(args.getString(QpidQueueOptions.QPID_LVQ_KEY)); + options.setOrderingPolicy(QpidQueueOptions.QPID_LAST_VALUE_QUEUE_NO_BROWSE); } if (args.getString(QpidQueueOptions.QPID_QUEUE_EVENT_GENERATION) != null) diff --git a/java/client/src/main/java/org/apache/qpid/client/messaging/address/QpidQueueOptions.java b/java/client/src/main/java/org/apache/qpid/client/messaging/address/QpidQueueOptions.java index ac9bc59d79..04aa7d146f 100644 --- a/java/client/src/main/java/org/apache/qpid/client/messaging/address/QpidQueueOptions.java +++ b/java/client/src/main/java/org/apache/qpid/client/messaging/address/QpidQueueOptions.java @@ -67,18 +67,19 @@ public class QpidQueueOptions extends HashMap public void setOrderingPolicy(String s) { - if ("lvq".equals(s)) + if (QpidQueueOptions.QPID_LAST_VALUE_QUEUE.equals(s)) { this.put(QPID_LAST_VALUE_QUEUE, 1); } - else if ("lvq_no_browse".equals(s)) + else if (QpidQueueOptions.QPID_LAST_VALUE_QUEUE_NO_BROWSE.equals(s)) { this.put(QPID_LAST_VALUE_QUEUE_NO_BROWSE,1); } else { throw new IllegalArgumentException("Invalid Ordering Policy" + - " should be one of {lvq|lvq_no_browse}"); + " should be one of {" + QpidQueueOptions.QPID_LAST_VALUE_QUEUE + "|" + + QPID_LAST_VALUE_QUEUE_NO_BROWSE + "}"); } } @@ -87,20 +88,16 @@ public class QpidQueueOptions extends HashMap this.put(QPID_LVQ_KEY, key); } - public void setQueueEvents(String s) + public void setQueueEvents(String value) { - if (s.equals("enque_only")) + if (value != null && (value.equals("1") || value.equals("2"))) { - this.put(QPID_QUEUE_EVENT_GENERATION, 1); - } - else if (s.equals("enque_and_dequeue")) - { - this.put(QPID_QUEUE_EVENT_GENERATION,2); + this.put(QPID_QUEUE_EVENT_GENERATION, value); } else { - throw new IllegalArgumentException("Invalid value" + - " should be one of {enqueue_only|enqueue_and_dequeue}"); + throw new IllegalArgumentException("Invalid value for " + + QPID_QUEUE_EVENT_GENERATION + " should be one of {1|2}"); } } } -- cgit v1.2.1