use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class JMSLVQTest method createAddressAndQueues.
@Override
protected void createAddressAndQueues(ActiveMQServer server) throws Exception {
super.createAddressAndQueues(server);
server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(LVQ_QUEUE_NAME), RoutingType.ANYCAST));
server.createQueue(SimpleString.toSimpleString(LVQ_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString("LVQ"), null, true, false, -1, false, true);
}
use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class CriticalAnalyzerFaultInjectionTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST));
server.createQueue(address, RoutingType.ANYCAST, address, null, true, false);
conn = nettyCf.createConnection();
}
use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class MQTTTest method testAmbiguousRoutingWithMQTT.
@Test(timeout = 60 * 1000)
public void testAmbiguousRoutingWithMQTT() throws Exception {
String anycastAddress = "foo/bar";
EnumSet<RoutingType> routingTypeSet = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
getServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString("foo.bar"), routingTypeSet));
String clientId = "testMqtt";
Topic[] mqttSubscription = new Topic[] { new Topic(anycastAddress, QoS.AT_LEAST_ONCE) };
MQTT mqtt = createMQTTConnection();
mqtt.setClientId(clientId);
BlockingConnection connection1 = mqtt.blockingConnection();
connection1.connect();
connection1.subscribe(mqttSubscription);
MQTT mqtt2 = createMQTTConnection();
mqtt2.setClientId(clientId + "2");
BlockingConnection connection2 = mqtt2.blockingConnection();
connection2.connect();
connection2.subscribe(mqttSubscription);
String message1 = "TestMessage1";
String message2 = "TestMessage2";
connection1.publish(anycastAddress, message1.getBytes(), QoS.AT_LEAST_ONCE, false);
connection2.publish(anycastAddress, message2.getBytes(), QoS.AT_LEAST_ONCE, false);
assertNotNull(connection1.receive(1000, TimeUnit.MILLISECONDS));
assertNotNull(connection1.receive(1000, TimeUnit.MILLISECONDS));
assertNotNull(connection2.receive(1000, TimeUnit.MILLISECONDS));
assertNotNull(connection2.receive(1000, TimeUnit.MILLISECONDS));
}
use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class MQTTTest method testRetainedMessagesAreCorrectlyFormedAfterRestart.
@Test
public void testRetainedMessagesAreCorrectlyFormedAfterRestart() throws Exception {
String clientId = "testMqtt";
String address = "testAddress";
String payload = "This is a test message";
// Create address
getServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(address), RoutingType.MULTICAST));
// Send MQTT Retain Message
Topic[] mqttTopic = new Topic[] { new Topic(address, QoS.AT_LEAST_ONCE) };
MQTT mqtt = createMQTTConnection();
mqtt.setClientId(clientId);
BlockingConnection connection1 = mqtt.blockingConnection();
connection1.connect();
connection1.publish(address, payload.getBytes(), QoS.AT_LEAST_ONCE, true);
getServer().fail(false);
getServer().start();
waitForServerToStart(getServer());
MQTT mqtt2 = createMQTTConnection();
mqtt2.setClientId(clientId + "2");
BlockingConnection connection2 = mqtt2.blockingConnection();
connection2.connect();
connection2.subscribe(mqttTopic);
Message message = connection2.receive(5000, TimeUnit.MILLISECONDS);
assertEquals(payload, new String(message.getPayload()));
}
use of org.apache.activemq.artemis.core.server.impl.AddressInfo in project activemq-artemis by apache.
the class ManagementServiceImplTest method testGetResources.
@Test
public void testGetResources() throws Exception {
Configuration config = createBasicConfig().setJMXManagementEnabled(false);
ManagementServiceImpl managementService = new ManagementServiceImpl(null, config);
managementService.setStorageManager(new NullStorageManager());
SimpleString address = RandomUtil.randomSimpleString();
managementService.registerAddress(new AddressInfo(address));
Queue queue = new FakeQueue(RandomUtil.randomSimpleString());
managementService.registerQueue(queue, RandomUtil.randomSimpleString(), new FakeStorageManager());
Object[] addresses = managementService.getResources(AddressControl.class);
Assert.assertEquals(1, addresses.length);
Assert.assertTrue(addresses[0] instanceof AddressControl);
AddressControl addressControl = (AddressControl) addresses[0];
Assert.assertEquals(address.toString(), addressControl.getAddress());
Object[] queues = managementService.getResources(QueueControl.class);
Assert.assertEquals(1, queues.length);
Assert.assertTrue(queues[0] instanceof QueueControl);
QueueControl queueControl = (QueueControl) queues[0];
Assert.assertEquals(queue.getName().toString(), queueControl.getName());
}
Aggregations