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
46 /**
47 * Test creates a private inner class Activatable object with a
48 * private constructor and makes sure that the object can be
49 * activated.
50 */
51 public class CreatePrivateActivatable
52 {
53 private static class PrivateActivatable extends Activatable
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);
|
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 * java.base/sun.nio.ch
35 * @build TestLibrary RMID ActivateMe
36 * @run main/othervm/policy=security.policy/timeout=240 CreatePrivateActivatable
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;
46
47 /**
48 * Test creates a private inner class Activatable object with a
49 * private constructor and makes sure that the object can be
50 * activated.
51 */
52 public class CreatePrivateActivatable
53 {
54 private static class PrivateActivatable extends Activatable
87 * The following line is required with the JDK 1.2 VM so that the
88 * VM can exit gracefully when this test completes. Otherwise, the
89 * conservative garbage collector will find a handle to the server
90 * object on the native stack and not clear the weak reference to
91 * it in the RMI runtime's object table.
92 */
93 Object dummy = new Object();
94 RMID rmid = null;
95 ActivateMe obj;
96
97 System.err.println("\nRegression test for bug 4164971\n");
98 System.err.println("java.security.policy = " +
99 System.getProperty("java.security.policy", "no policy"));
100
101 CreatePrivateActivatable server;
102 try {
103 TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager);
104
105 // start an rmid.
106 RMID.removeLog();
107 rmid = RMID.createRMIDOnEphemeralPort();
108 rmid.start();
109
110 /* Cause activation groups to have a security policy that will
111 * allow security managers to be downloaded and installed
112 */
113 Properties p = new Properties();
114 // this test must always set policies/managers in its
115 // activation groups
116 p.put("java.security.policy",
117 TestParams.defaultGroupPolicy);
118 p.put("java.security.manager",
119 TestParams.defaultSecurityManager);
120
121 /*
122 * Activate an object by registering its object
123 * descriptor and invoking a method on the
124 * stub returned from the register call.
125 */
126 ActivationGroupDesc groupDesc =
127 new ActivationGroupDesc(p, null);
|