< prev index next >

test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.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 4105080
  26  * @summary Activation retry during a remote method call to an activatable
  27  *          object can cause infinite recursion in some situations. The
  28  *          RemoteRef contained in the ActivatableRef should never be
  29  *          an ActivatableRef, but another type.
  30  * (Needs /othervm to evade JavaTest security manager --aecolley)
  31  * @author Ann Wollrath
  32  *
  33  * @bug 4164971
  34  * @summary allow non-public activatable class and/or constructor
  35  *          Main test class hasa non-public constructor to ensure
  36  *          functionality is in place
  37  *
  38  * @library ../../../testlibrary
  39  * @modules java.rmi/sun.rmi.registry
  40  *          java.rmi/sun.rmi.server
  41  *          java.rmi/sun.rmi.transport
  42  *          java.rmi/sun.rmi.transport.tcp
  43  * @build TestLibrary RMID ActivateMe CheckActivateRef_Stub
  44  * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=true CheckActivateRef
  45  * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=false CheckActivateRef


 100 
 101         // test should tolerate certain types of failures
 102         int failures = 0;
 103         int i = 0;
 104 
 105         System.err.println("\nRegression test for bug 4105080\n");
 106         System.err.println("java.security.policy = " +
 107                            System.getProperty("java.security.policy",
 108                                               "no policy"));
 109 
 110 
 111         String propValue =
 112             System.getProperty("java.rmi.server.useDynamicProxies", "false");
 113         boolean useDynamicProxies = Boolean.parseBoolean(propValue);
 114 
 115         CheckActivateRef server;
 116         try {
 117             TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager);
 118 
 119             // start an rmid.
 120             RMID.removeLog();
 121             rmid = RMID.createRMID();
 122             rmid.start();
 123 
 124             /* Cause activation groups to have a security policy that will
 125              * allow security managers to be downloaded and installed
 126              */
 127             Properties p = new Properties();
 128             // this test must always set policies/managers in its
 129             // activation groups
 130             p.put("java.security.policy",
 131                   TestParams.defaultGroupPolicy);
 132             p.put("java.security.manager",
 133                   TestParams.defaultSecurityManager);
 134             p.put("java.rmi.server.useDynamicProxies", propValue);
 135 
 136             /*
 137              * Activate an object by registering its object
 138              * descriptor and invoking a method on the
 139              * stub returned from the register call.
 140              */
 141             System.err.println("Create activation group in this VM");
 142             ActivationGroupDesc groupDesc =




   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 4105080 8085192
  26  * @summary Activation retry during a remote method call to an activatable
  27  *          object can cause infinite recursion in some situations. The
  28  *          RemoteRef contained in the ActivatableRef should never be
  29  *          an ActivatableRef, but another type.
  30  * (Needs /othervm to evade JavaTest security manager --aecolley)
  31  * @author Ann Wollrath
  32  *
  33  * @bug 4164971
  34  * @summary allow non-public activatable class and/or constructor
  35  *          Main test class hasa non-public constructor to ensure
  36  *          functionality is in place
  37  *
  38  * @library ../../../testlibrary
  39  * @modules java.rmi/sun.rmi.registry
  40  *          java.rmi/sun.rmi.server
  41  *          java.rmi/sun.rmi.transport
  42  *          java.rmi/sun.rmi.transport.tcp
  43  * @build TestLibrary RMID ActivateMe CheckActivateRef_Stub
  44  * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=true CheckActivateRef
  45  * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=false CheckActivateRef


 100 
 101         // test should tolerate certain types of failures
 102         int failures = 0;
 103         int i = 0;
 104 
 105         System.err.println("\nRegression test for bug 4105080\n");
 106         System.err.println("java.security.policy = " +
 107                            System.getProperty("java.security.policy",
 108                                               "no policy"));
 109 
 110 
 111         String propValue =
 112             System.getProperty("java.rmi.server.useDynamicProxies", "false");
 113         boolean useDynamicProxies = Boolean.parseBoolean(propValue);
 114 
 115         CheckActivateRef server;
 116         try {
 117             TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager);
 118 
 119             // start an rmid.
 120             rmid = RMID.launch();


 121 
 122             /* Cause activation groups to have a security policy that will
 123              * allow security managers to be downloaded and installed
 124              */
 125             Properties p = new Properties();
 126             // this test must always set policies/managers in its
 127             // activation groups
 128             p.put("java.security.policy",
 129                   TestParams.defaultGroupPolicy);
 130             p.put("java.security.manager",
 131                   TestParams.defaultSecurityManager);
 132             p.put("java.rmi.server.useDynamicProxies", propValue);
 133 
 134             /*
 135              * Activate an object by registering its object
 136              * descriptor and invoking a method on the
 137              * stub returned from the register call.
 138              */
 139             System.err.println("Create activation group in this VM");
 140             ActivationGroupDesc groupDesc =


< prev index next >