< prev index next >

test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.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 4110548
  26  * @summary activate fails if rmid is restarted
  27  * @author 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 ActivationLibrary
  35  *     ActivateMe CheckRegisterInLog_Stub
  36  * @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog
  37  */
  38 
  39 import java.io.*;
  40 import java.rmi.*;
  41 import java.rmi.server.*;
  42 import java.rmi.activation.*;
  43 import sun.rmi.server.ActivatableRef;
  44 import java.lang.reflect.*;
  45 import java.util.Properties;


  81          * The following line is required with the JDK 1.2 VM so that the
  82          * VM can exit gracefully when this test completes.  Otherwise, the
  83          * conservative garbage collector will find a handle to the server
  84          * object on the native stack and not clear the weak reference to
  85          * it in the RMI runtime's object table.
  86          */
  87         Object dummy = new Object();
  88         RMID rmid = null;
  89         ActivateMe obj;
  90 
  91         System.out.println("\nRegression test for bug 4110548\n");
  92 
  93         CheckRegisterInLog server;
  94 
  95         try {
  96             TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
  97 
  98             /*
  99              * Start up activation system daemon "rmid".
 100              */
 101             RMID.removeLog();
 102             rmid = RMID.createRMID();
 103             rmid.start();
 104 
 105             /* Cause activation groups to have a security policy that will
 106              * allow security managers to be downloaded and installed
 107              */
 108             Properties p = new Properties();
 109             // this test must always set policies/managers in its
 110             // activation groups
 111             p.put("java.security.policy",
 112                   TestParams.defaultGroupPolicy);
 113             p.put("java.security.manager",
 114                   TestParams.defaultSecurityManager);
 115 
 116             /*
 117              * Register an activation group and an object
 118              * in that group.
 119              */
 120             System.err.println("Creating group descriptor");
 121             ActivationGroupDesc groupDesc =
 122                 new ActivationGroupDesc(p, null);
 123             System.err.println("Registering group");




   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 4110548 8085192
  26  * @summary activate fails if rmid is restarted
  27  * @author 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 ActivationLibrary
  35  *     ActivateMe CheckRegisterInLog_Stub
  36  * @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog
  37  */
  38 
  39 import java.io.*;
  40 import java.rmi.*;
  41 import java.rmi.server.*;
  42 import java.rmi.activation.*;
  43 import sun.rmi.server.ActivatableRef;
  44 import java.lang.reflect.*;
  45 import java.util.Properties;


  81          * The following line is required with the JDK 1.2 VM so that the
  82          * VM can exit gracefully when this test completes.  Otherwise, the
  83          * conservative garbage collector will find a handle to the server
  84          * object on the native stack and not clear the weak reference to
  85          * it in the RMI runtime's object table.
  86          */
  87         Object dummy = new Object();
  88         RMID rmid = null;
  89         ActivateMe obj;
  90 
  91         System.out.println("\nRegression test for bug 4110548\n");
  92 
  93         CheckRegisterInLog server;
  94 
  95         try {
  96             TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
  97 
  98             /*
  99              * Start up activation system daemon "rmid".
 100              */
 101             rmid = RMID.launch();


 102 
 103             /* Cause activation groups to have a security policy that will
 104              * allow security managers to be downloaded and installed
 105              */
 106             Properties p = new Properties();
 107             // this test must always set policies/managers in its
 108             // activation groups
 109             p.put("java.security.policy",
 110                   TestParams.defaultGroupPolicy);
 111             p.put("java.security.manager",
 112                   TestParams.defaultSecurityManager);
 113 
 114             /*
 115              * Register an activation group and an object
 116              * in that group.
 117              */
 118             System.err.println("Creating group descriptor");
 119             ActivationGroupDesc groupDesc =
 120                 new ActivationGroupDesc(p, null);
 121             System.err.println("Registering group");


< prev index next >