|
@@ -78,5 +78,29 @@ public class TestJMXJsonServlet extends HttpServerFunctionalTest {
|
|
|
"/jmx?get=java.lang:type=Memory::"));
|
|
|
LOG.info("/jmx RESULT: "+result);
|
|
|
assertReFind("\"ERROR\"", result);
|
|
|
+
|
|
|
+ // test to get JSONP result
|
|
|
+ result = readOutput(new URL(baseUrl, "/jmx?qry=java.lang:type=Memory&callback=mycallback1"));
|
|
|
+ LOG.info("/jmx?qry=java.lang:type=Memory&callback=mycallback RESULT: "+result);
|
|
|
+ assertReFind("^mycallback1\\(\\{", result);
|
|
|
+ assertReFind("\\}\\);$", result);
|
|
|
+
|
|
|
+ // negative test to get an attribute of a mbean as JSONP
|
|
|
+ result = readOutput(new URL(baseUrl,
|
|
|
+ "/jmx?get=java.lang:type=Memory::&callback=mycallback2"));
|
|
|
+ LOG.info("/jmx RESULT: "+result);
|
|
|
+ assertReFind("^mycallback2\\(\\{", result);
|
|
|
+ assertReFind("\"ERROR\"", result);
|
|
|
+ assertReFind("\\}\\);$", result);
|
|
|
+
|
|
|
+ // test to get an attribute of a mbean as JSONP
|
|
|
+ result = readOutput(new URL(baseUrl,
|
|
|
+ "/jmx?get=java.lang:type=Memory::HeapMemoryUsage&callback=mycallback3"));
|
|
|
+ LOG.info("/jmx RESULT: "+result);
|
|
|
+ assertReFind("^mycallback3\\(\\{", result);
|
|
|
+ assertReFind("\"name\"\\s*:\\s*\"java.lang:type=Memory\"", result);
|
|
|
+ assertReFind("\"committed\"\\s*:", result);
|
|
|
+ assertReFind("\\}\\);$", result);
|
|
|
+
|
|
|
}
|
|
|
}
|