use of org.apache.activemq.artemis.tests.integration.server.FakeStorageManager 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