Skip to content

Commit

Permalink
Merge pull request #24574 from gsmet/move-test-extension
Browse files Browse the repository at this point in the history
Move the test extension out of the core module
  • Loading branch information
gsmet authored Mar 26, 2022
2 parents b051eb9 + ad20601 commit 7399136
Show file tree
Hide file tree
Showing 168 changed files with 211 additions and 140 deletions.
1 change: 0 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<module>runtime</module>
<module>processor</module>
<module>builder</module>
<module>test-extension</module>
<module>devmode-spi</module>
<module>launcher</module>
<module>class-change-agent</module>
Expand Down
2 changes: 1 addition & 1 deletion docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2716,7 +2716,7 @@
<script>${project.basedir}/../.github/quarkusbuilditemdoc.java</script>
<args>
<arg>--outputFile ${project.basedir}/../target/asciidoc/generated/config/quarkus-all-build-items.adoc</arg>
<arg>--dirs ${project.basedir}/../core/deployment ${project.basedir}/../core/test-extension ${project.basedir}/../extensions</arg>
<arg>--dirs ${project.basedir}/../core/deployment ${project.basedir}/../extensions</arg>
</args>
</configuration>
</execution>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/writing-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ Otherwise, Quarkus attempts to monitor the extension classes and this may result
Remember to add `IndexDependencyBuildItem` artifacts to your `@BuildStep`.

=== Sample Test Extension
We have an extension that is used to test for regressions in the extension processing. It is located in {quarkus-tree-url}/core/test-extension directory. In this section we touch on some of the tasks an extension
We have an extension that is used to test for regressions in the extension processing. It is located in {quarkus-tree-url}/integration-tests/test-extension/extension directory. In this section we touch on some of the tasks an extension
author will typically need to perform using the test-extension code to illustrate how the task could be done.

==== Features and Capabilities
Expand Down Expand Up @@ -2538,7 +2538,7 @@ Now that you have recorded the creation of a service during the build phase, you
<6> Runtime recorder registers an invocation of the service instance `stopService` method with the Quarkus `ShutdownContext`.

The code for the `RuntimeXmlConfigService` can be viewed here:
{quarkus-blob-url}/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/RuntimeXmlConfigService.java[RuntimeXmlConfigService.java]
{quarkus-blob-url}/integration-tests/test-extension/extension/runtime/src/main/java/io/quarkus/extest/runtime/RuntimeXmlConfigService.java[RuntimeXmlConfigService.java]

The testcase for validating that the `RuntimeXmlConfigService` has started can be found in the `testRuntimeXmlConfigService` test of `ConfiguredBeanTest` and `NativeImageIT`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
Expand Down Expand Up @@ -107,14 +109,26 @@ private Optional<String> parseDeploymentGAV(Artifact artifact) {
}

