@Override public void run() throws ActiveMQException { session.createTemporaryQueue(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString()); } });
@Override public void run() throws ActiveMQException { session.addressQuery(RandomUtil.randomSimpleString()); } });
@Override public void run() throws ActiveMQException { session.createConsumer(RandomUtil.randomSimpleString()); } });
@Override public void run() throws ActiveMQException { session.queueQuery(RandomUtil.randomSimpleString()); } });
@Override public void run() throws ActiveMQException { session.createQueue(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString(), RandomUtil.randomBoolean()); } });
@Before public void setUp() throws Exception { props = new TypedProperties(); key = RandomUtil.randomSimpleString(); }
@Before public void setUp() throws Exception { key = RandomUtil.randomSimpleString(); props = new TypedProperties(); }
@Test public void testListMessageCounterAsHTML() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); QueueControl queueControl = createManagementControl(address, queue); String history = queueControl.listMessageCounterAsHTML(); Assert.assertNotNull(history); session.deleteQueue(queue); }
@Test public void testGetAddress() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); session.createQueue(address, queue, false); AddressControl addressControl = createManagementControl(address); Assert.assertEquals(address.toString(), addressControl.getAddress()); session.deleteQueue(queue); }
@Test public void testSimpleStringProperty() throws Exception { SimpleString strVal = RandomUtil.randomSimpleString(); props.putSimpleStringProperty(key, strVal); Assert.assertEquals(strVal, props.getSimpleStringProperty(key)); }
@Test public void testGetNullFilter() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(queue.toString(), queueControl.getName()); Assert.assertNull(queueControl.getFilter()); session.deleteQueue(queue); }
@Test public void testNonEmptySimpleString() throws Exception { SimpleString junk = RandomUtil.randomSimpleString(); SimpleString result = putAndGetNullableSimpleString(junk); Assert.assertNotNull(result); ActiveMQTestBase.assertEqualsByteArrays(junk.getData(), result.getData()); }
@Test public void testCloseHierarchy() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); ClientSession session = sf.createSession(false, true, true); session.createQueue(address, queue, false); ClientProducer producer = session.createProducer(address); ClientConsumer consumer = session.createConsumer(queue); session.close(); Assert.assertTrue(session.isClosed()); Assert.assertTrue(producer.isClosed()); Assert.assertTrue(consumer.isClosed()); }
@Test public void testSetDeadLetterAddress() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); String deadLetterAddress = RandomUtil.randomString(); session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); QueueControl queueControl = createManagementControl(address, queue); AddressSettings addressSettings = new AddressSettings().setDeadLetterAddress(new SimpleString(deadLetterAddress)); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); Assert.assertEquals(deadLetterAddress, queueControl.getDeadLetterAddress()); session.deleteQueue(queue); }
@Test public void testAddressAdded() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); NotificationTest.flush(notifConsumer); session.createAddress(address, RoutingType.ANYCAST, true); ClientMessage[] notifications = NotificationTest.consumeMessages(1, notifConsumer); Assert.assertEquals(ADDRESS_ADDED.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString()); Assert.assertEquals(RoutingType.ANYCAST.getType(), notifications[0].getObjectProperty(ManagementHelper.HDR_ROUTING_TYPE)); Assert.assertEquals(address.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString()); }
@Test public void testAddressRemoved() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); session.createAddress(address, RoutingType.ANYCAST, true); NotificationTest.flush(notifConsumer); server.getPostOffice().removeAddressInfo(address); ClientMessage[] notifications = NotificationTest.consumeMessages(1, notifConsumer); Assert.assertEquals(ADDRESS_REMOVED.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString()); Assert.assertEquals(RoutingType.ANYCAST.getType(), notifications[0].getObjectProperty(ManagementHelper.HDR_ROUTING_TYPE)); Assert.assertEquals(address.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString()); }
@Test public void testRemove() throws Exception { props.putSimpleStringProperty(key, RandomUtil.randomSimpleString()); Assert.assertTrue(props.containsProperty(key)); Assert.assertNotNull(props.getProperty(key)); props.removeProperty(key); Assert.assertFalse(props.containsProperty(key)); Assert.assertNull(props.getProperty(key)); }
@Test public void testClear() throws Exception { props.putSimpleStringProperty(key, RandomUtil.randomSimpleString()); Assert.assertTrue(props.containsProperty(key)); Assert.assertNotNull(props.getProperty(key)); props.clear(); Assert.assertFalse(props.containsProperty(key)); Assert.assertNull(props.getProperty(key)); }
@Test public void testGetRoutingTypesAsJSON() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); session.createAddress(address, RoutingType.ANYCAST, false); AddressControl addressControl = createManagementControl(address); JsonArray jsonArray = JsonUtil.readJsonArray(addressControl.getRoutingTypesAsJSON()); assertEquals(1, jsonArray.size()); assertEquals(RoutingType.ANYCAST.toString(), ((JsonString) jsonArray.get(0)).getString()); }
@Test public void testCopyContructor() throws Exception { props.putSimpleStringProperty(key, RandomUtil.randomSimpleString()); TypedProperties copy = new TypedProperties(props); Assert.assertEquals(props.getEncodeSize(), copy.getEncodeSize()); Assert.assertEquals(props.getPropertyNames(), copy.getPropertyNames()); Assert.assertTrue(copy.containsProperty(key)); Assert.assertEquals(props.getProperty(key), copy.getProperty(key)); }