You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2014/10/07 21:55:41 UTC

git commit: Add full test coverage for the classes in jms.meta and enforce that id values cannot be null on creation plus fix a few other minor issues.

Repository: qpid-jms
Updated Branches:
  refs/heads/master 9e3d5608e -> 6973cb51d


Add full test coverage for the classes in jms.meta and enforce that id
values cannot be null on creation plus fix a few other minor issues. 

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/6973cb51
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/6973cb51
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/6973cb51

Branch: refs/heads/master
Commit: 6973cb51db39ade0e741580dc15bbc11eafa5f98
Parents: 9e3d560
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Oct 7 15:50:07 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Oct 7 15:50:15 2014 -0400

----------------------------------------------------------------------
 .../apache/qpid/jms/meta/JmsConnectionId.java   |  23 ++-
 .../apache/qpid/jms/meta/JmsConnectionInfo.java |  14 +-
 .../org/apache/qpid/jms/meta/JmsConsumerId.java |  32 +++-
 .../apache/qpid/jms/meta/JmsConsumerInfo.java   |  16 +-
 .../org/apache/qpid/jms/meta/JmsProducerId.java |  22 ++-
 .../apache/qpid/jms/meta/JmsProducerInfo.java   |  18 +-
 .../org/apache/qpid/jms/meta/JmsSessionId.java  |  25 ++-
 .../apache/qpid/jms/meta/JmsSessionInfo.java    |  50 +++++-
 .../apache/qpid/jms/meta/JmsTransactionId.java  |   9 +-
 .../qpid/jms/meta/JmsTransactionInfo.java       |  25 ++-
 .../qpid/jms/meta/JmsConnectionIdTest.java      | 167 ++++++++++++++++++
 .../qpid/jms/meta/JmsConnectionInfoTest.java    | 155 +++++++++++++++++
 .../apache/qpid/jms/meta/JmsConsumerIdTest.java | 161 ++++++++++++++++++
 .../qpid/jms/meta/JmsConsumerInfoTest.java      | 168 +++++++++++++++++++
 .../jms/meta/JmsDefaultResourceVisitorTest.java |  56 +++++++
 .../apache/qpid/jms/meta/JmsProducerIdTest.java | 161 ++++++++++++++++++
 .../qpid/jms/meta/JmsProducerInfoTest.java      | 142 ++++++++++++++++
 .../apache/qpid/jms/meta/JmsSessionIdTest.java  | 163 ++++++++++++++++++
 .../qpid/jms/meta/JmsSessionInfoTest.java       | 154 +++++++++++++++++
 .../qpid/jms/meta/JmsTransactionIdTest.java     | 117 +++++++++++++
 .../qpid/jms/meta/JmsTransactionInfoTest.java   | 138 +++++++++++++++
 21 files changed, 1765 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java
index 679b3b7..8af99d3 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java
@@ -21,22 +21,42 @@ public final class JmsConnectionId extends JmsAbstractResourceId implements Comp
     private final String value;
 
     public JmsConnectionId(String connectionId) {
+        if (connectionId == null || connectionId.isEmpty()) {
+            throw new IllegalArgumentException("Connection ID cannot be null or empty");
+        }
+
         this.value = connectionId;
     }
 
     public JmsConnectionId(JmsConnectionId id) {
+        if (id == null) {
+            throw new IllegalArgumentException("Connection ID cannot be null");
+        }
+
         this.value = id.getValue();
     }
 
     public JmsConnectionId(JmsSessionId id) {
+        if (id == null) {
+            throw new IllegalArgumentException("Session ID cannot be null");
+        }
+
         this.value = id.getConnectionId();
     }
 
     public JmsConnectionId(JmsProducerId id) {
+        if (id == null) {
+            throw new IllegalArgumentException("Producer ID cannot be null");
+        }
+
         this.value = id.getConnectionId();
     }
 
     public JmsConnectionId(JmsConsumerId id) {
+        if (id == null) {
+            throw new IllegalArgumentException("Consumer ID cannot be null");
+        }
+
         this.value = id.getConnectionId();
     }
 
@@ -47,7 +67,8 @@ public final class JmsConnectionId extends JmsAbstractResourceId implements Comp
     @Override
     public int hashCode() {
         if (hashCode == 0) {
-            hashCode = value.hashCode();
+            hashCode = 1;
+            hashCode = 31 * hashCode + value.hashCode();
         }
         return hashCode;
     }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java
index d5e7677..4d42b10 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java
@@ -49,6 +49,10 @@ public final class JmsConnectionInfo implements JmsResource, Comparable<JmsConne
     private String tempTopicPrefix = "/temp-topic/";
 
     public JmsConnectionInfo(JmsConnectionId connectionId) {
+        if (connectionId == null) {
+            throw new IllegalArgumentException("ConnectionId cannot be null");
+        }
+
         this.connectionId = connectionId;
     }
 
@@ -73,6 +77,7 @@ public final class JmsConnectionInfo implements JmsResource, Comparable<JmsConne
         copy.topicPrefix = topicPrefix;
         copy.tempQueuePrefix = tempQueuePrefix;
         copy.tempTopicPrefix = tempTopicPrefix;
+        copy.connectTimeout = connectTimeout;
     }
 
     public boolean isForceAsyncSend() {
@@ -214,7 +219,7 @@ public final class JmsConnectionInfo implements JmsResource, Comparable<JmsConne
 
     @Override
     public int hashCode() {
-        return (connectionId == null) ? super.hashCode() : connectionId.hashCode();
+        return connectionId.hashCode();
     }
 
     @Override
@@ -230,12 +235,7 @@ public final class JmsConnectionInfo implements JmsResource, Comparable<JmsConne
         }
 
         JmsConnectionInfo other = (JmsConnectionInfo) obj;
-
-        if (connectionId != null) {
-            return connectionId.equals(other.connectionId);
-        }
-
-        return false;
+        return connectionId.equals(other.connectionId);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java
index 2ea3d44..e6ba6d3 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java
@@ -26,26 +26,42 @@ public final class JmsConsumerId extends JmsAbstractResourceId implements Compar
     private transient JmsSessionId parentId;
 
     public JmsConsumerId(String connectionId, long sessionId, long consumerId) {
+        if (connectionId == null || connectionId.isEmpty()) {
+            throw new IllegalArgumentException("Connection ID cannot be null or an empty string");
+        }
+
         this.connectionId = connectionId;
         this.sessionId = sessionId;
         this.value = consumerId;
     }
 
     public JmsConsumerId(JmsSessionId sessionId, long consumerId) {
+        if (sessionId == null) {
+            throw new IllegalArgumentException("Session ID cannot be null");
+        }
+
         this.connectionId = sessionId.getConnectionId();
         this.sessionId = sessionId.getValue();
         this.value = consumerId;
         this.parentId = sessionId;
     }
 
