0N/A/*
2362N/A * Copyright (c) 2001, 2004, 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 *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A *
0N/A */
0N/A
0N/Aimport java.net.MalformedURLException;
0N/Aimport java.net.URL;
0N/Aimport java.net.URLClassLoader;
0N/Aimport java.util.ArrayList;
0N/Aimport java.util.Collections;
0N/Aimport java.util.List;
0N/A
0N/Aimport java.rmi.server.RMIClassLoader;
0N/Aimport java.rmi.server.RMIClassLoaderSpi;
0N/A
0N/A/**
0N/A * TestProvider2 extends TestProvider with very similar behavior, but
0N/A * with its own static fields, to allow a test to distinguish between
0N/A * an installed TestProvider2 being used, or a property-specified
0N/A * TestProvider being used.
0N/A */
0N/Apublic class TestProvider2 extends TestProvider {
0N/A
0N/A public static final Class loadClassReturn =
0N/A (new Object() { }).getClass();
0N/A public static final Class loadProxyClassReturn =
0N/A (new Object() { }).getClass();
0N/A public static final ClassLoader getClassLoaderReturn =
0N/A URLClassLoader.newInstance(new URL[0]);
0N/A public static final String getClassAnnotationReturn = new String();
0N/A
0N/A public static List invocations =
0N/A Collections.synchronizedList(new ArrayList(1));
0N/A
0N/A public TestProvider2() {
0N/A System.err.println("TestProvider2()");
0N/A }
0N/A
0N/A public Class loadClass(String codebase, String name,
0N/A ClassLoader defaultLoader)
0N/A throws MalformedURLException, ClassNotFoundException
0N/A {
0N/A invocations.add(new Invocation(loadClassMethod,
0N/A new Object[] { codebase, name, defaultLoader }));
0N/A
0N/A return loadClassReturn;
0N/A }
0N/A
0N/A public Class loadProxyClass(String codebase, String[] interfaces,
0N/A ClassLoader defaultLoader)
0N/A throws MalformedURLException, ClassNotFoundException
0N/A {
0N/A invocations.add(new Invocation(loadProxyClassMethod,
0N/A new Object[] { codebase, interfaces, defaultLoader }));
0N/A
0N/A return loadProxyClassReturn;
0N/A }
0N/A
0N/A public ClassLoader getClassLoader(String codebase)
0N/A throws MalformedURLException
0N/A {
0N/A invocations.add(new Invocation(
0N/A getClassLoaderMethod, new Object[] { codebase }));
0N/A
0N/A return getClassLoaderReturn;
0N/A }
0N/A
0N/A public String getClassAnnotation(Class<?> cl) {
0N/A invocations.add(new Invocation(
0N/A getClassAnnotationMethod, new Object[] { cl }));
0N/A
0N/A return getClassAnnotationReturn;
0N/A }
0N/A}