1 /* 2 * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 */ 5 package com.oracle.appbundlers.tests.functionality.jdk9test; 6 7 import static com.oracle.appbundlers.utils.installers.AbstractBundlerUtils.CHECK_MODULE_IN_JAVA_EXECUTABLE; 8 import static com.oracle.appbundlers.utils.installers.AbstractBundlerUtils.OUTPUT_CONTAINS; 9 10 import java.io.IOException; 11 import java.util.HashMap; 12 import java.util.Map; 13 14 import com.oracle.appbundlers.tests.functionality.functionalinterface.AdditionalParams; 15 import com.oracle.appbundlers.tests.functionality.functionalinterface.VerifiedOptions; 16 import com.oracle.appbundlers.utils.AppWrapper; 17 import com.oracle.appbundlers.utils.ExtensionType; 18 import com.oracle.appbundlers.utils.SourceFactory; 19 import com.oracle.appbundlers.utils.Utils; 20 21 /** 22 * Example 5: Named Module App + Entire JRE (default) 23 * 24 * -appClass HelloWorld -BmainJar=hello.world.jar -addmods hello.world,ALL_JRE 25 * (implicit so not required) 26 * 27 * @author Ramesh BG Example 5 in chris list Need to check with chris whether 28 * ALL_JRE is required here. 29 */ 30 public class NamedModuleWithEntireJreTest extends ModuleTestBase { 31 32 protected VerifiedOptions getVerifiedOptions() { 33 return () -> { 34 Map<String, Object> hashMap = new HashMap<String, Object>(); 35 hashMap.put(OUTPUT_CONTAINS, HELLO_WORLD_OUTPUT); 36 hashMap.put(CHECK_MODULE_IN_JAVA_EXECUTABLE, 37 COM_GREETINGS_MODULE_CUM_PACKAGE_NAME); 38 return hashMap; 39 }; 40 } 41 42 protected AdditionalParams getAdditionalParams() { 43 return () -> { 44 Map<String, Object> hashMap = new HashMap<String, Object>(); 45 hashMap.put(ADD_MODS, this.currentParameter.getApp().addAllModules()); 46 return hashMap; 47 }; 48 } 49 50 protected AppWrapper getApp() throws IOException { 51 return new AppWrapper(Utils.getTempSubDir(WORK_DIRECTORY), 52 COM_GREETINGS_APP1_QUALIFIED_CLASS_NAME, 53 SourceFactory.get_com_greetings_module()); 54 } 55 56 @Override 57 public void overrideParameters(ExtensionType intermediate) 58 throws IOException { 59 if (ExtensionType.NormalJar != intermediate) { 60 this.currentParameter.setApp(getApp()); 61 this.currentParameter.setAdditionalParams(getAdditionalParams()); 62 this.currentParameter.setVerifiedOptions(getVerifiedOptions()); 63 } 64 } 65 }