test/java/rmi/testlibrary/TestParams.java

Print this page
rev 9344 : 8036095: RMI tests using testlibrary.RMID and testlibrary.JavaVM do not pass through vmoptions
Reviewed-by: XXX

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -30,57 +30,51 @@
  * Setup static variables to represent properties in test environment.
  */
 public class TestParams {
 
     /** variables that hold value property values */
-    public static String testSrc = null;
-    public static String testClasses = null;
+    public static final String testSrc;
+    public static final String testClasses;
 
-    /** name of default security policy */
-    public static String defaultPolicy = null;
+    /** name of default security policy for test JVM */
+    public static final String defaultPolicy;
 
     /** name of default security policy for RMID */
-    public static String defaultRmidPolicy = null;
+    public static final String defaultRmidPolicy;
 
     /** name of default security policy for activation groups */
-    public static String defaultGroupPolicy = null;
+    public static final String defaultGroupPolicy;
 
     /** name of default security manager */
-    public static String defaultSecurityManager =
-        "java.rmi.RMISecurityManager";
+    public static final String defaultSecurityManager;
 
+    /** VM options string */
+    public static final String testVmOpts;
+
+    /** Java options string */
+    public static final String testJavaOpts;
 
     /* Initalize commonly used strings */
     static {
-        try {
-            testSrc = TestLibrary.
-                getProperty("test.src", ".");
-            testClasses = TestLibrary.
-                getProperty("test.classes", ".");
-
-            // if policy file already set use it
-            defaultPolicy = TestLibrary.
-                getProperty("java.security.policy",
-                            defaultPolicy);
-            if (defaultPolicy == null) {
-                defaultPolicy = testSrc + File.separatorChar +
-                    "security.policy";
-            }
+        testSrc = TestLibrary.getProperty("test.src", ".");
+        testClasses = TestLibrary.getProperty("test.classes", ".");
 
-            // if manager prop set use it
-            defaultSecurityManager = TestLibrary.
-                getProperty("java.security.manager",
-                            defaultSecurityManager);
+        String dp = TestLibrary.getProperty("java.security.policy", null);
+        if (dp == null) {
+            dp = testSrc + File.separatorChar + "security.policy";
+        }
+        defaultPolicy = dp;
 
             defaultRmidPolicy =
                 testSrc + File.separatorChar + "rmid.security.policy";
 
-            defaultGroupPolicy = testSrc +
-                File.separatorChar + "group.security.policy";
+        defaultGroupPolicy =
+            testSrc + File.separatorChar + "group.security.policy";
 
-        } catch (SecurityException se) {
-            TestLibrary.bomb("Security exception received" +
-                             " during test initialization:",
-                             se);
-        }
+        defaultSecurityManager = TestLibrary.getProperty(
+            "java.security.manager", "java.lang.SecurityManager");
+
+        testVmOpts = TestLibrary.getProperty("test.vm.opts", "");
+
+        testJavaOpts = TestLibrary.getProperty("test.java.opts", "");
     }
 }