コード例 #1
0
 @Test
 public void readWithPattern() {
   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";
   req = JmxRequestFactory.createGetRequest("read/java.lang:type=*/HeapMemoryUsage", null);
   assert req.getAttributeName().equals("HeapMemoryUsage") : "No attributes names";
 }
コード例 #2
0
 @Test
 public void simpleGetWithEscapedAttribute() {
   JmxReadRequest req =
       JmxRequestFactory.createGetRequest(
           "read/java.lang:type=Memory/!/Heap!/Memory!/Usage!/", null);
   assertEquals(req.getAttributeName(), "/Heap/Memory/Usage/", "Attribute properly parsed");
 }
コード例 #3
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";
 }
コード例 #4
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";
 }
コード例 #5
0
 @Test
 public void simplePostWithMergedMaps() {
   Map config = new HashMap();
   config.put("maxDepth", "10");
   Map<String, Object> reqMap =
       createMap(
           "type", "read",
           "mbean", "java.lang:type=Memory",
           "attribute", "HeapMemoryUsage",
           "config", config);
   Map param = new HashMap();
   ;
   param.put("maxObjects", new String[] {"100"});
   JmxReadRequest req = (JmxReadRequest) JmxRequestFactory.createPostRequest(reqMap, param);
   assertEquals(req.getAttributeName(), "HeapMemoryUsage");
   assertEquals(req.getProcessingConfig(ConfigKey.MAX_DEPTH), "10");
   assertEquals(req.getProcessingConfigAsInt(ConfigKey.MAX_OBJECTS), 100);
 }