LoadProxyClasses.java revision 0
0N/A * Copyright 2000-2001 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 * 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 * 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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * @summary functional test for RMIClassLoader.loadProxyClass; test 0N/A * ensures that the default RMI class loader provider implements 0N/A * RMIClassLoader.loadProxyClass correctly. 0N/A * @author Laird Dornin 0N/A * @library ../../../testlibrary 0N/A * @build TestLibrary FnnClass FnnUnmarshal LoadProxyClasses NonpublicInterface 0N/A * @build NonpublicInterface1 PublicInterface PublicInterface1 0N/A * Invokes RMIClassLoader.loadProxyClass() to load a proxy class with 0N/A * multiple interfaces using using RMI class unmarshalling. Test is 0N/A * composed of cases which each unmarshal a proxy class in a 0N/A * different environment. All of the cases create needed class 0N/A * loaders, load appropriate interfaces, create a proxy class that 0N/A * implements those interfaces, create a marshalled object from that 0N/A * proxy class, and finally call .get() on that object. Get of the 0N/A * object should pass in some cases and fail in others. 0N/A * 1. Nonpublic interface loaded from the parent of the First 0N/A * Non-Null class Loader on the execution stack (FNNL). Public 0N/A * interface loaded from grandparent of FNNL parent. Proxy class must 0N/A * be defined in non-null FNNL parent. Should succeed. 0N/A * 2. Nonpublic interface (java.util.zip.ZipConstants) and public 0N/A * interface (java.util.zip.CheckSum) loaded from bootclasspath, 0N/A * proxy class defined in null/boot class loader. Should succeed. 0N/A * 3. Public interface classes loaded in FNNL are also available in 0N/A * RMI loader parent. FNNL is grandparent of RMI loader. Proxy class 0N/A * must be defined in RMI class loader. Should succeed. public 0N/A * interface must be defined in FNNL. 0N/A * 4. Non-public interfaces have multiple class loaders. Should fail 0N/A * with a LinkageError. 0N/A * 5. Interface classes loaded from RMI class loader. Proxy class 0N/A * defined in RMI class loader. 0N/A * 6. Not all interfaces classes can be loaded from a single class 0N/A * loader; should fail with ClassNotFoundException. All interface 0N/A * classes will exist (but not all interfaces will be available from 0N/A * one class loader). 0N/A * 7. prove that proxy loader has correct annotation. 0N/A * 8. REMIND: may want to add a case where the FNNL is null (This 0N/A * would be for class unmarshalling in the implemntation of a remote 0N/A * method invocation). 0N/A "loads proxy classes correctly\n");
0N/A /* install proxy interfaces */ 0N/A "nonpublic",
false);
0N/A "nonpublic1",
false);
0N/A "when multiple nonpublic interfaces have \n" +
0N/A "different class loaders");
0N/A "thrown \n when trying to load proxy " +
0N/A "with multiple nonpublic interfaces in \n" +
0N/A " different class loaders");
0N/A "when not all proxy interfaces could " +
0N/A " be found in a single class loader ");
0N/A "correctly thrown when not all proxy" +
0N/A " interfaces could be found in a " +
0N/A "single class loader");
0N/A "placed into incorrect loader: " +
0N/A " placed into expected loader: " +