test/java/rmi/transport/checkFQDN/CheckFQDN.java

Print this page

        

@@ -32,10 +32,11 @@
  *
  * @author Laird Dornin
  *
  * @library ../../testlibrary
  * @build CheckFQDN CheckFQDNClient CheckFQDN_Stub TellServerName
+ * @build TestLibrary
  * @run main/othervm/timeout=120 CheckFQDN
  */
 
 /**
  * Get the hostname used by rmi using different rmi properities:

@@ -61,11 +62,11 @@
  * Export a remote object through which the exec'ed client vm can
  * inform the main test what its host name is.
  */
 public class CheckFQDN extends UnicastRemoteObject
     implements TellServerName {
-
+    public static int REGISTRY_PORT =-1;
     static String propertyBeingTested = null;
     static String propertyBeingTestedValue = null;
 
     public static void main(String args[]) {
 

@@ -75,12 +76,12 @@
             checkFQDN = new CheckFQDN();
 
             System.err.println
                 ("\nRegression test for bug/rfe 4115683\n");
 
-            Registry registry = java.rmi.registry.LocateRegistry.
-                createRegistry(TestLibrary.REGISTRY_PORT);
+            Registry registry = TestLibrary.createRegistryOnUnusedPort();
+            REGISTRY_PORT = TestLibrary.getRegistryPort(registry);
             registry.bind("CheckFQDN", checkFQDN);
 
             /* test the host name scheme in different environments.*/
             testProperty("java.rmi.server.useLocalHostname", "true", "");
             testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest", "");

@@ -115,11 +116,13 @@
             }
 
             JavaVM jvm = new JavaVM("CheckFQDNClient",
                                     propOption + property +
                                     equal +
-                                    propertyValue + extraProp,
+                                    propertyValue + extraProp +
+                                    " -Drmi.registry.port=" +
+                                    REGISTRY_PORT,
                                     "");
 
             propertyBeingTested=property;
             propertyBeingTestedValue=propertyValue;