changeset 10795:dbf81f23e85c

8060120: Improve diagnostic output of StartManagementAgent test Reviewed-by: dfuchs
author jbachorik
date Fri, 10 Oct 2014 14:35:53 +0200
parents a69246ee7ce7
children f504cac61abf
files test/com/sun/tools/attach/StartManagementAgent.java
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/com/sun/tools/attach/StartManagementAgent.java	Tue Oct 14 15:20:41 2014 +0900
+++ b/test/com/sun/tools/attach/StartManagementAgent.java	Fri Oct 10 14:35:53 2014 +0200
@@ -53,7 +53,9 @@
     public static void main(String[] args) throws Throwable {
         ProcessThread processThread = null;
         try {
+            System.out.println("Starting test application");
             processThread = RunnerUtil.startApplication();
+            System.out.println("Application started");
             runTests(processThread.getPid());
         } catch (Throwable t) {
             System.out.println("StartManagementAgent got unexpected exception: " + t);
@@ -70,6 +72,7 @@
         // Try calling with null argument
         boolean exception = false;
         try {
+            System.out.println("Starting management agent with null");
             vm.startManagementAgent(null);
         } catch (NullPointerException e) {
             exception = true;
@@ -86,6 +89,7 @@
         }
         p.put("com.sun.management.config.file", f.getAbsolutePath());
         try {
+            System.out.println("Starting management agent with bogus port");
             vm.startManagementAgent(p);
         } catch(AttachOperationFailedException ex) {
             // We expect parsing of "apa" above to fail, but if the file path
@@ -93,6 +97,9 @@
             if (!ex.getMessage().contains("Invalid com.sun.management.jmxremote.port number")) {
                 throw ex;
             }
+            ex.printStackTrace(System.err);
+        } catch (Throwable t) {
+            t.printStackTrace(System.err);
         }
     }
 
@@ -134,14 +141,19 @@
     }
 
     public static void testLocalAgent(VirtualMachine vm) throws Exception {
+        System.out.println("Getting VM properties");
         Properties agentProps = vm.getAgentProperties();
         String address = (String) agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP);
         if (address != null) {
             throw new Exception("Local management agent already started");
         }
 
+        System.out.println("Starting local agent");
+
         String result = vm.startLocalManagementAgent();
 
+        System.out.println("Agent started");
+
         // try to parse the return value as a JMXServiceURL
         new JMXServiceURL(result);