diff --git a/liberty-maven-plugin/src/it/toolchain-install-feature-it/invoker.properties b/liberty-maven-plugin/src/it/toolchain-install-feature-it/invoker.properties new file mode 100644 index 000000000..e2a44e3c0 --- /dev/null +++ b/liberty-maven-plugin/src/it/toolchain-install-feature-it/invoker.properties @@ -0,0 +1 @@ +invoker.goals = clean verify diff --git a/liberty-maven-plugin/src/it/toolchain-install-feature-it/pom.xml b/liberty-maven-plugin/src/it/toolchain-install-feature-it/pom.xml new file mode 100644 index 000000000..a0e4f3b1a --- /dev/null +++ b/liberty-maven-plugin/src/it/toolchain-install-feature-it/pom.xml @@ -0,0 +1,124 @@ + + + 4.0.0 + + + io.openliberty.tools.it + tests + 1.0-SNAPSHOT + + + toolchain-install-feature-it + jar + + + + junit + junit + 4.13.1 + test + + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.1.2 + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + + + + io.openliberty.tools + liberty-maven-plugin + @pom.version@ + + + 17 + + + ${runtimeGroupId} + ${runtimeKernelId} + ${runtimeVersion} + zip + + toolchainTestServer + src/test/resources/server.xml + + + + install-liberty + compile + + install-server + + + + create-liberty-server + pre-integration-test + + create + + + + install-features + pre-integration-test + + install-feature + + + + true + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + true + once + 300 + -enableassertions + ${project.build.directory} + + **/*Test.java + + + + + integration-test + + integration-test + + + + verify + verify + + verify + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + diff --git a/liberty-maven-plugin/src/it/toolchain-install-feature-it/src/test/java/net/wasdev/wlp/maven/test/app/ToolchainInstallFeatureTest.java b/liberty-maven-plugin/src/it/toolchain-install-feature-it/src/test/java/net/wasdev/wlp/maven/test/app/ToolchainInstallFeatureTest.java new file mode 100644 index 000000000..eca10e8a2 --- /dev/null +++ b/liberty-maven-plugin/src/it/toolchain-install-feature-it/src/test/java/net/wasdev/wlp/maven/test/app/ToolchainInstallFeatureTest.java @@ -0,0 +1,39 @@ +package net.wasdev.wlp.maven.test.app; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import org.junit.Test; + +public class ToolchainInstallFeatureTest { + + private static final String TOOLCHAIN_CONFIGURED_MESSAGE = "CWWKM4101I: The install-feature goal is using the configured toolchain JDK"; + + @Test + public void testToolchainUsedForInstallFeature() throws Exception { + File buildLog = new File("../build.log"); + assertTrue("Build log should exist: " + buildLog.getAbsolutePath(), buildLog.exists()); + + String logContent = readFile(buildLog); + assertNotNull("Build log content should not be null", logContent); + + assertTrue("Build log should contain toolchain configured message for install-feature goal", + logContent.contains(TOOLCHAIN_CONFIGURED_MESSAGE)); + } + + private String readFile(File file) throws IOException { + StringBuilder content = new StringBuilder(); + try (BufferedReader reader = new BufferedReader(new FileReader(file))) { + String line; + while ((line = reader.readLine()) != null) { + content.append(line).append("\n"); + } + } + return content.toString(); + } +} diff --git a/liberty-maven-plugin/src/it/toolchain-install-feature-it/src/test/resources/server.xml b/liberty-maven-plugin/src/it/toolchain-install-feature-it/src/test/resources/server.xml new file mode 100644 index 000000000..7f44db127 --- /dev/null +++ b/liberty-maven-plugin/src/it/toolchain-install-feature-it/src/test/resources/server.xml @@ -0,0 +1,11 @@ + + + + servlet-4.0 + + + + diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/InstallFeatureSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/InstallFeatureSupport.java index cc847d9f9..1353f5771 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/InstallFeatureSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/InstallFeatureSupport.java @@ -69,7 +69,7 @@ public abstract class InstallFeatureSupport extends ServerFeatureSupport { protected class InstallFeatureMojoUtil extends InstallFeatureUtil { public InstallFeatureMojoUtil(Set pluginListedEsas, List propertiesList, String openLibertyVerion, String containerName, List additionalJsons, Collection> keyMap) throws PluginScenarioException, PluginExecutionException { - super(installDirectory, new File(project.getBuild().getDirectory()), features.getFrom(), features.getTo(), pluginListedEsas, propertiesList, openLibertyVerion, containerName, additionalJsons, features.getVerify(), keyMap); + super(installDirectory, new File(project.getBuild().getDirectory()), features.getFrom(), features.getTo(), pluginListedEsas, propertiesList, openLibertyVerion, containerName, additionalJsons, features.getVerify(), keyMap, getToolchainEnvVar()); setContainerEngine(this); }