Author: arnaudsimon
Date: Tue Oct 23 09:47:22 2007
New Revision: 587552
URL: http://svn.apache.org/viewvc?rev=587552&view=rev
Log:
cahnged for setting the consumer before the producer
Modified:
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java
Modified:
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java?rev=587552&r1=587551&r2=587552&view=diff
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java
Tue Oct 23 09:47:22 2007
@@ -60,14 +60,15 @@
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 @@
{
_connection.close();
}
-
+
public void testSimpleReceiveConnection()
{
try
@@ -90,9 +91,9 @@
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 @@
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 @@
try
{
- _gotMessage.await(1000, TimeUnit.MILLISECONDS);
+ assertTrue("Listener was never called", _gotMessage.await(10 *
1000, TimeUnit.MILLISECONDS));
}
catch (InterruptedException e)
{