@Test(timeout = 60000)
  public void testSendMessageWithStandardHeadersEncoded() throws Exception {

    MessageConsumer consumer = session.createConsumer(queue);

    String frame =
        "CONNECT\n"
            + "login:system\n"
            + "passcode:manager\n"
            + "accept-version:1.1"
            + "\n\n"
            + Stomp.NULL;
    stompConnection.sendFrame(frame);

    frame = stompConnection.receiveFrame();
    assertTrue(frame.startsWith("CONNECTED"));

    frame =
        "SEND\n"
            + "correlation-id:c1\\:\\n\\23\n"
            + "priority:3\n"
            + "type:t34:5\n"
            + "JMSXGroupID:abc\n"
            + "foo:a\\bc\n"
            + "bar:123\n"
            + "destination:/queue/"
            + getQueueName()
            + "\n\n"
            + "Hello World"
            + Stomp.NULL;

    stompConnection.sendFrame(frame);

    TextMessage message = (TextMessage) consumer.receive(2500);
    assertNotNull(message);
    assertEquals("Hello World", message.getText());
    assertEquals("JMSCorrelationID", "c1\\:\n\\23", message.getJMSCorrelationID());
    assertEquals("getJMSType", "t34:5", message.getJMSType());
    assertEquals("getJMSPriority", 3, message.getJMSPriority());
    assertEquals("foo", "a\\bc", message.getStringProperty("foo"));
    assertEquals("bar", "123", message.getStringProperty("bar"));

    assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
    ActiveMQTextMessage amqMessage = (ActiveMQTextMessage) message;
    assertEquals("GroupID", "abc", amqMessage.getGroupID());
  }
Exemple #2
0
  public void testSendMessageWithLongHeaders() throws Exception {
    MessageConsumer consumer = session.createConsumer(queue);

    String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL;
    sendFrame(frame);

    frame = receiveFrame(10000);
    Assert.assertTrue(frame.startsWith("CONNECTED"));

    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < 1024; i++) {
      buffer.append("a");
    }
    String longHeader = "longHeader:" + buffer.toString() + "\n";

    frame =
        "SEND\n"
            + "correlation-id:c123\n"
            + "persistent:true\n"
            + "priority:3\n"
            + "type:t345\n"
            + "JMSXGroupID:abc\n"
            + "foo:abc\n"
            + longHeader
            + "destination:"
            + getQueuePrefix()
            + getQueueName()
            + "\n\n"
            + "Hello World"
            + Stomp.NULL;

    sendFrame(frame);

    TextMessage message = (TextMessage) consumer.receive(1000);
    Assert.assertNotNull(message);
    Assert.assertEquals("Hello World", message.getText());
    Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
    Assert.assertEquals("getJMSType", "t345", message.getJMSType());
    Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
    Assert.assertEquals(DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
    Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
    Assert.assertEquals("longHeader", 1024, message.getStringProperty("longHeader").length());

    Assert.assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
  }
Exemple #3
0
  public void testSendMessageWithStandardHeaders() throws Exception {

    MessageConsumer consumer = session.createConsumer(queue);

    String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL;
    sendFrame(frame);

    frame = receiveFrame(10000);
    Assert.assertTrue(frame.startsWith("CONNECTED"));

    frame =
        "SEND\n"
            + "correlation-id:c123\n"
            + "persistent:true\n"
            + "priority:3\n"
            + "type:t345\n"
            + "JMSXGroupID:abc\n"
            + "foo:abc\n"
            + "bar:123\n"
            + "destination:"
            + getQueuePrefix()
            + getQueueName()
            + "\n\n"
            + "Hello World"
            + Stomp.NULL;

    sendFrame(frame);

    TextMessage message = (TextMessage) consumer.receive(1000);
    Assert.assertNotNull(message);
    Assert.assertEquals("Hello World", message.getText());
    Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
    Assert.assertEquals("getJMSType", "t345", message.getJMSType());
    Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
    Assert.assertEquals(DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
    Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
    Assert.assertEquals("bar", "123", message.getStringProperty("bar"));

    Assert.assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
    // FIXME do we support it?
    // Assert.assertEquals("GroupID", "abc", amqMessage.getGroupID());
  }