use of org.apache.qpid.server.management.plugin.controller.LegacyConfiguredObject in project qpid-broker-j by apache.
the class VirtualHostControllerTest method convertNextVersionLegacyConfiguredObject.
@Test
public void convertNextVersionLegacyConfiguredObject() {
final LegacyConfiguredObject nextVersionVirtualHost = mock(LegacyConfiguredObject.class);
when(nextVersionVirtualHost.getAttribute(LegacyConfiguredObject.NAME)).thenReturn("test");
final LegacyConfiguredObject converted = _virtualHostController.convertNextVersionLegacyConfiguredObject(nextVersionVirtualHost);
assertThat(converted, is(notNullValue()));
assertThat(converted.getCategory(), is(equalTo(VirtualHostController.TYPE)));
assertThat(converted.getAttribute(LegacyConfiguredObject.NAME), is(equalTo("test")));
assertThat(converted.getAttribute("modelVersion"), is(equalTo("6.1")));
assertThat(converted.getAttribute("queue_deadLetterQueueEnabled"), is(equalTo(false)));
}
use of org.apache.qpid.server.management.plugin.controller.LegacyConfiguredObject in project qpid-broker-j by apache.
the class ContainerControllerTest method convertNextVersionBrokerConfiguredObject.
@Test
public void convertNextVersionBrokerConfiguredObject() {
final CategoryController controller = _factory.createController("Broker", _nextVersionManagementController);
assertThat(controller.getCategory(), is(equalTo("Broker")));
final LegacyConfiguredObject object = mock(LegacyConfiguredObject.class);
when(object.getAttribute("modelVersion")).thenReturn("foo");
final LegacyConfiguredObject converted = controller.convertFromNextVersion(object);
Object modelVersion = converted.getAttribute("modelVersion");
assertThat(modelVersion, is(equalTo(MODEL_VERSION)));
}
use of org.apache.qpid.server.management.plugin.controller.LegacyConfiguredObject in project qpid-broker-j by apache.
the class ContainerControllerTest method convertNextVersionVirtualHostConfiguredObject.
@Test
public void convertNextVersionVirtualHostConfiguredObject() {
final CategoryController controller = _factory.createController("VirtualHost", _nextVersionManagementController);
assertThat(controller.getCategory(), is(equalTo("VirtualHost")));
final LegacyConfiguredObject object = mock(LegacyConfiguredObject.class);
when(object.getAttribute("modelVersion")).thenReturn("foo");
final LegacyConfiguredObject converted = controller.convertFromNextVersion(object);
Object modelVersion = converted.getAttribute("modelVersion");
assertThat(modelVersion, is(equalTo(MODEL_VERSION)));
}
use of org.apache.qpid.server.management.plugin.controller.LegacyConfiguredObject in project qpid-broker-j by apache.
the class LatestManagementControllerAdapterTest method handleGet.
@Test
public void handleGet() throws Exception {
final String hostName = "test";
final String queueName = "foo";
final QueueManagingVirtualHost<?> virtualHost = createTestVirtualHost(hostName);
virtualHost.createChild(Queue.class, Collections.singletonMap(Queue.NAME, queueName));
final String nodeName = virtualHost.getParent().getName();
final ManagementRequest request = mockManagementRequest(virtualHost.getBroker(), "GET", "queue", Arrays.asList(nodeName, hostName), Collections.singletonMap("name", Collections.singletonList("foo")));
final ManagementResponse response = _adapter.handleGet(request);
assertThat(response, is(notNullValue()));
assertThat(response.getResponseCode(), is(equalTo(200)));
assertThat(response.getBody(), is(notNullValue()));
assertThat(response.getBody(), is(instanceOf(Collection.class)));
final Collection data = (Collection) response.getBody();
assertThat(data.size(), is(equalTo(1)));
final Object object = data.iterator().next();
assertThat(object, is(notNullValue()));
assertThat(object, is(instanceOf(LegacyConfiguredObject.class)));
assertThat(((LegacyConfiguredObject) object).getAttribute(LegacyConfiguredObject.NAME), is(equalTo("foo")));
}
use of org.apache.qpid.server.management.plugin.controller.LegacyConfiguredObject in project qpid-broker-j by apache.
the class LatestManagementControllerAdapterTest method createOrUpdate.
@Test
public void createOrUpdate() throws Exception {
final String hostName = "test";
final String queueName = "foo";
final QueueManagingVirtualHost<?> virtualHost = createTestVirtualHost(hostName);
final String nodeName = virtualHost.getParent().getName();
final Broker root = virtualHost.getBroker();
final ManagementRequest request = mockManagementRequest(root, "POST", "queue", Arrays.asList(nodeName, hostName), Collections.emptyMap());
when(request.getBody(LinkedHashMap.class)).thenReturn(new LinkedHashMap<String, Object>(Collections.singletonMap("name", queueName)));
when(request.getRequestURL()).thenReturn("test");
final Object response = _adapter.createOrUpdate(virtualHost.getBroker(), "queue", Arrays.asList(nodeName, hostName), Collections.singletonMap("name", queueName), true);
assertThat(response, is(instanceOf(LegacyConfiguredObject.class)));
final LegacyConfiguredObject object = (LegacyConfiguredObject) response;
assertThat(object.getAttribute(LegacyConfiguredObject.NAME), is(equalTo(queueName)));
}
Aggregations