[jboss-cvs] JBoss Messaging SVN: r4764 - in branches/Branch_Message_Chunking_new: examples/messaging/src/org/jboss/messaging/example and 22 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 1 10:58:09 EDT 2008


Author: ataylor
Date: 2008-08-01 10:58:09 -0400 (Fri, 01 Aug 2008)
New Revision: 4764

Added:
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/Encoder.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/util/PropertyValue.java
Modified:
   branches/Branch_Message_Chunking_new/examples/jms/src/org/jboss/jms/example/QueueExample.java
   branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SSLClient.java
   branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
   branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/client/ClientMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/journal/EncodingSupport.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/message/Message.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/MessagingBuffer.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/Packet.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ProducerSendMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReceiveMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossMapMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossTextMessage.java
   branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/util/TypedProperties.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientMessageImplTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/SimpleEncoding.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingHandlerImplTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageConsumerTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossQueueBrowserTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java
   branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
Log:
tidied up

Modified: branches/Branch_Message_Chunking_new/examples/jms/src/org/jboss/jms/example/QueueExample.java
===================================================================
--- branches/Branch_Message_Chunking_new/examples/jms/src/org/jboss/jms/example/QueueExample.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/examples/jms/src/org/jboss/jms/example/QueueExample.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -49,8 +49,8 @@
          Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
          final MessageProducer producer = session.createProducer(queue);
          final BytesMessage message = session.createBytesMessage();
-         byte[] bytes = new byte[1024];
-         for(int i = 0; i < 1024; i++)
+         byte[] bytes = new byte[500];
+         for(int i = 0; i < bytes.length; i++)
          {
             bytes[i] = (byte) i;
          }

Modified: branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SSLClient.java
===================================================================
--- branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SSLClient.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SSLClient.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -64,12 +64,12 @@
          ClientProducer clientProducer = clientSession.createProducer(queue);
          ClientMessage message = clientSession.createClientMessage(JBossTextMessage.TYPE, false, 0,
                System.currentTimeMillis(), (byte) 1);
-         message.getBody().putString("Hello!");
+         message.putString("Hello!");
          clientProducer.send(message);
          ClientConsumer clientConsumer = clientSession.createConsumer(queue);
          clientConnection.start();
          Message msg = clientConsumer.receive(5000);
-         System.out.println("msg.getPayload() = " + msg.getBody().getString());
+         System.out.println("msg.getPayload() = " + msg.getString());
       }
       catch(Exception e)
       {

Modified: branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
===================================================================
--- branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -52,12 +52,12 @@
          ClientProducer clientProducer = clientSession.createProducer(queue);
          ClientMessage message = clientSession.createClientMessage(JBossTextMessage.TYPE, false, 0,
                                                        System.currentTimeMillis(), (byte) 1);
-         message.getBody().putString("Hello!");
+         message.putString("Hello!");
          clientProducer.send(message);
          ClientConsumer clientConsumer = clientSession.createConsumer(queue);
          clientConnection.start();
          Message msg = clientConsumer.receive(5000);
-         System.out.println("msg.getPayload() = " + msg.getBody().getString());
+         System.out.println("msg.getPayload() = " + msg.getString());
       }
       catch(Exception e)
       {

Modified: branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
===================================================================
--- branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -68,12 +68,12 @@
          ClientProducer clientProducer = clientSession.createProducer(atestq);
          ClientMessage message = clientSession.createClientMessage(JBossTextMessage.TYPE, false, 0,
                  System.currentTimeMillis(), (byte) 1);
-         message.getBody().putString("Hello!");
+         message.putString("Hello!");
          clientProducer.send(message);
          ClientConsumer clientConsumer = clientSession.createConsumer(atestq);
          clientConnection.start();
          Message msg = clientConsumer.receive(5000);
-         System.out.println("msg.getPayload() = " + msg.getBody().getString());
+         System.out.println("msg.getPayload() = " + msg.getString());
       }
       catch (Exception e)
       {

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/client/ClientMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/client/ClientMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/client/ClientMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -40,5 +40,4 @@
    long getDeliveryID();
    
    void setDeliveryID(long deliveryID);
-   
 }

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/journal/EncodingSupport.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/journal/EncodingSupport.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/journal/EncodingSupport.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,7 +22,7 @@
 
 package org.jboss.messaging.core.journal;
 
-import org.jboss.messaging.core.remoting.MessagingBuffer;
+import org.jboss.messaging.core.remoting.Encoder;
 
 /**
  * 
@@ -37,7 +37,7 @@
 {
    int getEncodeSize();
    
-   void encode(MessagingBuffer buffer);
+   void encode(Encoder buffer);
    
-   void decode(MessagingBuffer buffer);
+   void decode(Encoder buffer);
 }

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/message/Message.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/message/Message.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/message/Message.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -23,8 +23,7 @@
 package org.jboss.messaging.core.message;
 
 import org.jboss.messaging.core.journal.EncodingSupport;
-import org.jboss.messaging.core.remoting.MessagingBuffer;
-import org.jboss.messaging.core.remoting.Packet;
+import org.jboss.messaging.core.remoting.Encoder;
 import org.jboss.messaging.util.SimpleString;
 import org.jboss.messaging.util.TypedProperties;
 
@@ -42,7 +41,7 @@
  *
  * $Id: Message.java 3341 2007-11-19 14:34:57Z timfox $
  */
-public interface Message extends EncodingSupport
+public interface Message extends EncodingSupport, Encoder
 {   
    SimpleString getDestination();
    
@@ -69,15 +68,7 @@
    void setPriority(byte priority);
    
    int getEncodeSize();
-
-   void encode(Packet packet);
-
-   void decode(Packet packet);
-
-   void encode(MessagingBuffer buffer);
    
-   void decode(MessagingBuffer buffer);
-   
    // Properties
    // ------------------------------------------------------------------
    
@@ -111,12 +102,81 @@
    Set<SimpleString> getPropertyNames();
 
    TypedProperties getProperties();
-   
-   // Body
-   // ---------------------------------------------------------------------------------
-   
-   MessagingBuffer getBody();
-   
-   void setBody(MessagingBuffer body);
-   
+
+   void putFloat(float val);
+
+   void putInt(int i);
+
+   void putByte(byte b);
+
+   void putLong(long l);
+
+   void putBoolean(boolean b);
+
+   void putNullableString(String nullableString);
+
+   void putSimpleString(SimpleString string);
+
+   void putNullableSimpleString(SimpleString string);
+
+   void putBytes(byte[] bytes, int i, int i1);
+
+   void putBytes(byte[] bytes);
+
+   void putShort(short val);
+
+   void putDouble(double val);
+
+   void putChar(char val);
+
+   void putUTF(String str);
+
+   void putString(String string);
+
+   String getString();
+
+   void getBytes(byte[] value, int i, int read);
+
+   String getUTF() throws Exception;
+
+   int getInt();
+
+   long getLong();
+
+   short getShort();
+
+   boolean getBoolean();
+
+   String getNullableString();
+
+   SimpleString getSimpleString();
+
+   SimpleString getNullableSimpleString();
+
+   byte getByte();
+
+   void getBytes(byte[] data);
+
+   float getFloat();
+
+   double getDouble();
+
+   char getChar();
+
+   short getUnsignedByte();
+
+   int getUnsignedShort();
+
+   void clearBody();
+
+   int getBodySize();
+
+   void reset();    
+
+   int  remaining();
+
+   void flip();         
+
+   void rewind();
+
 }

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -24,12 +24,19 @@
 
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.Message;
+import org.jboss.messaging.core.remoting.Encoder;
 import org.jboss.messaging.core.remoting.MessagingBuffer;
-import org.jboss.messaging.core.remoting.Packet;
+import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
+import org.jboss.messaging.util.DataConstants;
 import static org.jboss.messaging.util.DataConstants.*;
 import org.jboss.messaging.util.SimpleString;
 import org.jboss.messaging.util.TypedProperties;
 
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -53,6 +60,8 @@
 
    private static final Logger log = Logger.getLogger(MessageImpl.class);
 
+   private static final Charset utf8 = Charset.forName("UTF-8");
+
    public static final SimpleString HDR_ACTUAL_EXPIRY_TIME = new SimpleString("JBMActualExpiryTime");
 
    // Attributes ----------------------------------------------------
@@ -72,7 +81,11 @@
 
    private byte priority;
 
-   private MessagingBuffer body;
+   private List<MessagingBuffer> buffers = new ArrayList<MessagingBuffer>();
+   private List<Integer> buffersSizes = new ArrayList<Integer>();
+   private int bufferPos = 0;
+   private int pos = 0;
+   private int bodySize = 0;
 
    // Constructors --------------------------------------------------
 
@@ -99,7 +112,13 @@
       this.expiration = expiration;
       this.timestamp = timestamp;
       this.priority = priority;
-      this.body = body;
+      buffers.add(body);
+      pos = body.position();
+      bodySize = body.limit();
+      //fill in the headers
+      body.putInt(-1);
+      body.putInt(-1);
+      body.putBoolean(false);
    }
 
    /*
@@ -114,11 +133,12 @@
       this.timestamp = other.timestamp;
       this.priority = other.priority;
       this.properties = new TypedProperties(other.properties);
-      this.body = other.body;
+      this.buffers = other.buffers;
+      this.buffersSizes = other.buffersSizes;
    }
 
    // Message implementation ----------------------------------------
-    public void encode(Packet buff)
+    public void encode(Encoder buff)
    {
       buff.putSimpleString(destination);
       buff.putByte(type);
@@ -127,22 +147,13 @@
       buff.putLong(timestamp);
       buff.putByte(priority);
       properties.encode(buff);
-      buff.putBody(body);
+      buff.putInt(getBodySize() - (buffers.size() * 9));
+      for (MessagingBuffer buffer : buffers)
+      {
+         buff.putBuffer(buffer);
+      }
    }
 
-   public void encode(MessagingBuffer buff)
-   {
-      buff.putSimpleString(destination);
-      buff.putByte(type);
-      buff.putBoolean(durable);
-      buff.putLong(expiration);
-      buff.putLong(timestamp);
-      buff.putByte(priority);
-      properties.encode(buff);
-      buff.putInt(body.limit());
-      buff.putBytes(body.array(), 0, body.limit());
-   }
-
    public int getEncodeSize()
    {
       return /* Destination */ SimpleString.sizeofString(destination) +
@@ -152,10 +163,10 @@
       /* Timestamp */ SIZE_LONG +
       /* Priority */ SIZE_BYTE +
       /* PropertySize and Properties */ properties.getEncodeSize() +
-      /* BodySize and Body */ SIZE_INT + body.limit();
+      /* BodySize and Body */ SIZE_INT + getBodySize();
    }
 
-   public void decode(final Packet buffer)
+   public void decode(final Encoder buffer)
    {
       destination = buffer.getSimpleString();
       type = buffer.getByte();
@@ -165,27 +176,12 @@
       priority = buffer.getByte();
 
       properties.decode(buffer);
-      body = buffer.getBodyType();
+      int len = buffer.getInt();
+      buffers.add(new ByteBufferWrapper(ByteBuffer.allocate(PacketImpl.INITIAL_BUFFER_SIZE)));
+      buffer.transferRemainingBuffer(this, len);
+      flip();
    }
 
