< prev index next >

test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.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 4164971
  26  * @summary allow non-public activatable class and/or constructor
  27  * @author Laird Dornin
  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 ActivateMe
  35  * @run main/othervm/policy=security.policy/timeout=240 CreatePrivateActivatable
  36  */
  37 
  38 import java.io.*;
  39 import java.rmi.*;
  40 import java.rmi.server.*;
  41 import java.rmi.activation.*;
  42 import sun.rmi.server.ActivatableRef;
  43 import java.lang.reflect.*;
  44 import java.util.Properties;
  45 


  85         /*
  86          * The following line is required with the JDK 1.2 VM so that the
  87          * VM can exit gracefully when this test completes.  Otherwise, the
  88          * conservative garbage collector will find a handle to the server
  89          * object on the native stack and not clear the weak reference to
  90          * it in the RMI runtime's object table.
  91          */
  92         Object dummy = new Object();
  93         RMID rmid = null;
  94         ActivateMe obj;
  95 
  96         System.err.println("\nRegression test for bug 4164971\n");
  97         System.err.println("java.security.policy = " +
  98                            System.getProperty("java.security.policy", "no policy"));
  99 
 100         CreatePrivateActivatable server;
 101         try {
 102             TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager);
 103 
 104             // start an rmid.
 105             RMID.removeLog();
 106             rmid = RMID.createRMID();
 107             rmid.start();
 108 
 109             /* Cause activation groups to have a security policy that will
 110              * allow security managers to be downloaded and installed
 111              */
 112             Properties p = new Properties();
 113             // this test must always set policies/managers in its
 114             // activation groups
 115             p.put("java.security.policy",
 116                   TestParams.defaultGroupPolicy);
 117             p.put("java.security.manager",
 118                   TestParams.defaultSecurityManager);
 119 
 120             /*
 121              * Activate an object by registering its object
 122              * descriptor and invoking a method on the
 123              * stub returned from the register call.
 124              */
 125             ActivationGroupDesc groupDesc =
 126                 new ActivationGroupDesc(p, null);
 127             ActivationSystem system = ActivationGroup.getSystem();




   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 4164971 8085192
  26  * @summary allow non-public activatable class and/or constructor
  27  * @author Laird Dornin
  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 ActivateMe
  35  * @run main/othervm/policy=security.policy/timeout=240 CreatePrivateActivatable
  36  */
  37 
  38 import java.io.*;
  39 import java.rmi.*;
  40 import java.rmi.server.*;
  41 import java.rmi.activation.*;
  42 import sun.rmi.server.ActivatableRef;
  43 import java.lang.reflect.*;
  44 import java.util.Properties;
  45 


  85         /*
  86          * The following line is required with the JDK 1.2 VM so that the
  87          * VM can exit gracefully when this test completes.  Otherwise, the
  88          * conservative garbage collector will find a handle to the server
  89          * object on the native stack and not clear the weak reference to
  90          * it in the RMI runtime's object table.
  91          */
  92         Object dummy = new Object();
  93         RMID rmid = null;
  94         ActivateMe obj;
  95 
  96         System.err.println("\nRegression test for bug 4164971\n");
  97         System.err.println("java.security.policy = " +
  98                            System.getProperty("java.security.policy", "no policy"));
  99 
 100         CreatePrivateActivatable server;
 101         try {
 102             TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager);
 103 
 104             // start an rmid.
 105             rmid = RMID.launch();


 106 
 107             /* Cause activation groups to have a security policy that will
 108              * allow security managers to be downloaded and installed
 109              */
 110             Properties p = new Properties();
 111             // this test must always set policies/managers in its
 112             // activation groups
 113             p.put("java.security.policy",
 114                   TestParams.defaultGroupPolicy);
 115             p.put("java.security.manager",
 116                   TestParams.defaultSecurityManager);
 117 
 118             /*
 119              * Activate an object by registering its object
 120              * descriptor and invoking a method on the
 121              * stub returned from the register call.
 122              */
 123             ActivationGroupDesc groupDesc =
 124                 new ActivationGroupDesc(p, null);
 125             ActivationSystem system = ActivationGroup.getSystem();


< prev index next >