You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2017/12/21 17:27:49 UTC

[6/7] qpid-broker-j git commit: QPID-6933: [System Tests] Move DefaultFiltersTest to extension suite

QPID-6933: [System Tests] Move DefaultFiltersTest to extension suite


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/bd640ffe
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/bd640ffe
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/bd640ffe

Branch: refs/heads/master
Commit: bd640ffec47e96fef5fcf0eed92edbb44fcaf9b9
Parents: 5f8aa0c
Author: Keith Wall <kw...@apache.org>
Authored: Thu Dec 21 15:12:38 2017 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Thu Dec 21 15:13:37 2017 +0000

----------------------------------------------------------------------
 .../extensions/filters/DefaultFiltersTest.java  | 125 ++++++++++++++++++
 .../qpid/server/queue/DefaultFiltersTest.java   | 126 -------------------
 test-profiles/CPPExcludes                       |   1 -
 3 files changed, 125 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/bd640ffe/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/filters/DefaultFiltersTest.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/filters/DefaultFiltersTest.java b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/filters/DefaultFiltersTest.java
new file mode 100644
index 0000000..5f7cd3b
--- /dev/null
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/filters/DefaultFiltersTest.java
@@ -0,0 +1,125 @@
+/*
+ *
+ * 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.extensions.filters;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.Collections;
+
+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.junit.Test;
+
+import org.apache.qpid.systests.JmsTestBase;
+
+public class DefaultFiltersTest extends JmsTestBase
+{
+    @Test
+    public void defaultFilterIsApplied() throws Exception
+    {
+        String queueName = getTestName();
+        Connection connection = getConnection();
+        try
+        {
+            connection.start();
+
+            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+            createQueueWithDefaultFilter(queueName, "foo = 1");
+            Queue queue = createQueue(queueName);
+
+            final MessageProducer prod = session.createProducer(queue);
+            Message message = session.createMessage();
+            message.setIntProperty("foo", 0);
+            prod.send(message);
+
+            MessageConsumer cons = session.createConsumer(queue);
+
+            assertNull("Message with foo=0 should not be received", cons.receive(getReceiveTimeout()));
+
+            message = session.createMessage();
+            message.setIntProperty("foo", 1);
+            prod.send(message);
+
+            Message receivedMsg = cons.receive(getReceiveTimeout());
+            assertNotNull("Message with foo=1 should be received", receivedMsg);
+            assertEquals("Property foo not as expected", 1, receivedMsg.getIntProperty("foo"));
+        }
+        finally
+        {
+            connection.close();
+        }
+    }
+
+    @Test
+    public void defaultFilterIsOverridden() throws Exception
+    {
+        String queueName = getTestName();
+        Connection connection = getConnection();
+        try
+        {
+            connection.start();
+
+            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+            createQueueWithDefaultFilter(queueName, "foo = 1");
+            Queue queue = createQueue(queueName);
+
+            final MessageProducer prod = session.createProducer(queue);
+            Message message = session.createMessage();
+            message.setIntProperty("foo", 0);
+            prod.send(message);
+
+            MessageConsumer cons = session.createConsumer(queue, "foo = 0");
+
+            Message receivedMsg = cons.receive(getReceiveTimeout());
+            assertNotNull("Message with foo=0 should be received", receivedMsg);
+            assertEquals("Property foo not as expected", 0, receivedMsg.getIntProperty("foo"));
+
+            message = session.createMessage();
+            message.setIntProperty("foo", 1);
+            prod.send( message);
+
+            assertNull("Message with foo=1 should not be received", cons.receive(getReceiveTimeout()));
+        }
+        finally
+        {
+            connection.close();
+        }
+    }
+
+    private void createQueueWithDefaultFilter(String queueName, String selector) throws Exception
+    {
+        selector = selector.replace("\\", "\\\\");
+        selector = selector.replace("\"", "\\\"");
+
+        createEntityUsingAmqpManagement(queueName, "org.apache.qpid.Queue",
+                                        Collections.singletonMap("defaultFilters", "{ \"x-filter-jms-selector\" : { \"x-filter-jms-selector\" : [ \"" + selector + "\" ] } }"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/bd640ffe/systests/src/test/java/org/apache/qpid/server/queue/DefaultFiltersTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/server/queue/DefaultFiltersTest.java b/systests/src/test/java/org/apache/qpid/server/queue/DefaultFiltersTest.java
deleted file mode 100644
index 1590ee3..0000000
--- a/systests/src/test/java/org/apache/qpid/server/queue/DefaultFiltersTest.java
+++ /dev/null
@@ -1,126 +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.server.queue;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.qpid.QpidException;
-import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-public class DefaultFiltersTest extends QpidBrokerTestCase
-{
-
-    private String _queueName;
-    private Connection _connection;
-    private Session _session;
-    private Queue _queue;
-
-    @Override
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-
-        _queueName = getTestQueueName();
-        _connection = getConnection();
-        _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        _connection.start();
-    }
-
-    private void createQueueWithDefaultFilter(String selector) throws QpidException, JMSException
-    {
-        final Map<String,Object> arguments = new HashMap<>();
-        selector = selector.replace("\\", "\\\\");
-        selector = selector.replace("\"", "\\\"");
-        if(isBroker10())
-        {
-            createEntityUsingAmqpManagement(_queueName, _session, "org.apache.qpid.Queue",
-                                            Collections.<String,Object>singletonMap("defaultFilters", "{ \"x-filter-jms-selector\" : { \"x-filter-jms-selector\" : [ \"" + selector + "\" ] } }" ));
-            _queue = _session.createQueue(_queueName);
-        }
-        else
-        {
-            arguments.put("qpid.default_filters",
-                          "{ \"x-filter-jms-selector\" : { \"x-filter-jms-selector\" : [ \"" + selector + "\" ] } }");
-            ((AMQSession<?, ?>) _session).createQueue(_queueName, false, true, false, arguments);
-            _queue = new org.apache.qpid.client.AMQQueue("amq.direct", _queueName);
-            ((AMQSession<?, ?>) _session).declareAndBind((AMQDestination) _queue);
-        }
-    }
-
-    public void testDefaultFilterIsApplied() throws QpidException, JMSException
-    {
-        createQueueWithDefaultFilter("foo = 1");
-        final MessageProducer prod = _session.createProducer(_queue);
-        TextMessage textMessage = _session.createTextMessage("hello");
-        textMessage.setIntProperty("foo", 0);
-        prod.send(textMessage);
-
-        MessageConsumer cons = _session.createConsumer(_queue);
-
-        assertNull("Message with foo=0 should not be received", cons.receive(500));
-
-        textMessage = _session.createTextMessage("hello");
-        textMessage.setIntProperty("foo", 1);
-        prod.send( textMessage);
-
-        Message receivedMsg = cons.receive(500);
-        assertNotNull("Message with foo=1 should be received", receivedMsg);
-        assertEquals("Property foo not as expected", 1, receivedMsg.getIntProperty("foo"));
-    }
-
-
-    public void testDefaultFilterIsOverridden() throws QpidException, JMSException
-    {
-        createQueueWithDefaultFilter("foo = 1");
-        final MessageProducer prod = _session.createProducer(_queue);
-        TextMessage textMessage = _session.createTextMessage("hello");
-        textMessage.setIntProperty("foo", 0);
-        prod.send(textMessage);
-
-        MessageConsumer cons = _session.createConsumer(_queue, "foo = 0");
-
-        Message receivedMsg = cons.receive(500);
-        assertNotNull("Message with foo=0 should be received", receivedMsg);
-        assertEquals("Property foo not as expected", 0, receivedMsg.getIntProperty("foo"));
-
-
-        textMessage = _session.createTextMessage("hello");
-        textMessage.setIntProperty("foo", 1);
-        prod.send(textMessage);
-
-        assertNull("Message with foo=1 should not be received", cons.receive(500));
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/bd640ffe/test-profiles/CPPExcludes
----------------------------------------------------------------------
diff --git a/test-profiles/CPPExcludes b/test-profiles/CPPExcludes
index 2860246..1a0d4c5 100755
--- a/test-profiles/CPPExcludes
+++ b/test-profiles/CPPExcludes
@@ -182,7 +182,6 @@ org.apache.qpid.test.unit.client.AMQSessionTest#testQueueDepthForQueueThatDoesNo
 org.apache.qpid.client.prefetch.PrefetchBehaviourTest#testPrefetchWindowExpandsOnReceiveTransaction
 
 org.apache.qpid.server.queue.ArrivalTimeFilterTest#*
-org.apache.qpid.server.queue.DefaultFiltersTest#*
 org.apache.qpid.server.queue.EnsureNondestructiveConsumersTest#*
 org.apache.qpid.server.protocol.v0_8.*
 


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