-   public void decode(final MessagingBuffer buffer)
-   {
-      destination = buffer.getSimpleString();
-      type = buffer.getByte();
-      durable = buffer.getBoolean();
-      expiration = buffer.getLong();
-      timestamp = buffer.getLong();
-      priority = buffer.getByte();
-
-      properties.decode(buffer);
-      int len = buffer.getInt();
-
-      //TODO - this can be optimised
-      byte[] bytes = new byte[len];
-      buffer.getBytes(bytes);
-      body = buffer.createNewBuffer(len);
-      body.putBytes(bytes);      
-   }
    
    public SimpleString getDestination()
    {
@@ -327,24 +323,457 @@
 
    // Body
    // -------------------------------------------------------------------------------------
-   
-   public MessagingBuffer getBody()
+
+   public void putFloat(float val)
    {
-      return body;
+      checkWriteSpace(SIZE_FLOAT);
+      getCurrentBuffer().putFloat(val);
+      pos += SIZE_FLOAT;
    }
-   
-   public void setBody(final MessagingBuffer body)
+
+   public void putInt(int i)
    {
-      this.body = body;
+      checkWriteSpace(SIZE_INT);
+      getCurrentBuffer().putInt(i);
+      pos += SIZE_INT;
    }
-      
-   // Public --------------------------------------------------------
-   
+
+   public void putByte(byte b)
+   {
+      checkWriteSpace(SIZE_BYTE);
+      getCurrentBuffer().putByte(b);
+      pos += SIZE_BYTE;
+   }
+
+   public void putLong(long l)
+   {
+      checkWriteSpace(SIZE_LONG);
+      getCurrentBuffer().putLong(l);
+      pos += SIZE_LONG;
+   }
+
+   public void putBoolean(boolean b)
+   {
+      checkWriteSpace(SIZE_BOOLEAN);
+      getCurrentBuffer().putBoolean(b);
+      pos += SIZE_BOOLEAN;
+   }
+
+   public void putNullableString(String nullableString)
+   {
+      if (nullableString == null)
+		{
+			putByte(DataConstants.NULL);
+		}
+		else
+		{
+			putByte(DataConstants.NOT_NULL);
+
+			putString(nullableString);
+		}
+   }
+
+   public void putSimpleString(SimpleString string)
+   {
+      byte[] data = string.getData();
+
+   	putInt(data.length);
+   	putBytes(data);
+   }
+
+   public void putNullableSimpleString(SimpleString string)
+   {
+      if (string == null)
+   	{
+   		putByte(DataConstants.NULL);
+   	}
+   	else
+   	{
+   	   putByte(DataConstants.NOT_NULL);
+   		putSimpleString(string);
+   	}
+   }
+
+   public void putBytes(byte[] bytes, int i, int i1)
+   {
+      if(getCurrentBuffer().remaining() <= (i1 - i))
+      {
+         getCurrentBuffer().putBytes(bytes, i, i1);
+         pos += (i1 - i);
+      }
+      else
+      {
+         int written = 0;
+         while(written < i1)
+         {
+            int left = getCurrentBuffer().remaining();
+            int towrite = left + written > i1?i1 - written:left;
+            getCurrentBuffer().putBytes(bytes, i, towrite);
+            written+=towrite;
+            i += left;
+            pos += written;
+            if(written < i1)
+            {
+               setNextFragment();
+            }
+
+         }
+      }
+   }
+
+   public void putBytes(byte[] bytes)
+   {
+      putBytes(bytes, 0, bytes.length);
+   }
+
+   public void putShort(short val)
+   {
+      checkWriteSpace(SIZE_SHORT);
+      getCurrentBuffer().putShort(val);
+      pos += SIZE_SHORT;
+   }
+
+   public void putDouble(double val)
+   {
+      checkWriteSpace(SIZE_DOUBLE);
+      getCurrentBuffer().putDouble(val);
+      pos += SIZE_DOUBLE;
+   }
+
+   public void putChar(char val)
+   {
+      checkWriteSpace(SIZE_CHAR);
+      getCurrentBuffer().putChar(val);
+      pos += SIZE_CHAR;
+   }
+
+   public void putUTF(String str)
+   {
+      //TODO This is quite inefficient - can be improved using a method similar to what MINA IOBuffer does
+		//(putPrefixedString)
+		ByteBuffer bb = utf8.encode(str);
+   	putInt(bb.limit() - bb.position());
+   	putBytes(bb.array());
+   }
+
+   public void putString(String string)
+   {
+      putInt(string.length());
+
+		for (int i = 0; i < string.length(); i++)
+		{
+			putChar(string.charAt(i));
+		}
+   }
+
+   public String getString()
+   {
+      int len = getInt();
+
+   	char[] chars = new char[len];
+
+      for (int i = 0; i < len; i++)
+      {
+      	chars[i] = getChar();
+      }
+
+      return new String(chars);
+   }
+
+   public void getBytes(byte[] data, int i, int offset)
+   {
+      int size = offset - i;
+      int read = 0;
+      while (read < size)
+      {
+         int left = getCurrentBuffer().remaining() <= (size - read)? getCurrentBuffer().remaining():size - read;
+
+         getCurrentBuffer().getBytes(data, read, left);
+         read += left;
+         pos += read;
+         if(read < size)
+         {
+            bufferPos++;
+         }
+
+      }
+   }
+
+   public String getUTF() throws Exception
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public int getInt()
+   {
+      checkReadSpace(SIZE_INT);
+      pos += SIZE_INT;
+      return getCurrentBuffer().getInt();
+   }
+
+   public long getLong()
+   {
+      checkReadSpace(SIZE_LONG);
+      pos += SIZE_LONG;
+      return getCurrentBuffer().getLong();
+   }
+
+   public short getShort()
+   {
+      checkReadSpace(SIZE_SHORT);
+      pos += SIZE_SHORT;
+      return getCurrentBuffer().getShort();
+   }
+
+   public boolean getBoolean()
+   {
+      checkReadSpace(SIZE_BOOLEAN);
+      pos += SIZE_BOOLEAN;
+      return getCurrentBuffer().getBoolean();
+   }
+
+   public String getNullableString()
+   {
+      byte check = getByte();
+
+		if (check == DataConstants.NULL)
+		{
+			return null;
+		}
+		else
+		{
+			return getString();
+		}
+   }
+
+   public SimpleString getSimpleString()
+   {
+      int len = getInt();
+
+   	byte[] data = new byte[len];
+   	getBytes(data);
+
+   	return new SimpleString(data);
+   }
+
+    public SimpleString getNullableSimpleString()
+   {
+      int b = getByte();
+   	if (b == DataConstants.NULL)
+   	{
+   	   return null;
+   	}
+   	else
+   	{
+         return getSimpleString();
+   	}
+   }
+
+   public byte getByte()
+   {
+      checkReadSpace(SIZE_BYTE);
+      return getCurrentBuffer().getByte();
+   }
+
+   public void getBytes(byte[] data)
+   {
+      int left = getCurrentBuffer().remaining();
+      if(data.length <= left)
+      {
+         getCurrentBuffer().getBytes(data);
+         pos += data.length;
+      }
+      else
+      {
+         int size = data.length;
+         int read = 0;
+         while (read < size)
+         {
+            left = getCurrentBuffer().remaining() <= (size - read)? getCurrentBuffer().remaining():size - read;
+
+            getCurrentBuffer().getBytes(data, read, left);
+            read += left;
+            pos += read;
+            if(read < size)
+            {
+               bufferPos++;
+            }
+
+         }
+
+      }
+   }
+
+
+   public float getFloat()
+   {
+      checkReadSpace(SIZE_FLOAT);
+      pos += SIZE_FLOAT;
+      return getCurrentBuffer().getFloat();
+   }
+
+   public double getDouble()
+   {
+      checkReadSpace(SIZE_DOUBLE);
+      pos += SIZE_DOUBLE;
+      return getCurrentBuffer().getDouble();
+   }
+
+   public char getChar()
+   {
+      checkReadSpace(SIZE_CHAR);
+      pos += SIZE_CHAR;
+      return getCurrentBuffer().getChar();
+   }
+
+   public short getUnsignedByte()
+   {
+      checkReadSpace(SIZE_SHORT);
+      pos += SIZE_SHORT;
+      return getCurrentBuffer().getUnsignedByte();
+   }
+
+   public int getUnsignedShort()
+   {
+     checkReadSpace(SIZE_INT);
+      pos += SIZE_INT;
+      return getCurrentBuffer().getUnsignedByte();
+   }
+
+   public void clearBody()
+   {
+      bufferPos = 0;
+      pos = 0;
+      MessagingBuffer buff = buffers.get(0).createNewBuffer(PacketImpl.INITIAL_BUFFER_SIZE);
+      bodySize = PacketImpl.INITIAL_BUFFER_SIZE;
+      buffersSizes.clear();
+      buffers.clear();
+      buffers.add(buff);
+   }
+
+
+   public int getBodySize()
+   {
+      int size = 0;
+      for (MessagingBuffer buffer : buffers)
+      {
+         size += buffer.limit();
+      }
+      return size;
+   }
+
+   public void reset()
+   {
+      bufferPos = 0;
+      pos = 0;
+      for (MessagingBuffer buffer : buffers)
+      {
+         buffer.rewind();
+      }
+   }
+
+   public void flip()
+   {
+      for (MessagingBuffer buffer : buffers)
+      {
+         buffer.flip();
+         bodySize += buffer.limit();
+      }
+      pos = 0;
+   }
+
+   public void rewind()
+   {
+      bufferPos = 0;
+      pos = 0;
+      for (MessagingBuffer buffer : buffers)
+      {
+         buffer.rewind();
+      }
+   }
+
+   public int remaining()
+   {
+      return bodySize - pos;
+   }
+
+   public void putBuffer(MessagingBuffer body)
+   {
+      if(getCurrentBuffer().remaining() > body.limit())
+      {
+         //copy contents
+         putBytes(body.array(), 0, body.limit());
+      }
+      else
+      {
+         buffers.add(body);
+      }
+   }
+
+   public void transferRemainingBuffer(Encoder buffer, int len)
+   {
+      if(getCurrentBuffer().remaining() > 0)
+      {
+         //copy contents
+         byte[] bytes = new byte[len];
+         getBytes(bytes);
+         buffer.putBytes(bytes);
+      }
+      else
+      {
+         for(int i = bufferPos + 1; i < buffers.size(); i++)
+         {
+            buffer.putBuffer(buffers.get(i));
+         }
+      }
+   }
    // Package protected ---------------------------------------------
 
-   // Protected -----------------------------------------------------
+    // Private -------------------------------------------------------
 
-   // Private -------------------------------------------------------
+   private void checkReadSpace(int size)
+   {
+      if(getCurrentBuffer().position() + size > getCurrentBuffersSize() + SIZE_INT )
+      {
+         bufferPos++;
+      }
+   }
 
+   private void checkWriteSpace(int size)
+   {
+      if(getCurrentBuffer().remaining() < size)
+      {
+         setNextFragment();
+      }
+   }
+
+   private void setNextFragment()
+   {
+      MessagingBuffer buffer = buffers.get(0).createNewBuffer(PacketImpl.INITIAL_BUFFER_SIZE);
+      buffer.putInt(-1);
+      buffer.putInt(-1);
+      buffer.putBoolean(false);
+      buffers.add(buffer);
+      bufferPos++;
+   }
+
+
+   private MessagingBuffer getCurrentBuffer()
+   {
+      try
+      {
+         return buffers.get(bufferPos);
+      }
+      catch (Exception e)
+      {
+         return null;
+      }
+   }
+
+   private int getCurrentBuffersSize()
+   {
+      return buffersSizes.get(bufferPos);
+   }
+
    // Inner classes -------------------------------------------------  
 }

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,27 +22,10 @@
 
 package org.jboss.messaging.core.persistence.impl.journal;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
-
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.filter.Filter;
 import org.jboss.messaging.core.filter.impl.FilterImpl;
-import org.jboss.messaging.core.journal.EncodingSupport;
-import org.jboss.messaging.core.journal.Journal;
-import org.jboss.messaging.core.journal.PreparedTransactionInfo;
-import org.jboss.messaging.core.journal.RecordInfo;
-import org.jboss.messaging.core.journal.SequentialFileFactory;
+import org.jboss.messaging.core.journal.*;
 import org.jboss.messaging.core.journal.impl.AIOSequentialFileFactory;
 import org.jboss.messaging.core.journal.impl.JournalImpl;
 import org.jboss.messaging.core.journal.impl.NIOSequentialFileFactory;
@@ -51,16 +34,22 @@
 import org.jboss.messaging.core.postoffice.Binding;
 import org.jboss.messaging.core.postoffice.PostOffice;
 import org.jboss.messaging.core.postoffice.impl.BindingImpl;
+import org.jboss.messaging.core.remoting.Encoder;
 import org.jboss.messaging.core.remoting.MessagingBuffer;
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
-import org.jboss.messaging.core.server.JournalType;
-import org.jboss.messaging.core.server.MessageReference;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.server.QueueFactory;
-import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.*;
 import org.jboss.messaging.core.server.impl.ServerMessageImpl;
 import org.jboss.messaging.util.SimpleString;
 
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicLong;
+
 /**
  * 
  * A JournalStorageManager
@@ -605,12 +594,12 @@
       return new EncodingSupport()
       {
 
-         public void decode(MessagingBuffer buffer)
+         public void decode(Encoder buffer)
          {
             throw new UnsupportedOperationException();
          }
 
-         public void encode(MessagingBuffer buffer)
+         public void encode(Encoder buffer)
          {
             buffer.putLong(queueID);
             buffer.putLong(messageID);

Added: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/Encoder.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/Encoder.java	                        (rev 0)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/Encoder.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -0,0 +1,75 @@
+/*
+ * 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.core.remoting;
+
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public interface Encoder
+{
+
+   void putByte(byte aNull);
+
+   void putInt(int i);
+
+   void putBytes(byte[] data);
+
+   void putBoolean(boolean val);
+
+   void putShort(short val);
+
+   void putLong(long val);
+
+   void putFloat(float val);
+
+   void putDouble(double val);
+
+   void putChar(char val);
+
+   void putSimpleString(SimpleString val);
+
+   byte getByte();
+
+   int getInt();
+
+   void getBytes(byte[] data);
+
+   char getChar();
+
+   SimpleString getSimpleString();
+
+   double getDouble();
+
+   float getFloat();
+
+   long getLong();
+
+   short getShort();
+
+   boolean getBoolean();
+
+   void putBuffer(MessagingBuffer buffer);
+
+   void transferRemainingBuffer(Encoder buffer, int len);
+}

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/MessagingBuffer.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/MessagingBuffer.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/MessagingBuffer.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -31,7 +31,7 @@
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  *
  */
