diff options
| author | Arnaud Simon <arnaudsimon@apache.org> | 2007-10-23 16:47:22 +0000 |
|---|---|---|
| committer | Arnaud Simon <arnaudsimon@apache.org> | 2007-10-23 16:47:22 +0000 |
| commit | 92114fc688d69d283ca955b7de8f6265af0b7c2b (patch) | |
| tree | 682dcde268cfc1b3edc2595d9ce3254b4940b5c2 /java/client/src/test | |
| parent | 47c3698db7e5a52a7958ebb635e736b2f95df1f9 (diff) | |
| download | qpid-python-92114fc688d69d283ca955b7de8f6265af0b7c2b.tar.gz | |
cahnged for setting the consumer before the producer
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@587552 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/test')
| -rw-r--r-- | java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java index e115821755..e2d3832cc9 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java @@ -60,14 +60,15 @@ public class ConnectionStartTest extends QpidTestCase MessageProducer pub = pubSess.createProducer(queue); - pub.send(pubSess.createTextMessage("Initial Message")); - _connection = (AMQConnection) getConnection("guest", "guest"); _consumerSess = _connection.createSession(false, AMQSession.AUTO_ACKNOWLEDGE); _consumer = _consumerSess.createConsumer(queue); + //publish after queue is created to ensure it can be routed as expected + pub.send(pubSess.createTextMessage("Initial Message")); + pubCon.close(); } @@ -82,7 +83,7 @@ public class ConnectionStartTest extends QpidTestCase { _connection.close(); } - + public void testSimpleReceiveConnection() { try @@ -90,9 +91,9 @@ public class ConnectionStartTest extends QpidTestCase assertTrue("Connection should not be started", !_connection.started()); //Note that this next line will start the dispatcher in the session // should really not be called before _connection start - assertTrue("There should not be messages waiting for the consumer", _consumer.receiveNoWait() == null); + //assertTrue("There should not be messages waiting for the consumer", _consumer.receiveNoWait() == null); _connection.start(); - assertTrue("There should be messages waiting for the consumer", _consumer.receive(10*1000) == null); + assertTrue("There should be messages waiting for the consumer", _consumer.receive(10*1000) != null); assertTrue("Connection should be started", _connection.started()); } @@ -110,7 +111,7 @@ public class ConnectionStartTest extends QpidTestCase try { assertTrue("Connection should not be started", !_connection.started()); - _consumerSess.setMessageListener(new MessageListener() + _consumer.setMessageListener(new MessageListener() { public void onMessage(Message message) { @@ -133,7 +134,7 @@ public class ConnectionStartTest extends QpidTestCase try { - _gotMessage.await(1000, TimeUnit.MILLISECONDS); + assertTrue("Listener was never called", _gotMessage.await(10 * 1000, TimeUnit.MILLISECONDS)); } catch (InterruptedException e) { |
