1 /*
2 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 */
64 /**
65 * Export a remote object through which the exec'ed client vm can
66 * inform the main test what its host name is.
67 */
68 public class CheckFQDN extends UnicastRemoteObject
69 implements TellServerName {
70 public static int REGISTRY_PORT =-1;
71 static String propertyBeingTested = null;
72 static String propertyBeingTestedValue = null;
73
74 public static void main(String args[]) {
75
76 Object dummy = new Object();
77 CheckFQDN checkFQDN = null;
78 try {
79 checkFQDN = new CheckFQDN();
80
81 System.err.println
82 ("\nRegression test for bug/rfe 4115683\n");
83
84 Registry registry = TestLibrary.createRegistryOnUnusedPort();
85 REGISTRY_PORT = TestLibrary.getRegistryPort(registry);
86 registry.bind("CheckFQDN", checkFQDN);
87
88 /* test the host name scheme in different environments.*/
89 testProperty("java.rmi.server.useLocalHostname", "true", "");
90 testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest", "");
91 testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest",
92 " -Djava.rmi.server.useLocalHostname=true ");
93 testProperty("", "", "");
94
95 } catch (Exception e) {
96 TestLibrary.bomb(e);
97 } finally {
98 if (checkFQDN != null) {
99 TestLibrary.unexport(checkFQDN);
100 }
101 }
102 System.err.println("\nTest for bug/ref 4115683 passed.\n");
103 }
104
|
1 /*
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 */
64 /**
65 * Export a remote object through which the exec'ed client vm can
66 * inform the main test what its host name is.
67 */
68 public class CheckFQDN extends UnicastRemoteObject
69 implements TellServerName {
70 public static int REGISTRY_PORT =-1;
71 static String propertyBeingTested = null;
72 static String propertyBeingTestedValue = null;
73
74 public static void main(String args[]) {
75
76 Object dummy = new Object();
77 CheckFQDN checkFQDN = null;
78 try {
79 checkFQDN = new CheckFQDN();
80
81 System.err.println
82 ("\nRegression test for bug/rfe 4115683\n");
83
84 Registry registry = TestLibrary.createRegistryOnEphemeralPort();
85 REGISTRY_PORT = TestLibrary.getRegistryPort(registry);
86 registry.bind("CheckFQDN", checkFQDN);
87
88 /* test the host name scheme in different environments.*/
89 testProperty("java.rmi.server.useLocalHostname", "true", "");
90 testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest", "");
91 testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest",
92 " -Djava.rmi.server.useLocalHostname=true ");
93 testProperty("", "", "");
94
95 } catch (Exception e) {
96 TestLibrary.bomb(e);
97 } finally {
98 if (checkFQDN != null) {
99 TestLibrary.unexport(checkFQDN);
100 }
101 }
102 System.err.println("\nTest for bug/ref 4115683 passed.\n");
103 }
104
|