activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kea...@apache.org
Subject git commit: Converted to JUnit 4 and added timeouts. See AMQ-5013
Date Mon, 03 Feb 2014 13:29:34 GMT
Updated Branches:
  refs/heads/trunk da3775302 -> bdf7aa482


Converted to JUnit 4 and added timeouts.  See AMQ-5013


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/bdf7aa48
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/bdf7aa48
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/bdf7aa48

Branch: refs/heads/trunk
Commit: bdf7aa4823fd6bf7d2e3e1ae32158542b05b9ed3
Parents: da37753
Author: Kevin Earls <kevin@kevinearls.com>
Authored: Mon Feb 3 14:29:25 2014 +0100
Committer: Kevin Earls <kevin@kevinearls.com>
Committed: Mon Feb 3 14:29:25 2014 +0100

----------------------------------------------------------------------
 .../test/java/org/apache/activemq/web/AjaxTest.java   | 11 +++++++++++
 .../org/apache/activemq/web/JettyTestSupport.java     | 14 ++++++++++----
 .../org/apache/activemq/web/RestPersistentTest.java   |  6 ++++++
 .../test/java/org/apache/activemq/web/RestTest.java   | 12 ++++++++++++
 4 files changed, 39 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/bdf7aa48/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
----------------------------------------------------------------------
diff --git a/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java b/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
index ed640a0..5c6d9db 100644
--- a/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
+++ b/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
@@ -31,9 +31,12 @@ import org.eclipse.jetty.client.ContentExchange;
 import org.eclipse.jetty.client.HttpClient;
 import org.eclipse.jetty.io.Buffer;
 import org.eclipse.jetty.io.ByteArrayBuffer;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.Assert.*;
+
 public class AjaxTest extends JettyTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(AjaxTest.class);
 
@@ -70,6 +73,7 @@ public class AjaxTest extends JettyTestSupport {
         assertEquals( "Expected number of <response> elements is not correct.", expected,
occurrences );
     }
 
+    @Test(timeout = 60 * 1000)
     public void testAjaxClientReceivesMessagesWhichAreSentToQueueWhileClientIsPolling() throws
