[jboss-cvs] JBoss Messaging SVN: r6055 - in trunk/tests/src/org/jboss/messaging/tests/integration: client and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 10 09:39:58 EDT 2009


Author: ataylor
Date: 2009-03-10 09:39:58 -0400 (Tue, 10 Mar 2009)
New Revision: 6055

Added:
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateQueueTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionSendAcknowledgementHandlerTest.java
Removed:
   trunk/tests/src/org/jboss/messaging/tests/integration/session/
Log:
repacked client session tests

Copied: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateQueueTest.java (from rev 6053, trunk/tests/src/org/jboss/messaging/tests/integration/session/CreateQueueTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateQueueTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateQueueTest.java	2009-03-10 13:39:58 UTC (rev 6055)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.tests.integration.client;
+
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.postoffice.Binding;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.server.impl.SoloQueueImpl;
+import org.jboss.messaging.core.settings.impl.AddressSettings;
+import org.jboss.messaging.tests.util.ServiceTestBase;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class ClientSessionCreateQueueTest extends ServiceTestBase
+{
+   private MessagingService messagingService;
+
+   private SimpleString address = new SimpleString("address");
+
+   private SimpleString queueName = new SimpleString("queue");
+
+
+   public void testDurableFalse() throws Exception
+   {
+      ClientSession session = createInVMFactory().createSession(false, true, true);
+      session.createQueue(address, queueName, false);
+      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Queue q = (Queue) binding.getBindable();
+      assertFalse(q.isDurable());
+      
+      session.close();
+   }
+
+   public void testDurableTrue() throws Exception
+   {
+      ClientSession session = createInVMFactory().createSession(false, true, true);
+      session.createQueue(address, queueName, true);
+      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Queue q = (Queue) binding.getBindable();
+      assertTrue(q.isDurable());
+
+      session.close();
+   }
+
+   public void testTemporaryFalse() throws Exception
+   {
+      ClientSession session = createInVMFactory().createSession(false, true, true);
+      session.createQueue(address, queueName, false, false);
+      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Queue q = (Queue) binding.getBindable();
+      assertFalse(q.isTemporary());
+      
+      session.close();
+   }
+
+   public void testTemporaryTrue() throws Exception
+   {
+      ClientSession session = createInVMFactory().createSession(false, true, true);
+      session.createQueue(address, queueName, true, true);
+      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Queue q = (Queue) binding.getBindable();
+      assertTrue(q.isTemporary());
+      
+      session.close();
+   }
+
+   public void testcreateWithFilter() throws Exception
+   {
+      ClientSession session = createInVMFactory().createSession(false, true, true);
+      SimpleString filterString = new SimpleString("x=y");
+      session.createQueue(address, queueName, filterString, false, false);
+      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Queue q = (Queue) binding.getBindable();
+      assertEquals(q.getFilter().getFilterString(), filterString);
+      
+      session.close();
+   }
+
+    public void testAddressSettingUSed() throws Exception
+   {
+      AddressSettings addressSettings = new AddressSettings();
+      addressSettings.setSoloQueue(true);
+      messagingService.getServer().getAddressSettingsRepository().addMatch(address.toString(), addressSettings);
+      ClientSession session = createInVMFactory().createSession(false, true, true);
+      SimpleString filterString = new SimpleString("x=y");
+      session.createQueue(address, queueName, filterString, false, false);
+      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      assertTrue(binding.getBindable() instanceof SoloQueueImpl);
+
+      session.close();
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      messagingService = createService(false);
+      messagingService.start();
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      if(messagingService != null && messagingService.isStarted())
+      {
+         messagingService.stop();
+      }
+      
+      super.tearDown();
+
+   }
+}

Copied: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionSendAcknowledgementHandlerTest.java (from rev 6053, trunk/tests/src/org/jboss/messaging/tests/integration/session/SendAcknowledgementsTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionSendAcknowledgementHandlerTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionSendAcknowledgementHandlerTest.java	2009-03-10 13:39:58 UTC (rev 6055)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.client;
+
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientProducer;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.SendAcknowledgementHandler;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.message.Message;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.tests.util.ServiceTestBase;
+import org.jboss.messaging.utils.SimpleString;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A SendAcknowledgementsTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * Created 9 Feb 2009 13:29:19
+ *
+ *
+ */
+public class ClientSessionSendAcknowledgementHandlerTest extends ServiceTestBase
+{
+   private static final Logger log = Logger.getLogger(ClientSessionSendAcknowledgementHandlerTest.class);
+
+   private MessagingService messagingService;
+
+   private SimpleString address = new SimpleString("address");
+
+   private SimpleString queueName = new SimpleString("queue");
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      messagingService = createService(false);
+      messagingService.start();
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      if (messagingService != null && messagingService.isStarted())
+      {
+         messagingService.stop();
+      }
+      
+      super.tearDown();
+   }
+
+   public void testSendAcknowledgements() throws Exception
+   {
+      ClientSessionFactory csf = createInVMFactory();
+
+      ClientSession session = csf.createSession(null, null, false, true, true, false, 1);
+
+      csf.setSendWindowSize(1024);
+
+      session.createQueue(address, queueName, false);
+
+      ClientProducer prod = session.createProducer(address);
+
+      final int numMessages = 1000;
+
+      final CountDownLatch latch = new CountDownLatch(numMessages);
+
+      session.setSendAcknowledgementHandler(new SendAcknowledgementHandler()
+      {
+         public void sendAcknowledged(final Message message)
+         {
+            latch.countDown();
+         }
+      });
+
+      for (int i = 0; i < numMessages; i++)
+      {
+         ClientMessage msg = session.createClientMessage(false);
+
+         prod.send(msg);
+      }
+
+      session.close();
+
+      boolean ok = latch.await(5000, TimeUnit.MILLISECONDS);
+
+      assertTrue(ok);
+   }  
+}




More information about the jboss-cvs-commits mailing list