/* * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. */ package com.oracle.appbundlers.tests.functionality; import static com.oracle.appbundlers.utils.installers.AbstractBundlerUtils.OUTPUT_CONTAINS; import static java.util.stream.Collectors.toSet; import java.io.IOException; import java.nio.file.Path; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutionException; import com.oracle.appbundlers.tests.functionality.functionalinterface.BasicParams; 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.tools.packager.RelativeFileSet; import com.oracle.tools.packager.StandardBundlerParam; /** * @author Dmitry Ginzburg <dmitry.x.ginzburg@oracle.com> */ /** * This test's purpose is to check whether: * * So, the only passed parameter is essential {@code appResources} */ public class DefaultClassPathTest extends TestBase { public VerifiedOptions getVerifiedOptions() { return () -> { Map verifiedOptions = new HashMap<>(); verifiedOptions.put(OUTPUT_CONTAINS, PASS_1); return verifiedOptions; }; } @Override protected void prepareApp(AppWrapper app, ExtensionType extension) throws IOException, ExecutionException { app.preinstallApp(extension); app.writeSourcesToAppDirectory(); app.compileApp(); app.jarApp(Collections.emptyList(), true); } @Override protected BundlingManagers[] getBundlingManagers() { return new BundlingManagers[] { BundlingManagers.CLI }; } @Override protected BundlerUtils[] getBundlerUtils() { return new BundlerUtils[] { BundlerUtils.EXE }; } @Override public void overrideParameters(ExtensionType intermediate) throws IOException { this.currentParameter.setVerifiedOptions(getVerifiedOptions()); this.currentParameter.setBasicParams(getBasicParams()); } protected BasicParams getBasicParams() { return (AppWrapper app) -> { Map basicParams = new HashMap<>(); basicParams .put(APP_RESOURCES, new RelativeFileSet(app.getJarDir().toFile(), app.getJarFilesList().stream() .map(Path::toFile) .collect(toSet()))); String mainClass = StandardBundlerParam.MAIN_CLASS .fetchFrom(basicParams); basicParams.put(APPLICATION_CLASS, mainClass); return basicParams; }; } @Override public boolean isTestCaseApplicableForExtensionType( ExtensionType extension) { return ExtensionType.NormalJar == extension; } }