Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ActiveMQTextMessage


        container.addMessage(message);
        messageIdenties[i] = message.getJMSMessageIdentity();
    }

    protected void readMessage(int i) throws JMSException {
        ActiveMQTextMessage message = (ActiveMQTextMessage) container.getMessage(messageIdenties[i]);
        assertTrue("Message should not be null", message != null);

        String text = message.getText();
        assertEquals("Message text should be equal", messageTexts[i], text);
        assertEquals(messageIds[i], message.getJMSMessageID());
    }
View Full Code Here


        ActiveMQMessage message = container.getMessage(messageIdenties[i]);
        assertTrue("Message should be null", message == null);
    }

    protected ActiveMQMessage createMessage(int i) throws JMSException {
        ActiveMQTextMessage answer = new ActiveMQTextMessage();
        String text = "Message: " + i;
        messageTexts[i] = text;
        answer.setText(text);
        return answer;
    }
View Full Code Here

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

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

  }

  public void testReadPacket() {
    ActiveMQTextMessageReader reader = new ActiveMQTextMessageReader();
    ActiveMQTextMessageWriter writer = new ActiveMQTextMessageWriter();
    ActiveMQTextMessage msg1 = new ActiveMQTextMessage();
    try {
      msg1.setText(this.testStr);
      super.initializeMessage(msg1);
      byte[] data = writer.writePacketToByteArray(msg1);
      ActiveMQTextMessage msg2 = (ActiveMQTextMessage) reader.readPacketFromByteArray(data);
      super.testEquals(msg1, msg2);
      assertTrue(msg1.getText().equals(msg2.getText()));
    }
    catch (IOException e) {
      e.printStackTrace();
      assertTrue(false);
    }
View Full Code Here

 
  public void testTime(){

    ActiveMQTextMessageReader reader = new ActiveMQTextMessageReader();
    ActiveMQTextMessageWriter writer = new ActiveMQTextMessageWriter();
    ActiveMQTextMessage msg1 = new ActiveMQTextMessage();
   
    ActiveMQTextMessage msg2 = null;
    try {
      int count = 10000;
      long startTime = System.currentTimeMillis();
      //msg1.setText(this.testStr);
      msg1.setText("this is a test str");
View Full Code Here

        message.setJMSMessageID(id);
        messageIdenties[i] = container.addMessage(message);
    }

    protected void readMessage(int i) throws JMSException {
        ActiveMQTextMessage message = (ActiveMQTextMessage) container.getMessage(messageIdenties[i]);
        assertTrue("Message should not be null", message != null);

        String text = message.getText();
        assertEquals("Message text should be equal", messageTexts[i], text);
    }
View Full Code Here

        ActiveMQMessage message = container.getMessage(messageIdenties[i]);
        assertTrue("Message should be null", message == null);
    }

    protected ActiveMQMessage createMessage(int i) throws JMSException {
        ActiveMQTextMessage answer = new ActiveMQTextMessage();
        String text = "Message: " + i;
        messageTexts[i] = text;
        answer.setText(text);
        return answer;
    }
View Full Code Here

*/
public class JabberWireFormatTest extends TestCase {
    protected WireFormat format = new JabberWireFormat();

    public void testWrite() throws Exception {
        ActiveMQTextMessage message = new ActiveMQTextMessage();
        message.setJMSType("id");
        message.setJMSReplyTo(new ActiveMQTopic("my.source"));
        message.setJMSDestination(new ActiveMQTopic("my.target"));
        message.setJMSCorrelationID("abc123");
        message.setText("<body>hello there </body>");

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(buffer);
        format.writePacket(message, out);
        out.close();
View Full Code Here

        answer.addPostCommitTask(new SendMessageTransactionTask(null, createMessage()));
        return answer;
    }

    protected ActiveMQMessage createMessage() throws JMSException {
        ActiveMQTextMessage answer = new ActiveMQTextMessage();
        answer.setJMSMessageID("abc:123");
        answer.setText("I'm a test message!");
        return answer;
    }
View Full Code Here

        }
        return messages[i];
    }

    protected ActiveMQMessage createMessage(int i) throws JMSException {
        ActiveMQTextMessage answer = new ActiveMQTextMessage();
        answer.setJMSMessageID(idGenerator.generateId());
        answer.setJMSClientID(getClientID());
        answer.setJMSDestination(destination);
        answer.setText("message index: " + i);
        return answer;
    }
View Full Code Here

TOP

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

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.