You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by cs...@apache.org on 2014/02/06 11:44:02 UTC

svn commit: r1565157 - in /cxf/trunk/rt/transports/jms/src: main/java/org/apache/cxf/transport/jms/util/package-info.java test/java/org/apache/cxf/transport/jms/util/ test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java

Author: cschneider
Date: Thu Feb  6 10:44:02 2014
New Revision: 1565157

URL: http://svn.apache.org/r1565157
Log:
CXF-5543 Removing dependency jms dependency from jaxrs systests. Some other cleanup and fixes

Added:
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/package-info.java   (with props)
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java   (with props)

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/package-info.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/package-info.java?rev=1565157&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/package-info.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/package-info.java Thu Feb  6 10:44:02 2014
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+/**
+ * Utility classes to make it easier to work with the JMS API.
+ * 
+ * This package might later be moved to a jms library independent of cxf.
+ * So any classes in this package should only depend on the jms API. 
+ */
+package org.apache.cxf.transport.jms.util;
\ No newline at end of file

Propchange: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java?rev=1565157&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java (added)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java Thu Feb  6 10:44:02 2014
@@ -0,0 +1,57 @@
+/**
+ * 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.cxf.transport.jms.util;
+
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JMSUtilTest extends Assert {
+    
+    @Test
+    public void testCorrelationIDGeneration() {
+        final String conduitId = UUID.randomUUID().toString().replaceAll("-", "");
+
+        // test min edge case
+        AtomicLong messageMinCount = new AtomicLong(0);
+        createAndCheck(conduitId, "0000000000000000", messageMinCount.get());
+        
+        // test max edge case
+        AtomicLong messageMaxCount = new AtomicLong(0xFFFFFFFFFFFFFFFFL);
+        createAndCheck(conduitId, "ffffffffffffffff", messageMaxCount.get());
+
+        // test overflow case
+        AtomicLong overflowCount = new AtomicLong(0xFFFFFFFFFFFFFFFFL);
+        createAndCheck(conduitId, "0000000000000000", overflowCount.incrementAndGet());
+        
+        // Test sequence
+        AtomicLong sequence = new AtomicLong(0);
+        createAndCheck(conduitId, "0000000000000001", sequence.incrementAndGet());
+        createAndCheck(conduitId, "0000000000000002", sequence.incrementAndGet());
+    }
+
+    private void createAndCheck(String prefix, final String expectedIndex, long sequenceNum) {
+        String correlationID = JMSUtil.createCorrelationId(prefix, sequenceNum);
+        assertEquals("The correlationID value does not match expected value",
+                     prefix + expectedIndex, correlationID);
+    }
+}

Propchange: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain