[jboss-cvs] JBoss Messaging SVN: r5098 - in branches/Branch_Chunk_Clebert/tests/src/org/jboss/messaging/tests/unit/core: chunkmessage and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 9 16:23:11 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-10-09 16:23:11 -0400 (Thu, 09 Oct 2008)
New Revision: 5098

Added:
   branches/Branch_Chunk_Clebert/tests/src/org/jboss/messaging/tests/unit/core/chunkmessage/
   branches/Branch_Chunk_Clebert/tests/src/org/jboss/messaging/tests/unit/core/chunkmessage/MessageChunkTest.java
Log:
Adding test

Added: branches/Branch_Chunk_Clebert/tests/src/org/jboss/messaging/tests/unit/core/chunkmessage/MessageChunkTest.java
===================================================================
--- branches/Branch_Chunk_Clebert/tests/src/org/jboss/messaging/tests/unit/core/chunkmessage/MessageChunkTest.java	                        (rev 0)
+++ branches/Branch_Chunk_Clebert/tests/src/org/jboss/messaging/tests/unit/core/chunkmessage/MessageChunkTest.java	2008-10-09 20:23:11 UTC (rev 5098)
@@ -0,0 +1,133 @@
+/*
+ * 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.unit.core.chunkmessage;
+
+import java.nio.ByteBuffer;
+
+import org.jboss.messaging.core.client.ClientConsumer;
+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.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.tests.util.ServiceTestBase;
+import org.jboss.messaging.util.DataConstants;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * A TestMessageChunk
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * 
+ * Created 29-Sep-08 4:04:10 PM
+ *
+ *
+ */
+public class MessageChunkTest extends ServiceTestBase
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private static final SimpleString ADDRESS = new SimpleString("SimpleAddress");
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public void testMessageChunk() throws Exception
+   {
+      ClientSessionFactory sf = createInVMFactory();
+
+      ClientSession session = sf.createSession(false, true, true, false);
+
+      session.createQueue(ADDRESS, ADDRESS, null, true, false);
+
+      ClientProducer producer = session.createProducer(ADDRESS);
+      
+      MessagingBuffer body = new ByteBufferWrapper(ByteBuffer.allocate(DataConstants.SIZE_INT * 150000));
+      
+      for (int i = 0; i < 15000; i++)
+      {
+         body.putInt(i);
+      }
+      body.flip();      
+      
+      ClientMessage message = session.createClientMessage(true); 
+
+      message.setBody(body);
+      producer.send(message);
+      
+      session.close();
+
+      if (this.realFiles)
+      {
+         messagingService.stop();
+         
+         messagingService = createService(realFiles);
+         messagingService.start();
+   
+         sf = createInVMFactory();
+      }
+
+      session = sf.createSession(false, true, true, false);
+
+      ClientConsumer consumer = session.createConsumer(ADDRESS);
+      
+      session.start();
+      
+      ClientMessage message2 = consumer.receive(5000);
+      
+      assertNotNull(message2);
+      
+      System.out.println("msg on client = " + message2.getMessageID());
+      
+      assertEqualsByteArrays(body.limit(), body.array(), message2.getBody().array());
+      
+      session.close();
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   protected void setUp() throws Exception
+   {
+      this.realFiles = false;
+      super.setUp();
+   }
+
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}




More information about the jboss-cvs-commits mailing list