45N/A/*
553N/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
45N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45N/A *
45N/A * This code is free software; you can redistribute it and/or modify it
45N/A * under the terms of the GNU General Public License version 2 only, as
45N/A * published by the Free Software Foundation.
45N/A *
45N/A * This code is distributed in the hope that it will be useful, but WITHOUT
45N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
45N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
45N/A * version 2 for more details (a copy is included in the LICENSE file that
45N/A * accompanied this code).
45N/A *
45N/A * You should have received a copy of the GNU General Public License version
45N/A * 2 along with this work; if not, write to the Free Software Foundation,
45N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
45N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
45N/A */
45N/A
45N/A/**
45N/A * @test
45N/A * @bug 4882798
45N/A * @summary simple test for the Class-Path manifest attribute
45N/A * @author Gabriel Adauto, Wily Technology; Robert Field, Sun Microsystems
45N/A *
45N/A * @run build AppendToClassPathTest
45N/A * @run shell AppendToClassPathSetUp.sh
45N/A * @run shell MakeJAR.sh classpathAgent
45N/A * @run main/othervm -javaagent:classpathAgent.jar AppendToClassPathTest AppendToClassPathTest
45N/A */
45N/A
45N/Aimport java.io.*;
45N/A
45N/Apublic class
45N/AAppendToClassPathTest
45N/A extends ASimpleInstrumentationTestCase
45N/A{
45N/A
45N/A /**
45N/A * Constructor for AppendToClassPathTest.
45N/A * @param name
45N/A */
45N/A public AppendToClassPathTest(String name)
45N/A {
45N/A super(name);
45N/A }
45N/A
45N/A public static void
45N/A main (String[] args)
45N/A throws Throwable {
45N/A ATestCaseScaffold test = new AppendToClassPathTest(args[0]);
45N/A test.runTest();
45N/A }
45N/A
45N/A protected final void
45N/A doRunTest()
45N/A throws Throwable {
45N/A testAppendToClassPath();
45N/A }
45N/A
45N/A
45N/A public void
45N/A testAppendToClassPath()
45N/A throws IOException,
45N/A ClassNotFoundException
45N/A {
45N/A Class sentinelClass;
45N/A ClassLoader loader = this.getClass().getClassLoader();
45N/A
45N/A // load the "hidden" class, it should be loaded by the system loader
45N/A sentinelClass = loader.loadClass("ExampleForClassPath");
45N/A assertTrue(sentinelClass.getClassLoader() == ClassLoader.getSystemClassLoader());
45N/A }
45N/A
45N/A}
45N/A