< prev index next >

functional/appBundlerTestsJDK9/appBundlerTestsJDK9/test/com/oracle/appbundlers/tests/functionality/JvmOptionsTest.java

Print this page




  12 import java.util.Arrays;
  13 import java.util.HashMap;
  14 import java.util.List;
  15 import java.util.Map;
  16 
  17 import com.oracle.appbundlers.tests.functionality.functionalinterface.AdditionalParams;
  18 import com.oracle.appbundlers.tests.functionality.functionalinterface.VerifiedOptions;
  19 import com.oracle.appbundlers.utils.ExtensionType;
  20 
  21 /**
  22  * @author Dmitry Ginzburg &lt;dmitry.x.ginzburg@oracle.com&gt;
  23  * @author Dmitry Zinkevich &lt;dmitry.zinkevich@oracle.com&gt;
  24  * @TODO: test needs to be modified.
  25  */
  26 
  27 /**
  28  * Tests that provided JVM options are applied to the installed app.
  29  */
  30 public class JvmOptionsTest extends TestBase {
  31     private static final List<String> jvmOptions = Arrays.asList(
  32             "-Dsqe.foo.bar=baz", "-Dsqe.qux.corge=grault");

  33     private static final Map<String, String> jvmProperties = new HashMap<String, String>() {
  34         {
  35             put("sqe.aba.caba", "dabacaba");
  36         }
  37     };
  38 //    private static final Map<String, String> userJvmOptions = new HashMap<String, String>() {
  39 //        {
  40 //            // put("-Xmx", "1g");
  41 //            // put("-Xms", "512m");
  42 //        }
  43 //    };
  44 
  45     public List<String> jvmOptions() {
  46         return jvmOptions;
  47     }
  48 
  49     public Map<String, String> jvmProperties() {
  50         return jvmProperties;
  51     }
  52 
  53 //    public Map<String, String> userJvmOptions() {
  54 //        return userJvmOptions;
  55 //    }
  56 
  57     public AdditionalParams getAdditionalParams() {
  58         return () -> {
  59             Map<String, Object> additionalParams = new HashMap<>();
  60             additionalParams.put(JVM_OPTIONS, jvmOptions());
  61             additionalParams.put(JVM_PROPERTIES, jvmProperties());
  62 //            additionalParams.put(USER_JVM_OPTIONS, userJvmOptions());
  63             return additionalParams;
  64         };
  65     }
  66 
  67     protected VerifiedOptions getVerifiedOptions() {
  68         return () -> {
  69             Map<String, Object> verifiedOptions = new HashMap<>();
  70             verifiedOptions.put(JVM_PROPERTIES, jvmProperties);
  71             verifiedOptions.put(MULTI_OUTPUT_CONTAINS, jvmOptions);
  72 //            verifiedOptions
  73 //                    .put(MULTI_OUTPUT_CONTAINS,
  74 //                            userJvmOptions.entrySet().stream()
  75 //                                    .map(entry -> entry.getKey()
  76 //                                            + entry.getValue())
  77 //                            .collect(toList()));
  78             return verifiedOptions;
  79         };
  80     }
  81 
  82     @Override
  83     public void overrideParameters(ExtensionType intermediate)
  84             throws IOException {
  85         this.currentParameter.setAdditionalParams(getAdditionalParams());
  86         this.currentParameter.setVerifiedOptions(getVerifiedOptions());
  87     }
  88 }


  12 import java.util.Arrays;
  13 import java.util.HashMap;
  14 import java.util.List;
  15 import java.util.Map;
  16 
  17 import com.oracle.appbundlers.tests.functionality.functionalinterface.AdditionalParams;
  18 import com.oracle.appbundlers.tests.functionality.functionalinterface.VerifiedOptions;
  19 import com.oracle.appbundlers.utils.ExtensionType;
  20 
  21 /**
  22  * @author Dmitry Ginzburg &lt;dmitry.x.ginzburg@oracle.com&gt;
  23  * @author Dmitry Zinkevich &lt;dmitry.zinkevich@oracle.com&gt;
  24  * @TODO: test needs to be modified.
  25  */
  26 
  27 /**
  28  * Tests that provided JVM options are applied to the installed app.
  29  */
  30 public class JvmOptionsTest extends TestBase {
  31     private static final List<String> jvmOptions = Arrays.asList(
  32             "-Dsqe.foo.bar=baz", "-Dsqe.qux.corge=grault", "-Xmx1g",
  33             "-Xms1024m");
  34     private static final Map<String, String> jvmProperties = new HashMap<String, String>() {
  35         {
  36             put("sqe.aba.caba", "dabacaba");
  37         }
  38     };
  39     private static final Map<String, String> userJvmOptions = new HashMap<String, String>() {
  40         {
  41             // put("-Xmx", "1g");
  42             // put("-Xms", "512m");
  43         }
  44     };
  45 
  46     public List<String> jvmOptions() {
  47         return jvmOptions;
  48     }
  49 
  50     public Map<String, String> jvmProperties() {
  51         return jvmProperties;
  52     }
  53 
  54     public Map<String, String> userJvmOptions() {
  55         return userJvmOptions;
  56     }
  57 
  58     public AdditionalParams getAdditionalParams() {
  59         return () -> {
  60             Map<String, Object> additionalParams = new HashMap<>();
  61             additionalParams.put(JVM_OPTIONS, jvmOptions());
  62             additionalParams.put(JVM_PROPERTIES, jvmProperties());
  63             additionalParams.put(USER_JVM_OPTIONS, userJvmOptions());
  64             return additionalParams;
  65         };
  66     }
  67 
  68     protected VerifiedOptions getVerifiedOptions() {
  69         return () -> {
  70             Map<String, Object> verifiedOptions = new HashMap<>();
  71             verifiedOptions.put(JVM_PROPERTIES, jvmProperties);
  72             verifiedOptions.put(MULTI_OUTPUT_CONTAINS, jvmOptions);
  73             verifiedOptions
  74                     .put(MULTI_OUTPUT_CONTAINS,
  75                             userJvmOptions.entrySet().stream()
  76                                     .map(entry -> entry.getKey()
  77                                             + entry.getValue())
  78                             .collect(toList()));
  79             return verifiedOptions;
  80         };
  81     }
  82 
  83     @Override
  84     public void overrideParameters(ExtensionType intermediate)
  85             throws IOException {
  86         this.currentParameter.setAdditionalParams(getAdditionalParams());
  87         this.currentParameter.setVerifiedOptions(getVerifiedOptions());
  88     }
  89 }
< prev index next >