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 2015/01/07 21:32:54 UTC
[1/2] qpid-jms git commit: Use the simple inbound adapter instead of
the plain one.
Repository: qpid-jms
Updated Branches:
refs/heads/master b95ac58df -> bfc69cf9d
Use the simple inbound adapter instead of the plain one.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/ab895ca4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/ab895ca4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/ab895ca4
Branch: refs/heads/master
Commit: ab895ca4c158729cf12c6edbe3aa2d245157cd08
Parents: b95ac58
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Jan 7 15:12:15 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Jan 7 15:12:15 2015 -0500
----------------------------------------------------------------------
.../qpid/jms/transports/NettyTcpTransport.java | 22 +++++++-------------
1 file changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/ab895ca4/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java
index ebd385d..fb9629f 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/NettyTcpTransport.java
@@ -22,14 +22,13 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.FixedRecvByteBufAllocator;
+import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.util.ReferenceCountUtil;
import java.io.IOException;
import java.net.URI;
@@ -165,7 +164,7 @@ public class NettyTcpTransport implements Transport {
//----- Handle connection events -----------------------------------------//
- private class NettyTcpTransportHandler extends ChannelInboundHandlerAdapter {
+ private class NettyTcpTransportHandler extends SimpleChannelInboundHandler<ByteBuf> {
@Override
public void channelActive(ChannelHandlerContext context) throws Exception {
@@ -173,17 +172,6 @@ public class NettyTcpTransport implements Transport {
}
@Override
- public void channelRead(ChannelHandlerContext context, Object inbound) throws Exception {
- ByteBuf buffer = (ByteBuf) inbound;
- LOG.info("New data read: {} bytes incoming", buffer.readableBytes());
- try {
- listener.onData(new Buffer(buffer));
- } finally {
- ReferenceCountUtil.release(inbound);
- }
- }
-
- @Override
public void channelInactive(ChannelHandlerContext context) throws Exception {
LOG.info("Channel has gone inactive! Channel is {}", context.channel());
if (!closed.get()) {
@@ -200,5 +188,11 @@ public class NettyTcpTransport implements Transport {
listener.onTransportError(cause);
}
}
+
+ @Override
+ protected void channelRead0(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
+ LOG.info("New data read: {} bytes incoming", buffer.readableBytes());
+ listener.onData(new Buffer(buffer));
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-jms git commit: Clean up a bit more,
make port selection automatic in test peer and make the value
available so that client's can look it up.
Posted by ta...@apache.org.
Clean up a bit more, make port selection automatic in test peer and make
the value available so that client's can look it up.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/bfc69cf9
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/bfc69cf9
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/bfc69cf9
Branch: refs/heads/master
Commit: bfc69cf9dad9a3b3382d1b1a43a99dfb7717cded
Parents: ab895ca
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Jan 7 15:32:46 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Jan 7 15:32:46 2015 -0500
----------------------------------------------------------------------
.../BytesMessageIntegrationTest.java | 8 ++--
.../integration/ConnectionIntegrationTest.java | 8 ++--
.../jms/integration/IntegrationTestFixture.java | 29 +-----------
.../integration/MapMessageIntegrationTest.java | 4 +-
.../jms/integration/MessageIntegrationTest.java | 44 +++++++++----------
.../ObjectMessageIntegrationTest.java | 10 ++---
.../jms/integration/SenderIntegrationTest.java | 24 +++++-----
.../jms/integration/SessionIntegrationTest.java | 46 ++++++++++----------
.../StreamMessageIntegrationTest.java | 4 +-
.../integration/TextMessageIntegrationTest.java | 8 ++--
.../qpid/jms/test/testpeer/TestAmqpPeer.java | 12 +++++
.../jms/test/testpeer/TestAmqpPeerRunner.java | 19 ++++++++
12 files changed, 110 insertions(+), 106 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java
index 241b00a..c3a5c36 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java
@@ -57,7 +57,7 @@ public class BytesMessageIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testSendBasicBytesMessageWithContent() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -90,7 +90,7 @@ public class BytesMessageIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testReceiveBasicBytesMessageWithContentUsingDataSection() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -136,7 +136,7 @@ public class BytesMessageIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testReceiveBytesMessageAndResendAfterResetAndPartialRead() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -244,7 +244,7 @@ public class BytesMessageIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testReceiveBytesMessageWithAmqpValueAndResendResultsInData() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java
index 5b25e1c..246c288 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java
@@ -40,7 +40,7 @@ public class ConnectionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=10000)
public void testCreateAndCloseConnection() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectClose();
connection.close();
@@ -49,7 +49,7 @@ public class ConnectionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=10000)
public void testCreateAutoAckSession() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -59,7 +59,7 @@ public class ConnectionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=5000)
public void testCreateTransactedSession() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
@@ -76,7 +76,7 @@ public class ConnectionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=5000)
public void testConnectionMetaDataVersion() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
ConnectionMetaData meta = connection.getMetaData();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java
index a5a9e4b..804111c 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/IntegrationTestFixture.java
@@ -20,14 +20,11 @@ package org.apache.qpid.jms.integration;
import static org.junit.Assert.assertNull;
-import java.io.IOException;
-import java.net.ServerSocket;
import java.util.Map;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
-import javax.net.ServerSocketFactory;
import org.apache.qpid.jms.JmsConnectionFactory;
import org.apache.qpid.jms.test.testpeer.TestAmqpPeer;
@@ -35,10 +32,6 @@ import org.apache.qpid.proton.amqp.Symbol;
public class IntegrationTestFixture {
- private static final int PORT = 25672;
-
- protected int availablePort = 0;
-
Connection establishConnecton(TestAmqpPeer testPeer) throws JMSException {
return establishConnecton(testPeer, null, null, null);
}
@@ -61,7 +54,7 @@ public class IntegrationTestFixture {
// Each connection creates a session for managing temporary destinations etc
testPeer.expectBegin(true);
- final String baseURI = "amqp://localhost:" + getAvailablePort();
+ final String baseURI = "amqp://localhost:" + testPeer.getServerPort();
String brokerURI = baseURI;
if (optionsString != null) {
brokerURI = baseURI + optionsString;
@@ -76,24 +69,4 @@ public class IntegrationTestFixture {
assertNull(testPeer.getThrowable());
return connection;
}
-
- protected int getAvailablePort() {
- if (availablePort == 0) {
- ServerSocket ss = null;
- try {
- ss = ServerSocketFactory.getDefault().createServerSocket(0);
- availablePort = ss.getLocalPort();
- } catch (IOException e) { // revert back to default
- availablePort = PORT;
- } finally {
- try {
- if (ss != null ) {
- ss.close();
- }
- } catch (IOException e) { // ignore
- }
- }
- }
- return availablePort;
- }
}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MapMessageIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MapMessageIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MapMessageIntegrationTest.java
index fe3c573..0351ab8 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MapMessageIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MapMessageIntegrationTest.java
@@ -60,7 +60,7 @@ public class MapMessageIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testReceiveBasicMapMessage() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -149,7 +149,7 @@ public class MapMessageIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testSendBasicMapMessage() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
index 193bf4c..9449d4e 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
@@ -100,7 +100,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
@Test(timeout = 2000)
public void testSendMessageWithApplicationProperties() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -155,7 +155,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
@Test(timeout = 2000)
public void testReceiveMessageWithApplicationProperties() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -236,7 +236,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
}
public void receivedMessageFromQueueWithoutToResultsInUseOfConsumerDestinationImpl(boolean useQueue) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -287,7 +287,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 2000)
public void testReceivedMessageFromQueueWithNoReplyToReturnsNull() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -460,7 +460,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
Object annotationValue,
String replyAnnotationName,
Object replyAnnotationValue) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = null;
if (destType == Topic.class) {
connection = testFixture.establishConnecton(testPeer, "?jms.topicPrefix=" + destPrefix);
@@ -620,7 +620,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
String destName,
String destAddress,
Byte destTypeAnnotationValue) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = null;
if (destType == Topic.class) {
connection = testFixture.establishConnecton(testPeer, "?jms.topicPrefix=" + destPrefix);
@@ -745,7 +745,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
Object annotationValue,
String replyAnnotationName,
Object replyAnnotationValue) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
// Have the test peer provide the destination prefixes as connection properties
Map<Symbol, Object> properties = new HashMap<Symbol, Object>();
properties.put(AmqpConnectionProperties.QUEUE_PREFIX, destPrefix);
@@ -855,7 +855,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
String destName,
String destAddress,
Byte destTypeAnnotationValue) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
// Have the test peer provide the destination prefixes as connection properties
Map<Symbol, Object> properties = new HashMap<Symbol, Object>();
properties.put(AmqpConnectionProperties.QUEUE_PREFIX, destPrefix);
@@ -923,7 +923,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 2000)
public void testReceivedMessageFromTopicWithReplyToWithoutTypeAnnotationResultsInUseOfConsumerDestinationType() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -964,7 +964,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 5000)
public void testSentMessageContainsToTypeAnnotationByte() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -1001,7 +1001,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 5000)
public void testSentMessageContainsReplyToTypeAnnotationByte() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
@@ -1046,7 +1046,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 2000)
public void testReceivedMessageFromQueueWithToLegacyTypeAnnotationForTopic() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1088,7 +1088,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 2000)
public void testReceivedMessageFromQueueWithLegacyReplyToTypeAnnotationForTopic() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1131,7 +1131,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 2000)
public void testReceivedMessageFromQueueWithNoAbsoluteExpiryOrTtlReturnsJMSExpirationZero() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1164,7 +1164,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 2000)
public void testReceivedMessageFromQueueWithAbsoluteExpiryReturnsJMSExpirationNonZero() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1199,7 +1199,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
@Test(timeout = 2000)
public void testReceiveMessageWithoutMessageId() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1259,7 +1259,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
}
private void receivedMessageWithMessageIdTestImpl(Object underlyingAmqpMessageId) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1326,7 +1326,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
}
private void receivedMessageWithCorrelationIdTestImpl(Object correlationIdForAmqpMessageClass, boolean appSpecific) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1430,7 +1430,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
}
private void sentMessageWithCorrelationIdTestImpl(String stringCorrelationId, Object correlationIdForAmqpMessageClass, boolean appSpecific) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -1513,7 +1513,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
}
private void recieveMessageIdSendCorrelationIdTestImpl(Object idForAmqpMessageClass) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1580,7 +1580,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 2000)
public void testReceivedMessageWithGroupRelatedPropertiesSet() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1655,7 +1655,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
*/
@Test(timeout = 2000)
public void testSendMessageWithGroupRelatedPropertiesSet() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ObjectMessageIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ObjectMessageIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ObjectMessageIntegrationTest.java
index 7753738..8a97af7 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ObjectMessageIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ObjectMessageIntegrationTest.java
@@ -62,7 +62,7 @@ public class ObjectMessageIntegrationTest extends QpidJmsTestCase
@Test(timeout = 5000)
public void testSendBasicObjectMessageWithSerializedContent() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -104,7 +104,7 @@ public class ObjectMessageIntegrationTest extends QpidJmsTestCase
@Test(timeout = 5000)
public void testReceiveBasicObjectMessageWithSerializedContent() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -150,7 +150,7 @@ public class ObjectMessageIntegrationTest extends QpidJmsTestCase
@Test(timeout = 5000)
public void testReceiveAndThenResendBasicObjectMessageWithSerializedContent() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -212,7 +212,7 @@ public class ObjectMessageIntegrationTest extends QpidJmsTestCase
@Test(timeout = 5000)
public void testSendBasicObjectMessageWithAmqpTypedContent() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -249,7 +249,7 @@ public class ObjectMessageIntegrationTest extends QpidJmsTestCase
@Test(timeout = 5000)
public void testRecieveBasicObjectMessageWithAmqpTypedContentAndJMSMessageTypeAnnotation() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java
index 35b6759..dff1a6d 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java
@@ -56,7 +56,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 10000)
public void testCloseSender() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -74,7 +74,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 10000)
public void testDefaultDeliveryModeProducesDurableMessages() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -103,7 +103,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 10000)
public void testProducerOverridesMessageDeliveryMode() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -141,7 +141,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testSendingMessageSetsJMSDestination() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -176,7 +176,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 10000)
public void testSendingMessageSetsJMSTimestamp() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -220,7 +220,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testSendingMessageWithDisableMessageTimestampHint() throws Exception {
- try(TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try(TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -257,7 +257,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 10000)
public void testSendingMessageSetsJMSExpirationRelatedAbsoluteExpiryAndTtlFields() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -310,7 +310,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
}
public void sendingMessageWithJMS_AMQP_TTLSetTestImpl(long jmsTtl, long amqpTtl) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -362,7 +362,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 10000)
public void testDefaultPriorityProducesMessagesWithoutPriorityField() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -398,7 +398,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 10000)
public void testNonDefaultPriorityProducesMessagesWithPriorityFieldAndSetsJMSPriority() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -436,7 +436,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 10000)
public void testSendingMessageSetsJMSMessageID() throws Exception {
- try(TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try(TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -482,7 +482,7 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testSendingMessageWithDisableMessageIDHint() throws Exception {
- try(TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try(TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
index ed25300..057465f 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -82,7 +82,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCloseSession() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -94,7 +94,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateProducer() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
@@ -109,7 +109,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateProducerLinkSupportsAcceptedAndRejectedOutcomes() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
@@ -135,7 +135,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateConsumer() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -155,7 +155,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateTemporaryQueue() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -176,7 +176,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateTemporaryTopic() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -216,7 +216,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
private void doCreateConsumerSourceContainsCapabilityTestImpl(Class<? extends Destination> destType) throws JMSException, Exception, IOException {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
@@ -277,7 +277,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
private void doCreateProducerTargetContainsCapabilityTestImpl(Class<? extends Destination> destType) throws JMSException, Exception, IOException {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
@@ -316,7 +316,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateAnonymousProducerTargetContainsNoTypeCapabilityWhenAnonymousRelayNodeIsSupported() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
//Add capability to indicate support for ANONYMOUS-RELAY
Symbol[] serverCapabilities = new Symbol[]{AmqpConnectionProperties.ANONYMOUS_RELAY};
@@ -365,7 +365,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
private void doCreateAnonymousProducerTargetContainsCapabilityWhenAnonymousRelayNodeIsNotSupportedTestImpl(Class<? extends Destination> destType) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
//DO NOT add capability to indicate server support for ANONYMOUS-RELAY
@@ -431,7 +431,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateDurableTopicSubscriber() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -456,7 +456,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCloseDurableTopicSubscriberDetachesWithCloseFalse() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -481,7 +481,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateAnonymousProducerWhenAnonymousRelayNodeIsSupported() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
//Add capability to indicate support for ANONYMOUS-RELAY
Symbol[] serverCapabilities = new Symbol[]{AmqpConnectionProperties.ANONYMOUS_RELAY};
@@ -538,7 +538,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
private void doCreateAnonymousProducerFailsWhenAnonymousRelayNodeIsSupportedButLinkRefusedTestImpl(boolean deferAttachFrameWrite) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
//Add capability to indicate support for ANONYMOUS-RELAY
Symbol[] serverCapabilities = new Symbol[]{AmqpConnectionProperties.ANONYMOUS_RELAY};
@@ -580,7 +580,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
private void doCreateProducerFailsWhenLinkRefusedTestImpl(boolean deferAttachResponseWrite) throws JMSException, InterruptedException, Exception, IOException {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -614,7 +614,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testCreateAnonymousProducerWhenAnonymousRelayNodeIsNotSupported() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
//DO NOT add capability to indicate server support for ANONYMOUS-RELAY
@@ -676,7 +676,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
private void doCommitTransactedSessionWithConsumerTestImpl(int transferCount, int consumeCount) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -732,7 +732,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=5000)
public void testProducedMessagesOnTransactedSessionCarryTxnId() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -788,7 +788,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
private void doRollbackTransactedSessionWithConsumerTestImpl(int transferCount, int consumeCount) throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -856,7 +856,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=5000)
public void testRollbackTransactedSessionWithPrefetchFullBeforeStoppingConsumer() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
int messageCount = 5;
((JmsConnection) connection).getPrefetchPolicy().setAll(messageCount);
@@ -930,7 +930,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=5000)
public void testRollbackTransactedSessionWithPrefetchFullyUtilisedByDrainWhenStoppingConsumer() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
int messageCount = 5;
((JmsConnection) connection).getPrefetchPolicy().setAll(messageCount);
@@ -1009,7 +1009,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=5000)
public void testDefaultOutcomeIsModifiedForConsumerSourceOnTransactedSession() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -1039,7 +1039,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
@Test(timeout=5000)
public void testPrefetchPolicyInfluencesCreditFlow() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
int newPrefetch = 263;
((JmsConnection) connection).getPrefetchPolicy().setAll(newPrefetch);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/StreamMessageIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/StreamMessageIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/StreamMessageIntegrationTest.java
index 10311fc..29bb7da 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/StreamMessageIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/StreamMessageIntegrationTest.java
@@ -60,7 +60,7 @@ public class StreamMessageIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testReceiveBasicMapMessage() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -145,7 +145,7 @@ public class StreamMessageIntegrationTest extends QpidJmsTestCase {
*/
@Test(timeout = 5000)
public void testSendBasicMapMessage() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TextMessageIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TextMessageIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TextMessageIntegrationTest.java
index 876b30c..c6af404 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TextMessageIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TextMessageIntegrationTest.java
@@ -48,7 +48,7 @@ public class TextMessageIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testSendTextMessage() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -77,7 +77,7 @@ public class TextMessageIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testReceiveTextMessageWithContentAmqpValue() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
@@ -105,7 +105,7 @@ public class TextMessageIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testSendTextMessageWithoutContent() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
testPeer.expectBegin(true);
testPeer.expectSenderAttach();
@@ -133,7 +133,7 @@ public class TextMessageIntegrationTest extends QpidJmsTestCase {
@Test(timeout = 5000)
public void testReceiveTextMessageWithAmqpValueNullBodyAndNoMsgTypeAnnotation() throws Exception {
- try (TestAmqpPeer testPeer = new TestAmqpPeer(testFixture.getAvailablePort());) {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
Connection connection = testFixture.establishConnecton(testPeer);
connection.start();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
index 0604ac8..1dca5da 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
@@ -111,6 +111,13 @@ public class TestAmqpPeer implements AutoCloseable
private byte[] _deferredBytes;
+ public TestAmqpPeer() throws IOException
+ {
+ _driverRunnable = new TestAmqpPeerRunner(this);
+ _driverThread = new Thread(_driverRunnable, "MockAmqpPeerThread");
+ _driverThread.start();
+ }
+
public TestAmqpPeer(int port) throws IOException
{
_driverRunnable = new TestAmqpPeerRunner(port, this);
@@ -159,6 +166,11 @@ public class TestAmqpPeer implements AutoCloseable
return _driverRunnable.getException();
}
+ public int getServerPort()
+ {
+ return _driverRunnable.getServerPort();
+ }
+
public void receiveHeader(byte[] header)
{
Handler handler = getFirstHandler();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bfc69cf9/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeerRunner.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeerRunner.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeerRunner.java
index 6de2a3a..d1f98dd 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeerRunner.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeerRunner.java
@@ -33,7 +33,10 @@ class TestAmqpPeerRunner implements Runnable
{
private static final Logger LOGGER = LoggerFactory.getLogger(TestAmqpPeerRunner.class);
+ private static final int PORT = 25672;
+
private final ServerSocket _serverSocket;
+ private final boolean useFixedPort = Boolean.getBoolean("testPeerUsesFixedPort");
/** TODO handle multiple connections */
private Socket _clientSocket;
@@ -44,6 +47,12 @@ class TestAmqpPeerRunner implements Runnable
private volatile Throwable _throwable;
+ public TestAmqpPeerRunner(TestAmqpPeer peer) throws IOException
+ {
+ _serverSocket = new ServerSocket(useFixedPort ? PORT : 0);
+ _testFrameParser = new TestFrameParser(peer);
+ }
+
public TestAmqpPeerRunner(int port, TestAmqpPeer peer) throws IOException
{
_serverSocket = new ServerSocket(port);
@@ -158,4 +167,14 @@ class TestAmqpPeerRunner implements Runnable
{
return _throwable;
}
+
+ public int getServerPort()
+ {
+ if (_serverSocket != null)
+ {
+ return _serverSocket.getLocalPort();
+ }
+
+ return -1;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org