[jboss-cvs] JBoss Messaging SVN: r4465 - in trunk: tests/src/org/jboss/messaging/tests/unit/core/client/impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 13 09:12:54 EDT 2008


Author: timfox
Date: 2008-06-13 09:12:54 -0400 (Fri, 13 Jun 2008)
New Revision: 4465

Added:
   trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientConsumerPacketHandlerTest.java
Modified:
   trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReceiveMessage.java
Log:
More tests


Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReceiveMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReceiveMessage.java	2008-06-13 12:57:31 UTC (rev 4464)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReceiveMessage.java	2008-06-13 13:12:54 UTC (rev 4465)
@@ -49,6 +49,13 @@
       this.deliveryID = deliveryID;
    }
    
+   public ReceiveMessage(final ClientMessage message)
+   {
+      super(RECEIVE_MSG);
+
+      this.clientMessage = message;
+   }
+   
    public ReceiveMessage()
    {
       super(RECEIVE_MSG);

Added: trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientConsumerPacketHandlerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientConsumerPacketHandlerTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientConsumerPacketHandlerTest.java	2008-06-13 13:12:54 UTC (rev 4465)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.client.impl;
+
+import org.easymock.EasyMock;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.impl.ClientConsumerInternal;
+import org.jboss.messaging.core.client.impl.ClientConsumerPacketHandler;
+import org.jboss.messaging.core.remoting.PacketReturner;
+import org.jboss.messaging.core.remoting.impl.wireformat.ReceiveMessage;
+import org.jboss.messaging.tests.util.UnitTestCase;
+
+/**
+ * 
+ * A ClientConsumerPacketHandlerTest
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class ClientConsumerPacketHandlerTest extends UnitTestCase
+{
+   public void testHandle() throws Exception
+   {
+      ClientConsumerInternal consumer = EasyMock.createStrictMock(ClientConsumerInternal.class);
+      
+      final int id = 716276;
+      
+      ClientConsumerPacketHandler handler = new ClientConsumerPacketHandler(consumer, id);
+         
+      ClientMessage msg = EasyMock.createStrictMock(ClientMessage.class);
+      
+      ReceiveMessage rm = new ReceiveMessage(msg);
+                 
+      assertEquals(id, handler.getID());
+      
+      consumer.handleMessage(msg);
+      
+      EasyMock.replay(consumer, msg);
+      
+      handler.handle(rm, EasyMock.createStrictMock(PacketReturner.class));
+      
+      EasyMock.verify(consumer, msg);
+   }
+   
+   
+               
+   // Private -----------------------------------------------------------------------------------------------------------
+
+
+}




More information about the jboss-cvs-commits mailing list