-    public JmsConsumerId(JmsConsumerId id) {
-        this.connectionId = id.getConnectionId();
-        this.sessionId = id.getSessionId();
-        this.value = id.getValue();
-        this.parentId = id.getParentId();
+    public JmsConsumerId(JmsConsumerId consumerId) {
+        if (consumerId == null) {
+            throw new IllegalArgumentException("Consumer ID cannot be null");
+        }
+
+        this.connectionId = consumerId.getConnectionId();
+        this.sessionId = consumerId.getSessionId();
+        this.value = consumerId.getValue();
+        this.parentId = consumerId.getParentId();
     }
 
     public JmsConsumerId(String consumerKey) throws IllegalArgumentException {
+        if (consumerKey == null || consumerKey.isEmpty()) {
+            throw new IllegalArgumentException("Consumer Key cannot be null or empty");
+        }
+
         // Parse off the consumer Id value
         int p = consumerKey.lastIndexOf(":");
         if (p >= 0) {
@@ -77,7 +93,10 @@ public final class JmsConsumerId extends JmsAbstractResourceId implements Compar
     @Override
     public int hashCode() {
         if (hashCode == 0) {
-            hashCode = connectionId.hashCode() ^ (int) sessionId ^ (int) value;
+            hashCode = 1;
+            hashCode = 31 * hashCode + connectionId.hashCode();
+            hashCode = 31 * hashCode + (int) (sessionId ^ (sessionId >>> 32));
+            hashCode = 31 * hashCode + (int) (value ^ (value >>> 32));
         }
         return hashCode;
     }
@@ -90,6 +109,7 @@ public final class JmsConsumerId extends JmsAbstractResourceId implements Compar
         if (o == null || o.getClass() != JmsConsumerId.class) {
             return false;
         }
+
         JmsConsumerId id = (JmsConsumerId) o;
         return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId);
     }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java
index 3bc8027..192a6b4 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java
@@ -35,10 +35,16 @@ public final class JmsConsumerInfo implements JmsResource, Comparable<JmsConsume
     private transient long lastDeliveredSequenceId;
 
     public JmsConsumerInfo(JmsConsumerId consumerId) {
+        if (consumerId == null) {
+            throw new IllegalArgumentException("Consumer ID cannot be null");
+        }
         this.consumerId = consumerId;
     }
 
     public JmsConsumerInfo(JmsSessionInfo sessionInfo, long consumerId) {
+        if (sessionInfo == null) {
+            throw new IllegalArgumentException("Session info object cannot be null");
+        }
         this.consumerId = new JmsConsumerId(sessionInfo.getSessionId(), consumerId);
     }
 
@@ -57,6 +63,7 @@ public final class JmsConsumerInfo implements JmsResource, Comparable<JmsConsume
         info.subscriptionName = subscriptionName;
         info.noLocal = noLocal;
         info.acknowledgementMode = acknowledgementMode;
+        info.lastDeliveredSequenceId = lastDeliveredSequenceId;
     }
 
     public boolean isDurable() {
@@ -150,7 +157,7 @@ public final class JmsConsumerInfo implements JmsResource, Comparable<JmsConsume
 
     @Override
     public int hashCode() {
-        return (consumerId == null) ? super.hashCode() : consumerId.hashCode();
+        return consumerId.hashCode();
     }
 
     @Override
@@ -166,12 +173,7 @@ public final class JmsConsumerInfo implements JmsResource, Comparable<JmsConsume
         }
 
         JmsConsumerInfo other = (JmsConsumerInfo) obj;
-
-        if (consumerId != null) {
-            return consumerId.equals(other.consumerId);
-        }
-
-        return false;
+        return consumerId.equals(other.consumerId);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java
index 501667a..73c9fb8 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java
@@ -26,6 +26,10 @@ public final class JmsProducerId extends JmsAbstractResourceId implements Compar
     private transient JmsSessionId parentId;
 
     public JmsProducerId(JmsSessionId sessionId, long producerId) {
+        if (sessionId == null) {
+            throw new IllegalArgumentException("Session ID cannot be null");
+        }
+
         this.connectionId = sessionId.getConnectionId();
         this.sessionId = sessionId.getValue();
         this.value = producerId;
@@ -33,6 +37,10 @@ public final class JmsProducerId extends JmsAbstractResourceId implements Compar
     }
 
     public JmsProducerId(JmsProducerId id) {
+        if (id == null) {
+            throw new IllegalArgumentException("Producer ID cannot be null");
+        }
+
         this.connectionId = id.getConnectionId();
         this.sessionId = id.getSessionId();
         this.value = id.getValue();
@@ -40,12 +48,20 @@ public final class JmsProducerId extends JmsAbstractResourceId implements Compar
     }
 
     public JmsProducerId(String connectionId, long sessionId, long producerId) {
+        if (connectionId == null || connectionId.isEmpty()) {
+            throw new IllegalArgumentException("Connection ID cannot be null");
+        }
+
         this.connectionId = connectionId;
         this.sessionId = sessionId;
         this.value = producerId;
     }
 
     public JmsProducerId(String producerKey) {
+        if (producerKey == null || producerKey.isEmpty()) {
+            throw new IllegalArgumentException("Producer Key cannot be null or empty");
+        }
+
         // Parse off the producerId
         int p = producerKey.lastIndexOf(":");
         if (p >= 0) {
@@ -99,7 +115,10 @@ public final class JmsProducerId extends JmsAbstractResourceId implements Compar
     @Override
     public int hashCode() {
         if (hashCode == 0) {
-            hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value;
+            hashCode = 1;
+            hashCode = 31 * hashCode + connectionId.hashCode();
+            hashCode = 31 * hashCode + (int) (sessionId ^ (sessionId >>> 32));
+            hashCode = 31 * hashCode + (int) (value ^ (value >>> 32));
         }
         return hashCode;
     }
@@ -112,6 +131,7 @@ public final class JmsProducerId extends JmsAbstractResourceId implements Compar
         if (o == null || o.getClass() != JmsProducerId.class) {
             return false;
         }
+
         JmsProducerId id = (JmsProducerId)o;
         return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId);
     }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java
index d38ba6c..542c347 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java
@@ -25,10 +25,18 @@ public final class JmsProducerInfo implements JmsResource, Comparable<JmsProduce
     protected JmsDestination destination;
 
     public JmsProducerInfo(JmsProducerId producerId) {
+        if (producerId == null) {
+            throw new IllegalArgumentException("Producer ID cannot be null");
+        }
+
         this.producerId = producerId;
     }
 
     public JmsProducerInfo(JmsSessionInfo sessionInfo, long producerId) {
+        if (sessionInfo == null) {
+            throw new IllegalArgumentException("Parent Session Info object cannot be null");
+        }
+
         this.producerId = new JmsProducerId(sessionInfo.getSessionId(), producerId);
     }
 
@@ -65,7 +73,7 @@ public final class JmsProducerInfo implements JmsResource, Comparable<JmsProduce
 
     @Override
     public int hashCode() {
-        return (producerId == null) ? super.hashCode() : producerId.hashCode();
+        return producerId.hashCode();
     }
 
     @Override
@@ -81,13 +89,7 @@ public final class JmsProducerInfo implements JmsResource, Comparable<JmsProduce
         }
 
         JmsProducerInfo other = (JmsProducerInfo) obj;
-
-        if (producerId != null) {
-            return producerId.equals(other.producerId);
-        }
-
-        return false;
-
+        return producerId.equals(other.producerId);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionId.java
index de0d452..bf7f39a 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionId.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionId.java
@@ -25,27 +25,47 @@ public final class JmsSessionId extends JmsAbstractResourceId implements Compara
     protected transient JmsConnectionId parentId;
 
     public JmsSessionId(String connectionId, long value) {
+        if (connectionId == null || connectionId.isEmpty()) {
+            throw new IllegalArgumentException("Connection ID cannot be null");
+        }
+
         this.connectionId = connectionId;
         this.value = value;
     }
 
     public JmsSessionId(JmsConnectionId connectionId, long sessionId) {
+        if (connectionId == null) {
+            throw new IllegalArgumentException("Connection ID cannot be null");
+        }
+
         this.connectionId = connectionId.getValue();
         this.value = sessionId;
         this.parentId = connectionId;
     }
 
     public JmsSessionId(JmsSessionId id) {
+        if (id == null) {
+            throw new IllegalArgumentException("Session ID cannot be null");
+        }
+
         this.connectionId = id.getConnectionId();
         this.value = id.getValue();
     }
 
     public JmsSessionId(JmsProducerId id) {
+        if (id == null) {
+            throw new IllegalArgumentException("Producer ID cannot be null");
+        }
+
         this.connectionId = id.getConnectionId();
         this.value = id.getSessionId();
     }
 
     public JmsSessionId(JmsConsumerId id) {
+        if (id == null) {
+            throw new IllegalArgumentException("Consumer ID cannot be null");
+        }
+
         this.connectionId = id.getConnectionId();
         this.value = id.getSessionId();
     }
