< prev index next >

test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.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 4149366
  26  * @summary The class loader used to load classes for parameter types sent in
  27  * an RMI call to an activatable object should delegate to the class loader
  28  * that loaded the class of the activatable object itself, to maximize the
  29  * likelihood of type compatibility between downloaded parameter types and
  30  * supertypes shared with the activatable object.
  31  * @author Peter Jones (much code taken from Ann Wollrath's activation tests)
  32  *
  33  * @library ../../../testlibrary
  34  * @modules java.rmi/sun.rmi.registry
  35  *          java.rmi/sun.rmi.server
  36  *          java.rmi/sun.rmi.transport
  37  *          java.rmi/sun.rmi.transport.tcp
  38  * @build TestLibrary RMID ActivationLibrary
  39  *     Foo FooReceiverImpl FooReceiverImpl_Stub Bar
  40  * @run main/othervm/policy=security.policy/timeout=240 DownloadParameterClass
  41  */
  42 
  43 import java.io.*;
  44 import java.net.*;
  45 import java.util.*;


  72          * loader in the "codebase1" subdirectory of working directory, and
  73          * install the subtype to be downloaded into the activatable object
  74          * into the "codebase2" subdirectory.
  75          */
  76         URL codebase1 = null;
  77         URL codebase2 = null;
  78         try {
  79             codebase1 = TestLibrary.installClassInCodebase("FooReceiverImpl", "codebase1");
  80             TestLibrary.installClassInCodebase("FooReceiverImpl_Stub", "codebase1");
  81             TestLibrary.installClassInCodebase("Foo", "codebase1");
  82             codebase2 = TestLibrary.installClassInCodebase("Bar", "codebase2");
  83         } catch (MalformedURLException e) {
  84             TestLibrary.bomb("failed to install test classes", e);
  85         }
  86 
  87         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
  88 
  89         RMID rmid = null;
  90 
  91         try {
  92             RMID.removeLog();
  93             rmid = RMID.createRMID();
  94             rmid.start();
  95 
  96             /* Cause activation groups to have a security policy that will
  97              * allow security managers to be downloaded and installed
  98              */
  99             Properties p = new Properties();
 100             // this test must always set policies/managers in its
 101             // activation groups
 102             p.put("java.security.policy",
 103                   TestParams.defaultGroupPolicy);
 104             p.put("java.security.manager",
 105                   TestParams.defaultSecurityManager);
 106 
 107             /*
 108              * Create and register descriptors for activatable object in a
 109              * group other than this VM's group, so that another VM will be
 110              * spawned with the object is activated.
 111              */
 112             System.err.println("Creating descriptors");
 113             ActivationGroupDesc groupDesc =
 114                 new ActivationGroupDesc(p, null);




   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 4149366 8085192
  26  * @summary The class loader used to load classes for parameter types sent in
  27  * an RMI call to an activatable object should delegate to the class loader
  28  * that loaded the class of the activatable object itself, to maximize the
  29  * likelihood of type compatibility between downloaded parameter types and
  30  * supertypes shared with the activatable object.
  31  * @author Peter Jones (much code taken from Ann Wollrath's activation tests)
  32  *
  33  * @library ../../../testlibrary
  34  * @modules java.rmi/sun.rmi.registry
  35  *          java.rmi/sun.rmi.server
  36  *          java.rmi/sun.rmi.transport
  37  *          java.rmi/sun.rmi.transport.tcp
  38  * @build TestLibrary RMID ActivationLibrary
  39  *     Foo FooReceiverImpl FooReceiverImpl_Stub Bar
  40  * @run main/othervm/policy=security.policy/timeout=240 DownloadParameterClass
  41  */
  42 
  43 import java.io.*;
  44 import java.net.*;
  45 import java.util.*;


  72          * loader in the "codebase1" subdirectory of working directory, and
  73          * install the subtype to be downloaded into the activatable object
  74          * into the "codebase2" subdirectory.
  75          */
  76         URL codebase1 = null;
  77         URL codebase2 = null;
  78         try {
  79             codebase1 = TestLibrary.installClassInCodebase("FooReceiverImpl", "codebase1");
  80             TestLibrary.installClassInCodebase("FooReceiverImpl_Stub", "codebase1");
  81             TestLibrary.installClassInCodebase("Foo", "codebase1");
  82             codebase2 = TestLibrary.installClassInCodebase("Bar", "codebase2");
  83         } catch (MalformedURLException e) {
  84             TestLibrary.bomb("failed to install test classes", e);
  85         }
  86 
  87         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
  88 
  89         RMID rmid = null;
  90 
  91         try {
  92             rmid = RMID.launch();


  93 
  94             /* Cause activation groups to have a security policy that will
  95              * allow security managers to be downloaded and installed
  96              */
  97             Properties p = new Properties();
  98             // this test must always set policies/managers in its
  99             // activation groups
 100             p.put("java.security.policy",
 101                   TestParams.defaultGroupPolicy);
 102             p.put("java.security.manager",
 103                   TestParams.defaultSecurityManager);
 104 
 105             /*
 106              * Create and register descriptors for activatable object in a
 107              * group other than this VM's group, so that another VM will be
 108              * spawned with the object is activated.
 109              */
 110             System.err.println("Creating descriptors");
 111             ActivationGroupDesc groupDesc =
 112                 new ActivationGroupDesc(p, null);


< prev index next >