Properties extProperties = new Properties();
try (ZipFile zipFile = new ZipFile(artifactFile)) {
ZipEntry entry = zipFile.getEntry(EXT_PROPERTIES_PATH);
if (entry == null) {
return Optional.empty();
if (artifactFile.isDirectory()) {
Path extPropertiesPath = artifactFile.toPath().resolve(EXT_PROPERTIES_PATH);
try (InputStreamReader isr = new InputStreamReader(Files.newInputStream(extPropertiesPath),
StandardCharsets.UTF_8)) {
extProperties.load(isr);
} catch (IOException e) {
throw new UncheckedIOException("Failed to read " + EXT_PROPERTIES_PATH + " from " + artifactFile, e);
}
} else {
try (ZipFile zipFile = new ZipFile(artifactFile)) {
ZipEntry entry = zipFile.getEntry(EXT_PROPERTIES_PATH);
if (entry == null) {
return Optional.empty();
}
try (InputStreamReader isr = new InputStreamReader(zipFile.getInputStream(entry), StandardCharsets.UTF_8)) {
extProperties.load(isr);
}
} catch (IOException e) {
throw new UncheckedIOException("Failed to read " + EXT_PROPERTIES_PATH + " from " + artifactFile, e);
}
extProperties.load(new InputStreamReader(zipFile.getInputStream(entry), StandardCharsets.UTF_8));
} catch (IOException e) {
throw new UncheckedIOException("Failed to read " + EXT_PROPERTIES_PATH + " from " + artifactFile, e);
}

String deploymentGAV = extProperties.getProperty("deployment-artifact");
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/avro-reload/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<version>999-SNAPSHOT</version>
</parent>

<artifactId>quarkus-avro-reload-test</artifactId>
<name>Quarkus - Integration Test - Avro code generation and reload</name>
<artifactId>quarkus-integration-test-avro-reload</artifactId>
<name>Quarkus - Integration Tests - Avro code generation and reload</name>

<properties>
<avro.codegen.avsc.imports>imports,directImport/PrivacyDirectImport.avsc</avro.codegen.avsc.imports>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-test-extension-parent</artifactId>
<artifactId>quarkus-integration-test-test-extension-extension-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-test-extension-deployment</artifactId>
<name>Quarkus - Core - Test Extension - Deployment</name>
<artifactId>quarkus-integration-test-test-extension-extension-deployment</artifactId>
<name>Quarkus - Integration Tests - Test Extension - Extension - Deployment</name>

<properties>
<xml-combiner.version>3.0.0</xml-combiner.version>
Expand All @@ -30,7 +30,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-extension</artifactId>
<artifactId>quarkus-integration-test-test-extension-extension</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-integration-test-test-extension</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-test-extension-parent</artifactId>
<name>Quarkus - Core - Test Extension</name>
<artifactId>quarkus-integration-test-test-extension-extension-parent</artifactId>
<name>Quarkus - Integration Tests - Test Extension - Extension</name>
<packaging>pom</packaging>

<properties>
Expand All @@ -35,6 +35,4 @@
</plugin>
</plugins>
</build>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-test-extension-parent</artifactId>
<artifactId>quarkus-integration-test-test-extension-extension-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-test-extension</artifactId>
<name>Quarkus - Core - Test Extension - Runtime</name>
<artifactId>quarkus-integration-test-test-extension-extension</artifactId>
<name>Quarkus - Integration Tests - Test Extension - Extension - Runtime</name>

<dependencies>
<dependency>
Expand Down Expand Up @@ -63,6 +63,46 @@
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
</dependency>
<!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down
127 changes: 12 additions & 115 deletions integration-tests/test-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,122 +2,19 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-integration-tests-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-test-extension-nativetests</artifactId>
<name>Quarkus - Integration Tests - Test Extension Native Tests</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-extension</artifactId>
<version>${project.version}</version>
</dependency>

<!-- test dependencies -->
<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>

<!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-extension-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<parent>
<artifactId>quarkus-integration-tests-parent</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!-- See io.quarkus.extest.runtime.classpath.RecordedClasspathEntries -->
<classpathEntriesRecordingFile>${project.build.directory}/recorded-classpath-entries-surefire.txt</classpathEntriesRecordingFile>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!-- See io.quarkus.extest.runtime.classpath.RecordedClasspathEntries -->
<classpathEntriesRecordingFile>${project.build.directory}/recorded-classpath-entries-failsafe.txt</classpathEntriesRecordingFile>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<profiles>
<profile>
<id>no-native</id>
<activation>
<property>
<name>!native</name>
</property>
</activation>
<!-- these properties must not be defined in the general properties,
otherwise the native profile in the parent pom is not able to override them -->
<properties>
<quarkus.package.type>uber-jar</quarkus.package.type>
</properties>
</profile>
</profiles>
<artifactId>quarkus-integration-test-test-extension</artifactId>
<name>Quarkus - Integration Tests - Test Extension</name>
<packaging>pom</packaging>

<modules>
<module>extension</module>
<module>tests</module>
</modules>
</project>
Loading

0 comments on commit 7399136

Please sign in to comment.