Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/rmi/runtime/Log/4504153/Test4504153.java
38867 views
/*1* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/* @test24* @bug 450415325* @summary RMI implementation should not log to two loggers where one is26* an ancestor of the other, to avoid unintended or duplicate logging27* @author Peter Jones28*29* @library ../../../../../java/rmi/testlibrary30* @build JavaVM31* @run main/othervm Test450415332*/3334import java.io.ByteArrayOutputStream;35import java.rmi.registry.LocateRegistry;36import java.rmi.server.RemoteServer;3738public class Test4504153 {3940private final static String DONE = "Done!";4142public static void main(String[] args) throws Exception {4344System.err.println("\nRegression test for bug 4504153\n");4546ByteArrayOutputStream out = new ByteArrayOutputStream();47ByteArrayOutputStream err = new ByteArrayOutputStream();48JavaVM vm = new JavaVM(StartRegistry.class.getName(),49"-Dsun.rmi.transport.logLevel=v", "", out, err);50vm.execute();5152String errString = err.toString();5354System.err.println(55"child process's standard error output:\n\n" + err + "\n");5657if (errString.indexOf(DONE) < 0) {58throw new RuntimeException("TEST FAILED: " +59"failed to collect expected child process output");60}6162if (errString.indexOf("TCPEndpoint") >= 0) {63throw new RuntimeException("TEST FAILED: " +64"unrequested logging output detected");65}6667System.err.println("TEST PASSED");68}6970public static class StartRegistry {71public static void main(String[] args) throws Exception {72LocateRegistry.createRegistry(0);73System.err.println(DONE);74}75}76}777879