diff options
author | Keith Wall <kwall@apache.org> | 2012-06-15 18:16:11 +0000 |
---|---|---|
committer | Keith Wall <kwall@apache.org> | 2012-06-15 18:16:11 +0000 |
commit | 8a8278fb8a6ce211b82afaeb14876e949b397e25 (patch) | |
tree | 22271b7540393197de7a8e6d836f0ea4075f8d91 | |
parent | 6d83e41e96c05c345ed548e397529d2c1624e827 (diff) | |
download | qpid-python-8a8278fb8a6ce211b82afaeb14876e949b397e25.tar.gz |
QPID-4069: DistributedClientTest.testClientFailsToCreateProducerUsingInvalidSession occasionally seen to fail on CI
Test is seen to fail on slower CI boxes running persistent profiles. From the logs, it can be seen that the
issue is timing. Extending receive timeout and sync'ing after the message ought to resolve the problem.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1350722 13f79535-47bb-0310-9956-ffa450edef68
2 files changed, 11 insertions, 9 deletions
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/ControllerQueue.java b/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/ControllerQueue.java index 7f0c23eb38..2945286b47 100644 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/ControllerQueue.java +++ b/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/ControllerQueue.java @@ -66,7 +66,7 @@ public class ControllerQueue public <T extends Command> T getNext(boolean assertMessageExists) throws JMSException { - final Message message = _controllerQueueMessageConsumer.receive(1000); + final Message message = _controllerQueueMessageConsumer.receive(2000); if(assertMessageExists) { Assert.assertNotNull("No message received from control queue", message); diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/DistributedClientTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/DistributedClientTest.java index 4a872a7ee2..5b5a60ac43 100644 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/DistributedClientTest.java +++ b/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/DistributedClientTest.java @@ -32,6 +32,7 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; +import org.apache.qpid.client.AMQSession; import org.apache.qpid.disttest.client.Client; import org.apache.qpid.disttest.client.ClientState; import org.apache.qpid.disttest.jms.ClientJmsDelegate; @@ -158,7 +159,7 @@ public class DistributedClientTest extends DistributedTestSystemTestBase assertState(_client, RUNNING_TEST); } - public void testParticipantsSendResults() throws JMSException + public void testParticipantsSendResults() throws Exception { createTestProducer(TEST_SESSION_NAME, TEST_PRODUCER_NAME, TEST_DESTINATION); @@ -204,20 +205,21 @@ public class DistributedClientTest extends DistributedTestSystemTestBase assertState(_client, READY); } - private void sendCommandToClient(final Command command) throws JMSException + private void sendCommandToClient(final Command command) throws Exception { final Message message = JmsMessageAdaptor.commandToMessage(_session, command); _clientQueueProducer.send(message); + ((AMQSession<?, ?>)_session).sync(); } - private void sendCommandAndValidateResponse(final Command command, boolean shouldSucceed) throws JMSException + private void sendCommandAndValidateResponse(final Command command, boolean shouldSucceed) throws Exception { sendCommandToClient(command); Response response = _controllerQueue.getNext(); validateResponse(command.getType(), response, shouldSucceed); } - private void sendCommandAndValidateResponse(final Command command) throws JMSException + private void sendCommandAndValidateResponse(final Command command) throws Exception { sendCommandAndValidateResponse(command, true); } @@ -258,7 +260,7 @@ public class DistributedClientTest extends DistributedTestSystemTestBase createTestSession(connectionName, sessionName, true); } - private void createTestProducer(String sessionName, String producerName, String destinationName, boolean shouldSucceed) throws JMSException + private void createTestProducer(String sessionName, String producerName, String destinationName, boolean shouldSucceed) throws Exception { final CreateProducerCommand createProducerCommand = new CreateProducerCommand(); createProducerCommand.setParticipantName(producerName); @@ -269,12 +271,12 @@ public class DistributedClientTest extends DistributedTestSystemTestBase sendCommandAndValidateResponse(createProducerCommand, shouldSucceed); } - private void createTestProducer(String sessionName, String producerName, String destinationName) throws JMSException + private void createTestProducer(String sessionName, String producerName, String destinationName) throws Exception { createTestProducer(sessionName, producerName, destinationName, true); } - private void createTestConsumer(String sessionName, String consumerName, String destinationName, boolean shouldSucceed) throws JMSException + private void createTestConsumer(String sessionName, String consumerName, String destinationName, boolean shouldSucceed) throws Exception { final CreateConsumerCommand createConsumerCommand = new CreateConsumerCommand(); createConsumerCommand.setSessionName(sessionName); @@ -285,7 +287,7 @@ public class DistributedClientTest extends DistributedTestSystemTestBase sendCommandAndValidateResponse(createConsumerCommand, shouldSucceed); } - private void createTestConsumer(String sessionName, String consumerName, String destinationName) throws JMSException + private void createTestConsumer(String sessionName, String consumerName, String destinationName) throws Exception { createTestConsumer(sessionName, consumerName, destinationName, true); } |