Package org.activemq.message

Examples of org.activemq.message.ActiveMQStreamMessage


    }
  }

  public void testReadObject()
  {
    ActiveMQStreamMessage msg = new ActiveMQStreamMessage();
    try {
      byte testByte = (byte)2;
      msg.writeByte(testByte);
      msg.reset();
      assertTrue(((Byte)msg.readObject()).byteValue()==testByte);
      msg.clearBody();
     
      short testShort = 3;
      msg.writeShort(testShort);
      msg.reset();
      assertTrue(((Short)msg.readObject()).shortValue()==testShort);
      msg.clearBody();
     
      int testInt = 4;
      msg.writeInt(testInt);
      msg.reset();
      assertTrue(((Integer)msg.readObject()).intValue()==testInt);
      msg.clearBody();
     
      long testLong = 6l;
      msg.writeLong(testLong);
      msg.reset();
      assertTrue(((Long)msg.readObject()).longValue()==testLong);
      msg.clearBody();
     
      float testFloat = 6.6f;
      msg.writeFloat(testFloat);
      msg.reset();
      assertTrue(((Float)msg.readObject()).floatValue()==testFloat);
      msg.clearBody();
     
      double testDouble = 7.7d;
      msg.writeDouble(testDouble);
      msg.reset();
      assertTrue(((Double)msg.readObject()).doubleValue()==testDouble);
      msg.clearBody();
     
      char testChar = 'z';
      msg.writeChar(testChar);
      msg.reset();
      assertTrue(((Character)msg.readObject()).charValue()==testChar);
      msg.clearBody();
     
      byte[] data = new byte[50];
      for(int i = 0; i < data.length;i++){
        data[i] = (byte)i;
      }
      msg.writeBytes(data);
      msg.reset();
      byte[] valid = (byte[])msg.readObject();
      assertTrue(valid.length==data.length);
      for(int i =0; i < valid.length;i++){
        assertTrue(valid[i]==data[i]);
      }
      msg.clearBody();
      msg.writeBoolean(true);
      msg.reset();
      assertTrue(((Boolean)msg.readObject()).booleanValue());
     
     
    }catch(JMSException jmsEx){
      jmsEx.printStackTrace();
      assertTrue(false);
View Full Code Here


    /**
     * @return a new Packet instance
     */

    public Packet createPacket() {
        return new ActiveMQStreamMessage();
    }
View Full Code Here

TOP

Related Classes of org.activemq.message.ActiveMQStreamMessage

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.