You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2017/11/29 17:19:25 UTC

[2/2] qpid-broker-j git commit: QPID-6933: [System Tests] Move ClientAcknowledgeTest into JMS 1.1 system tests

QPID-6933: [System Tests] Move ClientAcknowledgeTest into JMS 1.1 system tests


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/37b6c9db
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/37b6c9db
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/37b6c9db

Branch: refs/heads/master
Commit: 37b6c9dbcdc7feb283cb0aba216939d2afeaf852
Parents: 2c9ce95
Author: Alex Rudyy <or...@apache.org>
Authored: Wed Nov 29 17:19:07 2017 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Wed Nov 29 17:19:07 2017 +0000

----------------------------------------------------------------------
 .../jms_1_1/acknowledge/AcknowledgeTest.java    | 90 ++++++++++++++++++++
 .../test/unit/ack/ClientAcknowledgeTest.java    | 86 -------------------
 test-profiles/CPPTransientExcludes              |  5 --
 test-profiles/JavaTransientExcludes             |  3 -
 4 files changed, 90 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/37b6c9db/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/acknowledge/AcknowledgeTest.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/acknowledge/AcknowledgeTest.java b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/acknowledge/AcknowledgeTest.java
new file mode 100644
index 0000000..65eecc4
--- /dev/null
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/acknowledge/AcknowledgeTest.java
@@ -0,0 +1,90 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.systests.jms_1_1.acknowledge;
+
+import static org.apache.qpid.systests.Utils.INDEX;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeThat;
+
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.Session;
+
+
+import org.junit.Test;
+
+import org.apache.qpid.systests.JmsTestBase;
+import org.apache.qpid.systests.Utils;
+
+public class AcknowledgeTest extends JmsTestBase
+{
+
+    @Test
+    public void testClientAckWithLargeFlusherPeriod() throws Exception
+    {
+        assumeThat(getBrokerAdmin().supportsRestart(), is(true));
+
+        Queue queue = createQueue(getTestName());
+        Connection connection = getConnection();
+        try
+        {
+            Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+            MessageConsumer consumer = session.createConsumer(queue);
+            connection.start();
+
+            Utils.sendMessage(session, queue, 2);
+
+            Message message = consumer.receive(getReceiveTimeout());
+            assertNotNull("Message has not been received", message);
+            assertEquals("Unexpected message is received", 0, message.getIntProperty(INDEX));
+            message.acknowledge();
+
+            message = consumer.receive(getReceiveTimeout());
+            assertNotNull("Second message has not been received", message);
+            assertEquals("Unexpected message is received", 1, message.getIntProperty(INDEX));
+        }
+        finally
+        {
+            connection.close();
+        }
+
+        getBrokerAdmin().restart();
+
+        Connection connection2 = getConnection();
+        try
+        {
+            connection2.start();
+            Session session = connection2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+            MessageConsumer consumer = session.createConsumer(queue);
+            Message message = consumer.receive(getReceiveTimeout());
+            assertNotNull("Message has not been received after restart", message);
+            assertEquals("Unexpected message is received after restart", 1, message.getIntProperty(INDEX));
+        }
+        finally
+        {
+            connection2.close();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/37b6c9db/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java b/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java
deleted file mode 100644
index f796973..0000000
--- a/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpid.test.unit.ack;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-public class ClientAcknowledgeTest extends QpidBrokerTestCase
-{
-    private static final long ONE_DAY_MS = 1000l * 60 * 60 * 24;
-    private Connection _connection;
-    private Session _consumerSession;
-    private MessageConsumer _consumer;
-    private MessageProducer _producer;
-
-    @Override
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-        _connection = getConnection();
-    }
-
-    /**
-     * Test that message.acknowledge actually acknowledges, regardless of
-     * the flusher thread period, by restarting the broker after calling
-     * acknowledge, and then verifying after restart that the message acked
-     * is no longer present. This test requires a persistent store.
-     */
-    public void testClientAckWithLargeFlusherPeriod() throws Exception
-    {
-        if (isBroker010())
-        {
-            setTestClientSystemProperty("qpid.session.max_ack_delay", Long.toString(ONE_DAY_MS));
-        }
-
-        _consumerSession = _connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-        Queue queue = createTestQueue(_consumerSession);
-        _consumer = _consumerSession.createConsumer(queue);
-        _connection.start();
-
-        _producer = _consumerSession.createProducer(queue);
-        _producer.send(createNextMessage(_consumerSession, 1));
-        _producer.send(createNextMessage(_consumerSession, 2));
-
-        Message message = _consumer.receive(getReceiveTimeout());
-        assertNotNull("Message has not been received", message);
-        assertEquals("Unexpected message is received", 1, message.getIntProperty(INDEX));
-        message.acknowledge();
-
-        //restart broker to allow verification of the acks
-        //without explicitly closing connection (which acks)
-        //Seems to be contrary to the JMS spec " Closing a connection does NOT force an acknowledgment of client-acknowledged sessions."
-        restartDefaultBroker();
-
-        // try to receive the message again, which should fail (as it was ackd)
-        _connection = getConnection();
-        _connection.start();
-        _consumerSession = _connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-        _consumer = _consumerSession.createConsumer(queue);
-        message = _consumer.receive(getReceiveTimeout());
-        assertNotNull("Message has not been received", message);
-        assertEquals("Unexpected message is received", 2, message.getIntProperty(INDEX));
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/37b6c9db/test-profiles/CPPTransientExcludes
----------------------------------------------------------------------
diff --git a/test-profiles/CPPTransientExcludes b/test-profiles/CPPTransientExcludes
index e30e9d6..969b927 100644
--- a/test-profiles/CPPTransientExcludes
+++ b/test-profiles/CPPTransientExcludes
@@ -17,8 +17,3 @@
 // under the License.
 //
 
-// those tests require broker recovery
-org.apache.qpid.test.unit.ct.DurableSubscriberTest#*
-
-// test requires a persistent store
-org.apache.qpid.test.unit.ack.ClientAcknowledgeTest#testClientAckWithLargeFlusherPeriod

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/37b6c9db/test-profiles/JavaTransientExcludes
----------------------------------------------------------------------
diff --git a/test-profiles/JavaTransientExcludes b/test-profiles/JavaTransientExcludes
index 60839e7..632f63d 100644
--- a/test-profiles/JavaTransientExcludes
+++ b/test-profiles/JavaTransientExcludes
@@ -23,9 +23,6 @@ org.apache.qpid.server.store.PersistentStoreTest#*
 org.apache.qpid.server.store.SplitStoreTest#*
 org.apache.qpid.server.logging.AlertingTest#testAlertingReallyWorksWithRestart
 org.apache.qpid.server.logging.AlertingTest#testAlertingReallyWorksWithChanges
-org.apache.qpid.test.unit.ack.ClientAcknowledgeTest#testClientAckWithLargeFlusherPeriod
-
-org.apache.qpid.test.unit.ct.DurableSubscriberTest#*
 
 org.apache.qpid.server.queue.QueueMessageDurabilityTest#*
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org