activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: NO-JIRA: just adding a test to avoid future issues
Date Thu, 19 Jan 2017 19:54:10 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master fb75df0c0 -> 9fb28e565


NO-JIRA: just adding a test to avoid future issues


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

Branch: refs/heads/master
Commit: 9fb28e56515b7863e53beb13faa186d9e2010623
Parents: fb75df0
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Thu Jan 19 14:47:30 2017 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Jan 19 14:51:15 2017 -0500

----------------------------------------------------------------------
 .../integration/paging/PagingReceiveTest.java   | 33 ++++++++++++++++++--
 1 file changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9fb28e56/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java
index 3e56461..e9d1c99 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java
@@ -41,6 +41,8 @@ public class PagingReceiveTest extends ActiveMQTestBase {
 
    private ServerLocator locator;
 
+   private int numMsgs = 500;
+
    protected boolean isNetty() {
       return false;
    }
@@ -48,11 +50,20 @@ public class PagingReceiveTest extends ActiveMQTestBase {
    @Test
    public void testReceive() throws Exception {
       ClientMessage message = receiveMessage();
-      System.out.println("message received:" + message);
-
       assertNotNull("Message not found.", message);
    }
 
+   @Test
+   public void testReceiveThenCheckCounter() throws Exception {
+
+      Queue queue = server.locateQueue(ADDRESS);
+      assertEquals(numMsgs, queue.getMessagesAdded());
+      receiveAllMessages();
+      queue.getPageSubscription().cleanupEntries(true);
+      assertEquals(numMsgs, queue.getMessagesAdded());
+   }
+
+
    @Override
    @Before
    public void setUp() throws Exception {
@@ -85,7 +96,7 @@ public class PagingReceiveTest extends ActiveMQTestBase {
 
       server.stop();
 
-      internalCreateServer();
+      server = internalCreateServer();
 
    }
 
@@ -100,6 +111,22 @@ public class PagingReceiveTest extends ActiveMQTestBase {
       return server;
    }
 
+   private void receiveAllMessages() throws Exception {
+      final ClientSessionFactory sf = createSessionFactory(locator);
+      ClientSession session = sf.createSession(null, null, false, true, true, false, 0);
+
+      session.start();
+      ClientConsumer consumer = session.createConsumer(ADDRESS);
+      for (int i = 0; i < numMsgs; i++) {
+         ClientMessage message = consumer.receive(2000);
+         assertNotNull(message);
+         message.acknowledge();
+      }
+
+      session.commit();
+      session.close();
+   }
+
    private ClientMessage receiveMessage() throws Exception {
       final ClientSessionFactory sf = createSessionFactory(locator);
       ClientSession session = sf.createSession(null, null, false, true, true, false, 0);


Mime
View raw message