< prev index next >

test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4289544
  26  * @summary ActivationGroupImpl.newInstance does not set context classloader for impl
  27  * @author Laird Dornin; code borrowed from Ann Wollrath
  28  *
  29  * @library ../../../testlibrary
  30  * @modules java.rmi/sun.rmi.registry
  31  *          java.rmi/sun.rmi.server
  32  *          java.rmi/sun.rmi.transport
  33  *          java.rmi/sun.rmi.transport.tcp
  34  * @build TestLibrary RMID
  35  *     MyRMI ActivatableImpl ActivatableImpl ActivatableImpl_Stub
  36  * @run main/othervm/policy=security.policy/timeout=150 CheckImplClassLoader
  37  */
  38 
  39 import java.io.*;
  40 import java.rmi.*;
  41 import java.rmi.server.*;
  42 import java.rmi.activation.*;
  43 import java.net.URL;
  44 
  45 /**


  62     public static void main(String args[]) {
  63         /*
  64          * The following line is required with the JDK 1.2 VM because
  65          * of gc hocus pocus that may no longer be needed with an
  66          * exact vm (hotspot).
  67          */
  68         Object dummy1 = new Object();
  69         RMID rmid = null;
  70 
  71         System.err.println("\nRegression test for bug/rfe 4289544\n");
  72 
  73         try {
  74 
  75             URL implcb = TestLibrary.installClassInCodebase("ActivatableImpl",
  76                                                             "implcb");
  77             TestLibrary.installClassInCodebase("ActivatableImpl_Stub",
  78                                                "implcb");
  79             TestLibrary.suggestSecurityManager(
  80                 TestParams.defaultSecurityManager);
  81 
  82             RMID.removeLog();
  83             rmid = RMID.createRMID();
  84             rmid.start();
  85 
  86             System.err.println("Create activation group in this VM");
  87             ActivationGroupDesc groupDesc =
  88                 new ActivationGroupDesc(null, null);
  89             ActivationSystem system = ActivationGroup.getSystem();
  90             ActivationGroupID groupID = system.registerGroup(groupDesc);
  91             group = ActivationGroup.createGroup(groupID, groupDesc, 0);
  92 
  93             ActivationDesc desc = new ActivationDesc("ActivatableImpl",
  94                                                      implcb.toString(), null);
  95             myRMI = (MyRMI) Activatable.register(desc);
  96 
  97             System.err.println("Checking that impl has correct " +
  98                                "context class loader");
  99             if (!myRMI.classLoaderOk()) {
 100                 TestLibrary.bomb("incorrect context class loader for " +
 101                                  "activation constructor");
 102             }
 103 
 104             System.err.println("Deactivate object via method call");


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4289544 8085192
  26  * @summary ActivationGroupImpl.newInstance does not set context classloader for impl
  27  * @author Laird Dornin; code borrowed from Ann Wollrath
  28  *
  29  * @library ../../../testlibrary
  30  * @modules java.rmi/sun.rmi.registry
  31  *          java.rmi/sun.rmi.server
  32  *          java.rmi/sun.rmi.transport
  33  *          java.rmi/sun.rmi.transport.tcp
  34  * @build TestLibrary RMID
  35  *     MyRMI ActivatableImpl ActivatableImpl ActivatableImpl_Stub
  36  * @run main/othervm/policy=security.policy/timeout=150 CheckImplClassLoader
  37  */
  38 
  39 import java.io.*;
  40 import java.rmi.*;
  41 import java.rmi.server.*;
  42 import java.rmi.activation.*;
  43 import java.net.URL;
  44 
  45 /**


  62     public static void main(String args[]) {
  63         /*
  64          * The following line is required with the JDK 1.2 VM because
  65          * of gc hocus pocus that may no longer be needed with an
  66          * exact vm (hotspot).
  67          */
  68         Object dummy1 = new Object();
  69         RMID rmid = null;
  70 
  71         System.err.println("\nRegression test for bug/rfe 4289544\n");
  72 
  73         try {
  74 
  75             URL implcb = TestLibrary.installClassInCodebase("ActivatableImpl",
  76                                                             "implcb");
  77             TestLibrary.installClassInCodebase("ActivatableImpl_Stub",
  78                                                "implcb");
  79             TestLibrary.suggestSecurityManager(
  80                 TestParams.defaultSecurityManager);
  81 
  82             rmid = RMID.launch();


  83 
  84             System.err.println("Create activation group in this VM");
  85             ActivationGroupDesc groupDesc =
  86                 new ActivationGroupDesc(null, null);
  87             ActivationSystem system = ActivationGroup.getSystem();
  88             ActivationGroupID groupID = system.registerGroup(groupDesc);
  89             group = ActivationGroup.createGroup(groupID, groupDesc, 0);
  90 
  91             ActivationDesc desc = new ActivationDesc("ActivatableImpl",
  92                                                      implcb.toString(), null);
  93             myRMI = (MyRMI) Activatable.register(desc);
  94 
  95             System.err.println("Checking that impl has correct " +
  96                                "context class loader");
  97             if (!myRMI.classLoaderOk()) {
  98                 TestLibrary.bomb("incorrect context class loader for " +
  99                                  "activation constructor");
 100             }
 101 
 102             System.err.println("Deactivate object via method call");
< prev index next >