summaryrefslogtreecommitdiff
path: root/qpid/java/systests/src
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2015-01-27 13:27:05 +0000
committerKeith Wall <kwall@apache.org>2015-01-27 13:27:05 +0000
commitd6ad905aa5da8b0c4be507c87cdae735d778154f (patch)
treee300b26b40a55fac54be611c9ef293c9a7992d41 /qpid/java/systests/src
parente08c11b991309252a19a572024961550e5adaf11 (diff)
downloadqpid-python-d6ad905aa5da8b0c4be507c87cdae735d778154f.tar.gz
QPID-6336: [Java Broker] Change 0-8..0-91 path to await the receiver being closed before continuing with the next connection attempt
Based on work by Oleksandr Rudyy <orudyy@gmail.com> git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1655034 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/systests/src')
-rw-r--r--qpid/java/systests/src/test/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java28
-rw-r--r--qpid/java/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java24
-rw-r--r--qpid/java/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java1
3 files changed, 34 insertions, 19 deletions
diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java
index 15ec0f9a4d..c59b0ecf34 100644
--- a/qpid/java/systests/src/test/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java
+++ b/qpid/java/systests/src/test/java/org/apache/qpid/client/failover/MultipleBrokersFailoverTest.java
@@ -38,7 +38,6 @@ import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQConnectionURL;
import org.apache.qpid.jms.ConnectionListener;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
-import org.apache.qpid.test.utils.TestUtils;
import org.apache.qpid.util.FileUtils;
public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements ConnectionListener
@@ -48,9 +47,10 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C
private static final String FAILOVER_VIRTUAL_HOST = "failover";
private static final String NON_FAILOVER_VIRTUAL_HOST = "nonfailover";
private static final String BROKER_PORTION_FORMAT = "tcp://localhost:%d?connectdelay='%d',retries='%d'";
- private static final int FAILOVER_RETRIES = 1;
- private static final int FAILOVER_CONNECTDELAY = 1000;
- private static final int FAILOVER_FACTOR = 4;
+ private static final int FAILOVER_RETRIES = 0;
+ private static final int FAILOVER_CONNECTDELAY = 0;
+ private static final int FAILOVER_AWAIT_TIME = 10000;
+
private int[] _brokerPorts;
private AMQConnectionURL _connectionURL;
@@ -169,7 +169,7 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C
killBroker(_brokerPorts[1]);
- awaitForFailoverCompletion(FAILOVER_CONNECTDELAY * _brokerPorts.length * FAILOVER_FACTOR);
+ awaitForFailoverCompletion(FAILOVER_AWAIT_TIME);
assertEquals("Failover is not started as expected", 0, _failoverStarted.getCount());
assertSendReceive(2);
@@ -185,7 +185,7 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C
stopBroker(_brokerPorts[1]);
- awaitForFailoverCompletion(FAILOVER_CONNECTDELAY * _brokerPorts.length * FAILOVER_FACTOR);
+ awaitForFailoverCompletion(FAILOVER_AWAIT_TIME);
assertEquals("Failover is not started as expected", 0, _failoverStarted.getCount());
assertSendReceive(1);
@@ -214,20 +214,12 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C
}
}
- private void awaitForFailoverCompletion(long delay)
+ private void awaitForFailoverCompletion(long delay) throws Exception
{
_logger.info("Awaiting Failover completion..");
- try
- {
- if (!_failoverComplete.await(delay, TimeUnit.MILLISECONDS))
- {
- _logger.warn("Test thread stack:\n\n" + TestUtils.dumpThreads());
- fail("Failover did not complete");
- }
- }
- catch (InterruptedException e)
+ if (!_failoverComplete.await(delay, TimeUnit.MILLISECONDS))
{
- fail("Test was interrupted:" + e.getMessage());
+ fail("Failover did not complete within " + delay + "ms.");
}
}
@@ -239,7 +231,7 @@ public class MultipleBrokersFailoverTest extends QpidBrokerTestCase implements C
receivedMessage instanceof TextMessage);
}
- private void init(int acknowledgeMode, boolean startConnection) throws JMSException
+ private void init(int acknowledgeMode, boolean startConnection) throws Exception
{
boolean isTransacted = acknowledgeMode == Session.SESSION_TRANSACTED ? true : false;
diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java
index 1dba5ced9d..7c82ea8e55 100644
--- a/qpid/java/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java
+++ b/qpid/java/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java
@@ -94,6 +94,29 @@ public class SSLTest extends QpidBrokerTestCase
}
}
+ public void testSSLConnectionToPlainPortRejected() throws Exception
+ {
+ if (shouldPerformTest())
+ {
+ super.setUp();
+
+ String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:%s" +
+ "?ssl='true''";
+
+ url = String.format(url,QpidBrokerTestCase.DEFAULT_PORT);
+
+ try
+ {
+ getConnection(new AMQConnectionURL(url));
+ fail("Exception not thrown");
+ }
+ catch (JMSException e)
+ {
+ assertTrue("Unexpected exception message", e.getMessage().contains("Unrecognized SSL message, plaintext connection?"));
+ }
+ }
+ }
+
public void testHostVerificationIsOnByDefault() throws Exception
{
if (shouldPerformTest())
@@ -116,6 +139,7 @@ public class SSLTest extends QpidBrokerTestCase
try
{
getConnection(new AMQConnectionURL(url));
+ fail("Exception not thrown");
}
catch(JMSException e)
{
diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
index ed03e83292..191f9d72cf 100644
--- a/qpid/java/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
+++ b/qpid/java/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
@@ -81,7 +81,6 @@ public class ConnectionTest extends QpidBrokerTestCase
+ "&temporaryQueueExchange='tmp.direct'"
+ "&temporaryTopicExchange='tmp.topic'");
- System.err.println(url.toString());
conn = new AMQConnection(url);