0N/A/*
1472N/A * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A */
0N/A
0N/A/* @test
1879N/A * @bug 4236543
1879N/A * @summary rmic w/o -d should put class files in package directory
1879N/A * @author Dana Burns
1879N/A * @library ../../../../java/rmi/testlibrary
1879N/A *
1879N/A * @build StreamPipe
1879N/A * @run main RmicDefault
1879N/A */
1879N/A
0N/A/*
0N/A * Ensure that, in the absence of a -d argument, rmic will deposit
0N/A * the generated class files in the package directory as opposed
0N/A * to the old behaviour of depositing them in the local directory.
0N/A * JavaTest/jtreg does not support setting the classpath yet, so do
0N/A * the javac directly.
0N/A */
0N/A
0N/Aimport java.io.File;
0N/Aimport java.io.IOException;
0N/A
0N/Apublic class RmicDefault {
0N/A public static void main(String args[]) throws Exception {
0N/A String javahome = System.getProperty("java.home");
0N/A String testclasses = System.getProperty("test.classes");
0N/A String userDir = System.getProperty("user.dir");
0N/A
0N/A if (javahome.regionMatches(true, javahome.length() - 4,
0N/A File.separator + "jre", 0, 4))
0N/A {
0N/A javahome = javahome.substring(0, javahome.length() - 4);
0N/A }
0N/A
0N/A Process javacProcess = Runtime.getRuntime().exec(
0N/A javahome + File.separator + "bin" + File.separator +
0N/A "javac -d " + testclasses + " " +
0N/A System.getProperty("test.src") + File.separator + "packagedir" +
0N/A File.separator + "RmicMeImpl.java");
0N/A
0N/A StreamPipe.plugTogether(javacProcess.getInputStream(), System.out);
0N/A StreamPipe.plugTogether(javacProcess.getErrorStream(), System.out);
0N/A
0N/A javacProcess.waitFor();
0N/A
0N/A Process rmicProcess = Runtime.getRuntime().exec(
0N/A javahome + File.separator + "bin" + File.separator +
0N/A "rmic -classpath " + testclasses + " packagedir.RmicMeImpl");
0N/A
0N/A StreamPipe.plugTogether(rmicProcess.getInputStream(), System.out);
0N/A StreamPipe.plugTogether(rmicProcess.getErrorStream(), System.err);
0N/A
0N/A rmicProcess.waitFor();
0N/A
0N/A File stub = new File(userDir + File.separator + "packagedir" +
0N/A File.separator + "RmicMeImpl_Stub.class");
0N/A if (!stub.exists()) {
0N/A throw new RuntimeException("TEST FAILED: could not find stub");
0N/A }
0N/A
0N/A System.err.println("TEST PASSED");
0N/A }
0N/A}
0N/A