-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance multi-module check for run goal
Signed-off-by: Adam Wisniewski <[email protected]>
- Loading branch information
Adam Wisniewski
authored and
Adam Wisniewski
committed
Mar 5, 2024
1 parent
adae635
commit cb7aaf5
Showing
28 changed files
with
1,213 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
...dev-it/resources/multi-module-projects/multipleLibertyModules-skip-conflicts/ear1/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | ||
http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-ear1</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>ear</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<!-- Liberty configuration --> | ||
<liberty.var.default.http.port>9080</liberty.var.default.http.port> | ||
<liberty.var.default.https.port>9443</liberty.var.default.https.port> | ||
<!-- Test Configuration --> | ||
<!-- <skipTests>true</skipTests> --> | ||
<!-- <skipITs>true</skipITs> --> | ||
<!-- <skipUTs>true</skipUTs> --> | ||
</properties> | ||
<repositories> | ||
<!-- Sonatype repository used to get the latest binary scanner jar --> | ||
<repository> | ||
<id>oss-sonatype</id> | ||
<name>oss-sonatype</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<!-- web and jar modules as dependencies --> | ||
<dependency> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-jar</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<type>jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-war</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<type>war</type> | ||
</dependency> | ||
<!-- For tests --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.6.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-ear-plugin</artifactId> | ||
<version>3.3.0</version> | ||
<configuration> | ||
<modules> | ||
<jarModule> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-jar</artifactId> | ||
<uri>/guide-maven-multimodules-jar-1.0-SNAPSHOT.jar</uri> | ||
</jarModule> | ||
<webModule> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-war</artifactId> | ||
<uri>/guide-maven-multimodules-war-1.0-SNAPSHOT.war</uri> | ||
<!-- Set custom context root --> | ||
<contextRoot>/converter</contextRoot> | ||
</webModule> | ||
</modules> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- Enable liberty-maven plugin --> | ||
<plugin> | ||
<groupId>io.openliberty.tools</groupId> | ||
<artifactId>liberty-maven-plugin</artifactId> | ||
<version>SUB_VERSION</version> | ||
</plugin> | ||
|
||
<!-- Since the package type is ear, | ||
need to run testCompile to compile the tests --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.11.0</version> | ||
<executions> | ||
<execution> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- Plugin to run integration tests --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>3.1.2</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<default.http.port> | ||
${liberty.var.default.http.port} | ||
</default.http.port> | ||
<default.https.port> | ||
${liberty.var.default.https.port} | ||
</default.https.port> | ||
<cf.context.root>/converter</cf.context.root> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
16 changes: 16 additions & 0 deletions
16
...le-projects/multipleLibertyModules-skip-conflicts/ear1/src/main/liberty/config/server.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<server description="Sample Liberty server"> | ||
|
||
<featureManager> | ||
<feature>jsp-2.3</feature> | ||
</featureManager> | ||
|
||
<variable name="default.http.port" defaultValue="9080" /> | ||
<variable name="default.https.port" defaultValue="9443" /> | ||
|
||
<httpEndpoint host="*" httpPort="${default.http.port}" | ||
httpsPort="${default.https.port}" id="defaultHttpEndpoint" /> | ||
|
||
<enterpriseApplication id="guide-maven-multimodules-ear1" | ||
location="guide-maven-multimodules-ear1.ear" | ||
name="guide-maven-multimodules-ear1" /> | ||
</server> |
66 changes: 66 additions & 0 deletions
66
...ip-conflicts/ear1/src/test/java/it/io/openliberty/guides/multimodules/ConverterAppIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017, 2019 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* IBM Corporation - Initial implementation | ||
*******************************************************************************/ | ||
package it.io.openliberty.guides.multimodules; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.InputStreamReader; | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class ConverterAppIT { | ||
String port = System.getProperty("default.http.port"); | ||
String war = "converter"; | ||
String urlBase = "http://localhost:" + port + "/" + war + "/"; | ||
|
||
@Test | ||
public void testIndexPage() throws Exception { | ||
String url = this.urlBase; | ||
HttpURLConnection con = testRequestHelper(url, "GET"); | ||
assertEquals(200, con.getResponseCode(), "Incorrect response code from " + url); | ||
assertTrue(testBufferHelper(con).contains("Enter the height in centimeters"), | ||
"Incorrect response from " + url); | ||
} | ||
|
||
@Test | ||
public void testHeightsPage() throws Exception { | ||
String url = this.urlBase + "heights.jsp?heightCm=10"; | ||
HttpURLConnection con = testRequestHelper(url, "POST"); | ||
assertTrue(testBufferHelper(con).contains("3 inches"), | ||
"Incorrect response from " + url); | ||
} | ||
|
||
private HttpURLConnection testRequestHelper(String url, String method) | ||
throws Exception { | ||
URL obj = new URL(url); | ||
HttpURLConnection con = (HttpURLConnection) obj.openConnection(); | ||
// optional default is GET | ||
con.setRequestMethod(method); | ||
return con; | ||
} | ||
|
||
private String testBufferHelper(HttpURLConnection con) throws Exception { | ||
BufferedReader in = new BufferedReader( | ||
new InputStreamReader(con.getInputStream())); | ||
String inputLine; | ||
StringBuffer response = new StringBuffer(); | ||
while ((inputLine = in.readLine()) != null) { | ||
response.append(inputLine); | ||
} | ||
in.close(); | ||
return response.toString(); | ||
} | ||
|
||
} |
133 changes: 133 additions & 0 deletions
133
...dev-it/resources/multi-module-projects/multipleLibertyModules-skip-conflicts/ear2/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | ||
http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-ear2</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>ear</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<!-- Liberty configuration --> | ||
<liberty.var.default.http.port>9081</liberty.var.default.http.port> | ||
<liberty.var.default.https.port>9444</liberty.var.default.https.port> | ||
<!-- Test Configuration --> | ||
<!-- <skipTests>true</skipTests> --> | ||
<!-- <skipITs>true</skipITs> --> | ||
<!-- <skipUTs>true</skipUTs> --> | ||
</properties> | ||
<repositories> | ||
<!-- Sonatype repository used to get the latest binary scanner jar --> | ||
<repository> | ||
<id>oss-sonatype</id> | ||
<name>oss-sonatype</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<!-- web and jar modules as dependencies --> | ||
<dependency> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-jar</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<type>jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-war</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<type>war</type> | ||
</dependency> | ||
<!-- For tests --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.6.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-ear-plugin</artifactId> | ||
<version>3.3.0</version> | ||
<configuration> | ||
<modules> | ||
<jarModule> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-jar</artifactId> | ||
<uri>/guide-maven-multimodules-jar-1.0-SNAPSHOT.jar</uri> | ||
</jarModule> | ||
<webModule> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-maven-multimodules-war</artifactId> | ||
<uri>/guide-maven-multimodules-war-1.0-SNAPSHOT.war</uri> | ||
<!-- Set custom context root --> | ||
<contextRoot>/converter</contextRoot> | ||
</webModule> | ||
</modules> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- Enable liberty-maven plugin --> | ||
<plugin> | ||
<groupId>io.openliberty.tools</groupId> | ||
<artifactId>liberty-maven-plugin</artifactId> | ||
<version>SUB_VERSION</version> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- Since the package type is ear, | ||
need to run testCompile to compile the tests --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.11.0</version> | ||
<executions> | ||
<execution> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- Plugin to run integration tests --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>3.1.2</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<default.http.port> | ||
${liberty.var.default.http.port} | ||
</default.http.port> | ||
<default.https.port> | ||
${liberty.var.default.https.port} | ||
</default.https.port> | ||
<cf.context.root>/converter</cf.context.root> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
16 changes: 16 additions & 0 deletions
16
...le-projects/multipleLibertyModules-skip-conflicts/ear2/src/main/liberty/config/server.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<server description="Sample Liberty server"> | ||
|
||
<featureManager> | ||
<feature>jsp-2.3</feature> | ||
</featureManager> | ||
|
||
<variable name="default.http.port" defaultValue="9080" /> | ||
<variable name="default.https.port" defaultValue="9443" /> | ||
|
||
<httpEndpoint host="*" httpPort="${default.http.port}" | ||
httpsPort="${default.https.port}" id="defaultHttpEndpoint" /> | ||
|
||
<enterpriseApplication id="guide-maven-multimodules-ear2" | ||
location="guide-maven-multimodules-ear2.ear" | ||
name="guide-maven-multimodules-ear2" /> | ||
</server> |
Oops, something went wrong.