jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java
changeset 27189 b90845965ee9
parent 24509 5d02a6d25f78
child 30376 2ccf2cf7ea48
equal deleted inserted replaced
27188:a1aa62221649 27189:b90845965ee9
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   186             command.add(TEST_CLASS_PATH);
   186             command.add(TEST_CLASS_PATH);
   187             command.add(className);
   187             command.add(className);
   188 
   188 
   189             ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(command.toArray(new String[command.size()]));
   189             ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(command.toArray(new String[command.size()]));
   190 
   190 
   191             Process p = processBuilder.start();
   191             OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
   192             OutputAnalyzer output = new OutputAnalyzer(p);
       
   193 
   192 
   194             System.out.println("test output:");
   193             System.out.println("test output:");
   195             System.out.println(output.getOutput());
   194             System.out.println(output.getOutput());
   196 
   195 
   197             if (!output.getOutput().contains("Exception thrown by the agent : " +
   196             if (!output.getOutput().contains("Exception thrown by the agent : " +
   198                     "java.rmi.server.ExportException: Port already in use")) {
   197                     "java.rmi.server.ExportException: Port already in use")) {
   199                 return p.exitValue();
   198                 return output.getExitValue();
   200             }
   199             }
   201         }
   200         }
   202         throw new Error("Cannot find free port");
   201         throw new Error("Cannot find free port");
   203     }
   202     }
   204 
   203