Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ActiveMQStreamMessageWriter


    assertTrue(msg.getPacketType() == Packet.ACTIVEMQ_STREAM_MESSAGE);
  }

  public void testReadPacket() {
    ActiveMQStreamMessageReader reader = new ActiveMQStreamMessageReader();
    ActiveMQStreamMessageWriter writer = new ActiveMQStreamMessageWriter();
    ActiveMQStreamMessage msg1 = new ActiveMQStreamMessage();
    try {
      msg1.setBooleanProperty("booleanprop",true);
      msg1.setLongProperty("longproperty",67l);
      msg1.setFloatProperty("floatproperty",4.6f);
      super.initializeMessage(msg1);
      byte[] data = writer.writePacketToByteArray(msg1);
      ActiveMQStreamMessage msg2 = (ActiveMQStreamMessage) reader.readPacketFromByteArray(data);
      super.testEquals(msg1, msg2);
      for (Enumeration e = msg1.getPropertyNames();e.hasMoreElements();){
        String name = e.nextElement().toString();
        assertTrue(msg1.getObjectProperty(name).equals(msg2.getObjectProperty(name)));
View Full Code Here


  }
 
  public void testTime(){

    ActiveMQStreamMessageReader reader = new ActiveMQStreamMessageReader();
    ActiveMQStreamMessageWriter writer = new ActiveMQStreamMessageWriter();
    ActiveMQStreamMessage msg1 = new ActiveMQStreamMessage();
   
    ActiveMQStreamMessage msg2 = null;
    try {
      int count = 10000;
      long startTime = System.currentTimeMillis();
   
      msg1.setBooleanProperty("booleanprop",true);
      msg1.setLongProperty("longproperty",67l);
      msg1.setFloatProperty("floatproperty",4.6f);
      super.initializeMessage(msg1);
      for (int i = 0; i < count; i++){
        byte[] data = writer.writePacketToByteArray(msg1);
        msg2 = (ActiveMQStreamMessage) reader.readPacketFromByteArray(data);
      }
      long finishTime = System.currentTimeMillis();
      long totalTime = finishTime-startTime;
      long ps = (count * 1000)/totalTime;
 
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.ActiveMQStreamMessageWriter

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.