Exception {
         LOG.debug( "*** testAjaxClientReceivesMessagesWhichAreSentToQueueWhileClientIsPolling
***" );
 
@@ -132,6 +136,7 @@ public class AjaxTest extends JettyTestSupport {
         assertResponseCount( 3, fullResponse );
     }
 
+    @Test(timeout = 60 * 1000)
     public void testAjaxClientReceivesMessagesWhichAreSentToTopicWhileClientIsPolling() throws
Exception {
         LOG.debug( "*** testAjaxClientReceivesMessagesWhichAreSentToTopicWhileClientIsPolling
***" );
 
@@ -194,6 +199,7 @@ public class AjaxTest extends JettyTestSupport {
         assertResponseCount( 3, fullResponse );
     }
 
+    @Test(timeout = 60 * 1000)
     public void testAjaxClientReceivesMessagesWhichAreQueuedBeforeClientSubscribes() throws
Exception {
         LOG.debug( "*** testAjaxClientReceivesMessagesWhichAreQueuedBeforeClientSubscribes
***" );
         // send messages to queue://test
@@ -234,6 +240,7 @@ public class AjaxTest extends JettyTestSupport {
         assertResponseCount( 3, response );
     }
 
+    @Test(timeout = 60 * 1000)
     public void testStompMessagesAreReceivedByAjaxClient() throws Exception {
         LOG.debug( "*** testStompMessagesAreRecievedByAjaxClient ***" );
 
@@ -302,6 +309,7 @@ public class AjaxTest extends JettyTestSupport {
         assertResponseCount( 5, fullResponse );
     }
 
+    @Test(timeout = 60 * 1000)
     public void testAjaxMessagesAreReceivedByStompClient() throws Exception {
         LOG.debug( "*** testAjaxMessagesAreReceivedByStompClient ***" );
 
@@ -343,6 +351,7 @@ public class AjaxTest extends JettyTestSupport {
         assertContains( "msg4", allMessageBodies );
     }
 
+    @Test(timeout = 60 * 1000)
     public void testAjaxClientMayUseSelectors() throws Exception {
         LOG.debug( "*** testAjaxClientMayUseSelectors ***" );
 
@@ -388,6 +397,7 @@ public class AjaxTest extends JettyTestSupport {
 
     }
 
+    @Test(timeout = 60 * 1000)
     public void testMultipleAjaxClientsMayExistInTheSameSession() throws Exception {
         LOG.debug( "*** testMultipleAjaxClientsMayExistInTheSameSession ***" );
 
@@ -465,6 +475,7 @@ public class AjaxTest extends JettyTestSupport {
         assertContains( expected2, poll.getResponseContent() );
     }
 
+    @Test(timeout = 60 * 1000)
     public void testAjaxClientReceivesMessagesForMultipleTopics() throws Exception {
         LOG.debug( "*** testAjaxClientReceivesMessagesForMultipleTopics ***" );
         HttpClient httpClient = new HttpClient();

http://git-wip-us.apache.org/repos/asf/activemq/blob/bdf7aa48/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
b/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
index 222df74..e1f565d 100644
--- a/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
+++ b/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
@@ -24,7 +24,6 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.net.SocketFactory;
 
-import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.util.Wait;
@@ -32,10 +31,14 @@ import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
 import org.eclipse.jetty.webapp.WebAppContext;
+import org.junit.After;
+import org.junit.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class JettyTestSupport extends TestCase {
+import static org.junit.Assert.*;
+
+public class JettyTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(JettyTestSupport.class);
 
     BrokerService broker;
@@ -52,7 +55,8 @@ public class JettyTestSupport extends TestCase {
         return false;
     }
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         broker = new BrokerService();
         broker.setBrokerName("amq-broker");
         broker.setPersistent(isPersistent());
@@ -86,7 +90,9 @@ public class JettyTestSupport extends TestCase {
         producer = session.createProducer(session.createQueue("test"));
     }
 
-    protected void tearDown() throws Exception {
+
+    @After
+    public void tearDown() throws Exception {
         session.close();
         connection.close();
         server.stop();

http://git-wip-us.apache.org/repos/asf/activemq/blob/bdf7aa48/activemq-web-demo/src/test/java/org/apache/activemq/web/RestPersistentTest.java
----------------------------------------------------------------------
diff --git a/activemq-web-demo/src/test/java/org/apache/activemq/web/RestPersistentTest.java
b/activemq-web-demo/src/test/java/org/apache/activemq/web/RestPersistentTest.java
index ff86212..9eb6df9 100644
--- a/activemq-web-demo/src/test/java/org/apache/activemq/web/RestPersistentTest.java
+++ b/activemq-web-demo/src/test/java/org/apache/activemq/web/RestPersistentTest.java
@@ -22,6 +22,9 @@ import org.eclipse.jetty.client.ContentExchange;
 import org.eclipse.jetty.client.HttpClient;
 import org.eclipse.jetty.http.HttpStatus;
 import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 public class RestPersistentTest extends JettyTestSupport {
 
@@ -31,10 +34,13 @@ public class RestPersistentTest extends JettyTestSupport {
         return true;
     }
 
+    @Test(timeout = 60 * 1000)
     public void testPostAndGetWithQueue() throws Exception {
         postAndGet("queue");
     }
 
+    @Test(timeout = 60 * 1000)
+    @Ignore("Needs a JIRA")
     public void testPostAndGetWithTopic() throws Exception {
         // TODO: problems with topics
         // postAndGet("topic");

http://git-wip-us.apache.org/repos/asf/activemq/blob/bdf7aa48/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java
----------------------------------------------------------------------
diff --git a/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java b/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java
index c86a65f..a9223bd 100644
--- a/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java
+++ b/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java
@@ -26,12 +26,16 @@ import org.eclipse.jetty.client.ContentExchange;
 import org.eclipse.jetty.client.HttpClient;
 import org.eclipse.jetty.http.HttpFields;
 import org.eclipse.jetty.http.HttpStatus;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.Assert.*;
+
 public class RestTest extends JettyTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(RestTest.class);
 
+    @Test(timeout = 60 * 1000)
     public void testConsume() throws Exception {
         producer.send(session.createTextMessage("test"));
         LOG.info("message sent");
@@ -46,6 +50,7 @@ public class RestTest extends JettyTestSupport {
         assertEquals("test", contentExchange.getResponseContent());
     }
 
+    @Test(timeout = 60 * 1000)
     public void testSubscribeFirst() throws Exception {
         HttpClient httpClient = new HttpClient();
         httpClient.start();
@@ -63,6 +68,7 @@ public class RestTest extends JettyTestSupport {
         assertEquals("test", contentExchange.getResponseContent());
     }
 
+    @Test(timeout = 60 * 1000)
     public void testSelector() throws Exception {
         TextMessage msg1 = session.createTextMessage("test1");
         msg1.setIntProperty("test", 1);
@@ -86,6 +92,7 @@ public class RestTest extends JettyTestSupport {
     }
 
     // test for https://issues.apache.org/activemq/browse/AMQ-2827
+    @Test(timeout = 60 * 1000)
     public void testCorrelation() throws Exception {
         for (int i = 0; i < 200; i++) {
             String correlId = "RESTY" + RandomStringUtils.randomNumeric(10);
@@ -111,6 +118,7 @@ public class RestTest extends JettyTestSupport {
         }
     }
 
+    @Test(timeout = 60 * 1000)
     public void testDisconnect() throws Exception {
 
         producer.send(session.createTextMessage("test"));
@@ -136,6 +144,7 @@ public class RestTest extends JettyTestSupport {
         assertEquals("Consumers not closed", 0 , subs.size());
     }
 
+    @Test(timeout = 60 * 1000)
     public void testPost() throws Exception {
         HttpClient httpClient = new HttpClient();
         httpClient.start();
@@ -156,6 +165,7 @@ public class RestTest extends JettyTestSupport {
     }
 
     // test for https://issues.apache.org/activemq/browse/AMQ-3857
+    @Test(timeout = 60 * 1000)
     public void testProperties() throws Exception {
         HttpClient httpClient = new HttpClient();
         httpClient.start();
@@ -179,6 +189,8 @@ public class RestTest extends JettyTestSupport {
         assertEquals("header value", "value", fields.getStringField("property"));
     }
 
+
+    @Test(timeout = 60 * 1000)
     public void testAuth() throws Exception {
         HttpClient httpClient = new HttpClient();
         httpClient.start();


Mime
View raw message