Search in sources :

Example 6 with RequestType

use of org.apache.qpid.server.management.plugin.RequestType in project qpid-broker-j by apache.

the class LatestManagementControllerTest method getRequestTypeForGetAndUserPreferences.

@Test
public void getRequestTypeForGetAndUserPreferences() throws Exception {
    final String hostName = "test";
    final QueueManagingVirtualHost<?> virtualHost = createVirtualHostWithQueue(hostName, "foo", "bar");
    final ManagementRequest request = mock(ManagementRequest.class);
    when(request.getCategory()).thenReturn("queue");
    doReturn(virtualHost.getBroker()).when(request).getRoot();
    List<String> path = Arrays.asList(virtualHost.getParent().getName(), hostName, "bar", "userpreferences");
    when(request.getPath()).thenReturn(path);
    when(request.getParameters()).thenReturn(Collections.emptyMap());
    when(request.getMethod()).thenReturn("GET");
    final RequestType type = _controller.getRequestType(request);
    assertThat(type, is(equalTo(RequestType.USER_PREFERENCES)));
}
Also used : ManagementRequest(org.apache.qpid.server.management.plugin.ManagementRequest) RequestType(org.apache.qpid.server.management.plugin.RequestType) Test(org.junit.Test)

Aggregations

RequestType (org.apache.qpid.server.management.plugin.RequestType)6 ManagementRequest (org.apache.qpid.server.management.plugin.ManagementRequest)5 Test (org.junit.Test)5 List (java.util.List)2 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ResponseType (org.apache.qpid.server.management.plugin.ResponseType)1