[hornetq-commits] JBoss hornetq SVN: r8478 - trunk/tests/src/org/hornetq/tests/integration/client.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Dec 1 11:33:36 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-12-01 11:33:35 -0500 (Tue, 01 Dec 2009)
New Revision: 8478

Added:
   trunk/tests/src/org/hornetq/tests/integration/client/BlockingSendTest.java
Log:


Added: trunk/tests/src/org/hornetq/tests/integration/client/BlockingSendTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/BlockingSendTest.java	                        (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/client/BlockingSendTest.java	2009-12-01 16:33:35 UTC (rev 8478)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2009 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.core.client.ClientConsumer;
+import org.hornetq.core.client.ClientMessage;
+import org.hornetq.core.client.ClientProducer;
+import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.client.ClientSessionFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * A BlockingSendTest
+ *
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class BlockingSendTest extends ServiceTestBase
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public void testSinglePersistentBlockingNonSync() throws Exception
+   {
+      HornetQServer server = createServer(true);
+      ClientSession session = null;
+      ClientSessionFactory factory = null;
+
+      try
+      {
+
+         server.getConfiguration().setJournalSyncNonTransactional(false);
+         server.getConfiguration().setJournalBufferTimeout(15000);
+
+         server.start();
+
+         System.out.println("sync = " + server.getConfiguration().isJournalSyncNonTransactional());
+         
+         factory = createFactory(false);
+         factory.setBlockOnPersistentSend(true);
+
+         session = factory.createSession();
+
+         session.createQueue("address", "queue");
+
+         ClientProducer prod = session.createProducer("address");
+
+         ClientMessage message = session.createClientMessage(true);
+
+         prod.send(message);
+
+         ClientConsumer consumer = session.createConsumer("queue");
+
+         session.start();
+
+         ClientMessage msg = consumer.receive(5000);
+
+         assertNotNull(msg);
+
+         msg.acknowledge();
+
+      }
+      finally
+      {
+         if (factory != null)
+         {
+            factory.close();
+         }
+
+         if (session != null)
+         {
+            session.close();
+         }
+
+         if (server != null)
+         {
+            server.stop();
+         }
+      }
+
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}



More information about the hornetq-commits mailing list