[hornetq-commits] JBoss hornetq SVN: r8888 - trunk/tests/src/org/hornetq/tests/integration/client.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Feb 18 18:10:06 EST 2010
Author: clebert.suconic at jboss.com
Date: 2010-02-18 18:10:06 -0500 (Thu, 18 Feb 2010)
New Revision: 8888
Added:
trunk/tests/src/org/hornetq/tests/integration/client/CoreSelectorTest.java
Log:
I've created a simple test on core selectors as I wanted to double check my answer before answering the forums today. Well.. why not commit the test then? you can never have enough tests, right?
Added: trunk/tests/src/org/hornetq/tests/integration/client/CoreSelectorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/CoreSelectorTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/client/CoreSelectorTest.java 2010-02-18 23:10:06 UTC (rev 8888)
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.integration.client;
+
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * A CoreSelectorTest
+ *
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class CoreSelectorTest extends ServiceTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testSelector() throws Exception
+ {
+ HornetQServer server = createServer(false, false);
+
+ server.start();
+
+ ClientSessionFactory factory = createInVMFactory();
+ ClientSession session = factory.createSession();
+
+ try
+ {
+ session.createQueue("queue", "queue");
+ ClientProducer prod = session.createProducer("queue");
+
+
+ ClientMessage msg = session.createMessage(false);
+ msg.putIntProperty("intValue", 1);
+
+ msg.putIntProperty("intValue", 1);
+ msg.putBytesProperty("bValue", new byte[]{'1'});
+
+ prod.send(msg);
+
+ msg = session.createMessage(false);
+ msg.putIntProperty("intValue", 2);
+
+ session.start();
+
+ ClientConsumer cons = session.createConsumer("queue", "bValue=1");
+
+ assertNull(cons.receiveImmediate());
+
+ cons.close();
+
+ cons = session.createConsumer("queue", "intValue=1");
+
+ msg = cons.receive(5000);
+
+ assertNotNull(msg);
+
+ assertEquals(1, (int)msg.getIntProperty("intValue"));
+
+ assertNull(cons.receiveImmediate());
+
+
+
+
+
+
+ }
+ finally
+ {
+ session.close();
+ server.stop();
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
More information about the hornetq-commits
mailing list