--- old/functional/appBundlerTestsJDK9/appBundlerTestsJDK9/test/com/oracle/appbundlers/tests/functionality/CoupleSecondaryLaunchersTest.java 2016-08-19 23:40:43.988519900 +0530 +++ new/functional/appBundlerTestsJDK9/appBundlerTestsJDK9/test/com/oracle/appbundlers/tests/functionality/CoupleSecondaryLaunchersTest.java 2016-08-19 23:40:43.196861600 +0530 @@ -7,21 +7,15 @@ import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import com.oracle.appbundlers.tests.functionality.functionalinterface.AdditionalParams; import com.oracle.appbundlers.tests.functionality.functionalinterface.VerifiedOptions; -import com.oracle.appbundlers.utils.AppWrapper; import com.oracle.appbundlers.utils.BundlerUtils; import com.oracle.appbundlers.utils.BundlingManagers; import com.oracle.appbundlers.utils.ExtensionType; -import com.oracle.appbundlers.utils.Source; -import com.oracle.appbundlers.utils.SourceFactory; -import com.oracle.appbundlers.utils.Utils; import javafx.util.Pair; @@ -31,10 +25,16 @@ */ public class CoupleSecondaryLaunchersTest extends TestBase { + private static final String appName = "SQE-TEST-APP"; private static final String secondAppName = "app2"; private static final String thirdAppName = "app3"; @Override + public String getResultingAppName() { + return appName; + } + + @Override protected BundlingManagers[] getBundlingManagers() { return new BundlingManagers[] { BundlingManagers.ANT, BundlingManagers.JAVA_API }; @@ -57,113 +57,47 @@ public AdditionalParams getAdditionalParams() { return () -> { Map additionalParams = new HashMap<>(); - additionalParams.put(APP_NAME, getResultingAppName()); + additionalParams.put(APP_NAME_REPLACEMENT_STATEMENT, appName); List> launchers = new ArrayList<>(); - Map secondLauncher = getSecondLauncher(); - launchers.add(secondLauncher); - Map thirdLauncher = getThirdLauncher(); - launchers.add(thirdLauncher); + Map launcherParams = new HashMap<>(); + launcherParams.put(APP_NAME_REPLACEMENT_STATEMENT, secondAppName); + launcherParams.put(APPLICATION_CLASS, APP1_FULLNAME); + launcherParams.put(ARGUMENTS, asList(secondAppName)); + + launchers.add(launcherParams); + + launcherParams = new HashMap<>(); + launcherParams.put(APP_NAME_REPLACEMENT_STATEMENT, thirdAppName); + launcherParams.put(APPLICATION_CLASS, APP2_FULLNAME); + launcherParams.put(ARGUMENTS, asList(thirdAppName)); + launchers.add(launcherParams); additionalParams.put(SECONDARY_LAUNCHERS, launchers); return additionalParams; }; - } - private Map getSecondLauncher() throws IOException { - Map secondLauncher = new HashMap<>(); - secondLauncher.put(APP_NAME, secondAppName); - secondLauncher.put(APPLICATION_CLASS, - COM_GREETINGS_APP2_QUALIFIED_CLASS_NAME); - if (this.currentParameter.getApp().isAppContainsModules()) { - secondLauncher.put(MAIN_MODULE, - COM_GREETINGS_MODULE_CUM_PACKAGE_NAME); - } - secondLauncher.put(ARGUMENTS, asList(secondAppName)); - return secondLauncher; - } - - private Map getThirdLauncher() throws IOException { - Map thirdLauncher = new HashMap<>(); - thirdLauncher.put(APP_NAME, thirdAppName); - thirdLauncher.put(APPLICATION_CLASS, - COM_GREETINGS_APP3_QUALIFIED_CLASS_NAME); - if (this.currentParameter.getApp().isAppContainsModules()) { - thirdLauncher.put(MAIN_MODULE, - COM_GREETINGS_MODULE_CUM_PACKAGE_NAME); - } - thirdLauncher.put(ARGUMENTS, asList(thirdAppName)); - return thirdLauncher; } public VerifiedOptions getVerifiedOptions() { return () -> { Map verifiedOptions = getAdditionalParams() .getAdditionalParams(); - verifiedOptions.put(OUTPUT_CONTAINS, PASS_1); verifiedOptions.put(SECOND_LAUNCHER_MULTI_OUTPUT_CONTAINS, - new Pair<>(secondAppName, asList(PASS_2, secondAppName))); + new Pair<>(secondAppName, asList(PASS_1, secondAppName))); verifiedOptions.put(SECOND_LAUNCHER_MULTI_OUTPUT_CONTAINS, - new Pair<>(thirdAppName, asList(PASS_3, thirdAppName))); + new Pair<>(thirdAppName, asList(PASS_2, thirdAppName))); + verifiedOptions.put(OUTPUT_CONTAINS, PASS_1); return verifiedOptions; }; } @Override - public void overrideParameters(ExtensionType extension) throws IOException { - this.currentParameter.setApp(getApp(extension)); + public void overrideParameters(ExtensionType intermediate) + throws IOException { this.currentParameter.setAdditionalParams(getAdditionalParams()); this.currentParameter.setVerifiedOptions(getVerifiedOptions()); } - - private AppWrapper getApp(ExtensionType extension) throws IOException { - Map replacementsInSourceCodeForApp2 = new HashMap(); - replacementsInSourceCodeForApp2.put(PASS_STRING_REPLACEMENT_STATEMENT, - PASS_2); - replacementsInSourceCodeForApp2.put(APP_NAME_REPLACEMENT_STATEMENT, - APP2_NAME); - - Map replacementsInSourceCodeForApp3 = new HashMap(); - replacementsInSourceCodeForApp3.put(PASS_STRING_REPLACEMENT_STATEMENT, - PASS_3); - replacementsInSourceCodeForApp3.put(APP_NAME_REPLACEMENT_STATEMENT, - APP3_NAME); - switch (extension) { - default: - return new AppWrapper(Utils.getTempSubDir(WORK_DIRECTORY), - COM_GREETINGS_APP1_QUALIFIED_CLASS_NAME, - SourceFactory.get_com_greetings_app_unnamed_module(), - SourceFactory.get_com_greetings_app_unnamed_module( - COM_GREETINGS_APP2_QUALIFIED_CLASS_NAME, - replacementsInSourceCodeForApp2), - SourceFactory.get_com_greetings_app_unnamed_module( - COM_GREETINGS_APP3_QUALIFIED_CLASS_NAME, - replacementsInSourceCodeForApp3)); - case ExplodedModules: - case Jmods: - case ModularJar: - Map> classNameToReplacements = new LinkedHashMap<>(); - classNameToReplacements.put(APP1_NAME, Collections.emptyMap()); - classNameToReplacements.put(APP2_NAME, Collections.emptyMap()); - classNameToReplacements.put(APP3_NAME, Collections.emptyMap()); - - Map classNameToTemplateMap = new HashMap<>(); - classNameToTemplateMap.put(COM_GREETINGS_APP1_QUALIFIED_CLASS_NAME, - FXAPP_JAVA_TEMPLATE); - classNameToTemplateMap.put(COM_GREETINGS_APP2_QUALIFIED_CLASS_NAME, - FXAPP_JAVA_TEMPLATE); - classNameToTemplateMap.put(COM_GREETINGS_APP3_QUALIFIED_CLASS_NAME, - FXAPP_JAVA_TEMPLATE); - Source get_com_greetings_module_source = SourceFactory - .get_com_greetings_module(classNameToTemplateMap, - COM_GREETINGS_APP1_QUALIFIED_CLASS_NAME, - classNameToReplacements); - get_com_greetings_module_source.setMainModule(true); - return new AppWrapper(Utils.getTempSubDir(WORK_DIRECTORY), - COM_GREETINGS_APP1_QUALIFIED_CLASS_NAME, - get_com_greetings_module_source); - } - } }