-public interface MessagingBuffer
+public interface MessagingBuffer extends Encoder
 {
 	void putByte(byte val);
 	

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/Packet.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/Packet.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/Packet.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -35,7 +35,7 @@
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  *
  */
-public interface Packet
+public interface Packet extends Encoder
 {
    // Public --------------------------------------------------------
    
@@ -127,11 +127,13 @@
 
    int getUnsignedShort();
 
-   void putBody(MessagingBuffer body);
+   void putBuffer(MessagingBuffer body);
 
+  void transferRemainingBuffer(Encoder buffer, int len);
+
    List<MessagingBuffer> getBuffers();
 
    void addBuffer(MessagingBuffer buffer, int packetLength);
 
-   MessagingBuffer getBodyType();
+   List<MessagingBuffer> getBodyType();
 }

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,18 +22,15 @@
 
 package org.jboss.messaging.core.remoting.impl;
 
-import static org.jboss.messaging.util.DataConstants.FALSE;
-import static org.jboss.messaging.util.DataConstants.NOT_NULL;
-import static org.jboss.messaging.util.DataConstants.NULL;
-import static org.jboss.messaging.util.DataConstants.TRUE;
+import org.jboss.messaging.core.remoting.Encoder;
+import org.jboss.messaging.core.remoting.MessagingBuffer;
+import static org.jboss.messaging.util.DataConstants.*;
+import org.jboss.messaging.util.SimpleString;
 
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 
-import org.jboss.messaging.core.remoting.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-
 /**
  * 
  * A ByteBufferWrapper
@@ -379,4 +376,15 @@
 	   return buffer;
 	}
 
+   public void putBuffer(MessagingBuffer buffer)
+   {
+      buffer.putBytes(buffer.array(), buffer.position(), buffer.limit());
+   }
+
+   public void transferRemainingBuffer(Encoder buffer, int len)
+   {
+      byte[] bytes = new byte[len];
+      this.buffer.get(bytes);
+      buffer.putBytes(bytes);
+   }
 }

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,13 +22,13 @@
  */
 package org.jboss.messaging.core.remoting.impl;
 
+import org.jboss.messaging.core.remoting.Encoder;
+import org.jboss.messaging.core.remoting.MessagingBuffer;
 import static org.jboss.messaging.util.DataConstants.*;
+import org.jboss.messaging.util.SimpleString;
 
 import java.nio.ByteBuffer;
 
-import org.jboss.messaging.core.remoting.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-
 /**
  * A {@link MessagingBuffer} which increases its capacity and length by itself
  * when there's not enough space for a {@code put} operation.
@@ -359,6 +359,18 @@
       return buf;
    }
 
+   public void putBuffer(MessagingBuffer buffer)
+   {
+      putBytes(buffer.array(), buffer.position(), buffer.limit());
+   }
+
+   public void transferRemainingBuffer(Encoder buffer, int len)
+   {
+      byte[] bytes = new byte[len];
+      this.buf.get(bytes);
+      buffer.putBytes(bytes);
+   }
+
    private ByteBuffer ensureRemaining(int minRemaining)
    {
       int remaining = remaining();

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -23,6 +23,7 @@
 package org.jboss.messaging.core.remoting.impl.mina;
 
 import org.apache.mina.core.buffer.IoBuffer;
+import org.jboss.messaging.core.remoting.Encoder;
 import org.jboss.messaging.core.remoting.MessagingBuffer;
 import static org.jboss.messaging.util.DataConstants.*;
 import org.jboss.messaging.util.SimpleString;
@@ -366,7 +367,18 @@
    {
       return buffer;
    }
-         
+
+   public void putBuffer(MessagingBuffer buffer)
+   {
+      buffer.putBytes(buffer.array(), buffer.position(), buffer.limit());
+   }
+
+   public void transferRemainingBuffer(Encoder buffer, int len)
+   {
+      byte[] bytes = new byte[len];
+      this.buffer.get(bytes);
+      buffer.putBytes(bytes);
+   }
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -24,6 +24,7 @@
 
 
 import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.Encoder;
 import org.jboss.messaging.core.remoting.MessagingBuffer;
 import org.jboss.messaging.core.remoting.Packet;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
@@ -258,9 +259,7 @@
              r.executorID == this.executorID &&
              r.targetID == this.targetID;
    }
-   
 
-
    public void putXidType(Xid xid)
    {
       putInt(xid.getFormatId());
@@ -337,7 +336,7 @@
 
    public void putBytes(byte[] bytes, int i, int i1)
    {
-      if(getCurrentBuffer().remaining() <= (i1 - i))
+      if(getCurrentBuffer().remaining() >= (i1 - i))
       {
          getCurrentBuffer().putBytes(bytes, i, i1);
       }
@@ -581,13 +580,12 @@
       return getCurrentBuffer().getUnsignedByte();
    }
 
-   public void putBody(MessagingBuffer body)
+   public void putBuffer(MessagingBuffer body)
    {
-      putInt(body.limit());
       if(getCurrentBuffer().remaining() > body.limit())
       {
          //copy contents
-         putBytes(body.array(), 0, body.limit());
+         putBytes(body.array(), 9, body.limit());
       }
       else
       {
@@ -595,6 +593,24 @@
       }
    }
 
+   public void transferRemainingBuffer(Encoder buffer, int len)
+   {
+      if(getCurrentBuffer().remaining() > 0)
+      {
+         //copy contents
+         byte[] bytes = new byte[len];
+         getBytes(bytes);
+         buffer.putBytes(bytes);
+      }
+      else
+      {
+         for(int i = currentPos + 1; i < buffers.size(); i++)
+         {
+            buffer.putBuffer(buffers.get(i));
+         }
+      }
+   }
+
    public List<MessagingBuffer> getBuffers()
    {
       for (int i = 0; i < buffers.size(); i++)
@@ -619,7 +635,7 @@
       buffersSizes.add(packetLength);
    }
 
-   public MessagingBuffer getBodyType()
+   public List<MessagingBuffer> getBodyType()
    {
       int bodyLength = getInt();
       //if we are part way thru a buffer it must we need to copy into new buffer
@@ -629,13 +645,21 @@
          byte[] bytes = new byte[bodyLength];
          getCurrentBuffer().getBytes(bytes);
          body.putBytes(bytes);
-         return body;
+         List<MessagingBuffer> theBody = new ArrayList<MessagingBuffer>();
+         theBody.add(body);
+         return theBody;
       }
       //else we just return the remaining buffers
       else
       {
+         List<MessagingBuffer> theBody = new ArrayList<MessagingBuffer>();
+         for(int i = currentPos; i < buffers.size(); i++)
+         {
+            theBody.add(buffers.get(i));
+            currentPos++;
+         }
          currentPos++;
-         return getCurrentBuffer();
+         return theBody;
       }
    }
 

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ProducerSendMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ProducerSendMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ProducerSendMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -93,7 +93,6 @@
       
       serverMessage.decode(this);
       
-      serverMessage.getBody().flip();
    }
 
 

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReceiveMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReceiveMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReceiveMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -119,8 +119,6 @@
       clientMessage = new ClientMessageImpl(deliveryCount, deliveryID);
       
       clientMessage.decode(this);
-      
-      clientMessage.getBody().flip();
    }
 
    // Package protected ---------------------------------------------

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -25,7 +25,6 @@
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
 
 import javax.jms.BytesMessage;
 import javax.jms.JMSException;
@@ -103,7 +102,7 @@
       checkRead();
       try
       {
-         return body.getBoolean();
+         return message.getBoolean();
       }
       catch (BufferUnderflowException e)
       {
@@ -116,7 +115,7 @@
       checkRead();
       try
       {
-         return body.getByte();
+         return message.getByte();
       }
       catch (BufferUnderflowException e)
       {
@@ -129,7 +128,7 @@
       checkRead();
       try
       {
-         return body.getUnsignedByte();
+         return message.getUnsignedByte();
       }
       catch (BufferUnderflowException e)
       {
@@ -142,7 +141,7 @@
       checkRead();
       try
       {
-         return body.getShort();
+         return message.getShort();
       }
       catch (BufferUnderflowException e)
       {
@@ -155,7 +154,7 @@
       checkRead();
       try
       {
-         return body.getUnsignedShort();
+         return message.getUnsignedShort();
       }
       catch (BufferUnderflowException e)
       {
@@ -168,7 +167,7 @@
       checkRead();
       try
       {
-         return body.getChar();
+         return message.getChar();
       }
       catch (BufferUnderflowException e)
       {
@@ -181,7 +180,7 @@
       checkRead();
       try
       {
-         return body.getInt();
+         return message.getInt();
       }
       catch (BufferUnderflowException e)
       {
@@ -194,7 +193,7 @@
       checkRead();
       try
       {
-         return body.getLong();
+         return message.getLong();
       }
       catch (BufferUnderflowException e)
       {
@@ -207,7 +206,7 @@
       checkRead();
       try
       {
-         return body.getFloat();
+         return message.getFloat();
       }
       catch (BufferUnderflowException e)
       {
@@ -220,7 +219,7 @@
       checkRead();
       try
       {
-         return body.getDouble();
+         return message.getDouble();
       }
       catch (BufferUnderflowException e)
       {
@@ -233,7 +232,7 @@
       checkRead();
       try
       {
-         return body.getUTF();
+         return message.getUTF();
       }
       catch (BufferUnderflowException e)
       {
@@ -257,13 +256,13 @@
    {
       checkRead();
 
-      if (body.remaining() == 0) { return -1; }
+      if (message.remaining() == 0) { return -1; }
 
-      int read = Math.min(length, body.remaining());
+      int read = Math.min(length, message.remaining());
 
       if (read != 0)
       {
-         body.getBytes(value, 0, read);
+         message.getBytes(value, 0, read);
       }
 
       return read;
@@ -272,49 +271,49 @@
    public void writeBoolean(final boolean value) throws JMSException
    {
       checkWrite();
-      body.putBoolean(value);
+      message.putBoolean(value);
    }
 
    public void writeByte(final byte value) throws JMSException
    {
       checkWrite();
-      body.putByte(value);
+      message.putByte(value);
    }
 
    public void writeShort(final short value) throws JMSException
    {
       checkWrite();
-      body.putShort(value);
+      message.putShort(value);
    }
 
    public void writeChar(final char value) throws JMSException
    {
       checkWrite();
-      body.putChar(value);
+      message.putChar(value);
    }
 
    public void writeInt(final int value) throws JMSException
    {
       checkWrite();
-      body.putInt(value);
+      message.putInt(value);
    }
 
    public void writeLong(final long value) throws JMSException
    {
       checkWrite();
-      body.putLong(value);
+      message.putLong(value);
    }
 
    public void writeFloat(final float value) throws JMSException
    {
       checkWrite();
-      body.putFloat(value);
+      message.putFloat(value);
    }
 
    public void writeDouble(final double value) throws JMSException
    {
       checkWrite();
-      body.putDouble(value);
+      message.putDouble(value);
    }
 
    public void writeUTF(final String value) throws JMSException
@@ -322,7 +321,7 @@
       checkWrite();
       try
       {
-         body.putUTF(value);
+         message.putUTF(value);
       }
       catch (Exception e)
       {
@@ -335,14 +334,14 @@
    public void writeBytes(final byte[] value) throws JMSException
    {
       checkWrite();
-      body.putBytes(value);
+      message.putBytes(value);
    }
 
    public void writeBytes(final byte[] value, final int offset, final int length)
          throws JMSException
    {
       checkWrite();
-      body.putBytes(value, offset, length);
+      message.putBytes(value, offset, length);
    }
 
    public void writeObject(final Object value) throws JMSException
@@ -401,11 +400,11 @@
       {
          readOnly = true;
 
-         body.flip();
+         message.flip();
       }
       else
       {
-         body.rewind();
+         message.rewind();
       }
    }
 
@@ -414,22 +413,21 @@
    public void clearBody() throws JMSException
    {
       super.clearBody();
-
-      body = new IoBufferWrapper(1024);
+      message.clearBody();
    }
 
    public long getBodyLength() throws JMSException
    {
       checkRead();
 
-      return body.limit();
+      return message.getBodySize();
    }
 
    public void doBeforeSend() throws Exception
    {
       reset();
 
-      message.setBody(body);
+      //message.setBody(body);
    }
 
    // Public --------------------------------------------------------

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossMapMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossMapMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossMapMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -442,7 +442,7 @@
    
    public void doBeforeSend() throws Exception
    {
-      map.encode(body);
+      map.encode(message);
       
       super.doBeforeSend();
    }
@@ -451,7 +451,7 @@
    {        
       super.doBeforeReceive();
       
-      map.decode(body);
+      map.decode(message);
    }
    
    // Package protected ---------------------------------------------

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -27,7 +27,6 @@
 import org.jboss.messaging.core.client.impl.ClientMessageImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.MessagingBuffer;
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
 import org.jboss.messaging.jms.JBossDestination;
 import org.jboss.messaging.util.SimpleString;
@@ -138,8 +137,6 @@
    //The underlying message
    protected ClientMessage message;
    
-   protected MessagingBuffer body;
-   
    private ClientSession session;
    
    //Read-only?
@@ -167,17 +164,11 @@
    public JBossMessage()
    {
       message = new ClientMessageImpl(JBossMessage.TYPE, true, 0, System.currentTimeMillis(), (byte)4, new ByteBufferWrapper(ByteBuffer.allocate(1024)));
-
-      //TODO - can we lazily create this?
-      body = message.getBody();
    }
 
    public JBossMessage(byte type)
    {
       message = new ClientMessageImpl(type, true, 0, System.currentTimeMillis(), (byte)4, new ByteBufferWrapper(ByteBuffer.allocate(1024)));
-
-      //TODO - can we lazily create this?
-      body = message.getBody();
    }
 
 
@@ -187,9 +178,6 @@
    protected JBossMessage(final byte type, final ClientSession session)
    {
       message = session.createClientMessage(type, true, 0, System.currentTimeMillis(), (byte)4);
-      
-      //TODO - can we lazily create this?
-      body = message.getBody();
    }
    
    public JBossMessage(final ClientSession session)
@@ -207,8 +195,6 @@
       this.readOnly = true;
       
       this.session = session;
-      
-      this.body = message.getBody();
    }
 
    /*
@@ -879,14 +865,14 @@
    
    public void doBeforeSend() throws Exception
    {
-      body.flip();
+      //body.flip();
 
-      message.setBody(body);
+      //message.setBody(body);
    }
    
    public void doBeforeReceive() throws Exception
    {
-      body = message.getBody();
+      //body = message.getBody();
    }
    
    public byte getType()

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -108,8 +108,8 @@
          
          byte[] data = baos.toByteArray();
          
-         body.putInt(data.length);
-         body.putBytes(data);
+         message.putInt(data.length);
+         message.putBytes(data);
       }
       
       super.doBeforeSend();
@@ -132,9 +132,9 @@
       {
          try
          {
-            int len = body.getInt();
+            int len = message.getInt();
             byte[] data = new byte[len];
-            body.getBytes(data);
+            message.getBytes(data);
             ByteArrayInputStream bais = new ByteArrayInputStream(data);
             ObjectInputStream ois = new ObjectInputStreamWithClassLoader(bais);
             object = (Serializable)ois.readObject();

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -25,7 +25,6 @@
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
 import org.jboss.messaging.util.DataConstants;
 
 import javax.jms.JMSException;
@@ -118,14 +117,14 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          
          switch (type)
          {
             case DataConstants.BOOLEAN:
-               return body.getBoolean();
+               return message.getBoolean();
             case DataConstants.STRING:
-               String s = body.getNullableString();
+               String s = message.getNullableString();
                return Boolean.valueOf(s);
             default:
                throw new MessageFormatException("Invalid conversion");           
@@ -142,13 +141,13 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          switch (type)
          {
             case DataConstants.BYTE:
-               return body.getByte();
+               return message.getByte();
             case DataConstants.STRING:
-               String s = body.getNullableString();
+               String s = message.getNullableString();
                return Byte.parseByte(s);
             default:
                throw new MessageFormatException("Invalid conversion");           
@@ -165,15 +164,15 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          switch (type)
          {
             case DataConstants.BYTE:
-               return body.getByte();
+               return message.getByte();
             case DataConstants.SHORT:
-               return body.getShort();
+               return message.getShort();
             case DataConstants.STRING:
-               String s = body.getNullableString();
+               String s = message.getNullableString();
                return Short.parseShort(s);
             default:
                throw new MessageFormatException("Invalid conversion");           
@@ -190,11 +189,11 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          switch (type)
          {
             case DataConstants.CHAR:
-               return body.getChar();
+               return message.getChar();
             default:
                throw new MessageFormatException("Invalid conversion");           
          }
@@ -210,17 +209,17 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          switch (type)
          {
             case DataConstants.BYTE:
-               return body.getByte();
+               return message.getByte();
             case DataConstants.SHORT:
-               return body.getShort();
+               return message.getShort();
             case DataConstants.INT:
-               return body.getInt();
+               return message.getInt();
             case DataConstants.STRING:
-               String s = body.getNullableString();
+               String s = message.getNullableString();
                return Integer.parseInt(s);
             default:
                throw new MessageFormatException("Invalid conversion");           
@@ -237,19 +236,19 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          switch (type)
          {
             case DataConstants.BYTE:
-               return body.getByte();
+               return message.getByte();
             case DataConstants.SHORT:
-               return body.getShort();
+               return message.getShort();
             case DataConstants.INT:
-               return body.getInt();
+               return message.getInt();
             case DataConstants.LONG:
-               return body.getLong();
+               return message.getLong();
             case DataConstants.STRING:
-               String s = body.getNullableString();
+               String s = message.getNullableString();
                return Long.parseLong(s);
             default:
                throw new MessageFormatException("Invalid conversion");           
@@ -266,13 +265,13 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          switch (type)
          {
             case DataConstants.FLOAT:
-               return body.getFloat();
+               return message.getFloat();
             case DataConstants.STRING:
-               String s = body.getNullableString();
+               String s = message.getNullableString();
                return Float.parseFloat(s);
             default:
                throw new MessageFormatException("Invalid conversion");           
@@ -289,15 +288,15 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          switch (type)
          {
             case DataConstants.FLOAT:
-               return body.getFloat();
+               return message.getFloat();
             case DataConstants.DOUBLE:
-               return body.getDouble();
+               return message.getDouble();
             case DataConstants.STRING:
-               String s = body.getNullableString();
+               String s = message.getNullableString();
                return Double.parseDouble(s);
             default:
                throw new MessageFormatException("Invalid conversion: " + type);           
@@ -314,27 +313,27 @@
       checkRead();
       try
       {
-         byte type = body.getByte();
+         byte type = message.getByte();
          switch (type)
          {
             case DataConstants.BOOLEAN:
-               return String.valueOf(body.getBoolean());
+               return String.valueOf(message.getBoolean());
             case DataConstants.BYTE:
-               return String.valueOf(body.getByte());
+               return String.valueOf(message.getByte());
             case DataConstants.SHORT:
-               return String.valueOf(body.getShort());
+               return String.valueOf(message.getShort());
             case DataConstants.CHAR:
-               return String.valueOf(body.getChar());
+               return String.valueOf(message.getChar());
             case DataConstants.INT:
-               return String.valueOf(body.getInt());
+               return String.valueOf(message.getInt());
             case DataConstants.LONG:
-               return String.valueOf(body.getLong());
+               return String.valueOf(message.getLong());
             case DataConstants.FLOAT:
-               return String.valueOf(body.getFloat());
+               return String.valueOf(message.getFloat());
             case DataConstants.DOUBLE:
-               return String.valueOf(body.getDouble());
+               return String.valueOf(message.getDouble());
             case DataConstants.STRING:
-               return body.getNullableString();
+               return message.getNullableString();
             default:
                throw new MessageFormatException("Invalid conversion");           
          }
@@ -359,15 +358,15 @@
          }
          else if (len == 0)
          {
-            byte type = body.getByte();
+            byte type = message.getByte();
             if (type != DataConstants.BYTES)
             {
                throw new MessageFormatException("Invalid conversion"); 
             }
-            len = body.getInt();       
+            len = message.getInt();
          }     
          int read = Math.min(value.length, len);
-         body.getBytes(value, 0, read);
+         message.getBytes(value, 0, read);
          len -= read;
          if (len == 0)
          {
@@ -384,31 +383,31 @@
    public Object readObject() throws JMSException
    {
       checkRead();
-      byte type = body.getByte();
+      byte type = message.getByte();
       switch (type)
       {
          case DataConstants.BOOLEAN:
-            return body.getBoolean();
+            return message.getBoolean();
          case DataConstants.BYTE:
-            return body.getByte();
+            return message.getByte();
          case DataConstants.SHORT:
-            return body.getShort();
+            return message.getShort();
          case DataConstants.CHAR:
-            return body.getChar();
+            return message.getChar();
          case DataConstants.INT:
-            return body.getInt();
+            return message.getInt();
          case DataConstants.LONG:
-            return body.getLong();
+            return message.getLong();
          case DataConstants.FLOAT:
-            return body.getFloat();
+            return message.getFloat();
          case DataConstants.DOUBLE:
-            return body.getDouble();
+            return message.getDouble();
          case DataConstants.STRING:
-            return body.getNullableString();         
+            return message.getNullableString();
          case DataConstants.BYTES:
-            int len = body.getInt();
+            int len = message.getInt();
             byte[] bytes = new byte[len];
-            body.getBytes(bytes);
+            message.getBytes(bytes);
             return bytes;
          default:
             throw new MessageFormatException("Invalid conversion");           
@@ -418,81 +417,81 @@
    public void writeBoolean(final boolean value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.BOOLEAN);
-      body.putBoolean(value);
+      message.putByte(DataConstants.BOOLEAN);
+      message.putBoolean(value);
    }
 
    public void writeByte(final byte value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.BYTE);
-      body.putByte(value);
+      message.putByte(DataConstants.BYTE);
+      message.putByte(value);
    }
 
    public void writeShort(final short value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.SHORT);
-      body.putShort(value);
+      message.putByte(DataConstants.SHORT);
+      message.putShort(value);
    }
 
    public void writeChar(final char value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.CHAR);
-      body.putChar(value);
+      message.putByte(DataConstants.CHAR);
+      message.putChar(value);
    }
 
    public void writeInt(final int value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.INT);
-      body.putInt(value);
+      message.putByte(DataConstants.INT);
+      message.putInt(value);
    }
 
    public void writeLong(final long value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.LONG);
-      body.putLong(value);
+      message.putByte(DataConstants.LONG);
+      message.putLong(value);
    }
 
    public void writeFloat(final float value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.FLOAT);
-      body.putFloat(value);
+      message.putByte(DataConstants.FLOAT);
+      message.putFloat(value);
    }
 
    public void writeDouble(final double value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.DOUBLE);
-      body.putDouble(value);
+      message.putByte(DataConstants.DOUBLE);
+      message.putDouble(value);
    }
    
    public void writeString(final String value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.STRING);
-      body.putNullableString(value);
+      message.putByte(DataConstants.STRING);
+      message.putNullableString(value);
    }
 
    public void writeBytes(final byte[] value) throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.BYTES);
-      body.putInt(value.length);
-      body.putBytes(value);
+      message.putByte(DataConstants.BYTES);
+      message.putInt(value.length);
+      message.putBytes(value);
    }
 
    public void writeBytes(final byte[] value, final int offset, final int length)
          throws JMSException
    {
       checkWrite();
-      body.putByte(DataConstants.BYTES);
-      body.putInt(length);
-      body.putBytes(value, offset, length);
+      message.putByte(DataConstants.BYTES);
+      message.putInt(length);
+      message.putBytes(value, offset, length);
    }
 
    public void writeObject(final Object value) throws JMSException
@@ -552,13 +551,8 @@
       if (!readOnly)
       {
          readOnly = true;
-         
-         body.flip();
       }
-      else
-      {
-         body.rewind();
-      }
+      message.reset();
    }
 
    // JBossMessage overrides ----------------------------------------
@@ -567,14 +561,12 @@
    {
       super.clearBody();
       
-      body = new IoBufferWrapper(1024);
+      message.clearBody();
    }
    
    public void doBeforeSend() throws Exception
    {
       reset();
-      
-      message.setBody(body);
    }
    
    // Package protected ---------------------------------------------

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossTextMessage.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossTextMessage.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/jms/client/JBossTextMessage.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -124,7 +124,7 @@
    
    public void doBeforeSend() throws Exception
    {
-      body.putNullableString(text);      
+      message.putNullableString(text);
       
       super.doBeforeSend();
    }
@@ -133,7 +133,7 @@
    {
       super.doBeforeReceive();
       
-      text = body.getNullableString();                        
+      text = message.getNullableString();                        
    }
    
    // Package protected ---------------------------------------------

Added: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/util/PropertyValue.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/util/PropertyValue.java	                        (rev 0)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/util/PropertyValue.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -0,0 +1,37 @@
+/*
+ * 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.util;
+
+import org.jboss.messaging.core.remoting.Encoder;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+
+public interface PropertyValue
+{
+   Object getValue();
+
+   void write(Encoder buffer);
+
+   int encodeSize();
+}

Modified: branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/util/TypedProperties.java
===================================================================
--- branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/util/TypedProperties.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/src/main/org/jboss/messaging/util/TypedProperties.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -24,7 +24,7 @@
 
 import org.jboss.messaging.core.journal.EncodingSupport;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.MessagingBuffer;
+import org.jboss.messaging.core.remoting.Encoder;
 import org.jboss.messaging.core.remoting.Packet;
 import static org.jboss.messaging.util.DataConstants.*;
 
@@ -60,8 +60,12 @@
 		this.properties = other.properties == null ? null : new HashMap<SimpleString, PropertyValue>(other.properties);
 		this.size = other.size;
 	}
-	
-	public void putBooleanProperty(final SimpleString key, final boolean value)
+
+   public int getEncodingSize()
+   {
+      return size;
+   }
+   public void putBooleanProperty(final SimpleString key, final boolean value)
 	{
    	checkCreateProperties();   	
    	doPutValue(key, new BooleanValue(value));
@@ -147,7 +151,7 @@
 	      return Collections.EMPTY_SET;
 	}
 			
-	public void decode(final MessagingBuffer buffer)
+	public void decode(final Encoder buffer)
    {   	
    	byte b = buffer.getByte();
    	
@@ -250,110 +254,7 @@
    	}
    }
 
-   public void decode(final Packet buffer)
-   {
-   	byte b = buffer.getByte();
-
-   	if (b == NULL)
-   	{
-   		properties = null;
-   	}
-   	else
-   	{
-   	   int numHeaders = buffer.getInt();
-
-      	properties = new HashMap<SimpleString, PropertyValue>(numHeaders);
-      	size = 0;
-
-   		for (int i = 0; i < numHeaders; i++)
-   		{
-   			int len = buffer.getInt();
-   			byte[] data = new byte[len];
-   			buffer.getBytes(data);
-   			SimpleString key = new SimpleString(data);
-
-   			byte type = buffer.getByte();
-
-   			PropertyValue val;
-
-   			switch (type)
-   			{
-   			   case NULL:
-   			   {
-   			      val = new NullValue();
-   			      doPutValue(key, val);
-   			      break;
-   			   }
-   			   case CHAR:
-   			   {
-   			      val = new CharValue(buffer);
-   			      doPutValue(key, val);
-   			      break;
-   			   }
-   				case BOOLEAN:
-   				{
-   					val = new BooleanValue(buffer);
-   					doPutValue(key, val);
-   					break;
-   				}
-   				case BYTE:
-   				{
-   					val = new ByteValue(buffer);
-   					doPutValue(key, val);
-   					break;
-   				}
-   				case BYTES:
-   				{
-   				   val = new BytesValue(buffer);
-   				   doPutValue(key, val);
-   				   break;
-   				}
-   				case SHORT:
-   				{
-   					val = new ShortValue(buffer);
-   					doPutValue(key, val);
-   					break;
-   				}
-   				case INT:
-   				{
-   					val = new IntValue(buffer);
-   					doPutValue(key, val);
-   					break;
-   				}
-   				case LONG:
-   				{
-   					val = new LongValue(buffer);
-   					doPutValue(key, val);
-   					break;
-   				}
-   				case FLOAT:
-   				{
-   					val = new FloatValue(buffer);
-   					doPutValue(key, val);
-   					break;
-   				}
-   				case DOUBLE:
-   				{
-   					val = new DoubleValue(buffer);
-   					doPutValue(key, val);
-   					break;
-   				}
-   				case STRING:
-   				{
-   					val = new StringValue(buffer);
-   					doPutValue(key, val);
-   					break;
-   				}
-   				default:
-   				{
-   					throw new IllegalArgumentException("Invalid type: " + type);
-   				}
-   			}
-   		}
-   	}
-   }
-
-   public void encode(final MessagingBuffer buffer)
+   public void encode(final Encoder buffer)
 	{
 		if (properties == null)
 		{
@@ -377,30 +278,6 @@
 		}
 	}
 
-   public void encode(final Packet buffer)
-	{
-		if (properties == null)
-		{
-			buffer.putByte(NULL);
-		}
-		else
-		{
-			buffer.putByte(NOT_NULL);
-
-   		buffer.putInt(properties.size());
-
-      	for (Map.Entry<SimpleString, PropertyValue> entry: properties.entrySet())
-   		{
-      		SimpleString s = entry.getKey();
-      		byte[] data = s.getData();
-      		buffer.putInt(data.length);
-      		buffer.putBytes(data);
-
-      		entry.getValue().write(buffer);
-   		}
-		}
-	}
-
    public int getEncodeSize()
 	{
 	   if (properties == null)
@@ -486,17 +363,7 @@
 	}
 	  
    // Inner classes ------------------------------------------------------------------------------
-		
-   private interface PropertyValue
-	{
-		Object getValue();	
-		
-		void write(MessagingBuffer buffer);
 
-      void write(Packet buffer);
-
-      int encodeSize();
-	}
    
    private static final class NullValue implements PropertyValue
    {
@@ -509,15 +376,10 @@
          return null;
       }
       
-      public void write(final MessagingBuffer buffer)
+      public void write(final Encoder buffer)
       {
          buffer.putByte(NULL);
       }
-
-      public void write(final Packet buffer)
-      {
-         buffer.putByte(NULL);
-      }
       
       public int encodeSize()
       {
@@ -535,7 +397,7 @@
 			this.val = val;
 		}
 		
-		public BooleanValue(final MessagingBuffer buffer)
+		public BooleanValue(final Encoder buffer)
 		{
 			this.val = buffer.getBoolean();
 		}
@@ -550,18 +412,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(BOOLEAN);
 			buffer.putBoolean(val);
 		}
 
-      public void write(Packet buffer)
-      {
-         buffer.putByte(BOOLEAN);
-			buffer.putBoolean(val);
-      }
-
       public int encodeSize()
       {
          return SIZE_BYTE + SIZE_BOOLEAN;
@@ -578,7 +434,7 @@
 			this.val = val;
 		}
 		
-		public ByteValue(final MessagingBuffer buffer)
+		public ByteValue(final Encoder buffer)
 		{
 			this.val = buffer.getByte();
 		}
@@ -593,18 +449,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(BYTE);
 			buffer.putByte(val);
 		}
 
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(BYTE);
-			buffer.putByte(val);
-		}
-
       public int encodeSize()
 		{
 		   return SIZE_BYTE + SIZE_BYTE;
@@ -620,7 +470,7 @@
 			this.val = val;
 		}
 		
-		public BytesValue(final MessagingBuffer buffer)
+		public BytesValue(final Encoder buffer)
 		{
 			int len = buffer.getInt();
 			this.val = new byte[len];
@@ -639,19 +489,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(BYTES);
 			buffer.putInt(val.length);
 			buffer.putBytes(val);
 		}
-
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(BYTES);
-			buffer.putInt(val.length);
-			buffer.putBytes(val);
-		}
 		
       public int encodeSize()
       {
@@ -669,7 +512,7 @@
 			this.val = val;
 		}
 		
-		public ShortValue(final MessagingBuffer buffer)
+		public ShortValue(final Encoder buffer)
 		{
 			this.val = buffer.getShort();
 		}
@@ -684,18 +527,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(SHORT);
 			buffer.putShort(val);
 		}
 
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(SHORT);
-			buffer.putShort(val);
-		}
-
       public int encodeSize()
 		{
 		   return SIZE_BYTE + SIZE_SHORT;
@@ -711,7 +548,7 @@
 			this.val = val;
 		}
 		
-		public IntValue(final MessagingBuffer buffer)
+		public IntValue(final Encoder buffer)
 		{
 			this.val = buffer.getInt();
 		}
@@ -726,18 +563,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(INT);
 			buffer.putInt(val);
 		}
 
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(INT);
-			buffer.putInt(val);
-		}
-
       public int encodeSize()
       {
          return SIZE_BYTE + SIZE_INT;
@@ -753,7 +584,7 @@
 			this.val = val;
 		}
 		
-		public LongValue(final MessagingBuffer buffer)
+		public LongValue(final Encoder buffer)
 		{
 			this.val = buffer.getLong();
 		}
@@ -768,18 +599,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(LONG);
 			buffer.putLong(val);
 		}
 
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(LONG);
-			buffer.putLong(val);
-		}
-
       public int encodeSize()
       {
          return SIZE_BYTE + SIZE_LONG;
@@ -795,7 +620,7 @@
 			this.val = val;
 		}
 		
-		public FloatValue(final MessagingBuffer buffer)
+		public FloatValue(final Encoder buffer)
 		{
 			this.val = buffer.getFloat();
 		}
@@ -809,17 +634,11 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(FLOAT);
 			buffer.putFloat(val);
 		}
-
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(FLOAT);
-			buffer.putFloat(val);
-		}
 		
       public int encodeSize()
       {
@@ -837,7 +656,7 @@
 			this.val = val;
 		}
 		
-		public DoubleValue(final MessagingBuffer buffer)
+		public DoubleValue(final Encoder buffer)
 		{
 			this.val = buffer.getDouble();
 		}
@@ -852,18 +671,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(DOUBLE);
 			buffer.putDouble(val);
 		}
 
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(DOUBLE);
-			buffer.putDouble(val);
-		}
-
       public int encodeSize()
       {
          return SIZE_BYTE + SIZE_DOUBLE;
@@ -879,7 +692,7 @@
 			this.val = val;
 		}
 		
-		public CharValue(final MessagingBuffer buffer)
+		public CharValue(final Encoder buffer)
 		{
 			this.val = buffer.getChar();
 		}
@@ -894,18 +707,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(CHAR);
 			buffer.putChar(val);
 		}
 
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(CHAR);
-			buffer.putChar(val);
-		}
-
       public int encodeSize()
       {
          return SIZE_BYTE + SIZE_CHAR;
@@ -921,7 +728,7 @@
 			this.val = val;
 		}
 		
-		public StringValue(final MessagingBuffer buffer)
+		public StringValue(final Encoder buffer)
 		{
 			this.val = buffer.getSimpleString();
 		}
@@ -936,18 +743,12 @@
 			return val;
 		}
 		
-		public void write(final MessagingBuffer buffer)
+		public void write(final Encoder buffer)
 		{
 			buffer.putByte(STRING);
 			buffer.putSimpleString(val);
 		}
 
-      public void write(final Packet buffer)
-		{
-			buffer.putByte(STRING);
-			buffer.putSimpleString(val);
-		}
-
       public int encodeSize()
 		{
 		   return SIZE_BYTE + SimpleString.sizeofString(val);

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -23,15 +23,7 @@
 package org.jboss.messaging.tests.integration.basic;
 
 import junit.framework.TestCase;
-
-import org.jboss.messaging.core.client.ClientConnection;
-import org.jboss.messaging.core.client.ClientConnectionFactory;
-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.ConnectionParams;
-import org.jboss.messaging.core.client.Location;
+import org.jboss.messaging.core.client.*;
 import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
 import org.jboss.messaging.core.client.impl.ConnectionParamsImpl;
 import org.jboss.messaging.core.client.impl.LocationImpl;
@@ -96,7 +88,7 @@
 
       ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
             System.currentTimeMillis(), (byte) 1);
-      message.getBody().putString("testINVMCoreClient");
+      message.putString("testINVMCoreClient");
       producer.send(message);
 
       ClientConsumer consumer = session.createConsumer(QUEUE);
@@ -104,7 +96,7 @@
       
       message = consumer.receive(1000);
       
-      assertEquals("testINVMCoreClient", message.getBody().getString());
+      assertEquals("testINVMCoreClient", message.getString());
       
       conn.close();
    }
@@ -127,7 +119,7 @@
 
       ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
             System.currentTimeMillis(), (byte) 1);
-      message.getBody().putString("testINVMCoreClient");
+      message.putString("testINVMCoreClient");
       producer.send(message);
 
       ClientConsumer consumer = session.createConsumer(QUEUE);
@@ -135,7 +127,7 @@
 
       message = consumer.receive(1000);
 
-      assertEquals("testINVMCoreClient", message.getBody().getString());
+      assertEquals("testINVMCoreClient", message.getString());
 
       conn.close();
    }

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,20 +22,14 @@
 
 package org.jboss.messaging.tests.integration.clientcrash;
 
-import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import junit.framework.TestCase;
-
-import org.jboss.messaging.core.client.ClientConnection;
-import org.jboss.messaging.core.client.ClientConnectionFactory;
-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.*;
 import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
 import org.jboss.messaging.core.client.impl.LocationImpl;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.Message;
+import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import org.jboss.messaging.core.remoting.impl.mina.MinaAcceptorFactory;
 import org.jboss.messaging.core.server.MessagingService;
 import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
@@ -113,13 +107,13 @@
          // send the message to the queue
          Message messageFromClient = consumer.receive(5000);
          assertNotNull("no message received", messageFromClient);
-         assertEquals(MESSAGE_TEXT_FROM_CLIENT, messageFromClient.getBody().getString());
+         assertEquals(MESSAGE_TEXT_FROM_CLIENT, messageFromClient.getString());
 
          assertActiveConnections(1 + 1); //One local and one from the other vm
 
          ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
                  System.currentTimeMillis(), (byte) 1);
-         message.getBody().putString(ClientCrashTest.MESSAGE_TEXT_FROM_SERVER);
+         message.putString(ClientCrashTest.MESSAGE_TEXT_FROM_SERVER);
          producer.send(message);
 
          log.debug("waiting for the client VM to crash ...");

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,9 +22,7 @@
 
 package org.jboss.messaging.tests.integration.clientcrash;
 
-import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import junit.framework.TestCase;
-
 import org.jboss.messaging.core.client.ClientConnection;
 import org.jboss.messaging.core.client.ClientConnectionFactory;
 import org.jboss.messaging.core.client.ClientConsumer;
@@ -34,6 +32,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.Message;
+import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import org.jboss.messaging.core.remoting.impl.mina.MinaAcceptorFactory;
 import org.jboss.messaging.core.server.MessagingService;
 import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
@@ -86,7 +85,7 @@
       Message message = consumer.receive(15000);
 
       assertNotNull(message);
-      assertEquals(MESSAGE_TEXT, message.getBody().getString());
+      assertEquals(MESSAGE_TEXT, message.getString());
 
       // the client VM should exit by itself. If it doesn't, that means we have a problem
       // and the test will timeout

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,25 +22,18 @@
 
 package org.jboss.messaging.tests.integration.clientcrash;
 
-import static org.jboss.messaging.core.remoting.TransportType.TCP;
-import static org.jboss.messaging.tests.integration.clientcrash.ClientCrashTest.QUEUE;
-
-import java.util.Arrays;
-
-import org.jboss.messaging.core.client.ClientConnection;
-import org.jboss.messaging.core.client.ClientConnectionFactory;
-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.Location;
+import org.jboss.messaging.core.client.*;
 import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
 import org.jboss.messaging.core.client.impl.LocationImpl;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.logging.Logger;
+import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import org.jboss.messaging.jms.client.JBossTextMessage;
+import static org.jboss.messaging.tests.integration.clientcrash.ClientCrashTest.QUEUE;
 
+import java.util.Arrays;
 
+
 /**
  * Code to be run in an external VM, via main().
  * 
@@ -91,7 +84,7 @@
          
          ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
                System.currentTimeMillis(), (byte) 1);
-         message.getBody().putString(ClientCrashTest.MESSAGE_TEXT_FROM_CLIENT);
+         message.putString(ClientCrashTest.MESSAGE_TEXT_FROM_CLIENT);
 
          producer.send(message);
 

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,21 +22,14 @@
 
 package org.jboss.messaging.tests.integration.clientcrash;
 
-import static org.jboss.messaging.core.remoting.TransportType.TCP;
-import static org.jboss.messaging.tests.integration.clientcrash.ClientExitTest.QUEUE;
-
-import org.jboss.messaging.core.client.ClientConnection;
-import org.jboss.messaging.core.client.ClientConnectionFactory;
-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.Location;
+import org.jboss.messaging.core.client.*;
 import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
 import org.jboss.messaging.core.client.impl.LocationImpl;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.logging.Logger;
+import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import org.jboss.messaging.jms.client.JBossTextMessage;
+import static org.jboss.messaging.tests.integration.clientcrash.ClientExitTest.QUEUE;
 
 /**
  * Code to be run in an external VM, via main().
@@ -70,7 +63,7 @@
 
          ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
                System.currentTimeMillis(), (byte) 1);
-         message.getBody().putString(ClientExitTest.MESSAGE_TEXT);
+         message.putString(ClientExitTest.MESSAGE_TEXT);
          producer.send(message);
 
          conn.start();

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,23 +22,16 @@
 
 package org.jboss.messaging.tests.integration.ssl;
 
-import static org.jboss.messaging.core.remoting.TransportType.TCP;
-
-import java.util.Arrays;
-
-import org.jboss.messaging.core.client.ClientConnection;
-import org.jboss.messaging.core.client.ClientConnectionFactory;
-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.ConnectionParams;
-import org.jboss.messaging.core.client.Location;
+import org.jboss.messaging.core.client.*;
 import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
 import org.jboss.messaging.core.client.impl.ConnectionParamsImpl;
 import org.jboss.messaging.core.client.impl.LocationImpl;
 import org.jboss.messaging.core.logging.Logger;
+import static org.jboss.messaging.core.remoting.TransportType.TCP;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 
+import java.util.Arrays;
+
 /**
  * This client will open a connection, send a message to a queue over SSL and
  * exit.
@@ -84,7 +77,7 @@
 
          ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
                System.currentTimeMillis(), (byte) 1);
-         message.getBody().putString(CoreClientOverSSLTest.MESSAGE_TEXT_FROM_CLIENT);
+         message.putString(CoreClientOverSSLTest.MESSAGE_TEXT_FROM_CLIENT);
          producer.send(message);
 
          conn.close();

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,14 +22,8 @@
 
 package org.jboss.messaging.tests.integration.ssl;
 
-import static java.lang.Boolean.FALSE;
 import junit.framework.TestCase;
-
-import org.jboss.messaging.core.client.ClientConnection;
-import org.jboss.messaging.core.client.ClientConnectionFactory;
-import org.jboss.messaging.core.client.ClientConsumer;
-import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.ConnectionParams;
+import org.jboss.messaging.core.client.*;
 import org.jboss.messaging.core.client.impl.ClientConnectionFactoryImpl;
 import org.jboss.messaging.core.client.impl.ConnectionParamsImpl;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
@@ -41,6 +35,8 @@
 import org.jboss.messaging.tests.util.SpawnedVMSupport;
 import org.jboss.messaging.util.SimpleString;
 
+import static java.lang.Boolean.FALSE;
+
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * 
@@ -85,7 +81,7 @@
 
       Message m = consumer.receive(10000);
       assertNotNull(m);
-      assertEquals(MESSAGE_TEXT_FROM_CLIENT, m.getBody().getString());
+      assertEquals(MESSAGE_TEXT_FROM_CLIENT, m.getString());
 
       log.debug("waiting for the client VM to exit ...");
       SpawnedVMSupport.assertProcessExits(true, 0, p);

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,11 +22,6 @@
 
 package org.jboss.messaging.tests.performance.persistence;
 
-import java.io.File;
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
 import org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl;
 import org.jboss.messaging.core.config.impl.FileConfiguration;
 import org.jboss.messaging.core.logging.Logger;
@@ -39,6 +34,11 @@
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.util.SimpleString;
 
+import java.io.File;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.concurrent.atomic.AtomicLong;
+
 /**
  * 
  * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
@@ -181,7 +181,7 @@
                   implMsg.putStringProperty(new SimpleString("Key"), new SimpleString("This String is worthless!"));
 
                   implMsg.setMessageID(i);
-                  implMsg.setBody(buffer);
+                  implMsg.putBuffer(buffer);
                   
                   implMsg.setDestination(address);
 

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientMessageImplTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientMessageImplTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientMessageImplTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -21,8 +21,6 @@
  */ 
 package org.jboss.messaging.tests.unit.core.client.impl;
 
-import java.nio.ByteBuffer;
-
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.impl.ClientMessageImpl;
 import org.jboss.messaging.core.message.Message;
@@ -31,7 +29,9 @@
 import org.jboss.messaging.tests.unit.core.message.impl.MessageImplTestBase;
 import org.jboss.messaging.tests.util.RandomUtil;
 
+import java.nio.ByteBuffer;
 
+
 /**
  * 
  * A ClientMessageImplTest
@@ -87,7 +87,6 @@
          
          ClientMessage msg = new ClientMessageImpl(durable, body);
          assertEquals(durable, msg.isDurable());
-         assertEquals(body, msg.getBody());
              
          assertEquals(0, msg.getType());
          assertEquals(0, msg.getExpiration());
@@ -108,7 +107,6 @@
          ClientMessage msg = new ClientMessageImpl(type, durable, body);
          assertEquals(type, msg.getType());
          assertEquals(durable, msg.isDurable());
-         assertEquals(body, msg.getBody());
              
          assertEquals(0, msg.getExpiration());
          assertTrue(System.currentTimeMillis() - msg.getTimestamp() < 5);
@@ -133,8 +131,7 @@
          assertEquals(durable, msg.isDurable());
          assertEquals(expiration, msg.getExpiration());
          assertEquals(timestamp, msg.getTimestamp());
-         assertEquals(priority, msg.getPriority());
-         assertEquals(body, msg.getBody());                      
+         assertEquals(priority, msg.getPriority());                     
       }
    }
 }

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/SimpleEncoding.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/SimpleEncoding.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/SimpleEncoding.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -23,7 +23,7 @@
 package org.jboss.messaging.tests.unit.core.journal.impl.fakes;
 
 import org.jboss.messaging.core.journal.EncodingSupport;
-import org.jboss.messaging.core.remoting.MessagingBuffer;
+import org.jboss.messaging.core.remoting.Encoder;
 
 /**
  * Provides a SimpleEncoding with a Fake Payload
@@ -52,13 +52,13 @@
    
 
    // Public --------------------------------------------------------
-   public void decode(MessagingBuffer buffer)
+   public void decode(Encoder buffer)
    {
       throw new UnsupportedOperationException();
       
    }
 
-   public void encode(MessagingBuffer buffer)
+   public void encode(Encoder buffer)
    {
       for (int i = 0; i < size; i++)
       {

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,19 +22,6 @@
 
 package org.jboss.messaging.tests.unit.core.message.impl;
 
-import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
-import static org.jboss.messaging.tests.util.RandomUtil.randomByte;
-import static org.jboss.messaging.tests.util.RandomUtil.randomBytes;
-import static org.jboss.messaging.tests.util.RandomUtil.randomDouble;
-import static org.jboss.messaging.tests.util.RandomUtil.randomFloat;
-import static org.jboss.messaging.tests.util.RandomUtil.randomInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
-import static org.jboss.messaging.tests.util.RandomUtil.randomShort;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-
-import java.nio.ByteBuffer;
-import java.util.Set;
-
 import org.jboss.messaging.core.journal.EncodingSupport;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.Message;
@@ -42,9 +29,13 @@
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
 import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
 import org.jboss.messaging.core.server.impl.ServerMessageImpl;
+import static org.jboss.messaging.tests.util.RandomUtil.*;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.util.SimpleString;
 
+import java.nio.ByteBuffer;
+import java.util.Set;
+
 /**
  * 
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -133,9 +124,7 @@
          
          message.setPriority(priority2);
          assertEquals(priority2, message.getPriority());
-         
-         message.setBody(body);
-         assertTrue(body == message.getBody());
+
       }      
    }
    
@@ -168,11 +157,9 @@
             
       SimpleString address = new SimpleString("Simple Destination ");
       
-      Message msg = createMessage(); 
-      msg.setBody(new ByteBufferWrapper(ByteBuffer.allocateDirect(1024)));
+      Message msg = createMessage();
          
       msg.setDestination(address);
-      msg.setBody(bufferBody);
       msg.putStringProperty(new SimpleString("Key"), new SimpleString("This String is worthless!"));
       msg.putStringProperty(new SimpleString("Key"), new SimpleString("This String is worthless and bigger!"));
       msg.putStringProperty(new SimpleString("Key2"), new SimpleString("This String is worthless and bigger and bigger!"));
@@ -320,9 +307,9 @@
       assertEquals(msg1.getPriority(), msg2.getPriority());
 
       assertEquals(msg1.getType(), msg2.getType());         
+      fail();
+      //assertEqualsByteArrays(msg1.getBody().array(), msg2.getBody().array());
 
-      assertEqualsByteArrays(msg1.getBody().array(), msg2.getBody().array());      
-
       assertEquals(msg1.getDestination(), msg2.getDestination());
       
       Set<SimpleString> props1 = msg1.getPropertyNames();

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -21,25 +21,13 @@
  */
 package org.jboss.messaging.tests.unit.core.persistence.impl.journal;
 
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
 import org.easymock.IArgumentMatcher;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.filter.Filter;
-import org.jboss.messaging.core.journal.EncodingSupport;
-import org.jboss.messaging.core.journal.Journal;
-import org.jboss.messaging.core.journal.PreparedTransactionInfo;
-import org.jboss.messaging.core.journal.RecordInfo;
-import org.jboss.messaging.core.journal.TestableJournal;
+import org.jboss.messaging.core.journal.*;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.persistence.impl.journal.JournalStorageManager;
 import org.jboss.messaging.core.postoffice.Binding;
@@ -47,16 +35,20 @@
 import org.jboss.messaging.core.postoffice.impl.BindingImpl;
 import org.jboss.messaging.core.remoting.MessagingBuffer;
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
-import org.jboss.messaging.core.server.HandleStatus;
-import org.jboss.messaging.core.server.MessageReference;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.server.QueueFactory;
-import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.*;
 import org.jboss.messaging.core.server.impl.ServerMessageImpl;
 import org.jboss.messaging.tests.util.RandomUtil;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.util.SimpleString;
 
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * 
  * A JournalStorageManagerTest
@@ -892,8 +884,10 @@
          
          if (matches)
          {
-            byte[] bod1 = msg.getBody().array();
-            byte[] bod2 = that.getBody().array();
+            byte[] bod1 = new byte[msg.remaining()];
+            msg.getBytes(bod1);
+            byte[] bod2 = new byte[that.remaining()];
+            msg.getBytes(bod2);
             if (bod1.length == bod2.length)
             {
                for (int i = 0; i < bod1.length; i++)

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingHandlerImplTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingHandlerImplTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingHandlerImplTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -350,7 +350,6 @@
    public void testProducerSendMessageNullBodyNoProps1() throws Exception
    {
       ClientMessageImpl message1 = new ClientMessageImpl(RandomUtil.randomInt(), RandomUtil.randomLong());
-      message1.setBody(new ByteBufferWrapper(ByteBuffer.allocate(0)));
       message1.setDestination(new SimpleString("test"));
       PacketImpl message = new ProducerSendMessage(message1);
       setHeaders(message);
@@ -358,7 +357,6 @@
       buff.getInt();
       ProducerSendMessage copy = (ProducerSendMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(0, copy.getServerMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getServerMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getServerMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getServerMessage().getExpiration());
@@ -378,7 +376,6 @@
       buff.getInt();
       ProducerSendMessage copy = (ProducerSendMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(0, copy.getServerMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getServerMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getServerMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getServerMessage().getExpiration());
@@ -397,7 +394,6 @@
       buff.getInt();
       ProducerSendMessage copy = (ProducerSendMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(0, copy.getServerMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getServerMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getServerMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getServerMessage().getExpiration());
@@ -417,7 +413,6 @@
       buff.getInt();
       ProducerSendMessage copy = (ProducerSendMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(0, copy.getServerMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getServerMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getServerMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getServerMessage().getExpiration());
@@ -434,7 +429,6 @@
       ByteBufferWrapper body = new ByteBufferWrapper(ByteBuffer.allocateDirect(bytes.length));
       body.putBytes(bytes);
       body.rewind();
-      message1.setBody(body);
       PacketImpl message = new ProducerSendMessage(message1);
       setHeaders(message);
       SimpleString boolProp = new SimpleString("bool.prop");
@@ -459,7 +453,6 @@
       buff.getInt();
       ProducerSendMessage copy = (ProducerSendMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(bytes.length, copy.getServerMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getServerMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getServerMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getServerMessage().getExpiration());
@@ -487,7 +480,6 @@
       ByteBufferWrapper body = new ByteBufferWrapper(ByteBuffer.allocateDirect(bytes.length));
       body.putBytes(bytes);
       body.rewind();
-      message1.setBody(body);
       PacketImpl message = new ProducerSendMessage(message1);
       setHeaders(message);
       SimpleString boolProp = new SimpleString("bool.prop");
@@ -512,7 +504,6 @@
       buff.getInt();
       ProducerSendMessage copy = (ProducerSendMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(bytes.length, copy.getServerMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getServerMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getServerMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getServerMessage().getExpiration());
@@ -539,7 +530,6 @@
       ByteBufferWrapper body = new ByteBufferWrapper(ByteBuffer.allocateDirect(bytes.length));
       body.putBytes(bytes);
       body.rewind();
-      message1.setBody(body);
       PacketImpl message = new ProducerSendMessage(message1);
       setHeaders(message);
       SimpleString boolProp = new SimpleString("bool.prop");
@@ -564,7 +554,6 @@
       buff.getInt();
       ProducerSendMessage copy = (ProducerSendMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(bytes.length, copy.getServerMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getServerMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getServerMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getServerMessage().getExpiration());
@@ -592,7 +581,6 @@
       ByteBufferWrapper body = new ByteBufferWrapper(ByteBuffer.allocateDirect(bytes.length));
       body.putBytes(bytes);
       body.rewind();
-      message1.setBody(body);
       PacketImpl message = new ProducerSendMessage(message1);
       setHeaders(message);
       SimpleString boolProp = new SimpleString("bool.prop");
@@ -617,7 +605,6 @@
       buff.getInt();
       ProducerSendMessage copy = (ProducerSendMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(bytes.length, copy.getServerMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getServerMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getServerMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getServerMessage().getExpiration());
@@ -640,14 +627,12 @@
    {
       ServerMessage message1 = new ServerMessageImpl();
       message1.setDestination(new SimpleString("test"));
-      message1.setBody(new ByteBufferWrapper(ByteBuffer.allocate(0)));
       PacketImpl message = new ReceiveMessage(message1, RandomUtil.randomInt(), RandomUtil.randomInt());
       setHeaders(message);
       message.encode(buff, 0);
       buff.getInt();
       ReceiveMessage copy = (ReceiveMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(0, copy.getClientMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getClientMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getClientMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getClientMessage().getExpiration());
@@ -660,14 +645,12 @@
    {
       ServerMessage message1 = new ServerMessageImpl(RandomUtil.randomLong());
       message1.setDestination(new SimpleString("test"));
-      message1.setBody(new ByteBufferWrapper(ByteBuffer.allocate(0)));
       PacketImpl message = new ReceiveMessage(message1, RandomUtil.randomInt(), RandomUtil.randomInt());
       setHeaders(message);
       message.encode(buff, 0);
       buff.getInt();
       ReceiveMessage copy = (ReceiveMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(0, copy.getClientMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getClientMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getClientMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getClientMessage().getExpiration());
@@ -680,14 +663,12 @@
    {
       ServerMessage message1 = new ServerMessageImpl(new ServerMessageImpl());
       message1.setDestination(new SimpleString("test"));
-      message1.setBody(new ByteBufferWrapper(ByteBuffer.allocate(0)));
       PacketImpl message = new ReceiveMessage(message1, RandomUtil.randomInt(), RandomUtil.randomInt());
       setHeaders(message);
       message.encode(buff, 0);
       buff.getInt();
       ReceiveMessage copy = (ReceiveMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(0, copy.getClientMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getClientMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getClientMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getClientMessage().getExpiration());
@@ -701,14 +682,12 @@
       ServerMessage message1 = new ServerMessageImpl(RandomUtil.randomByte(), RandomUtil.randomBoolean(), RandomUtil.randomLong(),
               RandomUtil.randomLong(), RandomUtil.randomByte(),new ByteBufferWrapper(ByteBuffer.allocateDirect(1024)));
       message1.setDestination(new SimpleString("test"));
-      message1.setBody(new ByteBufferWrapper(ByteBuffer.allocate(0)));
       PacketImpl message = new ReceiveMessage(message1, RandomUtil.randomInt(), RandomUtil.randomInt());
       setHeaders(message);
       message.encode(buff, 0);
       buff.getInt();
       ReceiveMessage copy = (ReceiveMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(0, copy.getClientMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getClientMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getClientMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getClientMessage().getExpiration());
@@ -727,7 +706,6 @@
       ByteBufferWrapper body = new ByteBufferWrapper(ByteBuffer.allocateDirect(bytes.length));
       body.putBytes(bytes);
       body.rewind();
-      message1.setBody(body);
       setHeaders(message);
       SimpleString boolProp = new SimpleString("bool.prop");
       message1.putBooleanProperty(boolProp, RandomUtil.randomBoolean());
@@ -751,7 +729,6 @@
       buff.getInt();
       ReceiveMessage copy = (ReceiveMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(bytes.length, copy.getClientMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getClientMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getClientMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getClientMessage().getExpiration());
@@ -779,7 +756,6 @@
       ByteBufferWrapper body = new ByteBufferWrapper(ByteBuffer.allocateDirect(bytes.length));
       body.putBytes(bytes);
       body.rewind();
-      message1.setBody(body);
       setHeaders(message);
       SimpleString boolProp = new SimpleString("bool.prop");
       message1.putBooleanProperty(boolProp, RandomUtil.randomBoolean());
@@ -803,7 +779,6 @@
       buff.getInt();
       ReceiveMessage copy = (ReceiveMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(bytes.length, copy.getClientMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getClientMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getClientMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getClientMessage().getExpiration());
@@ -831,7 +806,6 @@
       ByteBufferWrapper body = new ByteBufferWrapper(ByteBuffer.allocateDirect(bytes.length));
       body.putBytes(bytes);
       body.rewind();
-      message1.setBody(body);
       setHeaders(message);
       SimpleString boolProp = new SimpleString("bool.prop");
       message1.putBooleanProperty(boolProp, RandomUtil.randomBoolean());
@@ -855,7 +829,6 @@
       buff.getInt();
       ReceiveMessage copy = (ReceiveMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(bytes.length, copy.getClientMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getClientMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getClientMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getClientMessage().getExpiration());
@@ -884,7 +857,6 @@
       ByteBufferWrapper body = new ByteBufferWrapper(ByteBuffer.allocateDirect(bytes.length));
       body.putBytes(bytes);
       body.rewind();
-      message1.setBody(body);
       setHeaders(message);
       SimpleString boolProp = new SimpleString("bool.prop");
       message1.putBooleanProperty(boolProp, RandomUtil.randomBoolean());
@@ -908,7 +880,6 @@
       buff.getInt();
       ReceiveMessage copy = (ReceiveMessage) handler.decode(123, buff);
       checkHeaders(message, copy);
-      assertEquals(bytes.length, copy.getClientMessage().getBody().limit());
       assertEquals(message1.getDestination(), copy.getClientMessage().getDestination());
       assertEquals(message1.getEncodeSize(), copy.getClientMessage().getEncodeSize());
       assertEquals(message1.getExpiration(), copy.getClientMessage().getExpiration());

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -6,35 +6,22 @@
  */
 package org.jboss.messaging.tests.unit.jms.client;
 
-import static org.easymock.EasyMock.expect;
-import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
-import static org.jboss.messaging.tests.util.RandomUtil.randomByte;
-import static org.jboss.messaging.tests.util.RandomUtil.randomBytes;
-import static org.jboss.messaging.tests.util.RandomUtil.randomChar;
-import static org.jboss.messaging.tests.util.RandomUtil.randomDouble;
-import static org.jboss.messaging.tests.util.RandomUtil.randomFloat;
-import static org.jboss.messaging.tests.util.RandomUtil.randomInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
-import static org.jboss.messaging.tests.util.RandomUtil.randomShort;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-import static org.jboss.messaging.tests.util.UnitTestCase.assertEqualsByteArrays;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-
-import javax.jms.MessageEOFException;
-import javax.jms.MessageFormatException;
-
 import junit.framework.TestCase;
-
 import org.easymock.EasyMock;
+import static org.easymock.EasyMock.expect;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.impl.ClientMessageImpl;
-import org.jboss.messaging.core.remoting.MessagingBuffer;
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
 import org.jboss.messaging.jms.client.JBossBytesMessage;
+import static org.jboss.messaging.tests.util.RandomUtil.*;
+import static org.jboss.messaging.tests.util.UnitTestCase.assertEqualsByteArrays;
 
+import javax.jms.MessageEOFException;
+import javax.jms.MessageFormatException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * 
@@ -127,8 +114,7 @@
       boolean value = randomBoolean();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putBoolean(value);
+      message.getCoreMessage().putBoolean(value);
       message.reset();
 
       assertEquals(value, message.readBoolean());
@@ -161,8 +147,7 @@
       byte value = randomByte();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putByte(value);
+      message.getCoreMessage().putByte(value);
       message.reset();
 
       assertEquals(value, message.readByte());
@@ -197,8 +182,7 @@
       byte[] value = randomBytes();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putBytes(value);
+      message.getCoreMessage().putBytes(value);
       message.reset();
 
       byte[] v = new byte[value.length];
@@ -232,8 +216,7 @@
       short value = randomShort();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putShort(value);
+      message.getCoreMessage().putShort(value);
       message.reset();
 
       assertEquals(value, message.readShort());
@@ -266,8 +249,7 @@
       char value = randomChar();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putChar(value);
+      message.getCoreMessage().putChar(value);
       message.reset();
 
       assertEquals(value, message.readChar());
@@ -300,8 +282,7 @@
       int value = randomInt();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putInt(value);
+      message.getCoreMessage().putInt(value);
       message.reset();
 
       assertEquals(value, message.readInt());
@@ -334,8 +315,7 @@
       long value = randomLong();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putLong(value);
+      message.getCoreMessage().putLong(value);
       message.reset();
 
       assertEquals(value, message.readLong());
@@ -368,8 +348,7 @@
       float value = randomFloat();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putFloat(value);
+      message.getCoreMessage().putFloat(value);
       message.reset();
 
       assertEquals(value, message.readFloat());
@@ -402,8 +381,7 @@
       double value = randomDouble();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putDouble(value);
+      message.getCoreMessage().putDouble(value);
       message.reset();
 
       assertEquals(value, message.readDouble());
@@ -436,8 +414,7 @@
       String value = randomString();
       JBossBytesMessage message = new JBossBytesMessage();
 
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putUTF(value);
+      message.getCoreMessage().putUTF(value);
       message.reset();
 
       assertEquals(value, message.readUTF());

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageConsumerTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageConsumerTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageConsumerTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,24 +22,13 @@
 
 package org.jboss.messaging.tests.unit.jms.client;
 
+import junit.framework.TestCase;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.isA;
 import static org.easymock.classextension.EasyMock.createStrictMock;
 import static org.easymock.classextension.EasyMock.replay;
 import static org.easymock.classextension.EasyMock.verify;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-
-import javax.jms.Destination;
-import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.Session;
-
-import junit.framework.TestCase;
-
 import org.jboss.messaging.core.client.ClientConsumer;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
@@ -51,7 +40,11 @@
 import org.jboss.messaging.jms.client.JBossMessage;
 import org.jboss.messaging.jms.client.JBossMessageConsumer;
 import org.jboss.messaging.jms.client.JBossSession;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
+import javax.jms.*;
+import javax.jms.IllegalStateException;
+
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * 
@@ -351,7 +344,7 @@
       ClientMessage clientMessage = createStrictMock(ClientMessage.class);
       expect(clientMessage.getType()).andReturn(JBossMessage.TYPE);
       MessagingBuffer body = createStrictMock(MessagingBuffer.class);
-      expect(clientMessage.getBody()).andStubReturn(body );
+      //expect(clientMessage.getBody()).andStubReturn(body );
       expect(clientConsumer.receive(0)).andReturn(clientMessage );
 
       replay(session, clientSession, clientConsumer, clientMessage, body);

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,46 +22,26 @@
 
 package org.jboss.messaging.tests.unit.jms.client;
 
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.jboss.messaging.tests.util.RandomUtil.randomByte;
-import static org.jboss.messaging.tests.util.RandomUtil.randomBytes;
-import static org.jboss.messaging.tests.util.RandomUtil.randomDouble;
-import static org.jboss.messaging.tests.util.RandomUtil.randomFloat;
-import static org.jboss.messaging.tests.util.RandomUtil.randomInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
-import static org.jboss.messaging.tests.util.RandomUtil.randomShort;
-import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageFormatException;
-
 import junit.framework.TestCase;
-
 import org.easymock.EasyMock;
+import static org.easymock.EasyMock.*;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.impl.ClientMessageImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.remoting.MessagingBuffer;
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
-import org.jboss.messaging.jms.client.JBossBytesMessage;
-import org.jboss.messaging.jms.client.JBossMapMessage;
-import org.jboss.messaging.jms.client.JBossMessage;
-import org.jboss.messaging.jms.client.JBossObjectMessage;
-import org.jboss.messaging.jms.client.JBossStreamMessage;
-import org.jboss.messaging.jms.client.JBossTextMessage;
+import org.jboss.messaging.jms.client.*;
+import static org.jboss.messaging.tests.util.RandomUtil.*;
 import org.jboss.messaging.util.SimpleString;
 
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageFormatException;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * 
@@ -150,7 +130,7 @@
       clientSession = createStrictMock(ClientSession.class);
       clientMessage = createStrictMock(ClientMessage.class);
       MessagingBuffer buffer = createStrictMock(MessagingBuffer.class);
-      expect(clientMessage.getBody()).andReturn(buffer);
+      //expect(clientMessage.getBody()).andReturn(buffer);
       expect(clientMessage.getProperty(JBossMessage.JBM_MESSAGE_ID)).andReturn(
             messageID);
       replay(clientSession, clientMessage, buffer);
@@ -385,7 +365,7 @@
       clientSession = createStrictMock(ClientSession.class);
       clientMessage = createStrictMock(ClientMessage.class);
       MessagingBuffer buffer = createStrictMock(MessagingBuffer.class);
-      expect(clientMessage.getBody()).andReturn(buffer);
+      //expect(clientMessage.getBody()).andReturn(buffer);
       clientMessage.putStringProperty(JBossMessage.JBM_MESSAGE_ID,
             new SimpleString(messageID));
       replay(clientSession, clientMessage, buffer);
@@ -403,7 +383,7 @@
       clientSession = createStrictMock(ClientSession.class);
       clientMessage = createStrictMock(ClientMessage.class);
       MessagingBuffer buffer = createStrictMock(MessagingBuffer.class);
-      expect(clientMessage.getBody()).andReturn(buffer);
+      //expect(clientMessage.getBody()).andReturn(buffer);
       replay(clientSession, clientMessage, buffer);
 
       JBossMessage message = new JBossMessage(clientMessage, clientSession);
@@ -426,7 +406,7 @@
       clientSession = createStrictMock(ClientSession.class);
       clientMessage = createStrictMock(ClientMessage.class);
       MessagingBuffer buffer = createStrictMock(MessagingBuffer.class);
-      expect(clientMessage.getBody()).andReturn(buffer);
+      //expect(clientMessage.getBody()).andReturn(buffer);
       expect(clientMessage.removeProperty(JBossMessage.JBM_MESSAGE_ID))
             .andReturn(null);
       replay(clientSession, clientMessage, buffer);
@@ -1321,7 +1301,7 @@
       clientMessage = createStrictMock(ClientMessage.class);
       clientSession = createStrictMock(ClientSession.class);
       MessagingBuffer buffer = createStrictMock(MessagingBuffer.class);
-      expect(clientMessage.getBody()).andReturn(buffer);
+      //expect(clientMessage.getBody()).andReturn(buffer);
       clientSession.commit();
       replay(clientMessage, clientSession, buffer);
       
@@ -1336,7 +1316,7 @@
       clientMessage = createStrictMock(ClientMessage.class);
       clientSession = createStrictMock(ClientSession.class);
       MessagingBuffer buffer = createStrictMock(MessagingBuffer.class);
-      expect(clientMessage.getBody()).andReturn(buffer);
+      //expect(clientMessage.getBody()).andReturn(buffer);
       clientSession.commit();
       EasyMock.expectLastCall().andThrow(new MessagingException());
       replay(clientMessage, clientSession, buffer);
@@ -1374,7 +1354,7 @@
       clientMessage = createStrictMock(ClientMessage.class);
       MessagingBuffer buffer = createStrictMock(MessagingBuffer.class);
       expect(clientMessage.getType()).andReturn(expectedType);
-      expect(clientMessage.getBody()).andReturn(buffer);
+      //expect(clientMessage.getBody()).andReturn(buffer);
       replay(clientSession, clientMessage, buffer);
 
       JBossMessage message = JBossMessage.createMessage(clientMessage,

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,32 +22,25 @@
 
 package org.jboss.messaging.tests.unit.jms.client;
 
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.*;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.impl.ClientMessageImpl;
+import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.jms.client.JBossObjectMessage;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 import static org.jboss.messaging.tests.util.UnitTestCase.assertEqualsByteArrays;
 
+import javax.jms.DeliveryMode;
+import javax.jms.ObjectMessage;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.nio.ByteBuffer;
 import java.util.Collections;
 
-import javax.jms.DeliveryMode;
-import javax.jms.ObjectMessage;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.jboss.messaging.core.client.ClientMessage;
-import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.impl.ClientMessageImpl;
-import org.jboss.messaging.core.remoting.MessagingBuffer;
-import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
-import org.jboss.messaging.jms.client.JBossObjectMessage;
-
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  *
@@ -130,10 +123,9 @@
 
       msg.doBeforeSend();
 
-      MessagingBuffer body = msg.getCoreMessage().getBody();
-      assertEquals(data.length, body.getInt());
+      assertEquals(data.length, msg.getCoreMessage().getInt());
       byte[] bytes = new byte[data.length];
-      body.getBytes(bytes);
+      msg.getCoreMessage().getBytes(bytes);
 
       assertEqualsByteArrays(data, bytes);
    }
@@ -147,10 +139,9 @@
       byte[] data = baos.toByteArray();
       
       JBossObjectMessage message = new JBossObjectMessage();
-      MessagingBuffer body = message.getCoreMessage().getBody();
-      body.putInt(data.length);
-      body.putBytes(data);
-      body.flip();
+      message.getCoreMessage().putInt(data.length);
+      message.getCoreMessage().putBytes(data);
+      //body.flip();
       
       message.doBeforeReceive();
       

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossQueueBrowserTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossQueueBrowserTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossQueueBrowserTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,21 +22,8 @@
 
 package org.jboss.messaging.tests.unit.jms.client;
 
-import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-
-import java.util.Enumeration;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Queue;
-
 import junit.framework.TestCase;
-
+import static org.easymock.EasyMock.*;
 import org.jboss.messaging.core.client.ClientBrowser;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.exception.MessagingException;
@@ -44,7 +31,13 @@
 import org.jboss.messaging.jms.JBossQueue;
 import org.jboss.messaging.jms.client.JBossMessage;
 import org.jboss.messaging.jms.client.JBossQueueBrowser;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Queue;
+import java.util.Enumeration;
+
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * 
@@ -175,7 +168,7 @@
       clientBrowser.reset();
       expect(clientBrowser.hasNextMessage()).andReturn(true);
       expect(clientMessage.getType()).andReturn(JBossMessage.TYPE);
-      expect(clientMessage.getBody()).andStubReturn(buffer);
+      //expect(clientMessage.getBody()).andStubReturn(buffer);
       expect(clientBrowser.nextMessage()).andReturn(clientMessage);
       expect(clientBrowser.hasNextMessage()).andReturn(false);
       replay(clientMessage, clientBrowser);

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,28 +22,21 @@
 
 package org.jboss.messaging.tests.unit.jms.client;
 
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-
-import javax.jms.DeliveryMode;
-import javax.jms.TextMessage;
-
 import junit.framework.TestCase;
-
 import org.easymock.EasyMock;
+import static org.easymock.EasyMock.*;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.impl.ClientMessageImpl;
-import org.jboss.messaging.core.remoting.MessagingBuffer;
 import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
 import org.jboss.messaging.jms.client.JBossTextMessage;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
+import javax.jms.DeliveryMode;
+import javax.jms.TextMessage;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * 
@@ -120,8 +113,7 @@
       
       msg.doBeforeSend();
 
-      MessagingBuffer body = msg.getCoreMessage().getBody();
-      String s = body.getNullableString();
+      String s = msg.getCoreMessage().getNullableString();
       assertEquals(text, s);
    }
    
@@ -129,9 +121,7 @@
    {
       JBossTextMessage msg = new JBossTextMessage();
       assertNull(msg.getText());
-      MessagingBuffer body = msg.getCoreMessage().getBody();
-      body.putNullableString(text);
-      body.flip();
+      msg.getCoreMessage().putNullableString(text);
       
       msg.doBeforeReceive();
       

Modified: branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
===================================================================
--- branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java	2008-08-01 13:28:18 UTC (rev 4763)
+++ branches/Branch_Message_Chunking_new/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java	2008-08-01 14:58:09 UTC (rev 4764)
@@ -22,24 +22,7 @@
 
 package org.jboss.messaging.tests.util;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.AbstractExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import javax.transaction.xa.Xid;
-
 import junit.framework.TestCase;
-
 import org.easymock.EasyMock;
 import org.easymock.IArgumentMatcher;
 import org.jboss.messaging.core.exception.MessagingException;
@@ -49,6 +32,15 @@
 import org.jboss.messaging.core.server.ServerMessage;
 import org.jboss.messaging.core.server.impl.ServerMessageImpl;
 
+import javax.transaction.xa.Xid;
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.AbstractExecutorService;
+import java.util.concurrent.TimeUnit;
+
 /**
  * 
  * Helper base class for our unit tests
@@ -338,7 +330,7 @@
       
       //message.setPayload(bytes);
       
-      message.getBody().putString(UUID.randomUUID().toString());
+      message.putString(UUID.randomUUID().toString());
       
       return message;
    }




More information about the jboss-cvs-commits mailing list