@@ -60,7 +80,9 @@ public final class JmsSessionId extends JmsAbstractResourceId implements Compara
     @Override
     public int hashCode() {
         if (hashCode == 0) {
-            hashCode = connectionId.hashCode() ^ (int)value;
+            hashCode = 1;
+            hashCode = 31 * hashCode + connectionId.hashCode();
+            hashCode = 31 * hashCode + (int) (value ^ (value >>> 32));
         }
         return hashCode;
     }
@@ -73,6 +95,7 @@ public final class JmsSessionId extends JmsAbstractResourceId implements Compara
         if (o == null || o.getClass() != JmsSessionId.class) {
             return false;
         }
+
         JmsSessionId id = (JmsSessionId)o;
         return value == id.value && connectionId.equals(id.connectionId);
     }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionInfo.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionInfo.java
index 04f57d8..bab15bf 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionInfo.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsSessionInfo.java
@@ -18,20 +18,38 @@ package org.apache.qpid.jms.meta;
 
 import javax.jms.Session;
 
-public final class JmsSessionInfo implements JmsResource {
+public final class JmsSessionInfo implements JmsResource, Comparable<JmsSessionInfo> {
 
     private final JmsSessionId sessionId;
     private int acknowledgementMode;
     private boolean sendAcksAsync;
 
-    public JmsSessionInfo(JmsConnectionInfo connectionMeta, long sessionId) {
-        this.sessionId = new JmsSessionId(connectionMeta.getConnectionId(), sessionId);
+    public JmsSessionInfo(JmsConnectionInfo connectionInfo, long sessionId) {
+        if (connectionInfo == null) {
+            throw new IllegalArgumentException("Connection info object cannot be null");
+        }
+        this.sessionId = new JmsSessionId(connectionInfo.getConnectionId(), sessionId);
     }
 
     public JmsSessionInfo(JmsSessionId sessionId) {
+        if (sessionId == null) {
+            throw new IllegalArgumentException("session Id object cannot be null");
+        }
+
         this.sessionId = sessionId;
     }
 
+    public JmsSessionInfo copy() {
+        JmsSessionInfo copy = new JmsSessionInfo(sessionId);
+        copy(copy);
+        return copy;
+    }
+
+    private void copy(JmsSessionInfo copy) {
+        copy.acknowledgementMode = acknowledgementMode;
+        copy.sendAcksAsync = sendAcksAsync;
+    }
+
     public JmsSessionId getSessionId() {
         return sessionId;
     }
@@ -60,4 +78,30 @@ public final class JmsSessionInfo implements JmsResource {
     public void setSendAcksAsync(boolean sendAcksAsync) {
         this.sendAcksAsync = sendAcksAsync;
     }
+
+    @Override
+    public int hashCode() {
+        return sessionId.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        JmsSessionInfo other = (JmsSessionInfo) obj;
+        return sessionId.equals(other.sessionId);
+    }
+
+    @Override
+    public int compareTo(JmsSessionInfo other) {
+        return this.sessionId.compareTo(other.sessionId);
+    }
 }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionId.java
index 226aedf..1ad5a53 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionId.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionId.java
@@ -24,6 +24,10 @@ public final class JmsTransactionId extends JmsAbstractResourceId implements Com
     private transient String transactionKey;
 
     public JmsTransactionId(JmsConnectionId connectionId, long transactionId) {
+        if (connectionId == null) {
+            throw new IllegalArgumentException("Connection ID cannot be null");
+        }
+
         this.connectionId = connectionId;
         this.value = transactionId;
     }
@@ -43,7 +47,9 @@ public final class JmsTransactionId extends JmsAbstractResourceId implements Com
     @Override
     public int hashCode() {
         if (hashCode == 0) {
-            hashCode = connectionId.hashCode() ^ (int)value;
+            hashCode = 1;
+            hashCode = 31 * hashCode + connectionId.hashCode();
+            hashCode = 31 * hashCode + (int) (value ^ (value >>> 32));
         }
         return hashCode;
     }
@@ -58,7 +64,6 @@ public final class JmsTransactionId extends JmsAbstractResourceId implements Com
         }
 
         JmsTransactionId tx = (JmsTransactionId) other;
-
         return value == tx.value && connectionId.equals(tx.connectionId);
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionInfo.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionInfo.java
index e4cdebd..f745e54 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionInfo.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsTransactionInfo.java
@@ -22,6 +22,13 @@ public final class JmsTransactionInfo implements JmsResource, Comparable<JmsTran
     protected JmsTransactionId transactionId;
 
     public JmsTransactionInfo(JmsSessionId sessionId, JmsTransactionId transactionId) {
+        if (sessionId == null) {
+            throw new IllegalArgumentException("Session ID cannot be null");
+        }
+        if (transactionId == null) {
+            throw new IllegalArgumentException("Transaction ID cannot be null");
+        }
+
         this.sessionId = sessionId;
         this.transactionId = transactionId;
     }
@@ -38,17 +45,13 @@ public final class JmsTransactionInfo implements JmsResource, Comparable<JmsTran
         return transactionId;
     }
 
-    public void setTransactionId(JmsTransactionId transactionId) {
-        this.transactionId = transactionId;
-    }
-
     public JmsSessionId getParentId() {
         return this.sessionId;
     }
 
     @Override
     public int hashCode() {
-        return (transactionId == null) ? super.hashCode() : transactionId.hashCode();
+        return transactionId.hashCode();
     }
 
     @Override
@@ -56,20 +59,12 @@ public final class JmsTransactionInfo implements JmsResource, Comparable<JmsTran
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (obj == null || getClass() != obj.getClass()) {
             return false;
         }
 
         JmsTransactionInfo other = (JmsTransactionInfo) obj;
-
-        if (transactionId != null) {
-            return transactionId.equals(other.transactionId);
-        }
-
-        return false;
+        return transactionId.equals(other.transactionId);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConnectionIdTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConnectionIdTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConnectionIdTest.java
new file mode 100644
index 0000000..6164fb1
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConnectionIdTest.java
@@ -0,0 +1,167 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test for JmsConnectionId
+ */
+public class JmsConnectionIdTest {
+
+    private String firstId;
+    private String secondId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstId = generator.generateId();
+        secondId = generator.generateId();
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromStringThrowsWhenNull() {
+        new JmsConnectionId((String) null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromStringThrowsWhenEmpty() {
+        new JmsConnectionId("");
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConnectionIdThrowsWhenNull() {
+        new JmsConnectionId((JmsConnectionId) null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromSessionIdThrowsWhenNull() {
+        new JmsConnectionId((JmsSessionId) null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromProducerIdThrowsWhenNull() {
+        new JmsConnectionId((JmsProducerId) null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConsumerIdThrowsWhenNull() {
+        new JmsConnectionId((JmsConsumerId) null);
+    }
+
+    @Test
+    public void testStringConstructor() {
+        JmsConnectionId id = new JmsConnectionId(firstId);
+        assertNotNull(id.getValue());
+        assertNull(id.getProviderHint());
+        assertNull(id.getProviderId());
+    }
+
+    @Test
+    public void testProviderHints() {
+        JmsConnectionId id = new JmsConnectionId(firstId);
+        assertNotNull(id.getValue());
+        assertNull(id.getProviderHint());
+        assertNull(id.getProviderId());
+
+        String hint = new String("hint");
+        String pid = new String("id");
+
+        id.setProviderHint(hint);
+        id.setProviderId(pid);
+
+        assertEquals(hint, id.getProviderHint());
+        assertEquals(pid, id.getProviderId());
+    }
+
+    @Test
+    public void testJmsConnectionIdFromJmsConnectionId() throws Exception {
+        JmsConnectionId id1 = new JmsConnectionId(firstId);
+        JmsConnectionId id2 = new JmsConnectionId(id1);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsConnectionIdFromJmsSessionId() throws Exception {
+        JmsConnectionId id1 = new JmsConnectionId(firstId);
+        JmsSessionId sessionId = new JmsSessionId(id1, 1);
+        JmsConnectionId id2 = new JmsConnectionId(sessionId);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsConnectionIdFromJmsConsumerId() throws Exception {
+        JmsConnectionId id1 = new JmsConnectionId(firstId);
+        JmsSessionId sessionId = new JmsSessionId(id1, 1);
+        JmsConsumerId consumerId = new JmsConsumerId(sessionId, 1);
+        JmsConnectionId id2 = new JmsConnectionId(consumerId);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsConnectionIdFromJmsProducerId() throws Exception {
+        JmsConnectionId id1 = new JmsConnectionId(firstId);
+        JmsSessionId sessionId = new JmsSessionId(id1, 1);
+        JmsProducerId consumerId = new JmsProducerId(sessionId, 1);
+        JmsConnectionId id2 = new JmsConnectionId(consumerId);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testCompareTo() {
+        JmsConnectionId id1 = new JmsConnectionId(firstId);
+        JmsConnectionId id2 = new JmsConnectionId(secondId);
+
+        assertEquals(-1, id1.compareTo(id2));
+        assertEquals(0, id1.compareTo(id1));
+        assertEquals(1, id2.compareTo(id1));
+    }
+
+    @Test
+    public void testEquals() {
+        JmsConnectionId id1 = new JmsConnectionId(firstId);
+        JmsConnectionId id2 = new JmsConnectionId(secondId);
+
+        assertTrue(id1.equals(id1));
+        assertTrue(id2.equals(id2));
+        assertFalse(id1.equals(id2));
+        assertFalse(id2.equals(id1));
+
+        assertFalse(id1.equals(null));
+        assertFalse(id1.equals(new String("TEST")));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsConnectionId id1 = new JmsConnectionId(firstId);
+        JmsConnectionId id2 = new JmsConnectionId(secondId);
+
+        assertEquals(id1.hashCode(), id1.hashCode());
+        assertEquals(id2.hashCode(), id2.hashCode());
+        assertFalse(id1.hashCode() == id2.hashCode());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConnectionInfoTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConnectionInfoTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConnectionInfoTest.java
new file mode 100644
index 0000000..86b75bf
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConnectionInfoTest.java
@@ -0,0 +1,155 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test for class JmsConnectionInfo
+ */
+public class JmsConnectionInfoTest {
+
+    private JmsConnectionId firstId;
+    private JmsConnectionId secondId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstId = new JmsConnectionId(generator.generateId());
+        secondId = new JmsConnectionId(generator.generateId());
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testExceptionWhenCreatedWithNullConnectionId() {
+        new JmsConnectionInfo(null);
+    }
+
+    @Test
+    public void testCreate() {
+        JmsConnectionInfo info = new JmsConnectionInfo(firstId);
+        assertSame(firstId, info.getConnectionId());
+        assertNotNull(info.toString());
+    }
+
+    @Test
+    public void testCopy() {
+        JmsConnectionInfo info = new JmsConnectionInfo(firstId);
+
+        info.setAlwaysSyncSend(true);
+        info.setClientId("test");
+        info.setClientIp("127.0.0.1");
+        info.setCloseTimeout(100);
+        info.setConnectTimeout(200);
+        info.setForceAsyncSends(true);
+        info.setOmitHost(true);
+        info.setPassword("pass");
+        info.setQueuePrefix("queue");
+        info.setRequestTimeout(50);
+        info.setSendTimeout(150);
+        info.setTempQueuePrefix("tempQueue");
+        info.setTempTopicPrefix("tempTopic");
+        info.setTopicPrefix("topic");
+        info.setUsername("user");
+        info.setWatchRemoteDestinations(false);
+
+        JmsConnectionInfo copy = info.copy();
+
+        assertEquals(true, copy.isAlwaysSyncSend());
+        assertEquals("test", copy.getClientId());
+        assertEquals("127.0.0.1", copy.getClientIp());
+        assertEquals(100, copy.getCloseTimeout());
+        assertEquals(200, copy.getConnectTimeout());
+        assertEquals(true, copy.isForceAsyncSend());
+        assertEquals(true, copy.isOmitHost());
+        assertEquals("pass", copy.getPassword());
+        assertEquals("queue", copy.getQueuePrefix());
+        assertEquals(50, copy.getRequestTimeout());
+        assertEquals(150, copy.getSendTimeout());
+        assertEquals("tempQueue", copy.getTempQueuePrefix());
+        assertEquals("tempTopic", copy.getTempTopicPrefix());
+        assertEquals("topic", copy.getTopicPrefix());
+        assertEquals("user", copy.getUsername());
+        assertEquals(false, copy.isWatchRemoteDestinations());
+
+        assertEquals(info, copy);
+}
+
+    @Test
+    public void testCompareTo() {
+        JmsConnectionInfo first = new JmsConnectionInfo(firstId);
+        JmsConnectionInfo second = new JmsConnectionInfo(secondId);
+
+        assertEquals(-1, first.compareTo(second));
+        assertEquals(0, first.compareTo(first));
+        assertEquals(1, second.compareTo(first));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsConnectionInfo first = new JmsConnectionInfo(firstId);
+        JmsConnectionInfo second = new JmsConnectionInfo(secondId);
+
+        assertEquals(first.hashCode(), first.hashCode());
+        assertEquals(second.hashCode(), second.hashCode());
+
+        assertFalse(first.hashCode() == second.hashCode());
+    }
+
+    @Test
+    public void testEqualsCode() {
+        JmsConnectionInfo first = new JmsConnectionInfo(firstId);
+        JmsConnectionInfo second = new JmsConnectionInfo(secondId);
+
+        assertEquals(first, first);
+        assertEquals(second, second);
+
+        assertFalse(first.equals(second));
+        assertFalse(second.equals(first));
+
+        assertFalse(first.equals(null));
+        assertFalse(second.equals("test"));
+    }
+
+    @Test
+    public void testVisit() throws Exception {
+        final JmsConnectionInfo first = new JmsConnectionInfo(firstId);
+
+        final AtomicBoolean visited = new AtomicBoolean();
+
+        first.visit(new JmsDefaultResourceVisitor() {
+
+            @Override
+            public void processConnectionInfo(JmsConnectionInfo info) {
+                assertEquals(first, info);
+                visited.set(true);
+            }
+        });
+
+        assertTrue(visited.get());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConsumerIdTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConsumerIdTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConsumerIdTest.java
new file mode 100644
index 0000000..64480de
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConsumerIdTest.java
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test forJmsConsumerId
+ */
+public class JmsConsumerIdTest {
+
+    private JmsSessionId firstId;
+    private JmsSessionId secondId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstId = new JmsSessionId(generator.generateId(), 1);
+        secondId = new JmsSessionId(generator.generateId(), 2);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromStringThrowsWhenNull() {
+        new JmsConsumerId((String) null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromStringThrowsWhenEmpty() {
+        new JmsConsumerId("");
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConnectionStringThrowsWhenNull() {
+        new JmsConsumerId((String) null, 1, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateConnectionFromStringThrowsWhenEmpty() {
+        new JmsConsumerId("", 1, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromSessionIdThrowsWhenNull() {
+        new JmsConsumerId((JmsSessionId) null, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConsumerIdThrowsWhenNull() {
+        new JmsConsumerId((JmsConsumerId) null);
+    }
+
+    @Test
+    public void testJmsSessionIdConstructor() {
+        JmsConsumerId id = new JmsConsumerId(firstId, 1);
+        assertNotNull(id.getValue());
+        assertNull(id.getProviderHint());
+        assertNull(id.getProviderId());
+    }
+
+    @Test
+    public void testJmsConsumerIdFromJmsConnectionId() throws Exception {
+        JmsConsumerId id1 = new JmsConsumerId(firstId.getConnectionId(), 1, 1);
+        JmsConsumerId id2 = new JmsConsumerId(secondId.getConnectionId(), 1, 1);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsConsumerIdFromJmsSessionId() throws Exception {
+        JmsConsumerId id1 = new JmsConsumerId(firstId, 1);
+        JmsConsumerId id2 = new JmsConsumerId(id1);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsConnectionIdFromJmsConsumerIdString() throws Exception {
+        JmsConsumerId id1 = new JmsConsumerId(firstId, 1);
+        JmsConsumerId id2 = new JmsConsumerId(id1.toString());
+        assertSame(id1.getValue(), id2.getValue());
+
+        JmsConsumerId id3 = new JmsConsumerId("SOMEIDVALUE");
+        assertEquals("SOMEIDVALUE", id3.getConnectionId());
+        assertEquals(0, id3.getSessionId());
+        assertEquals(0, id3.getValue());
+    }
+
+    @Test
+    public void testGetParentId() {
+        JmsConsumerId id1 = new JmsConsumerId(firstId, 1);
+        assertSame(firstId, id1.getParentId());
+
+        JmsConsumerId id2 = new JmsConsumerId(firstId.getConnectionId(), 1, 1);
+        assertEquals(firstId, id2.getParentId());
+    }
+
+    @Test
+    public void testCompareTo() {
+        JmsConsumerId id1 = new JmsConsumerId(firstId, 1);
+        JmsConsumerId id2 = new JmsConsumerId(secondId, 1);
+
+        assertEquals(-1, id1.compareTo(id2));
+        assertEquals(0, id1.compareTo(id1));
+        assertEquals(1, id2.compareTo(id1));
+    }
+
+    @Test
+    public void testEquals() {
+        JmsConsumerId id1 = new JmsConsumerId(firstId, 1);
+        JmsConsumerId id2 = new JmsConsumerId(secondId, 1);
+
+        assertTrue(id1.equals(id1));
+        assertTrue(id2.equals(id2));
+        assertFalse(id1.equals(id2));
+        assertFalse(id2.equals(id1));
+
+        assertFalse(id1.equals(null));
+        assertFalse(id1.equals(new String("TEST")));
+
+        JmsConsumerId id3 = new JmsConsumerId(firstId, 1);
+        JmsConsumerId id4 = new JmsConsumerId(firstId, 2);
+        JmsConsumerId id5 = new JmsConsumerId(firstId, 1);
+        JmsConsumerId id6 = new JmsConsumerId(secondId.getConnectionId(), 1, 1);
+
+        assertFalse(id3.equals(id4));
+        assertTrue(id3.equals(id5));
+        assertFalse(id3.equals(id6));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsConsumerId id1 = new JmsConsumerId(firstId, 1);
+        JmsConsumerId id2 = new JmsConsumerId(secondId, 1);
+
+        assertEquals(id1.hashCode(), id1.hashCode());
+        assertEquals(id2.hashCode(), id2.hashCode());
+        assertFalse(id1.hashCode() == id2.hashCode());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConsumerInfoTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConsumerInfoTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConsumerInfoTest.java
new file mode 100644
index 0000000..86a7caa
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsConsumerInfoTest.java
@@ -0,0 +1,168 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.qpid.jms.JmsTopic;
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JmsConsumerInfoTest {
+
+    private JmsConsumerId firstId;
+    private JmsConsumerId secondId;
+
+    private JmsSessionId firstSessionId;
+    private JmsSessionId secondSessionId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstSessionId = new JmsSessionId(generator.generateId(), 1);
+        secondSessionId = new JmsSessionId(generator.generateId(), 2);
+
+        firstId = new JmsConsumerId(firstSessionId, 1);
+        secondId = new JmsConsumerId(secondSessionId, 2);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testExceptionWhenCreatedWithNullConnectionId() {
+        new JmsConsumerInfo(null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testExceptionWhenCreatedWithNullSessionInfo() {
+        new JmsConsumerInfo(null, 1);
+    }
+
+    @Test
+    public void testCreateFromConsumerId() {
+        JmsConsumerInfo info = new JmsConsumerInfo(firstId);
+        assertSame(firstId, info.getConsumerId());
+        assertSame(firstId.getParentId(), info.getParentId());
+        assertNotNull(info.toString());
+    }
+
+    @Test
+    public void testCreateFromSessionId() {
+        JmsConsumerInfo info = new JmsConsumerInfo(new JmsSessionInfo(firstSessionId), 1);
+        assertNotNull(info.toString());
+    }
+
+    @Test
+    public void testCopy() {
+        JmsConsumerInfo info = new JmsConsumerInfo(firstId);
+
+        info.setAcknowledgementMode(1);
+        info.setBrowser(true);
+        info.setClientId("test");
+        info.setDestination(new JmsTopic("Test"));
+        info.setLastDeliveredSequenceId(42);
+        info.setNoLocal(true);
+        info.setPrefetchSize(123456);
+        info.setSelector("select");
+        info.setSubscriptionName("name");
+
+        JmsConsumerInfo copy = info.copy();
+
+        assertEquals(1, copy.getAcknowledgementMode());
+        assertEquals(true, copy.isBrowser());
+        assertEquals("test", copy.getClientId());
+        assertEquals(new JmsTopic("Test"), copy.getDestination());
+        assertEquals(42, copy.getLastDeliveredSequenceId());
+        assertEquals(true, copy.isNoLocal());
+        assertEquals(123456, copy.getPrefetchSize());
+        assertEquals("select", copy.getSelector());
+        assertEquals("name", copy.getSubscriptionName());
+
+        assertEquals(info, copy);
+    }
+
+    @Test
+    public void testIsDurable() {
+        JmsConsumerInfo info = new JmsConsumerInfo(firstId);
+        assertFalse(info.isDurable());
+        info.setSubscriptionName("name");
+        assertTrue(info.isDurable());
+    }
+
+    @Test
+    public void testCompareTo() {
+        JmsConsumerInfo first = new JmsConsumerInfo(firstId);
+        JmsConsumerInfo second = new JmsConsumerInfo(secondId);
+
+        assertEquals(-1, first.compareTo(second));
+        assertEquals(0, first.compareTo(first));
+        assertEquals(1, second.compareTo(first));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsConsumerInfo first = new JmsConsumerInfo(firstId);
+        JmsConsumerInfo second = new JmsConsumerInfo(secondId);
+
+        assertEquals(first.hashCode(), first.hashCode());
+        assertEquals(second.hashCode(), second.hashCode());
+
+        assertFalse(first.hashCode() == second.hashCode());
+    }
+
+    @Test
+    public void testEqualsCode() {
+        JmsConsumerInfo first = new JmsConsumerInfo(firstId);
+        JmsConsumerInfo second = new JmsConsumerInfo(secondId);
+
+        assertEquals(first, first);
+        assertEquals(second, second);
+
+        assertFalse(first.equals(second));
+        assertFalse(second.equals(first));
+
+        assertFalse(first.equals(null));
+        assertFalse(second.equals("test"));
+    }
+
+    @Test
+    public void testVisit() throws Exception {
+        final JmsConsumerInfo first = new JmsConsumerInfo(firstId);
+
+        final AtomicBoolean visited = new AtomicBoolean();
+
+        first.visit(new JmsDefaultResourceVisitor() {
+
+            @Override
+            public void processConsumerInfo(JmsConsumerInfo info) {
+                assertEquals(first, info);
+                visited.set(true);
+            }
+        });
+
+        assertTrue(visited.get());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsDefaultResourceVisitorTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsDefaultResourceVisitorTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsDefaultResourceVisitorTest.java
new file mode 100644
index 0000000..4a32654
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsDefaultResourceVisitorTest.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import org.apache.qpid.jms.JmsTopic;
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JmsDefaultResourceVisitorTest {
+
+    private JmsConnectionId connectionId;
+    private JmsSessionId sessionId;
+    private JmsProducerId producerId;
+    private JmsConsumerId consumerId;
+    private JmsTransactionId transactionId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        connectionId = new JmsConnectionId(generator.generateId());
+        sessionId = new JmsSessionId(connectionId, 1);
+        producerId = new JmsProducerId(sessionId, 1);
+        consumerId = new JmsConsumerId(sessionId, 1);
+        transactionId = new JmsTransactionId(connectionId, 0);
+    }
+
+    @Test
+    public void test() throws Exception {
+        JmsDefaultResourceVisitor visitor = new JmsDefaultResourceVisitor();
+        visitor.processConnectionInfo(new JmsConnectionInfo(connectionId));
+        visitor.processSessionInfo(new JmsSessionInfo(sessionId));
+        visitor.processConsumerInfo(new JmsConsumerInfo(consumerId));
+        visitor.processProducerInfo(new JmsProducerInfo(producerId));
+        visitor.processDestination(new JmsTopic("Test"));
+        visitor.processTransactionInfo(new JmsTransactionInfo(sessionId, transactionId));
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsProducerIdTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsProducerIdTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsProducerIdTest.java
new file mode 100644
index 0000000..6621fa1
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsProducerIdTest.java
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JmsProducerIdTest {
+
+    private JmsSessionId firstId;
+    private JmsSessionId secondId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstId = new JmsSessionId(generator.generateId(), 1);
+        secondId = new JmsSessionId(generator.generateId(), 2);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromStringThrowsWhenNull() {
+        new JmsProducerId((String) null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromStringThrowsWhenEmpty() {
+        new JmsProducerId("");
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConnectionStringThrowsWhenNull() {
+        new JmsProducerId((String) null, 1, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateConnectionFromStringThrowsWhenEmpty() {
+        new JmsProducerId("", 1, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromSessionIdThrowsWhenNull() {
+        new JmsProducerId((JmsSessionId) null, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConsumerIdThrowsWhenNull() {
+        new JmsProducerId((JmsProducerId) null);
+    }
+
+    @Test
+    public void testStringConstructor() {
+        JmsProducerId id = new JmsProducerId(firstId, 1);
+        assertNotNull(id.getValue());
+        assertNull(id.getProviderHint());
+        assertNull(id.getProviderId());
+    }
+
+    @Test
+    public void testJmsProducerIdFromJmsConnectionId() throws Exception {
+        JmsProducerId id1 = new JmsProducerId(firstId.getConnectionId(), 1, 1);
+        JmsProducerId id2 = new JmsProducerId(secondId.getConnectionId(), 1, 1);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsProducerIdFromJmsSessionId() throws Exception {
+        JmsProducerId id1 = new JmsProducerId(firstId, 1);
+        JmsProducerId id2 = new JmsProducerId(id1);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsProducerIdFromJmsConsumerIdString() throws Exception {
+        JmsProducerId id1 = new JmsProducerId(firstId, 1);
+        JmsProducerId id2 = new JmsProducerId(id1.toString());
+        assertSame(id1.getValue(), id2.getValue());
+
+        JmsProducerId id3 = new JmsProducerId("SOMEIDVALUE");
+        assertEquals("SOMEIDVALUE", id3.getConnectionId());
+        assertEquals(0, id3.getSessionId());
+        assertEquals(0, id3.getValue());
+    }
+
+    @Test
+    public void testGetParentId() {
+        JmsProducerId id1 = new JmsProducerId(firstId, 1);
+        assertSame(firstId, id1.getParentId());
+
+        JmsProducerId id2 = new JmsProducerId(firstId.getConnectionId(), 1, 1);
+        assertEquals(firstId, id2.getParentId());
+    }
+
+    @Test
+    public void testCompareTo() {
+        JmsProducerId id1 = new JmsProducerId(firstId, 1);
+        JmsProducerId id2 = new JmsProducerId(secondId, 1);
+
+        assertEquals(-1, id1.compareTo(id2));
+        assertEquals(0, id1.compareTo(id1));
+        assertEquals(1, id2.compareTo(id1));
+    }
+
+    @Test
+    public void testEquals() {
+        JmsProducerId id1 = new JmsProducerId(firstId, 1);
+        JmsProducerId id2 = new JmsProducerId(secondId, 1);
+
+        assertTrue(id1.equals(id1));
+        assertTrue(id2.equals(id2));
+        assertFalse(id1.equals(id2));
+        assertFalse(id2.equals(id1));
+
+        assertFalse(id1.equals(null));
+        assertFalse(id1.equals(new String("TEST")));
+
+        JmsProducerId id3 = new JmsProducerId(firstId, 1);
+        JmsProducerId id4 = new JmsProducerId(firstId, 2);
+        JmsProducerId id5 = new JmsProducerId(firstId, 1);
+        JmsProducerId id6 = new JmsProducerId(secondId.getConnectionId(), 1, 1);
+
+        assertFalse(id3.equals(id4));
+        assertTrue(id3.equals(id5));
+        assertFalse(id3.equals(id6));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsProducerId id1 = new JmsProducerId(firstId, 1);
+        JmsProducerId id2 = new JmsProducerId(secondId, 1);
+
+        assertEquals(id1.hashCode(), id1.hashCode());
+        assertEquals(id2.hashCode(), id2.hashCode());
+        assertFalse(id1.hashCode() == id2.hashCode());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsProducerInfoTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsProducerInfoTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsProducerInfoTest.java
new file mode 100644
index 0000000..d335f63
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsProducerInfoTest.java
@@ -0,0 +1,142 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.qpid.jms.JmsTopic;
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JmsProducerInfoTest {
+
+    private JmsProducerId firstId;
+    private JmsProducerId secondId;
+
+    private JmsSessionId firstSessionId;
+    private JmsSessionId secondSessionId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstSessionId = new JmsSessionId(generator.generateId(), 1);
+        secondSessionId = new JmsSessionId(generator.generateId(), 2);
+
+        firstId = new JmsProducerId(firstSessionId, 1);
+        secondId = new JmsProducerId(secondSessionId, 2);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testExceptionWhenCreatedWithNullConnectionId() {
+        new JmsProducerInfo(null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testExceptionWhenCreatedWithNullSessionInfo() {
+        new JmsProducerInfo(null, 1);
+    }
+
+    @Test
+    public void testCreateFromProducerId() {
+        JmsProducerInfo info = new JmsProducerInfo(firstId);
+        assertSame(firstId, info.getProducerId());
+        assertSame(firstId.getParentId(), info.getParentId());
+        assertNotNull(info.toString());
+    }
+
+    @Test
+    public void testCreateFromSessionId() {
+        JmsProducerInfo info = new JmsProducerInfo(new JmsSessionInfo(firstSessionId), 1);
+        assertNotNull(info.toString());
+    }
+
+    @Test
+    public void testCopy() {
+        JmsProducerInfo info = new JmsProducerInfo(firstId);
+        info.setDestination(new JmsTopic("Test"));
+
+        JmsProducerInfo copy = info.copy();
+        assertEquals(new JmsTopic("Test"), copy.getDestination());
+
+        assertEquals(info, copy);
+    }
+
+    @Test
+    public void testCompareTo() {
+        JmsProducerInfo first = new JmsProducerInfo(firstId);
+        JmsProducerInfo second = new JmsProducerInfo(secondId);
+
+        assertEquals(-1, first.compareTo(second));
+        assertEquals(0, first.compareTo(first));
+        assertEquals(1, second.compareTo(first));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsProducerInfo first = new JmsProducerInfo(firstId);
+        JmsProducerInfo second = new JmsProducerInfo(secondId);
+
+        assertEquals(first.hashCode(), first.hashCode());
+        assertEquals(second.hashCode(), second.hashCode());
+
+        assertFalse(first.hashCode() == second.hashCode());
+    }
+
+    @Test
+    public void testEqualsCode() {
+        JmsProducerInfo first = new JmsProducerInfo(firstId);
+        JmsProducerInfo second = new JmsProducerInfo(secondId);
+
+        assertEquals(first, first);
+        assertEquals(second, second);
+
+        assertFalse(first.equals(second));
+        assertFalse(second.equals(first));
+
+        assertFalse(first.equals(null));
+        assertFalse(second.equals("test"));
+    }
+
+    @Test
+    public void testVisit() throws Exception {
+        final JmsProducerInfo first = new JmsProducerInfo(firstId);
+
+        final AtomicBoolean visited = new AtomicBoolean();
+
+        first.visit(new JmsDefaultResourceVisitor() {
+
+            @Override
+            public void processProducerInfo(JmsProducerInfo info) {
+                assertEquals(first, info);
+                visited.set(true);
+            }
+        });
+
+        assertTrue(visited.get());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsSessionIdTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsSessionIdTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsSessionIdTest.java
new file mode 100644
index 0000000..2baaf6d
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsSessionIdTest.java
@@ -0,0 +1,163 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JmsSessionIdTest {
+
+    private JmsConnectionId firstId;
+    private JmsConnectionId secondId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstId = new JmsConnectionId(generator.generateId());
+        secondId = new JmsConnectionId(generator.generateId());
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConnectionStringThrowsWhenNull() {
+        new JmsSessionId((String) null, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateConnectionFromStringThrowsWhenEmpty() {
+        new JmsSessionId("", 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConnectionIdThrowsWhenNull() {
+        new JmsSessionId((JmsConnectionId) null, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromSessionIdThrowsWhenNull() {
+        new JmsSessionId((JmsSessionId) null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromConsumerIdThrowsWhenNull() {
+        new JmsSessionId((JmsConsumerId) null);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testCreateFromProducerIdThrowsWhenNull() {
+        new JmsSessionId((JmsProducerId) null);
+    }
+
+    @Test
+    public void testStringConstructor() {
+        JmsSessionId id = new JmsSessionId(firstId, 1);
+        assertNotNull(id.getValue());
+        assertNull(id.getProviderHint());
+        assertNull(id.getProviderId());
+    }
+
+    @Test
+    public void testJmsSessionIdFromJmsConnectionId() throws Exception {
+        JmsSessionId id1 = new JmsSessionId(firstId, 1);
+        JmsSessionId id2 = new JmsSessionId(secondId, 1);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsConnectionIdFromJmsSessionId() throws Exception {
+        JmsSessionId id1 = new JmsSessionId(firstId, 1);
+        JmsSessionId id2 = new JmsSessionId(id1);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsConnectionIdFromJmsConsumerId() throws Exception {
+        JmsSessionId id1 = new JmsSessionId(firstId, 1);
+        JmsConsumerId consumerId = new JmsConsumerId(id1, 1);
+        JmsSessionId id2 = new JmsSessionId(consumerId);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testJmsConnectionIdFromJmsProducerId() throws Exception {
+        JmsSessionId id1 = new JmsSessionId(firstId, 1);
+        JmsProducerId producerId = new JmsProducerId(id1, 1);
+        JmsSessionId id2 = new JmsSessionId(producerId);
+        assertSame(id1.getValue(), id2.getValue());
+    }
+
+    @Test
+    public void testGetParentId() {
+        JmsSessionId id1 = new JmsSessionId(firstId, 1);
+        assertSame(firstId, id1.getParentId());
+
+        JmsSessionId id2 = new JmsSessionId(firstId.getValue(), 1);
+        assertEquals(firstId, id2.getParentId());
+    }
+
+    @Test
+    public void testCompareTo() {
+        JmsSessionId id1 = new JmsSessionId(firstId, 1);
+        JmsSessionId id2 = new JmsSessionId(secondId, 1);
+
+        assertEquals(-1, id1.compareTo(id2));
+        assertEquals(0, id1.compareTo(id1));
+        assertEquals(1, id2.compareTo(id1));
+    }
+
+    @Test
+    public void testEquals() {
+        JmsSessionId id1 = new JmsSessionId(firstId, 1);
+        JmsSessionId id2 = new JmsSessionId(secondId, 1);
+
+        assertTrue(id1.equals(id1));
+        assertTrue(id2.equals(id2));
+        assertFalse(id1.equals(id2));
+        assertFalse(id2.equals(id1));
+
+        assertFalse(id1.equals(null));
+        assertFalse(id1.equals(new String("TEST")));
+
+        JmsSessionId id3 = new JmsSessionId(firstId, 1);
+        JmsSessionId id4 = new JmsSessionId(firstId, 2);
+        JmsSessionId id5 = new JmsSessionId(firstId, 1);
+
+        assertFalse(id3.equals(id4));
+        assertTrue(id3.equals(id5));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsSessionId id1 = new JmsSessionId(firstId, 1);
+        JmsSessionId id2 = new JmsSessionId(secondId, 1);
+
+        assertEquals(id1.hashCode(), id1.hashCode());
+        assertEquals(id2.hashCode(), id2.hashCode());
+        assertFalse(id1.hashCode() == id2.hashCode());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsSessionInfoTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsSessionInfoTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsSessionInfoTest.java
new file mode 100644
index 0000000..028d502
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsSessionInfoTest.java
@@ -0,0 +1,154 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jms.Session;
+
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JmsSessionInfoTest {
+
+    private JmsSessionId firstId;
+    private JmsSessionId secondId;
+
+    private JmsConnectionInfo connectionInfo;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstId = new JmsSessionId(generator.generateId(), 1);
+        secondId = new JmsSessionId(generator.generateId(), 2);
+
+        JmsConnectionId connectionId = new JmsConnectionId(generator.generateId());
+        connectionInfo = new JmsConnectionInfo(connectionId);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testExceptionWhenCreatedWithNullConnectionId() {
+        new JmsSessionInfo(null, 1);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testExceptionWhenCreatedWithNullSessionId() {
+        new JmsSessionInfo(null);
+    }
+
+    @Test
+    public void testCreateFromSessionId() {
+        JmsSessionInfo info = new JmsSessionInfo(firstId);
+        assertSame(firstId, info.getSessionId());
+        assertNotNull(info.toString());
+    }
+
+    @Test
+    public void testCreateFromConnectionInfo() {
+        JmsSessionInfo info = new JmsSessionInfo(connectionInfo, 1);
+        assertEquals(connectionInfo.getConnectionId(), info.getSessionId().getParentId());
+    }
+
+    @Test
+    public void testIsTransacted() {
+        JmsSessionInfo info = new JmsSessionInfo(firstId);
+        info.setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE);
+        assertFalse(info.isTransacted());
+        info.setAcknowledgementMode(Session.SESSION_TRANSACTED);
+        assertTrue(info.isTransacted());
+    }
+
+    @Test
+    public void testCopy() {
+        JmsSessionInfo info = new JmsSessionInfo(firstId);
+
+        info.setAcknowledgementMode(2);
+        info.setSendAcksAsync(true);
+
+        JmsSessionInfo copy = info.copy();
+
+        assertEquals(2, copy.getAcknowledgementMode());
+        assertEquals(true, copy.isSendAcksAsync());
+
+        assertEquals(info, copy);
+}
+
+    @Test
+    public void testCompareTo() {
+        JmsSessionInfo first = new JmsSessionInfo(firstId);
+        JmsSessionInfo second = new JmsSessionInfo(secondId);
+
+        assertEquals(-1, first.compareTo(second));
+        assertEquals(0, first.compareTo(first));
+        assertEquals(1, second.compareTo(first));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsSessionInfo first = new JmsSessionInfo(firstId);
+        JmsSessionInfo second = new JmsSessionInfo(secondId);
+
+        assertEquals(first.hashCode(), first.hashCode());
+        assertEquals(second.hashCode(), second.hashCode());
+
+        assertFalse(first.hashCode() == second.hashCode());
+    }
+
+    @Test
+    public void testEqualsCode() {
+        JmsSessionInfo first = new JmsSessionInfo(firstId);
+        JmsSessionInfo second = new JmsSessionInfo(secondId);
+
+        assertEquals(first, first);
+        assertEquals(second, second);
+
+        assertFalse(first.equals(second));
+        assertFalse(second.equals(first));
+
+        assertFalse(first.equals(null));
+        assertFalse(second.equals("test"));
+    }
+
+    @Test
+    public void testVisit() throws Exception {
+        final JmsSessionInfo first = new JmsSessionInfo(firstId);
+
+        final AtomicBoolean visited = new AtomicBoolean();
+
+        first.visit(new JmsDefaultResourceVisitor() {
+
+            @Override
+            public void processSessionInfo(JmsSessionInfo info) {
+                assertEquals(first, info);
+                visited.set(true);
+            }
+        });
+
+        assertTrue(visited.get());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsTransactionIdTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsTransactionIdTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsTransactionIdTest.java
new file mode 100644
index 0000000..9dcde87
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsTransactionIdTest.java
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JmsTransactionIdTest {
+
+    private JmsConnectionId firstId;
+    private JmsConnectionId secondId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstId = new JmsConnectionId(generator.generateId());
+        secondId = new JmsConnectionId(generator.generateId());
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testNullIdThrowsException() {
+        new JmsTransactionId(null, 0);
+    }
+
+    @Test
+    public void testConstructor() {
+        JmsTransactionId id = new JmsTransactionId(firstId, 1);
+        assertEquals(firstId, id.getConnectionId());
+        assertNotNull(id.getValue());
+        assertNull(id.getProviderHint());
+        assertNull(id.getProviderId());
+    }
+
+    @Test
+    public void testGetTXKey() {
+        JmsTransactionId id = new JmsTransactionId(firstId, 1);
+        String txKey = id.getTransactionKey();
+        assertNotNull(txKey);
+        assertTrue(txKey.startsWith("TX:"));
+        assertSame(txKey, id.getTransactionKey());
+    }
+
+    @Test
+    public void testToString() {
+        JmsTransactionId id = new JmsTransactionId(firstId, 1);
+        String txKey = id.toString();
+        assertNotNull(txKey);
+        assertTrue(txKey.startsWith("TX:"));
+    }
+
+    @Test
+    public void testCompareTo() {
+        JmsTransactionId id1 = new JmsTransactionId(firstId, 1);
+        JmsTransactionId id2 = new JmsTransactionId(secondId, 1);
+
+        assertEquals(-1, id1.compareTo(id2));
+        assertEquals(0, id1.compareTo(id1));
+        assertEquals(1, id2.compareTo(id1));
+    }
+
+    @Test
+    public void testEquals() {
+        JmsTransactionId id1 = new JmsTransactionId(firstId, 1);
+        JmsTransactionId id2 = new JmsTransactionId(secondId, 1);
+
+        assertTrue(id1.equals(id1));
+        assertTrue(id2.equals(id2));
+        assertFalse(id1.equals(id2));
+        assertFalse(id2.equals(id1));
+
+        assertFalse(id1.equals(null));
+        assertFalse(id1.equals(new String("TEST")));
+
+        JmsTransactionId id3 = new JmsTransactionId(firstId, 1);
+        JmsTransactionId id4 = new JmsTransactionId(firstId, 2);
+        JmsTransactionId id5 = new JmsTransactionId(firstId, 1);
+
+        assertFalse(id3.equals(id4));
+        assertTrue(id3.equals(id5));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsTransactionId id1 = new JmsTransactionId(firstId, 1);
+        JmsTransactionId id2 = new JmsTransactionId(secondId, 1);
+
+        assertEquals(id1.hashCode(), id1.hashCode());
+        assertEquals(id2.hashCode(), id2.hashCode());
+        assertFalse(id1.hashCode() == id2.hashCode());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6973cb51/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsTransactionInfoTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsTransactionInfoTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsTransactionInfoTest.java
new file mode 100644
index 0000000..b02effc
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/meta/JmsTransactionInfoTest.java
@@ -0,0 +1,138 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.meta;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.qpid.jms.util.IdGenerator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class JmsTransactionInfoTest {
+
+    private JmsConnectionId firstId;
+    private JmsConnectionId secondId;
+
+    private JmsSessionId firstSessionId;
+    private JmsSessionId secondSessionId;
+
+    private JmsTransactionId firstTxId;
+    private JmsTransactionId secondTxId;
+
+    @Before
+    public void setUp() {
+        IdGenerator generator = new IdGenerator();
+
+        firstId = new JmsConnectionId(generator.generateId());
+        secondId = new JmsConnectionId(generator.generateId());
+
+        firstSessionId = new JmsSessionId(firstId, 1);
+        secondSessionId = new JmsSessionId(secondId, 2);
+
+        firstTxId = new JmsTransactionId(firstId, 1);
+        secondTxId = new JmsTransactionId(secondId, 2);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testThrowsWhenSessionIdIsNull() {
+        new JmsTransactionInfo(null, firstTxId);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testThrowsWhenTransactionIdIsNull() {
+        new JmsTransactionInfo(firstSessionId, null);
+    }
+
+    @Test
+    public void testCreateTransactionInfo() {
+        JmsTransactionInfo info = new JmsTransactionInfo(firstSessionId, firstTxId);
+        assertSame(firstSessionId, info.getSessionId());
+        assertSame(firstTxId, info.getTransactionId());
+        assertSame(firstSessionId, info.getParentId());
+        assertNotNull(info.toString());
+    }
+
+    @Test
+    public void testCopy() {
+        JmsTransactionInfo info = new JmsTransactionInfo(firstSessionId, firstTxId);
+        JmsTransactionInfo copy = info.copy();
+        assertEquals(info, copy);
+    }
+
+    @Test
+    public void testCompareTo() {
+        JmsTransactionInfo first = new JmsTransactionInfo(firstSessionId, firstTxId);
+        JmsTransactionInfo second = new JmsTransactionInfo(secondSessionId, secondTxId);
+
+        assertEquals(-1, first.compareTo(second));
+        assertEquals(0, first.compareTo(first));
+        assertEquals(1, second.compareTo(first));
+    }
+
+    @Test
+    public void testHashCode() {
+        JmsTransactionInfo first = new JmsTransactionInfo(firstSessionId, firstTxId);
+        JmsTransactionInfo second = new JmsTransactionInfo(secondSessionId, secondTxId);
+
+        assertEquals(first.hashCode(), first.hashCode());
+        assertEquals(second.hashCode(), second.hashCode());
+
+        assertFalse(first.hashCode() == second.hashCode());
+    }
+
+    @Test
+    public void testEqualsCode() {
+        JmsTransactionInfo first = new JmsTransactionInfo(firstSessionId, firstTxId);
+        JmsTransactionInfo second = new JmsTransactionInfo(secondSessionId, secondTxId);
+
+        assertEquals(first, first);
+        assertEquals(second, second);
+
+        assertFalse(first.equals(second));
+        assertFalse(second.equals(first));
+
+        assertFalse(first.equals(null));
+        assertFalse(second.equals("test"));
+    }
+
+    @Test
+    public void testVisit() throws Exception {
+        final JmsTransactionInfo first = new JmsTransactionInfo(firstSessionId, firstTxId);
+
+        final AtomicBoolean visited = new AtomicBoolean();
+
+        first.visit(new JmsDefaultResourceVisitor() {
+
+            @Override
+            public void processTransactionInfo(JmsTransactionInfo info) {
+                assertEquals(first, info);
+                visited.set(true);
+            }
+        });
+
+        assertTrue(visited.get());
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org