-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24845 from aloubyansky/custom-test-dirs
Support custom test classes dir under 'target'
- Loading branch information
Showing
7 changed files
with
337 additions
and
18 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
234 changes: 234 additions & 0 deletions
234
integration-tests/maven/src/test/resources-filtered/projects/test-source-sets/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,234 @@ | ||
<?xml version="1.0"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>de.turing85</groupId> | ||
<artifactId>quarkus-source-sets</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<properties> | ||
<!-- Maven plugin --> | ||
<build-helper-maven-plugin.version>3.3.0</build-helper-maven-plugin.version> | ||
<compiler-plugin.version>3.8.1</compiler-plugin.version> | ||
<dependency-plugin.version>3.2.0</dependency-plugin.version> | ||
<failsafe.useModulePath>false</failsafe.useModulePath> | ||
<maven.compiler.release>11</maven.compiler.release> | ||
|
||
<!-- General project setup --> | ||
<failsafe.it-phase>verify</failsafe.it-phase> | ||
<failsafe.bt-phase>none</failsafe.bt-phase> | ||
|
||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
|
||
<project.build.integrationtestRoot> | ||
\${project.basedir}/src/integrationtest | ||
</project.build.integrationtestRoot> | ||
<project.build.integrationtestSourceDirectory> | ||
\${project.build.integrationtestRoot}/java | ||
</project.build.integrationtestSourceDirectory> | ||
<project.build.integerationtestResoruceDirectory> | ||
\${project.build.integrationtestRoot}/resources | ||
</project.build.integerationtestResoruceDirectory> | ||
<project.build.integrationtestOutputDirectory> | ||
\${project.build.directory}/integrationtest-classes | ||
</project.build.integrationtestOutputDirectory> | ||
<project.build.integrationtestGeneratedSourceDirectory> | ||
\${project.build.directory}/generated-integrationtest-sources/test-annotations | ||
</project.build.integrationtestGeneratedSourceDirectory> | ||
|
||
<!-- Quarkus setup --> | ||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> | ||
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id> | ||
<quarkus.platform.version>@project.version@</quarkus.platform.version> | ||
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version> | ||
</properties> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>${quarkus.platform.group-id}</groupId> | ||
<artifactId>${quarkus.platform.artifact-id}</artifactId> | ||
<version>${quarkus.platform.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-reactive</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>${dependency-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build-classpath</goal> | ||
</goals> | ||
<phase>generate-test-sources</phase> | ||
<configuration> | ||
<outputProperty>classpath</outputProperty> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-maven-plugin</artifactId> | ||
<version>${build-helper-maven-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>add-integration-test</id> | ||
<phase>generate-test-sources</phase> | ||
<goals> | ||
<goal>add-test-source</goal> | ||
<goal>add-test-resource</goal> | ||
</goals> | ||
<configuration> | ||
<sources> | ||
<source>\${project.build.integrationtestSourceDirectory}</source> | ||
</sources> | ||
<resources> | ||
<resource> | ||
<directory>\${project.build.integerationtestResoruceDirectory}</directory> | ||
<targetPath>\${project.build.integrationtestOutputDirectory}</targetPath> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>${quarkus.platform.group-id}</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>${quarkus.platform.version}</version> | ||
<extensions>true</extensions> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
<goal>generate-code</goal> | ||
<goal>generate-code-tests</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${compiler-plugin.version}</version> | ||
<configuration> | ||
<compilerArgs> | ||
<arg>-parameters</arg> | ||
</compilerArgs> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>default-testCompile</id> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
<phase>test-compile</phase> | ||
<configuration> | ||
<compilerArgs> | ||
<compilerArg>-cp</compilerArg> | ||
<compilerArg> | ||
\${classpath}\${path.separator}\${project.build.outputDirectory} | ||
</compilerArg> | ||
</compilerArgs> | ||
<compileSourceRoots> | ||
<compileSourceRoot>\${project.build.testSourceDirectory}</compileSourceRoot> | ||
</compileSourceRoots> | ||
<outputDirectory>\${project.build.testOutputDirectory}</outputDirectory> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>compile-integrationtests</id> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
<phase>test-compile</phase> | ||
<configuration> | ||
<compilerArgs> | ||
<compilerArg>-cp</compilerArg> | ||
<compilerArg> | ||
\${classpath}\${path.separator}\${project.build.outputDirectory}\${path.separator}\${project.build.testOutputDirectory} | ||
</compilerArg> | ||
</compilerArgs> | ||
<compileSourceRoots> | ||
<compileSourceRoot> | ||
\${project.build.integrationtestSourceDirectory} | ||
</compileSourceRoot> | ||
</compileSourceRoots> | ||
<generatedTestSourcesDirectory> | ||
\${project.build.integrationtestGeneratedSourceDirectory} | ||
</generatedTestSourcesDirectory> | ||
<outputDirectory>\${project.build.integrationtestOutputDirectory}</outputDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${surefire-plugin.version}</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>\${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
<testClassesDirectory>\${project.build.outputDirectory}</testClassesDirectory> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${surefire-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<phase>none</phase> | ||
</execution> | ||
<execution> | ||
<id>integration-test</id> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<phase>\${failsafe.it-phase}</phase> | ||
<configuration> | ||
<additionalClasspathElements> | ||
<additionalClasspathElement> | ||
\${project.build.testOutputDirectory} | ||
</additionalClasspathElement> | ||
</additionalClasspathElements> | ||
<includes> | ||
<include>**/*.java</include> | ||
</includes> | ||
<trimStackTrace>false</trimStackTrace> | ||
<systemPropertyVariables> | ||
<native.image.path>\${project.build.directory}/\${project.build.finalName}-runner</native.image.path> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>\${maven.home}</maven.home> | ||
<testClassesDirectory>\${project.build.integrationtestOutputDirectory}</testClassesDirectory> | ||
</systemPropertyVariables> | ||
<classesDirectory>\${project.build.outputDirectory}</classesDirectory> | ||
<testClassesDirectory>\${project.build.integrationtestOutputDirectory}</testClassesDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
22 changes: 22 additions & 0 deletions
22
...s/test-source-sets/src/integrationtest/java/org/acme/GreetingResourceIntegrationTest.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,22 @@ | ||
package org.acme; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.is; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@QuarkusTest | ||
public class GreetingResourceIntegrationTest { | ||
|
||
@Test | ||
public void testHelloEndpoint() { | ||
// @formatter: off | ||
given() | ||
.when().get("/hello") | ||
.then() | ||
.statusCode(200) | ||
.body(is(GreetingResource.HELLO)); | ||
// @formatter: on | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...resources-filtered/projects/test-source-sets/src/main/java/org/acme/GreetingResource.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,18 @@ | ||
package org.acme; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
@Path("/hello") | ||
public class GreetingResource { | ||
|
||
static final String HELLO = "Hello"; | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return HELLO; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...urces-filtered/projects/test-source-sets/src/test/java/org/acme/GreetingResourceTest.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,12 @@ | ||
package org.acme; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class GreetingResourceTest { | ||
@Test | ||
void shouldReturnExpectedValue() { | ||
String actual = new GreetingResource().hello(); | ||
Assertions.assertEquals(actual, GreetingResource.HELLO); | ||
} | ||
} |
Oops, something went wrong.