Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8487010A79 for ; Thu, 20 Mar 2014 20:16:03 +0000 (UTC) Received: (qmail 44344 invoked by uid 500); 20 Mar 2014 20:15:52 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 44018 invoked by uid 500); 20 Mar 2014 20:15:40 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 43590 invoked by uid 99); 20 Mar 2014 20:15:32 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2014 20:15:32 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 91339986CFC; Thu, 20 Mar 2014 20:15:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hadrian@apache.org To: commits@activemq.apache.org Date: Thu, 20 Mar 2014 20:15:44 -0000 Message-Id: <781e0505249b4660bb21e0c3bc7ed185@git.apache.org> In-Reply-To: <6c16abf4302748cda816f03d9fdb2a03@git.apache.org> References: <6c16abf4302748cda816f03d9fdb2a03@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [14/19] git commit: Fix OOME errors in tests Fix OOME errors in tests Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/dddba068 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/dddba068 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/dddba068 Branch: refs/heads/activemq-5.9 Commit: dddba0684ca72e5d9fbb7b2d8fb24f9a05d285d3 Parents: bb132b1 Author: Hadrian Zbarcea Authored: Wed Mar 5 12:32:46 2014 -0500 Committer: Hadrian Zbarcea Committed: Thu Mar 20 15:17:35 2014 -0400 ---------------------------------------------------------------------- .../java/org/apache/activemq/web/AjaxTest.java | 54 ++++++++++++-------- .../java/org/apache/activemq/web/RestTest.java | 19 +++---- 2 files changed, 43 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/dddba068/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 5c6d9db..d229367 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 @@ -73,13 +73,13 @@ public class AjaxTest extends JettyTestSupport { assertEquals( "Expected number of elements is not correct.", expected, occurrences ); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testAjaxClientReceivesMessagesWhichAreSentToQueueWhileClientIsPolling() throws Exception { LOG.debug( "*** testAjaxClientReceivesMessagesWhichAreSentToQueueWhileClientIsPolling ***" ); HttpClient httpClient = new HttpClient(); - httpClient.start(); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); // client 1 subscribes to a queue LOG.debug( "SENDING LISTEN" ); @@ -132,17 +132,18 @@ public class AjaxTest extends JettyTestSupport { assertContains( "msg1", fullResponse ); assertContains( "msg2", fullResponse ); assertContains( "msg3", fullResponse ); - assertResponseCount( 3, fullResponse ); - } - @Test(timeout = 60 * 1000) + httpClient.stop(); +} + + @Test(timeout = 15 * 1000) public void testAjaxClientReceivesMessagesWhichAreSentToTopicWhileClientIsPolling() throws Exception { LOG.debug( "*** testAjaxClientReceivesMessagesWhichAreSentToTopicWhileClientIsPolling ***" ); HttpClient httpClient = new HttpClient(); - httpClient.start(); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); // client 1 subscribes to a queue LOG.debug( "SENDING LISTEN" ); @@ -197,9 +198,11 @@ public class AjaxTest extends JettyTestSupport { assertContains( "msg2", fullResponse ); assertContains( "msg3", fullResponse ); assertResponseCount( 3, fullResponse ); + + httpClient.stop(); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testAjaxClientReceivesMessagesWhichAreQueuedBeforeClientSubscribes() throws Exception { LOG.debug( "*** testAjaxClientReceivesMessagesWhichAreQueuedBeforeClientSubscribes ***" ); // send messages to queue://test @@ -208,8 +211,8 @@ public class AjaxTest extends JettyTestSupport { producer.send( session.createTextMessage("test three") ); HttpClient httpClient = new HttpClient(); - httpClient.start(); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); // client 1 subscribes to queue LOG.debug( "SENDING LISTEN" ); @@ -238,15 +241,17 @@ public class AjaxTest extends JettyTestSupport { assertContains( "test two", response ); assertContains( "test three", response ); assertResponseCount( 3, response ); + + httpClient.stop(); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testStompMessagesAreReceivedByAjaxClient() throws Exception { LOG.debug( "*** testStompMessagesAreRecievedByAjaxClient ***" ); HttpClient httpClient = new HttpClient(); - httpClient.start(); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); // client 1 subscribes to a queue LOG.debug( "SENDING LISTEN" ); @@ -307,15 +312,17 @@ public class AjaxTest extends JettyTestSupport { assertContains( "message4", fullResponse ); assertContains( "message5", fullResponse ); assertResponseCount( 5, fullResponse ); + + httpClient.stop(); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testAjaxMessagesAreReceivedByStompClient() throws Exception { LOG.debug( "*** testAjaxMessagesAreReceivedByStompClient ***" ); HttpClient httpClient = new HttpClient(); - httpClient.start(); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); AjaxTestContentExchange contentExchange = new AjaxTestContentExchange(); contentExchange.setMethod( "POST" ); @@ -349,9 +356,11 @@ public class AjaxTest extends JettyTestSupport { assertContains( "msg2", allMessageBodies ); assertContains( "msg3", allMessageBodies ); assertContains( "msg4", allMessageBodies ); + + httpClient.stop(); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testAjaxClientMayUseSelectors() throws Exception { LOG.debug( "*** testAjaxClientMayUseSelectors ***" ); @@ -364,10 +373,10 @@ public class AjaxTest extends JettyTestSupport { producer.send( msg ); HttpClient httpClient = new HttpClient(); - httpClient.start(); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); - // client ubscribes to queue + // client subscribes to queue LOG.debug( "SENDING LISTEN" ); AjaxTestContentExchange contentExchange = new AjaxTestContentExchange(); contentExchange.setMethod( "POST" ); @@ -392,12 +401,12 @@ public class AjaxTest extends JettyTestSupport { LOG.debug( poll.getResponseContent() ); String expected = "test two"; - assertContains( expected, poll.getResponseContent() ); + httpClient.stop(); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testMultipleAjaxClientsMayExistInTheSameSession() throws Exception { LOG.debug( "*** testMultipleAjaxClientsMayExistInTheSameSession ***" ); @@ -410,8 +419,8 @@ public class AjaxTest extends JettyTestSupport { producerB.send( session.createTextMessage("B2") ); HttpClient httpClient = new HttpClient(); - httpClient.start(); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); // clientA subscribes to /queue/testA LOG.debug( "SENDING LISTEN" ); @@ -470,17 +479,18 @@ public class AjaxTest extends JettyTestSupport { LOG.debug( "clientB response : " + poll.getResponseContent() ); expected1 = "B1"; expected2 = "B2"; - assertContains( expected1, poll.getResponseContent() ); assertContains( expected2, poll.getResponseContent() ); + + httpClient.stop(); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testAjaxClientReceivesMessagesForMultipleTopics() throws Exception { LOG.debug( "*** testAjaxClientReceivesMessagesForMultipleTopics ***" ); HttpClient httpClient = new HttpClient(); - httpClient.start(); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); LOG.debug( "SENDING LISTEN FOR /topic/topicA" ); AjaxTestContentExchange contentExchange = new AjaxTestContentExchange(); @@ -545,5 +555,7 @@ public class AjaxTest extends JettyTestSupport { assertContains( "A2", fullResponse ); assertContains( "B2", fullResponse ); assertResponseCount( 4, fullResponse ); + + httpClient.stop(); } } http://git-wip-us.apache.org/repos/asf/activemq/blob/dddba068/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 a9223bd..13488f0 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 @@ -92,8 +92,12 @@ public class RestTest extends JettyTestSupport { } // test for https://issues.apache.org/activemq/browse/AMQ-2827 - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testCorrelation() throws Exception { + HttpClient httpClient = new HttpClient(); + httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); + httpClient.start(); + for (int i = 0; i < 200; i++) { String correlId = "RESTY" + RandomStringUtils.randomNumeric(10); @@ -102,13 +106,9 @@ public class RestTest extends JettyTestSupport { message.setJMSCorrelationID(correlId); LOG.info("Sending: " + correlId); - producer.send(message); - HttpClient httpClient = new HttpClient(); - httpClient.start(); ContentExchange contentExchange = new ContentExchange(); - httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); contentExchange.setURL("http://localhost:8080/message/test?readTimeout=1000&type=queue&clientId=test"); httpClient.send(contentExchange); contentExchange.waitForDone(); @@ -116,9 +116,10 @@ public class RestTest extends JettyTestSupport { assertEquals(200, contentExchange.getResponseStatus()); assertEquals(correlId, contentExchange.getResponseContent()); } + httpClient.stop(); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testDisconnect() throws Exception { producer.send(session.createTextMessage("test")); @@ -144,7 +145,7 @@ public class RestTest extends JettyTestSupport { assertEquals("Consumers not closed", 0 , subs.size()); } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testPost() throws Exception { HttpClient httpClient = new HttpClient(); httpClient.start(); @@ -165,7 +166,7 @@ public class RestTest extends JettyTestSupport { } // test for https://issues.apache.org/activemq/browse/AMQ-3857 - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testProperties() throws Exception { HttpClient httpClient = new HttpClient(); httpClient.start(); @@ -190,7 +191,7 @@ public class RestTest extends JettyTestSupport { } - @Test(timeout = 60 * 1000) + @Test(timeout = 15 * 1000) public void testAuth() throws Exception { HttpClient httpClient = new HttpClient(); httpClient.start();