@Test public void simpleGetWithQueryPath() { Map<String, String[]> params = new HashMap<String, String[]>(); params.put("p", new String[] {"list/java.lang/type=Memory"}); JmxListRequest req = JmxRequestFactory.createGetRequest(null, params); assert req.getHttpMethod() == HttpMethod.GET : "GET by default"; assert req.getPath().equals("java.lang/type=Memory") : "Path extracted"; }
@Test public void simpleGetWithQueryPath() { Map<String, String> params = new HashMap<String, String>(); params.put("p", "list/java.lang/type=Memory"); JmxListRequest req = JmxRequestFactory.createGetRequest( null, new Configuration().getProcessingParameters(params)); assert req.getHttpMethod() == HttpMethod.GET : "GET by default"; assert req.getPath().equals("java.lang/type=Memory") : "Path extracted"; }
@Test public void listRequest() { for (JmxListRequest req : new JmxListRequest[] { (JmxListRequest) JmxRequestFactory.createGetRequest("list/java.lang:type=Memory", null), (JmxListRequest) JmxRequestFactory.createPostRequest( createMap("type", "list", "path", "java.lang:type=Memory"), null) }) { assertEquals(req.getType(), RequestType.LIST); assertEquals(req.getPath(), "java.lang:type=Memory"); verify(req, "type", "list"); verify(req, "path", "java.lang:type=Memory"); } }