Examples of StreamMessageImpl


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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

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

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

Examples of org.exolab.jms.message.StreamMessageImpl

     * @throws JMSException if the JMS provider fails to create this message due
     *                      to some internal error.
     */
    public StreamMessage createStreamMessage() throws JMSException {
        ensureOpen();
        return new StreamMessageImpl();
    }
View Full Code Here

Examples of org.exolab.jms.message.StreamMessageImpl

     *
     * @return a new message
     * @throws JMSException for any JMS error
     */
    protected Message newMessage() throws JMSException {
        return new StreamMessageImpl();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.