You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/11/28 11:13:51 UTC
svn commit: r1771710 - in /qpid/java/trunk:
systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
test-profiles/Java10UninvestigatedTestsExcludes
Author: rgodfrey
Date: Mon Nov 28 11:13:51 2016
New Revision: 1771710
URL: http://svn.apache.org/viewvc?rev=1771710&view=rev
Log:
QPID-7546 : SessionStartTest
Modified:
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes
Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java?rev=1771710&r1=1771709&r2=1771710&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java (original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java Mon Nov 28 11:13:51 2016
@@ -20,32 +20,40 @@
*/
package org.apache.qpid.test.unit.basic;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
+import javax.jms.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQSession;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
public class SessionStartTest extends QpidBrokerTestCase implements MessageListener
{
private static final Logger _logger = LoggerFactory.getLogger(SessionStartTest.class);
- private AMQConnection _connection;
- private AMQDestination _destination;
- private AMQSession _session;
- private int count;
+ private Connection _connection;
+ private Destination _destination;
+ private Session _session;
+ private CountDownLatch _countdownLatch;
protected void setUp() throws Exception
{
super.setUp();
- init((AMQConnection) getConnection("guest", "guest"));
+ _connection = getConnection();
+ _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ _destination = createTestQueue(_session);
+ _connection.start();
+
+ _session.createConsumer(_destination).setMessageListener(this);
+ _countdownLatch = new CountDownLatch(1);
}
protected void tearDown() throws Exception
@@ -53,37 +61,13 @@ public class SessionStartTest extends Qp
super.tearDown();
}
- private void init(AMQConnection connection) throws Exception
- {
- init(connection,
- new AMQQueue(connection.getDefaultQueueExchangeName(), randomize("SessionStartTest"), true));
- }
-
- private void init(AMQConnection connection, AMQDestination destination) throws Exception
- {
- _connection = connection;
- _destination = destination;
- connection.start();
-
- _session = (AMQSession) connection.createSession(false, AMQSession.NO_ACKNOWLEDGE);
- _session.createConsumer(destination).setMessageListener(this);
- }
-
- public synchronized void test() throws JMSException, InterruptedException
+ public void test() throws JMSException, InterruptedException
{
try
{
_session.createProducer(_destination).send(_session.createTextMessage("Message"));
_logger.info("Message sent, waiting for response...");
- wait(1000);
- if (count > 0)
- {
- _logger.info("Got message");
- }
- else
- {
- throw new RuntimeException("Did not get message!");
- }
+ _countdownLatch.await(getReceiveTimeout(), TimeUnit.MILLISECONDS);
}
finally
{
@@ -92,14 +76,9 @@ public class SessionStartTest extends Qp
}
}
- public synchronized void onMessage(Message message)
+ public void onMessage(Message message)
{
- count++;
- notify();
+ _countdownLatch.countDown();
}
- private static String randomize(String in)
- {
- return in + System.currentTimeMillis();
- }
}
Modified: qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes
URL: http://svn.apache.org/viewvc/qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes?rev=1771710&r1=1771709&r2=1771710&view=diff
==============================================================================
--- qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes (original)
+++ qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes Mon Nov 28 11:13:51 2016
@@ -56,7 +56,6 @@ org.apache.qpid.test.unit.client.connect
org.apache.qpid.test.unit.client.connection.ConnectionFactoryTest#*
org.apache.qpid.test.unit.client.connection.BrokerClosesClientConnectionTest#*
org.apache.qpid.test.unit.client.channelclose.CloseWithBlockingReceiveTest#*
-org.apache.qpid.test.unit.basic.SessionStartTest#*
org.apache.qpid.test.unit.basic.close.CloseTest#*
org.apache.qpid.test.client.queue.LVQTest#*
org.apache.qpid.test.client.message.JMSDestinationTest#*
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org