Package org.activemq.message

Examples of org.activemq.message.ActiveMQBytesMessage


  public ActiveMQBytesMessageReaderTest(String arg0) {
    super(arg0);
  }

  public void testGetPacketType() {
    ActiveMQBytesMessage msg = new ActiveMQBytesMessage();
    assertTrue(msg.getPacketType() == Packet.ACTIVEMQ_BYTES_MESSAGE);
  }
View Full Code Here


  public void testReadPacket() {
        DefaultWireFormat wf = new DefaultWireFormat();
    ActiveMQBytesMessageReader reader = new ActiveMQBytesMessageReader(wf);
    ActiveMQBytesMessageWriter writer = new ActiveMQBytesMessageWriter(wf);
    ActiveMQBytesMessage msg1 = new ActiveMQBytesMessage();
    try {
      msg1.setBodyAsBytes(testdata,0,testdata.length);
      super.initializeMessage(msg1);
      byte[] data = writer.writePacketToByteArray(msg1);
      ActiveMQBytesMessage msg2 = (ActiveMQBytesMessage) reader.readPacketFromByteArray(data);
      super.testEquals(msg1, msg2);
      ByteArray d2 = msg2.getBodyAsBytes();
      assertTrue(d2.getLength()==testdata.length);
      for(int i = 0; i < testdata.length; i++)
      assertTrue(d2.get(i)==testdata[i]);
    }
    catch (IOException e) {
View Full Code Here

 
  public void testTime(){
        DefaultWireFormat wf = new DefaultWireFormat();
    ActiveMQBytesMessageReader reader = new ActiveMQBytesMessageReader(wf);
    ActiveMQBytesMessageWriter writer = new ActiveMQBytesMessageWriter(wf);
    ActiveMQBytesMessage msg1 = new ActiveMQBytesMessage();
   
    ActiveMQBytesMessage msg2 = null;
    try {
      int count = 10000;
      long startTime = System.currentTimeMillis();
      msg1.setBodyAsBytes(this.testdata,0,this.testdata.length);
      super.initializeMessage(msg1);
View Full Code Here

     * @return the an ActiveMQBytesMessage
     * @throws JMSException if the JMS provider fails to create this message due to some internal error.
     */
    public BytesMessage createBytesMessage() throws JMSException {
        checkClosed();
        return new ActiveMQBytesMessage();
    }
View Full Code Here

     * @return the an ActiveMQBytesMessage
     * @throws JMSException if the JMS provider fails to create this message due to some internal error.
     */
    public BytesMessage createBytesMessage() throws JMSException {
        checkClosed();
        return new ActiveMQBytesMessage();
    }
View Full Code Here

        return buf.length - count;
    }
   
    private void writeBuffer(byte[] buf,int offset, int length) throws IOException{
        try {
        BytesMessage message = new ActiveMQBytesMessage();
        message.writeBytes(buf,offset,length);
        producer.send(message);
        }catch(JMSException jmsEx){
            IOException ioEx = new IOException(jmsEx.getMessage());
            throw ioEx;
        }
View Full Code Here

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

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

     * @return the an ActiveMQBytesMessage
     * @throws JMSException if the JMS provider fails to create this message due to some internal error.
     */
    public BytesMessage createBytesMessage() throws JMSException {
        checkClosed();
        return new ActiveMQBytesMessage();
    }
View Full Code Here

  public ActiveMQBytesMessageReaderTest(String arg0) {
    super(arg0);
  }

  public void testGetPacketType() {
    ActiveMQBytesMessage msg = new ActiveMQBytesMessage();
    assertTrue(msg.getPacketType() == Packet.ACTIVEMQ_BYTES_MESSAGE);
  }
View Full Code Here

  public void testReadPacket() {
        DefaultWireFormat wf = new DefaultWireFormat();
    ActiveMQBytesMessageReader reader = new ActiveMQBytesMessageReader(wf);
    ActiveMQBytesMessageWriter writer = new ActiveMQBytesMessageWriter(wf);
    ActiveMQBytesMessage msg1 = new ActiveMQBytesMessage();
    try {
      msg1.setBodyAsBytes(testdata,0,testdata.length);
      super.initializeMessage(msg1);
      byte[] data = writer.writePacketToByteArray(msg1);
      ActiveMQBytesMessage msg2 = (ActiveMQBytesMessage) reader.readPacketFromByteArray(data);
      super.testEquals(msg1, msg2);
      ByteArray d2 = msg2.getBodyAsBytes();
      assertTrue(d2.getLength()==testdata.length);
      for(int i = 0; i < testdata.length; i++)
      assertTrue(d2.get(i)==testdata[i]);
    }
    catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.activemq.message.ActiveMQBytesMessage

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.