From 4ff653e37f6950f7fba870649a8555ee9837f65d Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Mon, 13 Jan 2025 11:43:20 +0530 Subject: [PATCH 01/15] passing default execution id for all tasks in execute mojo Signed-off-by: Arun Venmany --- liberty-maven-plugin/pom.xml | 9 +- .../pom.xml | 270 ++++++++++++++++++ .../src/main/java/com/demo/HelloLogger.java | 37 +++ .../src/main/java/com/demo/HelloServlet.java | 39 +++ .../src/main/java/com/demo/HelloWorld.java | 23 ++ .../main/liberty/config/bootstrap.properties | 1 + .../src/main/liberty/config/extraFeatures.xml | 6 + .../src/main/liberty/config/server.xml | 11 + .../src/main/resources/placeHolder.txt | 0 ...DevRecompileWithCustomExecutionIdTest.java | 68 +++++ ...evRecompileWithDefaultExecutionIdTest.java | 66 +++++ .../tools/maven/ServerFeatureSupport.java | 26 +- .../tools/maven/server/DevMojo.java | 3 +- .../maven/server/StartDebugMojoSupport.java | 3 +- 14 files changed, 557 insertions(+), 5 deletions(-) create mode 100755 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml create mode 100755 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloLogger.java create mode 100644 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloServlet.java create mode 100755 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloWorld.java create mode 100644 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/bootstrap.properties create mode 100644 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/extraFeatures.xml create mode 100755 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/server.xml create mode 100644 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/resources/placeHolder.txt create mode 100644 liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java create mode 100644 liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java diff --git a/liberty-maven-plugin/pom.xml b/liberty-maven-plugin/pom.xml index b7912546f..df85db359 100644 --- a/liberty-maven-plugin/pom.xml +++ b/liberty-maven-plugin/pom.xml @@ -88,12 +88,17 @@ io.openliberty.tools ci.common - 1.8.36 + 1.8.37-SNAPSHOT + + + org.apache.commons + commons-lang3 + 3.11 org.twdata.maven mojo-executor - 2.3.2 + 2.4.1 xmlunit diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml new file mode 100755 index 000000000..ca47792bd --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml @@ -0,0 +1,270 @@ + + + + 4.0.0 + + dev-it-tests + dev-sample-proj + 1.0-SNAPSHOT + war + + + ISO_8859_1 + UTF-8 + 1.8 + 1.8 + -Xms512m + LibertyProject + + 9080 + 9443 + + usr + + + + + + oss-sonatype + oss-sonatype + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + false + + + + + + + + io.openliberty.features + features-bom + RUNTIME_VERSION + pom + import + + + + + + + + io.openliberty.features + jaxrs-2.1 + esa + provided + + + io.openliberty.features + jsonp-1.1 + esa + provided + + + io.openliberty.features + cdi-2.0 + esa + provided + + + io.openliberty.features + mpConfig-1.3 + esa + provided + + + io.openliberty.features + mpRestClient-1.2 + esa + provided + + + + + + + + junit + junit + 4.13.1 + test + + + org.apache.cxf + cxf-rt-rs-client + 3.2.6 + test + + + org.apache.cxf + cxf-rt-rs-extension-providers + 3.2.6 + test + + + org.glassfish + javax.json + 1.0.4 + test + + + + org.apache.commons + commons-lang3 + 3.0 + + + + javax.xml.bind + jaxb-api + 2.3.1 + provided + + + com.sun.xml.bind + jaxb-core + 2.3.0.1 + provided + + + javax.activation + activation + 1.1.1 + provided + + + javax.batch + javax.batch-api + 1.0.1 + provided + + + + org.slf4j + slf4j-api + 2.0.7 + + + ch.qos.logback + logback-classic + 1.3.12 + runtime + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + java-compile + compile + compile + + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + false + pom.xml + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + test + default-test + + + **/it/** + + ${project.build.directory}/test-reports/unit + + + + + + + io.openliberty.tools + liberty-maven-plugin + SUB_VERSION + + + io.openliberty + openliberty-kernel + RUNTIME_VERSION + zip + + ${app.name} + ${packaging.type} + + ${testServerHttpPort} + ${testServerHttpsPort} + json + + + -Xms512m + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.1.2 + + + integration-test + integration-test + + integration-test + + + + **/it/**/*.java + + + + ${testServerHttpPort} + + + + + + verify-results + + verify + + + + + ${project.build.directory}/test-reports/it/failsafe-summary.xml + ${project.build.directory}/test-reports/it + + + + + diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloLogger.java b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloLogger.java new file mode 100755 index 000000000..4ff18e503 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloLogger.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * (c) Copyright IBM Corporation 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package com.demo; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import static javax.ws.rs.core.MediaType.TEXT_PLAIN; + +@Path("/show-log") +public class HelloLogger { + private static final Logger log = LoggerFactory.getLogger(HelloLogger.class); + + @GET + @Produces(TEXT_PLAIN) + public String showLog() { + log.info("Here is the Log"); + return "Log has been shown"; + } +} diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloServlet.java b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloServlet.java new file mode 100644 index 000000000..52777ebd2 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloServlet.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * (c) Copyright IBM Corporation 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package com.demo; + +import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns="/servlet") +public class HelloServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + private static final Logger log = LoggerFactory.getLogger(HelloLogger.class); + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + log.info("SLF4J Logger is ready for messages."); + response.getWriter().append("hello world"); + } +} \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloWorld.java b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloWorld.java new file mode 100755 index 000000000..cac040467 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/java/com/demo/HelloWorld.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * (c) Copyright IBM Corporation 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package com.demo; + +public class HelloWorld { + + public String helloWorld() { + return "helloWorld"; + } +} diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/bootstrap.properties b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/bootstrap.properties new file mode 100644 index 000000000..46fee5e9c --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/bootstrap.properties @@ -0,0 +1 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/extraFeatures.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/extraFeatures.xml new file mode 100644 index 000000000..6fa271bbf --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/extraFeatures.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/server.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/server.xml new file mode 100755 index 000000000..013f8a951 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/liberty/config/server.xml @@ -0,0 +1,11 @@ + + + + jaxrs-2.1 + + + + + + diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/resources/placeHolder.txt b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/src/main/resources/placeHolder.txt new file mode 100644 index 000000000..e69de29bb diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java new file mode 100644 index 000000000..ddfe68d71 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * (c) Copyright IBM Corporation 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package net.wasdev.wlp.test.dev.it; + +import static org.junit.Assert.*; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.nio.file.Files; +import java.util.Scanner; + +import org.apache.commons.io.FileUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import static io.openliberty.tools.common.plugins.util.BinaryScannerUtil.*; + +public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", false, false, null, null); + } + + @AfterClass + public static void cleanUpAfterClass() throws Exception { + BaseDevTest.cleanUpAfterClass(true); + } + + @Test + public void validateRunExecutionNotSkipped() throws Exception { + String mavenPluginCommand = "mvn compile io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":dev"; + + StringBuilder command = new StringBuilder(mavenPluginCommand); + ProcessBuilder builder = buildProcess(command.toString()); + + builder.redirectOutput(logFile); + builder.redirectError(logFile); + process = builder.start(); + assertTrue(process.isAlive()); + + OutputStream stdin = process.getOutputStream(); + + writer = new BufferedWriter(new OutputStreamWriter(stdin)); + + //java-compile is the custom execution id + assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); + // Check that the server has started + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + } +} \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java new file mode 100644 index 000000000..219749def --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * (c) Copyright IBM Corporation 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package net.wasdev.wlp.test.dev.it; + +import static org.junit.Assert.*; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.nio.file.Files; +import java.util.Scanner; + +import org.apache.commons.io.FileUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import static io.openliberty.tools.common.plugins.util.BinaryScannerUtil.*; + +public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + setUpBeforeClass(null, "../resources/basic-dev-project", false, false, null, null); + } + + @AfterClass + public static void cleanUpAfterClass() throws Exception { + BaseDevTest.cleanUpAfterClass(true); + } + + @Test + public void validateRunExecutionNotSkipped() throws Exception { + String mavenPluginCommand = "mvn compile io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":dev"; + + StringBuilder command = new StringBuilder(mavenPluginCommand); + ProcessBuilder builder = buildProcess(command.toString()); + + builder.redirectOutput(logFile); + builder.redirectError(logFile); + process = builder.start(); + assertTrue(process.isAlive()); + + OutputStream stdin = process.getOutputStream(); + + writer = new BufferedWriter(new OutputStreamWriter(stdin)); + + // Check that the server has started + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + } +} \ No newline at end of file diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/ServerFeatureSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/ServerFeatureSupport.java index 36cf2e422..591bf0cab 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/ServerFeatureSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/ServerFeatureSupport.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2021, 2024. + * (C) Copyright IBM Corporation 2021, 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,17 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Comparator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Properties; import java.util.Set; import org.apache.maven.execution.ProjectDependencyGraph; import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginExecution; import org.apache.maven.model.PluginManagement; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.descriptor.PluginDescriptor; @@ -344,4 +347,25 @@ protected Plugin getPluginForProject(String groupId, String artifactId, MavenPro } return plugin; } + + /** + * Get Plugin execution id from current project build configuration + * @param goal + * @param plugin + * @return + */ + protected String getExecutionId(String goal, Plugin plugin) { + // by default, each goal will have default execution, it will be named as default-{goal_name} + // if user has specified execution id in for a plugin, plugin execution list will have multiple entries + // if multiple entries are present, default execution id will have lowest priority(-1) + // due to this, we are taking pluginExecution will maximum priority + Optional currentExecution = plugin.getExecutions().stream() + .filter(pluginExecution -> pluginExecution.getGoals().stream().anyMatch(goal1 -> goal1.equals(goal))) + .max(Comparator.comparing(PluginExecution::getPriority)); + if (currentExecution.isPresent()) { + return currentExecution.get().getId(); + } else { + return "default-" + goal; + } + } } diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java index 709ddaf88..b0255d578 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2019, 2024. + * (C) Copyright IBM Corporation 2019, 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -2019,6 +2019,7 @@ private void runCompileMojo(String goal, MavenProject mavenProject) throws MojoE MavenProject tempProject = mavenProject; Xpp3Dom config = ExecuteMojoUtil.getPluginGoalConfig(plugin, goal, getLog()); config = Xpp3Dom.mergeXpp3Dom(configuration(element(name("failOnError"), "false")), config); + goal = goal + "#" + getExecutionId(goal, plugin); getLog().info("Running maven-compiler-plugin:" + goal + " on " + tempProject.getFile()); getLog().debug("configuration:\n" + config); executeMojo(plugin, goal(goal), config, executionEnvironment(tempProject, tempSession, pluginManager)); diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartDebugMojoSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartDebugMojoSupport.java index 953f4eadb..0b6e4bc85 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartDebugMojoSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartDebugMojoSupport.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2024. + * (C) Copyright IBM Corporation 2014, 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -178,6 +178,7 @@ protected ServerTask initializeJava() { protected void runMojo(String groupId, String artifactId, String goal) throws MojoExecutionException { Plugin plugin = getPlugin(groupId, artifactId); Xpp3Dom config = ExecuteMojoUtil.getPluginGoalConfig(plugin, goal, getLog()); + goal = goal + "#" + getExecutionId(goal, plugin); getLog().info("Running " + artifactId + ":" + goal); getLog().debug("configuration:\n" + config); executeMojo(plugin, goal(goal), config, From 4ca82a64e038482dd45e266004bf64761a8bcdb0 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Tue, 14 Jan 2025 10:42:09 +0530 Subject: [PATCH 02/15] updating tests Signed-off-by: Arun Venmany --- .../pom.xml | 259 ++++++++++++++++++ .../src/main/java/com/demo/HelloLogger.java | 37 +++ .../src/main/java/com/demo/HelloServlet.java | 39 +++ .../src/main/java/com/demo/HelloWorld.java | 23 ++ .../main/liberty/config/bootstrap.properties | 1 + .../src/main/liberty/config/extraFeatures.xml | 6 + .../src/main/liberty/config/server.xml | 11 + .../src/main/resources/placeHolder.txt | 0 ...DevRecompileWithCustomExecutionIdTest.java | 2 - ...evRecompileWithDefaultExecutionIdTest.java | 4 +- 10 files changed, 378 insertions(+), 4 deletions(-) create mode 100755 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml create mode 100755 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloLogger.java create mode 100644 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloServlet.java create mode 100755 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloWorld.java create mode 100644 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/bootstrap.properties create mode 100644 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/extraFeatures.xml create mode 100755 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/server.xml create mode 100644 liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/resources/placeHolder.txt diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml new file mode 100755 index 000000000..ffb5356e1 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml @@ -0,0 +1,259 @@ + + + + 4.0.0 + + dev-it-tests + dev-sample-proj + 1.0-SNAPSHOT + war + + + ISO_8859_1 + UTF-8 + 1.8 + 1.8 + -Xms512m + LibertyProject + + 9080 + 9443 + + usr + + + + + + oss-sonatype + oss-sonatype + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + false + + + + + + + + io.openliberty.features + features-bom + RUNTIME_VERSION + pom + import + + + + + + + + io.openliberty.features + jaxrs-2.1 + esa + provided + + + io.openliberty.features + jsonp-1.1 + esa + provided + + + io.openliberty.features + cdi-2.0 + esa + provided + + + io.openliberty.features + mpConfig-1.3 + esa + provided + + + io.openliberty.features + mpRestClient-1.2 + esa + provided + + + + + + + + junit + junit + 4.13.1 + test + + + org.apache.cxf + cxf-rt-rs-client + 3.2.6 + test + + + org.apache.cxf + cxf-rt-rs-extension-providers + 3.2.6 + test + + + org.glassfish + javax.json + 1.0.4 + test + + + + org.apache.commons + commons-lang3 + 3.0 + + + + javax.xml.bind + jaxb-api + 2.3.1 + provided + + + com.sun.xml.bind + jaxb-core + 2.3.0.1 + provided + + + javax.activation + activation + 1.1.1 + provided + + + javax.batch + javax.batch-api + 1.0.1 + provided + + + + org.slf4j + slf4j-api + 2.0.7 + + + ch.qos.logback + logback-classic + 1.3.12 + runtime + + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + false + pom.xml + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + test + default-test + + + **/it/** + + ${project.build.directory}/test-reports/unit + + + + + + + io.openliberty.tools + liberty-maven-plugin + SUB_VERSION + + + io.openliberty + openliberty-kernel + RUNTIME_VERSION + zip + + ${app.name} + ${packaging.type} + + ${testServerHttpPort} + ${testServerHttpsPort} + json + + + -Xms512m + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.1.2 + + + integration-test + integration-test + + integration-test + + + + **/it/**/*.java + + + + ${testServerHttpPort} + + + + + + verify-results + + verify + + + + + ${project.build.directory}/test-reports/it/failsafe-summary.xml + ${project.build.directory}/test-reports/it + + + + + diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloLogger.java b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloLogger.java new file mode 100755 index 000000000..241bc76f1 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloLogger.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * (c) Copyright IBM Corporation 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package com.demo; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import static javax.ws.rs.core.MediaType.TEXT_PLAIN; + +@Path("/show-log") +public class HelloLogger { + private static final Logger log = LoggerFactory.getLogger(HelloLogger.class); + + @GET + @Produces(TEXT_PLAIN) + public String showLog() { + log.info("Here is the Log"); + return "Log has been shown"; + } +} diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloServlet.java b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloServlet.java new file mode 100644 index 000000000..5afcb4f24 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloServlet.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * (c) Copyright IBM Corporation 2019. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package com.demo; + +import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns="/servlet") +public class HelloServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + private static final Logger log = LoggerFactory.getLogger(HelloLogger.class); + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + log.info("SLF4J Logger is ready for messages."); + response.getWriter().append("hello world"); + } +} \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloWorld.java b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloWorld.java new file mode 100755 index 000000000..7c580a445 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/java/com/demo/HelloWorld.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * (c) Copyright IBM Corporation 2019. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package com.demo; + +public class HelloWorld { + + public String helloWorld() { + return "helloWorld"; + } +} diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/bootstrap.properties b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/bootstrap.properties new file mode 100644 index 000000000..46fee5e9c --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/bootstrap.properties @@ -0,0 +1 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/extraFeatures.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/extraFeatures.xml new file mode 100644 index 000000000..6fa271bbf --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/extraFeatures.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/server.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/server.xml new file mode 100755 index 000000000..013f8a951 --- /dev/null +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/liberty/config/server.xml @@ -0,0 +1,11 @@ + + + + jaxrs-2.1 + + + + + + diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/resources/placeHolder.txt b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/src/main/resources/placeHolder.txt new file mode 100644 index 000000000..e69de29bb diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index ddfe68d71..ec6d2ca60 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -62,7 +62,5 @@ public void validateRunExecutionNotSkipped() throws Exception { //java-compile is the custom execution id assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); - // Check that the server has started - assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); } } \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index 219749def..c28a2fe99 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project", false, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", false, false, null, null); } @AfterClass @@ -61,6 +61,6 @@ public void validateRunExecutionNotSkipped() throws Exception { writer = new BufferedWriter(new OutputStreamWriter(stdin)); // Check that the server has started - assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); } } \ No newline at end of file From 0d6342bd00cc64a92bc38e6b9abf50b33a951d1e Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Tue, 14 Jan 2025 19:54:23 +0530 Subject: [PATCH 03/15] updating tests Signed-off-by: Arun Venmany --- .../test/dev/it/DevRecompileWithDefaultExecutionIdTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index c28a2fe99..0b5f3f22c 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -60,7 +60,8 @@ public void validateRunExecutionNotSkipped() throws Exception { writer = new BufferedWriter(new OutputStreamWriter(stdin)); - // Check that the server has started + // Check that the correct execution id is picked up + // in this case, we are not passing any execution id in pom.xml, hence default execution id will be taken up assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); } } \ No newline at end of file From cd98b2c5d4652ae252df9a539533d7109c9556dc Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Tue, 14 Jan 2025 23:14:11 +0530 Subject: [PATCH 04/15] correcting arguments for StartProcess Signed-off-by: Arun Venmany --- .../wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java | 3 ++- .../test/dev/it/DevRecompileWithDefaultExecutionIdTest.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index ec6d2ca60..f0e57d8f0 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", false, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); } @AfterClass @@ -62,5 +62,6 @@ public void validateRunExecutionNotSkipped() throws Exception { //java-compile is the custom execution id assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); } } \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index 0b5f3f22c..72c7cb3cb 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", false, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); } @AfterClass @@ -60,6 +60,7 @@ public void validateRunExecutionNotSkipped() throws Exception { writer = new BufferedWriter(new OutputStreamWriter(stdin)); + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); // Check that the correct execution id is picked up // in this case, we are not passing any execution id in pom.xml, hence default execution id will be taken up assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); From 1ea7c95076839a08e8efc8a298a45acd672b190b Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 15 Jan 2025 10:37:30 +0530 Subject: [PATCH 05/15] updating tests Signed-off-by: Arun Venmany --- ...DevRecompileWithCustomExecutionIdTest.java | 21 ++++--------------- ...evRecompileWithDefaultExecutionIdTest.java | 21 ++++--------------- .../wlp/test/dev/it/SpringBootRunTest.java | 18 ++-------------- 3 files changed, 10 insertions(+), 50 deletions(-) diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index f0e57d8f0..547942b87 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -36,7 +36,8 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", false, false, null, null); + startProcess(null, true, "mvn compile liberty:", true); } @AfterClass @@ -46,22 +47,8 @@ public static void cleanUpAfterClass() throws Exception { @Test public void validateRunExecutionNotSkipped() throws Exception { - String mavenPluginCommand = "mvn compile io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":dev"; - - StringBuilder command = new StringBuilder(mavenPluginCommand); - ProcessBuilder builder = buildProcess(command.toString()); - - builder.redirectOutput(logFile); - builder.redirectError(logFile); - process = builder.start(); - assertTrue(process.isAlive()); - - OutputStream stdin = process.getOutputStream(); - - writer = new BufferedWriter(new OutputStreamWriter(stdin)); - //java-compile is the custom execution id - assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); - assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + assertTrue(verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); + assertTrue(verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); } } \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index 72c7cb3cb..eb258b784 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,7 +36,8 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", false, false, null, null); + startProcess(null, true, "mvn compile liberty:", true); } @AfterClass @@ -46,23 +47,9 @@ public static void cleanUpAfterClass() throws Exception { @Test public void validateRunExecutionNotSkipped() throws Exception { - String mavenPluginCommand = "mvn compile io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":dev"; - - StringBuilder command = new StringBuilder(mavenPluginCommand); - ProcessBuilder builder = buildProcess(command.toString()); - - builder.redirectOutput(logFile); - builder.redirectError(logFile); - process = builder.start(); - assertTrue(process.isAlive()); - - OutputStream stdin = process.getOutputStream(); - - writer = new BufferedWriter(new OutputStreamWriter(stdin)); - - assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + assertTrue(verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); // Check that the correct execution id is picked up // in this case, we are not passing any execution id in pom.xml, hence default execution id will be taken up - assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); + assertTrue(verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); } } \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/SpringBootRunTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/SpringBootRunTest.java index 06d1cadf2..270113dbf 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/SpringBootRunTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/SpringBootRunTest.java @@ -52,24 +52,10 @@ public static void cleanUpAfterClass() throws Exception { */ @Test public void validateRunExecutionNotSkipped() throws Exception { - String mavenPluginCommand = "mvn package io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":run"; - - StringBuilder command = new StringBuilder(mavenPluginCommand); - ProcessBuilder builder = buildProcess(command.toString()); - - builder.redirectOutput(logFile); - builder.redirectError(logFile); - process = builder.start(); - assertTrue(process.isAlive()); - - OutputStream stdin = process.getOutputStream(); - - writer = new BufferedWriter(new OutputStreamWriter(stdin)); - // Make sure we are not skipping the project - assertTrue(getLogTail(), verifyLogMessageDoesNotExist("Skipping module springboot-project which is not included in this invocation of the run goal", 30000)); + assertTrue(verifyLogMessageDoesNotExist("Skipping module springboot-project which is not included in this invocation of the run goal", 30000)); // Check that the server has started - assertTrue(getLogTail(), verifyLogMessageExists("CWWKF0011I", 120000)); + assertTrue(verifyLogMessageExists("CWWKF0011I", 120000)); } } From 13b0e14d531ec9c43cdd50cbf93df9254d199e86 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 15 Jan 2025 10:38:22 +0530 Subject: [PATCH 06/15] Revert "updating tests" This reverts commit 1ea7c95076839a08e8efc8a298a45acd672b190b. --- ...DevRecompileWithCustomExecutionIdTest.java | 21 +++++++++++++++---- ...evRecompileWithDefaultExecutionIdTest.java | 21 +++++++++++++++---- .../wlp/test/dev/it/SpringBootRunTest.java | 18 ++++++++++++++-- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index 547942b87..f0e57d8f0 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -36,8 +36,7 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", false, false, null, null); - startProcess(null, true, "mvn compile liberty:", true); + setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); } @AfterClass @@ -47,8 +46,22 @@ public static void cleanUpAfterClass() throws Exception { @Test public void validateRunExecutionNotSkipped() throws Exception { + String mavenPluginCommand = "mvn compile io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":dev"; + + StringBuilder command = new StringBuilder(mavenPluginCommand); + ProcessBuilder builder = buildProcess(command.toString()); + + builder.redirectOutput(logFile); + builder.redirectError(logFile); + process = builder.start(); + assertTrue(process.isAlive()); + + OutputStream stdin = process.getOutputStream(); + + writer = new BufferedWriter(new OutputStreamWriter(stdin)); + //java-compile is the custom execution id - assertTrue(verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); - assertTrue(verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); } } \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index eb258b784..72c7cb3cb 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,8 +36,7 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", false, false, null, null); - startProcess(null, true, "mvn compile liberty:", true); + setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); } @AfterClass @@ -47,9 +46,23 @@ public static void cleanUpAfterClass() throws Exception { @Test public void validateRunExecutionNotSkipped() throws Exception { - assertTrue(verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + String mavenPluginCommand = "mvn compile io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":dev"; + + StringBuilder command = new StringBuilder(mavenPluginCommand); + ProcessBuilder builder = buildProcess(command.toString()); + + builder.redirectOutput(logFile); + builder.redirectError(logFile); + process = builder.start(); + assertTrue(process.isAlive()); + + OutputStream stdin = process.getOutputStream(); + + writer = new BufferedWriter(new OutputStreamWriter(stdin)); + + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); // Check that the correct execution id is picked up // in this case, we are not passing any execution id in pom.xml, hence default execution id will be taken up - assertTrue(verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); } } \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/SpringBootRunTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/SpringBootRunTest.java index 270113dbf..06d1cadf2 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/SpringBootRunTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/SpringBootRunTest.java @@ -52,10 +52,24 @@ public static void cleanUpAfterClass() throws Exception { */ @Test public void validateRunExecutionNotSkipped() throws Exception { + String mavenPluginCommand = "mvn package io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":run"; + + StringBuilder command = new StringBuilder(mavenPluginCommand); + ProcessBuilder builder = buildProcess(command.toString()); + + builder.redirectOutput(logFile); + builder.redirectError(logFile); + process = builder.start(); + assertTrue(process.isAlive()); + + OutputStream stdin = process.getOutputStream(); + + writer = new BufferedWriter(new OutputStreamWriter(stdin)); + // Make sure we are not skipping the project - assertTrue(verifyLogMessageDoesNotExist("Skipping module springboot-project which is not included in this invocation of the run goal", 30000)); + assertTrue(getLogTail(), verifyLogMessageDoesNotExist("Skipping module springboot-project which is not included in this invocation of the run goal", 30000)); // Check that the server has started - assertTrue(verifyLogMessageExists("CWWKF0011I", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("CWWKF0011I", 120000)); } } From cb46bddcea1c77a8a99fdd86143dfa02bfce849b Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 15 Jan 2025 11:09:50 +0530 Subject: [PATCH 07/15] updating tests Signed-off-by: Arun Venmany --- ...DevRecompileWithCustomExecutionIdTest.java | 21 ++++--------------- ...evRecompileWithDefaultExecutionIdTest.java | 21 ++++--------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index f0e57d8f0..547942b87 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -36,7 +36,8 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", false, false, null, null); + startProcess(null, true, "mvn compile liberty:", true); } @AfterClass @@ -46,22 +47,8 @@ public static void cleanUpAfterClass() throws Exception { @Test public void validateRunExecutionNotSkipped() throws Exception { - String mavenPluginCommand = "mvn compile io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":dev"; - - StringBuilder command = new StringBuilder(mavenPluginCommand); - ProcessBuilder builder = buildProcess(command.toString()); - - builder.redirectOutput(logFile); - builder.redirectError(logFile); - process = builder.start(); - assertTrue(process.isAlive()); - - OutputStream stdin = process.getOutputStream(); - - writer = new BufferedWriter(new OutputStreamWriter(stdin)); - //java-compile is the custom execution id - assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); - assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + assertTrue(verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); + assertTrue(verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); } } \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index 72c7cb3cb..eb258b784 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,7 +36,8 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", false, false, null, null); + startProcess(null, true, "mvn compile liberty:", true); } @AfterClass @@ -46,23 +47,9 @@ public static void cleanUpAfterClass() throws Exception { @Test public void validateRunExecutionNotSkipped() throws Exception { - String mavenPluginCommand = "mvn compile io.openliberty.tools:liberty-maven-plugin:"+System.getProperty("mavenPluginVersion")+":dev"; - - StringBuilder command = new StringBuilder(mavenPluginCommand); - ProcessBuilder builder = buildProcess(command.toString()); - - builder.redirectOutput(logFile); - builder.redirectError(logFile); - process = builder.start(); - assertTrue(process.isAlive()); - - OutputStream stdin = process.getOutputStream(); - - writer = new BufferedWriter(new OutputStreamWriter(stdin)); - - assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + assertTrue(verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); // Check that the correct execution id is picked up // in this case, we are not passing any execution id in pom.xml, hence default execution id will be taken up - assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); + assertTrue(verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); } } \ No newline at end of file From 7259809959716f5bca55da9659f8453112206e14 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 15 Jan 2025 15:02:01 +0530 Subject: [PATCH 08/15] updating tests , trying with liberty:run Signed-off-by: Arun Venmany --- .../test/dev/it/DevRecompileWithCustomExecutionIdTest.java | 4 ++-- .../test/dev/it/DevRecompileWithDefaultExecutionIdTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index 547942b87..9bd123b66 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -37,12 +37,12 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", false, false, null, null); - startProcess(null, true, "mvn compile liberty:", true); + startProcess(null, false, "mvn compile liberty:", false); } @AfterClass public static void cleanUpAfterClass() throws Exception { - BaseDevTest.cleanUpAfterClass(true); + BaseDevTest.cleanUpAfterClass(false, false); } @Test diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index eb258b784..d7d2f7fb4 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -37,12 +37,12 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", false, false, null, null); - startProcess(null, true, "mvn compile liberty:", true); + startProcess(null, false, "mvn compile liberty:", false); } @AfterClass public static void cleanUpAfterClass() throws Exception { - BaseDevTest.cleanUpAfterClass(true); + BaseDevTest.cleanUpAfterClass(false, false); } @Test From bb1ec32d82bde9d8efd63937ce659e47984e164e Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 15 Jan 2025 16:25:45 +0530 Subject: [PATCH 09/15] making workflow and pom changes to test only dev test Signed-off-by: Arun Venmany --- .github/workflows/maven.yml | 2 +- liberty-maven-plugin/src/it/dev-it/pom.xml | 4 +++- .../dev/it/DevRecompileWithCustomExecutionIdTest.java | 10 +++++----- .../dev/it/DevRecompileWithDefaultExecutionIdTest.java | 10 +++++----- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 24d837339..48c3546d4 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -70,7 +70,7 @@ jobs: run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*setup*,*springboot-3-*,*compile-jsp-source-17-*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # Run tests - name: Run tests - run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" + run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*dev-it*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # WINDOWS BUILD build-windows: diff --git a/liberty-maven-plugin/src/it/dev-it/pom.xml b/liberty-maven-plugin/src/it/dev-it/pom.xml index 218102db3..b0d6576ae 100755 --- a/liberty-maven-plugin/src/it/dev-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/pom.xml @@ -58,7 +58,9 @@ -enableassertions ${project.build.directory} - **/*Test.java + **/*DevRecompileWithCustomExecutionIdTest.java + **/*DevRecompileWithDefaultExecutionIdTest.java + **/*DevTest.java @pom.version@ diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index 9bd123b66..c9f6bd2ea 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -36,19 +36,19 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", false, false, null, null); - startProcess(null, false, "mvn compile liberty:", false); + setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); + startProcess(null, true, "mvn compile liberty:", true); } @AfterClass public static void cleanUpAfterClass() throws Exception { - BaseDevTest.cleanUpAfterClass(false, false); + BaseDevTest.cleanUpAfterClass(true, true); } @Test public void validateRunExecutionNotSkipped() throws Exception { //java-compile is the custom execution id - assertTrue(verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); - assertTrue(verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); } } \ No newline at end of file diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index d7d2f7fb4..f714a4d68 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,20 +36,20 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", false, false, null, null); - startProcess(null, false, "mvn compile liberty:", false); + setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); + startProcess(null, true, "mvn compile liberty:", true); } @AfterClass public static void cleanUpAfterClass() throws Exception { - BaseDevTest.cleanUpAfterClass(false, false); + BaseDevTest.cleanUpAfterClass(true, true); } @Test public void validateRunExecutionNotSkipped() throws Exception { - assertTrue(verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); // Check that the correct execution id is picked up // in this case, we are not passing any execution id in pom.xml, hence default execution id will be taken up - assertTrue(verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 120000)); + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 120000)); } } \ No newline at end of file From c1fc05aefef96ff6e1978fc7e16f8a71405a5267 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 15 Jan 2025 18:08:09 +0530 Subject: [PATCH 10/15] making changes to not use temp folder for new tests Signed-off-by: Arun Venmany --- .../wasdev/wlp/test/dev/it/BaseDevTest.java | 52 +++++++++++++++++++ ...DevRecompileWithCustomExecutionIdTest.java | 2 +- ...evRecompileWithDefaultExecutionIdTest.java | 2 +- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java index ea3795bab..e6e526248 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java @@ -151,6 +151,58 @@ protected static void setUpBeforeClass(String params, String projectRoot, boolea } } + /** + * Setup and optionally start dev/run + * + * @param params Params for the dev/run goal + * @param projectRoot The Maven project root + * @param isDevMode Use dev if true, use run if false. Ignored if startProcessDuringSetup is false. + * @param startProcessDuringSetup If this method should start the actual dev/run process + * @param libertyConfigModule For multi module project, the module where Liberty configuration is located + * @param pomModule For multi module project, the module where the pom is located. If null, use the project root. + * @throws IOException + * @throws InterruptedException + * @throws FileNotFoundException + */ + protected static void setUpBeforeClassWithoutTemp(String params, String projectRoot, boolean isDevMode, boolean startProcessDuringSetup, String libertyConfigModule, String pomModule) throws IOException, InterruptedException, FileNotFoundException { + customLibertyModule = libertyConfigModule; + customPomModule = pomModule; + + basicDevProj = new File(projectRoot); + + tempProj = basicDevProj; + assertTrue("temp directory does not exist", tempProj.exists()); + + assertTrue(projectRoot+" directory does not exist", basicDevProj.exists()); + + assertTrue("temp directory does not contain expected copied files from "+projectRoot, tempProj.listFiles().length > 0); + + // in case cleanup was not successful, try to delete the various log files so we can proceed + logFile = new File(basicDevProj, "logFile.txt"); + if (logFile.exists()) { + assertTrue("Could not delete log file: "+logFile.getCanonicalPath(), logFile.delete()); + } + assertTrue("log file already existed: "+logFile.getCanonicalPath(), logFile.createNewFile()); + logErrorFile = new File(basicDevProj, "logErrorFile.txt"); + if (logErrorFile.exists()) { + assertTrue("Could not delete logError file: "+logErrorFile.getCanonicalPath(), logErrorFile.delete()); + } + assertTrue("logError file already existed: "+logErrorFile.getCanonicalPath(), logErrorFile.createNewFile()); + + if (customPomModule == null) { + pom = new File(tempProj, "pom.xml"); + } else { + pom = new File(new File(tempProj, customPomModule), "pom.xml"); + } + assertTrue(pom.getCanonicalPath()+" file does not exist", pom.exists()); + + replaceVersion(); + + if (startProcessDuringSetup) { + startProcess(params, isDevMode); + } + } + protected static void startProcess(String params, boolean isDevMode) throws IOException, InterruptedException, FileNotFoundException { startProcess(params, isDevMode, "mvn liberty:"); } diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index c9f6bd2ea..62abc17e0 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); + setUpBeforeClassWithoutTemp(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); startProcess(null, true, "mvn compile liberty:", true); } diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index f714a4d68..2b8c76fef 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); + setUpBeforeClassWithoutTemp(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); startProcess(null, true, "mvn compile liberty:", true); } From 23c34e695ef5a143a3582ec0339131f81f269c14 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 15 Jan 2025 23:39:34 +0530 Subject: [PATCH 11/15] rolling back workflow changes Signed-off-by: Arun Venmany --- .github/workflows/maven.yml | 2 +- liberty-maven-plugin/src/it/dev-it/pom.xml | 4 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../wasdev/wlp/test/dev/it/BaseDevTest.java | 52 ------------------- ...DevRecompileWithCustomExecutionIdTest.java | 2 +- ...evRecompileWithDefaultExecutionIdTest.java | 2 +- .../tools/maven/utils/ExecuteMojoUtil.java | 11 ++-- 8 files changed, 13 insertions(+), 64 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 48c3546d4..24d837339 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -70,7 +70,7 @@ jobs: run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*setup*,*springboot-3-*,*compile-jsp-source-17-*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # Run tests - name: Run tests - run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*dev-it*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" + run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # WINDOWS BUILD build-windows: diff --git a/liberty-maven-plugin/src/it/dev-it/pom.xml b/liberty-maven-plugin/src/it/dev-it/pom.xml index b0d6576ae..218102db3 100755 --- a/liberty-maven-plugin/src/it/dev-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/pom.xml @@ -58,9 +58,7 @@ -enableassertions ${project.build.directory} - **/*DevRecompileWithCustomExecutionIdTest.java - **/*DevRecompileWithDefaultExecutionIdTest.java - **/*DevTest.java + **/*Test.java @pom.version@ diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml index ffb5356e1..2500534bc 100755 --- a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml @@ -4,7 +4,7 @@ 4.0.0 dev-it-tests - dev-sample-proj + basic-dev-project-with-default-execution-id 1.0-SNAPSHOT war diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml index ca47792bd..8531de9fa 100755 --- a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml @@ -4,7 +4,7 @@ 4.0.0 dev-it-tests - dev-sample-proj + basic-dev-project-with-execution-id 1.0-SNAPSHOT war diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java index e6e526248..ea3795bab 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java @@ -151,58 +151,6 @@ protected static void setUpBeforeClass(String params, String projectRoot, boolea } } - /** - * Setup and optionally start dev/run - * - * @param params Params for the dev/run goal - * @param projectRoot The Maven project root - * @param isDevMode Use dev if true, use run if false. Ignored if startProcessDuringSetup is false. - * @param startProcessDuringSetup If this method should start the actual dev/run process - * @param libertyConfigModule For multi module project, the module where Liberty configuration is located - * @param pomModule For multi module project, the module where the pom is located. If null, use the project root. - * @throws IOException - * @throws InterruptedException - * @throws FileNotFoundException - */ - protected static void setUpBeforeClassWithoutTemp(String params, String projectRoot, boolean isDevMode, boolean startProcessDuringSetup, String libertyConfigModule, String pomModule) throws IOException, InterruptedException, FileNotFoundException { - customLibertyModule = libertyConfigModule; - customPomModule = pomModule; - - basicDevProj = new File(projectRoot); - - tempProj = basicDevProj; - assertTrue("temp directory does not exist", tempProj.exists()); - - assertTrue(projectRoot+" directory does not exist", basicDevProj.exists()); - - assertTrue("temp directory does not contain expected copied files from "+projectRoot, tempProj.listFiles().length > 0); - - // in case cleanup was not successful, try to delete the various log files so we can proceed - logFile = new File(basicDevProj, "logFile.txt"); - if (logFile.exists()) { - assertTrue("Could not delete log file: "+logFile.getCanonicalPath(), logFile.delete()); - } - assertTrue("log file already existed: "+logFile.getCanonicalPath(), logFile.createNewFile()); - logErrorFile = new File(basicDevProj, "logErrorFile.txt"); - if (logErrorFile.exists()) { - assertTrue("Could not delete logError file: "+logErrorFile.getCanonicalPath(), logErrorFile.delete()); - } - assertTrue("logError file already existed: "+logErrorFile.getCanonicalPath(), logErrorFile.createNewFile()); - - if (customPomModule == null) { - pom = new File(tempProj, "pom.xml"); - } else { - pom = new File(new File(tempProj, customPomModule), "pom.xml"); - } - assertTrue(pom.getCanonicalPath()+" file does not exist", pom.exists()); - - replaceVersion(); - - if (startProcessDuringSetup) { - startProcess(params, isDevMode); - } - } - protected static void startProcess(String params, boolean isDevMode) throws IOException, InterruptedException, FileNotFoundException { startProcess(params, isDevMode, "mvn liberty:"); } diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index 62abc17e0..c9f6bd2ea 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClassWithoutTemp(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); startProcess(null, true, "mvn compile liberty:", true); } diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index 2b8c76fef..f714a4d68 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClassWithoutTemp(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); startProcess(null, true, "mvn compile liberty:", true); } diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java index a8e5432d7..45585cdf0 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java @@ -22,9 +22,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginExecution; @@ -269,8 +271,9 @@ public static Xpp3Dom getPluginGoalConfig(Plugin plugin, String goal, Log log) { String execId = "default"; int numExec = 0; - List executions = plugin.getExecutions(); - if (executions != null) { + List executions = plugin.getExecutions() + .stream().sorted(Comparator.comparing(PluginExecution::getPriority)).collect(Collectors.toList()); + if (!executions.isEmpty()) { for (PluginExecution e : executions) { if (e.getGoals() != null && e.getGoals().contains(goal)) { if (numExec == 0) { @@ -289,10 +292,10 @@ public static Xpp3Dom getPluginGoalConfig(Plugin plugin, String goal, Log log) { config = (Xpp3Dom) plugin.getConfiguration(); } if (numExec > 1) { - log.warn(plugin.getArtifactId() + ":" + goal + log.warn(plugin.getArtifactId() + ":" + goal + " goal has multiple execution configurations (default to \"" + execId + "\" execution)"); } - + if (config == null) { config = configuration(); } else { From b03668fa38459b1c6f10bcb4c52c77918068b13e Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Thu, 16 Jan 2025 00:33:05 +0530 Subject: [PATCH 12/15] rolling back workflow changes Signed-off-by: Arun Venmany --- .../java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java index 45585cdf0..763b0b403 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java @@ -272,7 +272,7 @@ public static Xpp3Dom getPluginGoalConfig(Plugin plugin, String goal, Log log) { int numExec = 0; List executions = plugin.getExecutions() - .stream().sorted(Comparator.comparing(PluginExecution::getPriority)).collect(Collectors.toList()); + .stream().sorted(Comparator.comparing(PluginExecution::getPriority).reversed()).collect(Collectors.toList()); if (!executions.isEmpty()) { for (PluginExecution e : executions) { if (e.getGoals() != null && e.getGoals().contains(goal)) { From 55d998d5d2568031a5cd54834c4226af839cee14 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Thu, 16 Jan 2025 10:53:16 +0530 Subject: [PATCH 13/15] more workflow changes to just test existing projects Signed-off-by: Arun Venmany --- .github/workflows/maven.yml | 2 +- liberty-maven-plugin/src/it/dev-it/pom.xml | 6 +++++- .../resources/basic-dev-project-umbrella-deps/pom.xml | 11 +++++++++++ .../java/net/wasdev/wlp/test/dev/it/BaseDevTest.java | 2 +- .../dev/it/DevGenerateFeaturesDependenciesTest.java | 2 ++ .../net/wasdev/wlp/test/dev/it/DevHotTestingTest.java | 2 ++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 24d837339..48c3546d4 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -70,7 +70,7 @@ jobs: run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*setup*,*springboot-3-*,*compile-jsp-source-17-*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # Run tests - name: Run tests - run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" + run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*dev-it*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # WINDOWS BUILD build-windows: diff --git a/liberty-maven-plugin/src/it/dev-it/pom.xml b/liberty-maven-plugin/src/it/dev-it/pom.xml index 218102db3..3a81b6df3 100755 --- a/liberty-maven-plugin/src/it/dev-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/pom.xml @@ -58,7 +58,11 @@ -enableassertions ${project.build.directory} - **/*Test.java + **/*DevTest.java + **/*DevRecompileWithDefaultExecutionIdTest.java + **/*DevRecompileWithCustomExecutionIdTest.java + **/*DevHotTestingTest.java + **/*DevGenerateFeaturesDependenciesTest.java @pom.version@ diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-umbrella-deps/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-umbrella-deps/pom.xml index 8d1350d03..e79f85845 100644 --- a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-umbrella-deps/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-umbrella-deps/pom.xml @@ -92,6 +92,17 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + java-compile + compile + compile + + + org.apache.maven.plugins maven-war-plugin diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java index ea3795bab..8ee919451 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java @@ -152,7 +152,7 @@ protected static void setUpBeforeClass(String params, String projectRoot, boolea } protected static void startProcess(String params, boolean isDevMode) throws IOException, InterruptedException, FileNotFoundException { - startProcess(params, isDevMode, "mvn liberty:"); + startProcess(params, isDevMode, "mvn compile liberty:"); } protected static void startProcess(String params, boolean isDevMode, String mavenPluginCommand) throws IOException, InterruptedException, FileNotFoundException { diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevGenerateFeaturesDependenciesTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevGenerateFeaturesDependenciesTest.java index e817f2e04..5ef7a438e 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevGenerateFeaturesDependenciesTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevGenerateFeaturesDependenciesTest.java @@ -42,6 +42,8 @@ public static void cleanUpAfterClass() throws Exception { @Test public void updateDependencyTest() throws Exception { assertTrue(verifyLogMessageExists("Liberty is running in dev mode.", 10000)); + assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 10000)); + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 10000)); File generatedFeaturesFile = getGeneratedFeaturesFile(); File targetGeneratedFeaturesFile = getTargetGeneratedFeaturesFile(); diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevHotTestingTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevHotTestingTest.java index 3a7c18317..9b9d9c68d 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevHotTestingTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevHotTestingTest.java @@ -34,6 +34,8 @@ public static void cleanUpAfterClass() throws Exception { @Test public void autoTestsInvocationTest() throws Exception { + assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 20000)); + assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 20000)); assertTrue(verifyLogMessageExists("Tests will run automatically", 20000)); testModifyJavaFile(); From 32f40d7d2e101b0f6df8e2faaedcb32b168bd4dd Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Thu, 16 Jan 2025 14:00:13 +0530 Subject: [PATCH 14/15] more workflow changes to use maven 3.9.9 Signed-off-by: Arun Venmany --- .github/workflows/maven.yml | 4 ++-- .mvn/wrapper/maven-wrapper.properties | 2 +- liberty-maven-plugin/src/it/dev-it/pom.xml | 3 --- .../resources/basic-dev-project-umbrella-deps/pom.xml | 11 ----------- .../java/net/wasdev/wlp/test/dev/it/BaseDevTest.java | 2 +- .../dev/it/DevGenerateFeaturesDependenciesTest.java | 2 -- .../net/wasdev/wlp/test/dev/it/DevHotTestingTest.java | 2 -- 7 files changed, 4 insertions(+), 22 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 48c3546d4..f7235c2f7 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -58,7 +58,7 @@ jobs: - name: Set up Maven uses: stCarolas/setup-maven@v4.5 with: - maven-version: 3.9.2 + maven-version: 3.9.9 # Install dependencies - name: Install ci.ant and ci.common run: | @@ -107,7 +107,7 @@ jobs: - name: Set up Maven uses: stCarolas/setup-maven@v4.5 with: - maven-version: 3.9.2 + maven-version: 3.9.9 # Install ci.ant - name: Install ci.ant working-directory: C:/ci.ant diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 3c6fda8c6..1a60da793 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.2-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/liberty-maven-plugin/src/it/dev-it/pom.xml b/liberty-maven-plugin/src/it/dev-it/pom.xml index 3a81b6df3..82dce31b6 100755 --- a/liberty-maven-plugin/src/it/dev-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/pom.xml @@ -58,11 +58,8 @@ -enableassertions ${project.build.directory} - **/*DevTest.java **/*DevRecompileWithDefaultExecutionIdTest.java **/*DevRecompileWithCustomExecutionIdTest.java - **/*DevHotTestingTest.java - **/*DevGenerateFeaturesDependenciesTest.java @pom.version@ diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-umbrella-deps/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-umbrella-deps/pom.xml index e79f85845..8d1350d03 100644 --- a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-umbrella-deps/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-umbrella-deps/pom.xml @@ -92,17 +92,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - - java-compile - compile - compile - - - org.apache.maven.plugins maven-war-plugin diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java index 8ee919451..ea3795bab 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java @@ -152,7 +152,7 @@ protected static void setUpBeforeClass(String params, String projectRoot, boolea } protected static void startProcess(String params, boolean isDevMode) throws IOException, InterruptedException, FileNotFoundException { - startProcess(params, isDevMode, "mvn compile liberty:"); + startProcess(params, isDevMode, "mvn liberty:"); } protected static void startProcess(String params, boolean isDevMode, String mavenPluginCommand) throws IOException, InterruptedException, FileNotFoundException { diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevGenerateFeaturesDependenciesTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevGenerateFeaturesDependenciesTest.java index 5ef7a438e..e817f2e04 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevGenerateFeaturesDependenciesTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevGenerateFeaturesDependenciesTest.java @@ -42,8 +42,6 @@ public static void cleanUpAfterClass() throws Exception { @Test public void updateDependencyTest() throws Exception { assertTrue(verifyLogMessageExists("Liberty is running in dev mode.", 10000)); - assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#java-compile", 10000)); - assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 10000)); File generatedFeaturesFile = getGeneratedFeaturesFile(); File targetGeneratedFeaturesFile = getTargetGeneratedFeaturesFile(); diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevHotTestingTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevHotTestingTest.java index 9b9d9c68d..3a7c18317 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevHotTestingTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevHotTestingTest.java @@ -34,8 +34,6 @@ public static void cleanUpAfterClass() throws Exception { @Test public void autoTestsInvocationTest() throws Exception { - assertTrue(getLogTail(), verifyLogMessageExists("Running maven-compiler-plugin:compile#default-compile", 20000)); - assertTrue(getLogTail(), verifyLogMessageExists("Nothing to compile - all classes are up to date.", 20000)); assertTrue(verifyLogMessageExists("Tests will run automatically", 20000)); testModifyJavaFile(); From 2e0942704599747a8c53c8efd511c00c9e32fb77 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Thu, 16 Jan 2025 14:06:37 +0530 Subject: [PATCH 15/15] github workflow changes rolled back to use correct tests Signed-off-by: Arun Venmany --- .github/workflows/maven.yml | 2 +- liberty-maven-plugin/src/it/dev-it/pom.xml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index f7235c2f7..f6091f18b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -70,7 +70,7 @@ jobs: run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*setup*,*springboot-3-*,*compile-jsp-source-17-*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # Run tests - name: Run tests - run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*dev-it*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" + run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # WINDOWS BUILD build-windows: diff --git a/liberty-maven-plugin/src/it/dev-it/pom.xml b/liberty-maven-plugin/src/it/dev-it/pom.xml index 82dce31b6..218102db3 100755 --- a/liberty-maven-plugin/src/it/dev-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/pom.xml @@ -58,8 +58,7 @@ -enableassertions ${project.build.directory} - **/*DevRecompileWithDefaultExecutionIdTest.java - **/*DevRecompileWithCustomExecutionIdTest.java + **/*Test.java @pom.version@