Пример #1
0
 @Test
 public void simpleGetWithEscapedPath() {
   JmxReadRequest req =
       JmxRequestFactory.createGetRequest(
           "read/java.lang:type=Memory/HeapMemoryUsage/used!/bla!/blub/bloe", null);
   assertEquals(req.getPathParts().size(), 2, "Size of path");
   assertEquals(req.getPath(), "used!/bla!/blub/bloe", "Path properly parsed");
 }
Пример #2
0
 @Test
 public void simpleGet() {
   JmxReadRequest req =
       JmxRequestFactory.createGetRequest("read/java.lang:type=Memory/HeapMemoryUsage", null);
   assert req.getType() == RequestType.READ : "Type is read";
   assert req.getObjectName().getCanonicalName().equals("java.lang:type=Memory")
       : "Name properly parsed";
   assertEquals(req.getAttributeName(), "HeapMemoryUsage", "Attribute parsed properly");
   assert req.getPathParts() == null : "PathParts are null";
   assert req.getPath() == null : "Path is null";
 }
Пример #3
0
 @Test
 public void readWithPatternAndAttribute() {
   JmxReadRequest req = JmxRequestFactory.createGetRequest("read/java.lang:type=*/", null);
   assert req.getType() == RequestType.READ : "Type is read";
   assert req.getObjectName().getCanonicalName().equals("java.lang:type=*")
       : "Name properly parsed";
   assert req.getObjectName().isPattern() : "Name is pattern";
   assert req.getAttributeNames() == null : "No attributes names";
   assert req.getAttributeName() == null : "No attributes names";
   assert req.getPath() == null : "Path is null";
 }
Пример #4
0
 @Test
 public void simplePostWithPath() {
   Map<String, Object> reqMap =
       createMap(
           "type", "read",
           "mbean", "java.lang:type=Memory",
           "attribute", "HeapMemoryUsage",
           "path", "blub!/bla/hello");
   JmxReadRequest req = JmxRequestFactory.createPostRequest(reqMap, null);
   List<String> path = req.getPathParts();
   assertEquals(path.size(), 2);
   assertEquals(path.get(0), "blub/bla");
   assertEquals(path.get(1), "hello");
   assertEquals(req.getPath(), "blub!/bla/hello");
 }
Пример #5
0
 @Test
 public void simplePost() {
   Map<String, Object> reqMap =
       createMap(
           "type", "read",
           "mbean", "java.lang:type=Memory",
           "attribute", "HeapMemoryUsage");
   JmxReadRequest req = JmxRequestFactory.createPostRequest(reqMap, null);
   assert req.getType() == RequestType.READ : "Type is read";
   assert req.getObjectName().getCanonicalName().equals("java.lang:type=Memory")
       : "Name properly parsed";
   assertEquals(req.getAttributeName(), "HeapMemoryUsage", "Attribute parsed properly");
   assert req.getPathParts() == null : "PathParts are null";
   assert req.getPath() == null : "Path is null";
 }