qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject git commit: Add test for JmsOutboundMessageDispatch
Date Fri, 10 Oct 2014 15:43:29 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master 7dbfa28c2 -> 466975eba


Add test for JmsOutboundMessageDispatch

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

Branch: refs/heads/master
Commit: 466975ebaf56a246e436fa0e51f699f13ceb1a75
Parents: 7dbfa28
Author: Timothy Bish <tabish121@gmail.com>
Authored: Fri Oct 10 11:31:30 2014 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Fri Oct 10 11:31:30 2014 -0400

----------------------------------------------------------------------
 .../jms/message/JmsOutboundMessageDispatch.java |  4 ++
 .../message/JmsOutboundMessageDispatchTest.java | 71 ++++++++++++++++++++
 2 files changed, 75 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/466975eb/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatch.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatch.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatch.java
index 44e211f..ac6b949 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatch.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatch.java
@@ -62,6 +62,10 @@ public class JmsOutboundMessageDispatch {
         return sendAsync;
     }
 
+    public String getDispatchId() {
+        return dispatchId;
+    }
+
     public void setDispatchId(String dispatchId) {
         this.dispatchId = dispatchId;
     }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/466975eb/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatchTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatchTest.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatchTest.java
new file mode 100644
index 0000000..d28883d
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsOutboundMessageDispatchTest.java
@@ -0,0 +1,71 @@
+/**
+ * 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.message;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.qpid.jms.JmsTopic;
+import org.apache.qpid.jms.meta.JmsProducerId;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class JmsOutboundMessageDispatchTest {
+
+    private JmsOutboundMessageDispatch envelope;
+
+    @Before
+    public void setUp() {
+        envelope = new JmsOutboundMessageDispatch();
+    }
+
+    @Test
+    public void testCreateState() {
+        assertFalse(envelope.isSendAsync());
+        assertNull(envelope.getDestination());
+        assertNull(envelope.getMessage());
+        assertNull(envelope.getProducerId());
+        assertNull(envelope.getDispatchId());
+
+        envelope.setDestination(new JmsTopic("test"));
+        envelope.setProducerId(new JmsProducerId("ID:test:1:0:1"));
+        envelope.setDispatchId("DispatchId");
+        envelope.setMessage(Mockito.mock(JmsMessage.class));
+        envelope.setSendAsync(true);
+
+        assertTrue(envelope.isSendAsync());
+        assertNotNull(envelope.getDestination());
+        assertNotNull(envelope.getMessage());
+        assertNotNull(envelope.getProducerId());
+        assertNotNull(envelope.getDispatchId());
+    }
+
+    @Test
+    public void testToString() {
+        envelope.setDispatchId("TEST:ID");
+        assertTrue(envelope.toString().startsWith("JmsOutboundMessageDispatch"));
+        assertTrue(envelope.toString().contains("TEST:ID"));
+    }
+
+    @Test
+    public void testToStringNullDispatchId() {
+        assertTrue(envelope.toString().startsWith("JmsOutboundMessageDispatch"));
+    }
+}


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


Mime
View raw message