< prev index next >

jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java

Print this page




  51 
  52     public static void main(String[] args) throws Exception {
  53         System.err.println("\nRegression test for bug 6409194\n");
  54 
  55         /*
  56          * Exdecute a subprocess VM that does a bunch of RMI activity
  57          * with a logging configuration file that does not specify a
  58          * ConsoleHandler and with no legacy sun.rmi.*.logLevel system
  59          * properties set.
  60          */
  61         String loggingPropertiesFile =
  62             System.getProperty("test.src", ".") +
  63             File.separatorChar + "logging.properties";
  64         ByteArrayOutputStream out = new ByteArrayOutputStream();
  65         ByteArrayOutputStream err = new ByteArrayOutputStream();
  66 
  67         // We instantiate a JavaVM that should not produce any console output
  68         // (neither on standard output, nor on standard err streams).
  69         JavaVM vm = new JavaVM(
  70                 DoRMIStuff.class.getName(),
  71                 "-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED"
  72                 + " -XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED"
  73                 + " -XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED"
  74                 + " -XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
  75                 + " -Djava.util.logging.config.file="
  76                 + loggingPropertiesFile, "", out, err);
  77         vm.execute();
  78 
  79         /*
  80          * Verify that the subprocess had no System.out or System.err
  81          * output.
  82          */
  83         String outString = out.toString();
  84         String errString = err.toString();
  85 
  86         System.err.println("-------- subprocess standard output: --------");
  87         System.err.print(out);
  88         System.err.println("-------- subprocess standard error:  --------");
  89         System.err.print(err);
  90         System.err.println("---------------------------------------------");
  91 
  92         if (outString.length() > 0 || errString.length() > 0) {
  93             throw new Error("TEST FAILED: unexpected subprocess output");
  94         }




  51 
  52     public static void main(String[] args) throws Exception {
  53         System.err.println("\nRegression test for bug 6409194\n");
  54 
  55         /*
  56          * Exdecute a subprocess VM that does a bunch of RMI activity
  57          * with a logging configuration file that does not specify a
  58          * ConsoleHandler and with no legacy sun.rmi.*.logLevel system
  59          * properties set.
  60          */
  61         String loggingPropertiesFile =
  62             System.getProperty("test.src", ".") +
  63             File.separatorChar + "logging.properties";
  64         ByteArrayOutputStream out = new ByteArrayOutputStream();
  65         ByteArrayOutputStream err = new ByteArrayOutputStream();
  66 
  67         // We instantiate a JavaVM that should not produce any console output
  68         // (neither on standard output, nor on standard err streams).
  69         JavaVM vm = new JavaVM(
  70                 DoRMIStuff.class.getName(),
  71                 "--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED"
  72                 + " --add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED"
  73                 + " --add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED"
  74                 + " --add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
  75                 + " -Djava.util.logging.config.file="
  76                 + loggingPropertiesFile, "", out, err);
  77         vm.execute();
  78 
  79         /*
  80          * Verify that the subprocess had no System.out or System.err
  81          * output.
  82          */
  83         String outString = out.toString();
  84         String errString = err.toString();
  85 
  86         System.err.println("-------- subprocess standard output: --------");
  87         System.err.print(out);
  88         System.err.println("-------- subprocess standard error:  --------");
  89         System.err.print(err);
  90         System.err.println("---------------------------------------------");
  91 
  92         if (outString.length() > 0 || errString.length() > 0) {
  93             throw new Error("TEST FAILED: unexpected subprocess output");
  94         }


< prev index next >