use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class JmsTopicWildcardSendReceiveTest method testReceiveWildcardTopicMatchDoubleWildcard.
public void testReceiveWildcardTopicMatchDoubleWildcard() throws Exception {
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination1 = (ActiveMQDestination) session.createTopic("a.*.>.>");
ActiveMQDestination destination2 = (ActiveMQDestination) session.createTopic("a.b");
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());
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class NetworkBrokerDetachTest method testNetworkedBrokerDetach.
@Test
public void testNetworkedBrokerDetach() throws Exception {
LOG.info("Creating Consumer on the networked broker ...");
// Create a consumer on the networked broker
ConnectionFactory consFactory = createConnectionFactory(networkedBroker);
Connection consConn = consFactory.createConnection();
Session consSession = consConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = (ActiveMQDestination) consSession.createQueue(DESTINATION_NAME);
for (int i = 0; i < NUM_CONSUMERS; i++) {
consSession.createConsumer(destination);
}
assertTrue("got expected consumer count from mbean within time limit", verifyConsumerCount(1, destination, broker));
LOG.info("Stopping Consumer on the networked broker ...");
// Closing the connection will also close the consumer
consConn.close();
// We should have 0 consumer for the queue on the local broker
assertTrue("got expected 0 count from mbean within time limit", verifyConsumerCount(0, destination, broker));
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class DemandForwardingBridgeFilterTest method assertReceiveNoMessageOn.
private void assertReceiveNoMessageOn(String destinationName, byte destinationType) throws Exception, InterruptedException {
ActiveMQDestination destination = ActiveMQDestination.createDestination(destinationName, destinationType);
// Send the message to the local broker.
producerConnection.send(createMessage(producerInfo, destination, destinationType));
// Make sure the message was delivered via the remote.
Message m = createConsumerAndReceiveMessage(destination);
assertNull(m);
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class DemandForwardingBridgeFilterTest method assertReceiveMessageOn.
private void assertReceiveMessageOn(String destinationName, byte destinationType) throws Exception, InterruptedException {
ActiveMQDestination destination = ActiveMQDestination.createDestination(destinationName, destinationType);
// Send the message to the local broker.
producerConnection.send(createMessage(producerInfo, destination, destinationType));
// Make sure the message was delivered via the remote.
Message m = createConsumerAndReceiveMessage(destination);
assertNotNull(m);
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class ObjectFactoryTest method testDestination.
public void testDestination() throws Exception {
// Create sample destination
ActiveMQDestination dest = new ActiveMQQueue();
dest.setPhysicalName("TEST.FOO");
// Create reference
Reference ref = JNDIReferenceFactory.createReference(dest.getClass().getName(), dest);
// Get object created based on reference
ActiveMQDestination temp;
JNDIReferenceFactory refFactory = new JNDIReferenceFactory();
temp = (ActiveMQDestination) refFactory.getObjectInstance(ref, null, null, null);
// Check settings
assertEquals(dest.getPhysicalName(), temp.getPhysicalName());
}
Aggregations