Search in sources :

Example 36 with ActiveMQDestination

use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.

the class DestinationMapTest method assertMapValue.

protected void assertMapValue(String destinationName, Object expected) {
    ActiveMQDestination destination = createDestination(destinationName);
    assertMapValue(destination, expected);
}
Also used : ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination)

Example 37 with ActiveMQDestination

use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.

the class DestinationMapTest method testCompositeDestinations.

public void testCompositeDestinations() throws Exception {
    ActiveMQDestination d1 = createDestination("TEST.BAR.D2");
    ActiveMQDestination d2 = createDestination("TEST.BAR.D3");
    map.put(d1, d1);
    map.put(d2, d2);
    map.get(createDestination("TEST.BAR.D2,TEST.BAR.D3"));
}
Also used : ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination)

Example 38 with ActiveMQDestination

use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.

the class JmsTopicWildcardSendReceiveTest method testReceiveWildcardTopicMidAsterisk.

@Test
public void testReceiveWildcardTopicMidAsterisk() throws Exception {
    connection.start();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    ActiveMQDestination destination1 = (ActiveMQDestination) session.createTopic(destination1String);
    ActiveMQDestination destination4 = (ActiveMQDestination) session.createTopic(destination4String);
    Message m = null;
    MessageConsumer consumer = null;
    String text = null;
    ActiveMQDestination destination8 = (ActiveMQDestination) session.createTopic("TEST.*.ONE");
    consumer = session.createConsumer(destination8);
    sendMessage(session, destination1, destination1String);
    sendMessage(session, destination4, destination4String);
    m = consumer.receive(1000);
    assertNotNull(m);
    text = ((TextMessage) m).getText();
    if (!(text.equals(destination1String) || text.equals(destination4String))) {
        fail("unexpected message:" + text);
    }
    m = consumer.receive(1000);
    assertNotNull(m);
    text = ((TextMessage) m).getText();
    if (!(text.equals(destination1String) || text.equals(destination4String))) {
        fail("unexpected message:" + text);
    }
    assertNull(consumer.receiveNoWait());
}
Also used : MessageConsumer(javax.jms.MessageConsumer) TextMessage(javax.jms.TextMessage) Message(javax.jms.Message) Session(javax.jms.Session) ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination) Test(org.junit.Test)

Example 39 with ActiveMQDestination

use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.

the class JmsTopicWildcardSendReceiveTest method testReceiveWildcardTopicEndGreaterThan.

@Test
public void testReceiveWildcardTopicEndGreaterThan() throws Exception {
    connection.start();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    ActiveMQDestination destination1 = (ActiveMQDestination) session.createTopic(destination1String);
    ActiveMQDestination destination2 = (ActiveMQDestination) session.createTopic(destination2String);
    ActiveMQDestination destination3 = (ActiveMQDestination) session.createTopic(destination3String);
    Message m = null;
    MessageConsumer consumer = null;
    String text = null;
    ActiveMQDestination destination7 = (ActiveMQDestination) session.createTopic("TEST.ONE.>");
    consumer = session.createConsumer(destination7);
    sendMessage(session, destination1, destination1String);
    sendMessage(session, destination2, destination2String);
    sendMessage(session, destination3, destination3String);
    m = consumer.receive(1000);
    assertNotNull(m);
    text = ((TextMessage) m).getText();
    if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
        fail("unexpected message:" + text);
    }
    m = consumer.receive(1000);
    assertNotNull(m);
    if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
        fail("unexpected message:" + text);
    }
    m = consumer.receive(1000);
    assertNotNull(m);
    if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
        fail("unexpected message:" + text);
    }
    assertNull(consumer.receiveNoWait());
}
Also used : MessageConsumer(javax.jms.MessageConsumer) TextMessage(javax.jms.TextMessage) Message(javax.jms.Message) Session(javax.jms.Session) ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination) Test(org.junit.Test)

Example 40 with ActiveMQDestination

use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.

the class JmsTopicWildcardSendReceiveTest method testReceiveWildcardTopicMatchSinglePastTheEndWildcard.

@Test
public void testReceiveWildcardTopicMatchSinglePastTheEndWildcard() throws Exception {
    connection.start();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    ActiveMQDestination destination1 = (ActiveMQDestination) session.createTopic("a.>");
    ActiveMQDestination destination2 = (ActiveMQDestination) session.createTopic("a");
    Message m = null;
    MessageConsumer consumer = null;
    String text = null;
    consumer = session.createConsumer(destination1);
    sendMessage(session, destination2, destination3String);
    m = consumer.receive(1000);
    assertNotNull(m);
    text = ((TextMessage) m).getText();
    if (!(text.equals(destination1String) || text.equals(destination3String))) {
        fail("unexpected message:" + text);
    }
    assertNull(consumer.receiveNoWait());
}
Also used : MessageConsumer(javax.jms.MessageConsumer) TextMessage(javax.jms.TextMessage) Message(javax.jms.Message) Session(javax.jms.Session) ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination) Test(org.junit.Test)

Aggregations

ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)165 Session (javax.jms.Session)62 MessageConsumer (javax.jms.MessageConsumer)49 Message (org.apache.activemq.command.Message)46 ConsumerInfo (org.apache.activemq.command.ConsumerInfo)45 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)44 SessionInfo (org.apache.activemq.command.SessionInfo)44 ProducerInfo (org.apache.activemq.command.ProducerInfo)42 Test (org.junit.Test)41 Message (javax.jms.Message)40 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)40 TextMessage (javax.jms.TextMessage)31 BasicOpenWireTest (org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest)24 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)22 MessageProducer (javax.jms.MessageProducer)18 XATransactionId (org.apache.activemq.command.XATransactionId)15 CountDownLatch (java.util.concurrent.CountDownLatch)14 ActiveMQMessageProducer (org.apache.activemq.ActiveMQMessageProducer)12 MessageAck (org.apache.activemq.command.MessageAck)12 ActiveMQMessageConsumer (org.apache.activemq.ActiveMQMessageConsumer)11