Package net.timewalker.ffmq3.common.message

Examples of net.timewalker.ffmq3.common.message.StreamMessageImpl


*/
public class StreamMessageImplTest extends TestCase
{
  public void testBooleanConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    assertTrue(msg.readBoolean());
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    try { msg.readByte(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertTrue(msg.readBoolean());
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    try { msg.readShort(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.readBoolean());

    // Char
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertTrue(msg.readBoolean());
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    try { msg.readInt(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.readBoolean());
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    try { msg.readLong(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.readBoolean());
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    try { msg.readFloat(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.readBoolean());
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    try { msg.readDouble(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertTrue(msg.readBoolean());
   
    // String
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    assertEquals("true",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeBoolean(true);
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertTrue(msg.readBoolean());
  }
 
View Full Code Here


    assertEquals(123,msg.readLong());
  }
 
  public void testFloatConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    try { msg.readBoolean(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23f,msg.readFloat(),0);
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    try { msg.readByte(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23f,msg.readFloat(),0);
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    try { msg.readShort(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23f,msg.readFloat(),0);
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23f,msg.readFloat(),0);
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    try { msg.readInt(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(1.23f,msg.readFloat(),0);
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    try { msg.readLong(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(1.23f,msg.readFloat(),0);
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    assertEquals(1.23f,msg.readFloat(),0);
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    assertEquals(1.23,msg.readDouble(),0.0000001);
   
    // String
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    assertEquals("1.23",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeFloat(1.23f);
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23f,msg.readFloat(),0);
  }
 
View Full Code Here

    assertEquals(1.23f,msg.readFloat(),0);
  }
 
  public void testDoubleConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    try { msg.readBoolean(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23,msg.readDouble(),0);
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    try { msg.readByte(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23,msg.readDouble(),0);
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    try { msg.readShort(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23,msg.readDouble(),0);
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23,msg.readDouble(),0);
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    try { msg.readInt(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(1.23,msg.readDouble(),0);
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    try { msg.readLong(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(1.23,msg.readDouble(),0);
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    try { msg.readFloat(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(1.23,msg.readDouble(),0);
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    assertEquals(1.23,msg.readDouble(),0.0000001);
   
    // String
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    assertEquals("1.23",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeDouble(1.23);
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(1.23,msg.readDouble(),0);
  }
 
View Full Code Here

    assertEquals(1.23,msg.readDouble(),0);
  }
 
  public void testStringConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    assertFalse(msg.readBoolean());
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    try { msg.readByte(); fail("Should have failed"); } catch (NumberFormatException e) { /* OK */  }
    assertEquals("foobar",msg.readString());
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    try { msg.readShort(); fail("Should have failed"); } catch (NumberFormatException e) { /* OK */  }
    assertEquals("foobar",msg.readString());
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals("foobar",msg.readString());
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    try { msg.readInt(); fail("Should have failed"); } catch (NumberFormatException e) { /* OK */ }
    assertEquals("foobar",msg.readString());
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    try { msg.readLong(); fail("Should have failed"); } catch (NumberFormatException e) { /* OK */ }
    assertEquals("foobar",msg.readString());
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    try { msg.readFloat(); fail("Should have failed"); } catch (NumberFormatException e) { /* OK */ }
    assertEquals("foobar",msg.readString());
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    try { msg.readDouble(); fail("Should have failed"); } catch (NumberFormatException e) { /* OK */ }
    assertEquals("foobar",msg.readString());
   
    // String
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    assertEquals("foobar",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeString("foobar");
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals("foobar",msg.readString());
  }
 
View Full Code Here

    assertTrue(msg.readBoolean());
  }

  public void testByteConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    try { msg.readBoolean(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readByte());
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readByte());
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readShort());
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readByte());
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readInt());
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readLong());
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    try { msg.readFloat(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readByte());
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    try { msg.readDouble(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readByte());
   
    // String
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    assertEquals("123",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeByte((byte)123);
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readByte());
  }
 
View Full Code Here

    assertEquals(123,msg.readByte());
  }
 
  public void testShortConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    try { msg.readBoolean(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readShort());
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    try { msg.readByte(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readShort());
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readShort());
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readShort());
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readInt());
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readLong());
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    try { msg.readFloat(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readShort());
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    try { msg.readDouble(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readShort());
   
    // String
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    assertEquals("123",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeShort((short)123);
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readShort());
  }
 
View Full Code Here

    assertEquals(123,msg.readShort());
  }
 
  public void testCharConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    try { msg.readBoolean(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals('c',msg.readChar());
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    try { msg.readByte(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals('c',msg.readChar());
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    try { msg.readShort(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals('c',msg.readChar());
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    assertEquals('c',msg.readChar());
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    try { msg.readInt(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals('c',msg.readChar());
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    try { msg.readLong(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals('c',msg.readChar());
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    try { msg.readFloat(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals('c',msg.readChar());
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    try { msg.readDouble(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals('c',msg.readChar());
   
    // String
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    assertEquals("c",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeChar('c');
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals('c',msg.readChar());
  }
 
View Full Code Here

    assertEquals('c',msg.readChar());
  }
 
  public void testIntConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    try { msg.readBoolean(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readInt());
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    try { msg.readByte(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readInt());
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    try { msg.readShort(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readInt());
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readInt());
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readInt());
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readLong());
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    try { msg.readFloat(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readInt());
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    try { msg.readDouble(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readInt());
   
    // String
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    assertEquals("123",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeInt(123);
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readInt());
  }
 
View Full Code Here

    assertEquals(123,msg.readInt());
  }
 
  public void testLongConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    try { msg.readBoolean(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readLong());
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    try { msg.readByte(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readLong());
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    try { msg.readShort(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readLong());
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readLong());
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    try { msg.readInt(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readLong());
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    assertEquals(123,msg.readLong());
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    try { msg.readFloat(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readLong());
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    try { msg.readDouble(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */ }
    assertEquals(123,msg.readLong());
   
    // String
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    assertEquals("123",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeLong(123);
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals(123,msg.readLong());
  }
 
View Full Code Here

    assertEquals("foobar",msg.readString());
  }
 
  public void testNumericStringConversion() throws Exception
  {
    StreamMessageImpl msg;
   
    // Boolean
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    assertFalse(msg.readBoolean());
   
    // Byte
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    assertEquals((byte)123,msg.readByte());
   
    // Short
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    assertEquals(123,msg.readShort());
   
    // Char
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    try { msg.readChar(); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals("123",msg.readString());
   
    // Int
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    assertEquals(123,msg.readInt());
   
    // Long
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    assertEquals(123,msg.readLong());
   
    // Float
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    assertEquals(123,msg.readFloat(),0);
   
    // Double
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    assertEquals(123,msg.readDouble(),0);
   
    // String
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    assertEquals("123",msg.readString());
   
    // Bytes
    msg = new StreamMessageImpl();
    msg.writeString("123");
    msg.markAsReadOnly();
    try { msg.readBytes(new byte[1]); fail("Should have failed"); } catch (MessageFormatException e) { /* OK */  }
    assertEquals("123",msg.readString());
  }
 
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.common.message.StreamMessageImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.