-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CXF-5543 Removing dependency jms dependency from jaxrs systests. Some…
… other cleanup and fixes git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1565157 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
1 parent
b235b11
commit 0bfee67
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
57 changes: 57 additions & 0 deletions
57
rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |