Skip to content

Commit

Permalink
Make native tests runnable on Quarkus Platform
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Jan 26, 2024
1 parent fc392d1 commit e03cdfd
Show file tree
Hide file tree
Showing 17 changed files with 250 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ jobs:
run: |
array=(${{matrix.testModule}})
if [ "${array[0]}" == "ws-rm-client" ]; then
# ws-rm-client requires test-ws-rm-server native executable
cd test-util-parent/test-ws-rm-server && ../../mvnw -B clean install -Pnative -Dquarkus.native.container-build=true
# ws-rm-client requires test-ws-rm-server-native executable
cd test-util-parent/test-ws-rm-server-native && ../../mvnw -B clean install -Prelease
cd ../..
fi
if [ "${#array[@]}" -gt "1" ]; then
Expand Down
21 changes: 19 additions & 2 deletions bom-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,32 @@
</dependency>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-test-ws-rm-server</artifactId>
<artifactId>quarkus-cxf-test-ws-rm-server-jvm</artifactId>
<classifier>runner</classifier>
<version>${quarkus-cxf.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-test-ws-rm-server</artifactId>
<artifactId>quarkus-cxf-test-ws-rm-server-jvm</artifactId>
<version>${quarkus-cxf.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-test-ws-rm-server-jvm</artifactId>
<type>pom</type>
<version>${quarkus-cxf.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-test-ws-rm-server-native</artifactId>
<version>${quarkus-cxf.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-test-ws-rm-server-native</artifactId>
<type>exe</type>
<version>${quarkus-cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-netty-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ quarkus.http.ssl.certificate.key-store-key-alias = localhost
quarkus.http.ssl.certificate.key-store-key-password = password
# end::server-key-store[]

quarkus.native.resources.includes = *.xml,*.pkcs12

# Disable HTTP
#quarkus.http.insecure-requests = disabled

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ quarkus.cxf.endpoint."/rounder".in-interceptors = org.apache.cxf.ws.security.wss

quarkus.cxf.endpoint."/security-policy-hello".implementor = io.quarkiverse.cxf.it.ws.securitypolicy.server.WssSecurityPolicyHelloServiceImpl

quarkus.native.resources.includes = bob.properties,alice.properties,*.jks,encrypt-sign-policy.xml,*.p12
quarkus.native.resources.includes = bob.properties,alice.properties,*.jks,encrypt-sign-policy.xml,*.pkcs12
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Map;

import org.assertj.core.api.Assertions;
Expand Down Expand Up @@ -75,7 +76,7 @@ void wsdlUpToDate() throws IOException {
staticCopyPath = Paths.get("target/classes/wsdl/CalculatorService.wsdl");
Files.createDirectories(staticCopyPath.getParent());
try (InputStream in = Hc5Test.class.getClassLoader().getResourceAsStream("wsdl/CalculatorService.wsdl")) {
Files.copy(in, staticCopyPath);
Files.copy(in, staticCopyPath, StandardCopyOption.REPLACE_EXISTING);
}
}
/* The changing Docker IP address in the WSDL should not matter */
Expand Down
17 changes: 14 additions & 3 deletions integration-tests/ws-rm-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
<scope>test</scope>
</dependency>
<dependency>
<!-- quarkus-cxf-test-ws-rm-server uber-jar and native executable are run by a test in this module. -->
<!-- quarkus-cxf-test-ws-rm-server-jvm uber-jar and quarkus-cxf-test-ws-rm-server-native are run by a test in this module. -->
<!-- They both need to be installed in local Maven repository before running this test -->
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-test-ws-rm-server</artifactId>
<scope>test</scope>
<artifactId>quarkus-cxf-test-ws-rm-server-jvm</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down Expand Up @@ -90,6 +90,17 @@
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>

<dependencies>
<dependency>
<!-- quarkus-cxf-test-ws-rm-server-jvm uber-jar and quarkus-cxf-test-ws-rm-server-native are run by a test in this module. -->
<!-- They both need to be installed in local Maven repository before running this test -->
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-test-ws-rm-server-native</artifactId>
<type>exe</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
import java.util.EnumSet;
import java.util.List;
import java.util.Properties;
import java.util.stream.Collectors;

import org.jboss.logging.Logger;
Expand All @@ -20,11 +23,24 @@ public class WsrmServer implements Closeable {

public WsrmServer(boolean isNative) {

final String mavenLocalRepo = System.getProperty("maven.repo.local");
String mavenLocalRepo = System.getProperty("maven.repo.local");
if (mavenLocalRepo == null) {
throw new IllegalStateException("maven.repo.local property not set");
mavenLocalRepo = System.getProperty("user.home") + "/.m2/repository";
}
String quarkusCxfVersion = System.getProperty("quarkus-cxf.version");
if (quarkusCxfVersion == null) {
URL pomPropsUrl = this.getClass().getClassLoader()
.getResource("META-INF/maven/io.quarkiverse.cxf/quarkus-cxf-integration-test-ws-rm-client/pom.properties");
if (pomPropsUrl != null) {
try (InputStream in = pomPropsUrl.openStream()) {
Properties props = new Properties();
props.load(in);
quarkusCxfVersion = props.getProperty("version");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
final String quarkusCxfVersion = System.getProperty("quarkus-cxf.version");
if (quarkusCxfVersion == null) {
throw new IllegalStateException("quarkus-cxf.version property not set");
}
Expand All @@ -48,8 +64,8 @@ public WsrmServer(boolean isNative) {
private List<String> cmd(boolean isNative, final String quarkusCxfVersion, final Path localRepo, final Path serverLog) {
if (isNative) {
final Path binPath = localRepo
.resolve("io/quarkiverse/cxf/quarkus-cxf-test-ws-rm-server/" + quarkusCxfVersion
+ "/quarkus-cxf-test-ws-rm-server-" + quarkusCxfVersion + ".exe");
.resolve("io/quarkiverse/cxf/quarkus-cxf-test-ws-rm-server-native/" + quarkusCxfVersion
+ "/quarkus-cxf-test-ws-rm-server-native-" + quarkusCxfVersion + ".exe");

if (!Files.isRegularFile(binPath)) {
throw new RuntimeException(binPath.toString()
Expand All @@ -72,8 +88,8 @@ private List<String> cmd(boolean isNative, final String quarkusCxfVersion, final
return cmd;
} else {
final Path jarPath = localRepo
.resolve("io/quarkiverse/cxf/quarkus-cxf-test-ws-rm-server/" + quarkusCxfVersion
+ "/quarkus-cxf-test-ws-rm-server-" + quarkusCxfVersion + "-runner.jar");
.resolve("io/quarkiverse/cxf/quarkus-cxf-test-ws-rm-server-jvm/" + quarkusCxfVersion
+ "/quarkus-cxf-test-ws-rm-server-jvm-" + quarkusCxfVersion + "-runner.jar");

if (!Files.isRegularFile(jarPath)) {
throw new RuntimeException(jarPath.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

import org.assertj.core.api.Assertions;
import org.eclipse.microprofile.config.ConfigProvider;
Expand Down Expand Up @@ -59,7 +60,7 @@ void wsdlUpToDate() throws IOException {
staticCopyPath = Paths.get("target/classes/wsdl/dir/WssCalculatorService.wsdl");
Files.createDirectories(staticCopyPath.getParent());
try (InputStream in = getClass().getClassLoader().getResourceAsStream("wsdl/dir/WssCalculatorService.wsdl")) {
Files.copy(in, staticCopyPath);
Files.copy(in, staticCopyPath, StandardCopyOption.REPLACE_EXISTING);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ quarkus.http.ssl.certificate.key-store-key-alias = localhost
quarkus.http.ssl.certificate.key-store-key-password = password
# end::server-key-store[]

quarkus.native.resources.includes = *.xml,*.pkcs12

# Disable HTTP
#quarkus.http.insecure-requests = disabled

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ quarkus.cxf.endpoint."/rounder".in-interceptors = org.apache.cxf.ws.security.wss

quarkus.cxf.endpoint."/security-policy-hello".implementor = io.quarkiverse.cxf.it.ws.securitypolicy.server.WssSecurityPolicyHelloServiceImpl

quarkus.native.resources.includes = bob.properties,alice.properties,*.jks,encrypt-sign-policy.xml,*.p12
quarkus.native.resources.includes = bob.properties,alice.properties,*.jks,encrypt-sign-policy.xml,*.pkcs12
3 changes: 2 additions & 1 deletion test-util-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

<modules>
<module>test-util</module>
<module>test-ws-rm-server</module>
<module>test-ws-rm-server-jvm</module>
<module>test-ws-rm-server-native</module>
<module>test-list</module>
</modules>

Expand Down
144 changes: 144 additions & 0 deletions test-util-parent/test-ws-rm-server-jvm/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?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>
<parent>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-test-util-parent</artifactId>
<version>2.7.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>quarkus-cxf-test-ws-rm-server-jvm</artifactId>

<name>Quarkus CXF - Test WS-ReliableMessaging Server - JVM runner</name>
<description>The application containing the service for testing re-delivery of dropped messages with WS-ReliableMessaging</description>

<properties>
<!-- Allow running our tests against alternative BOMs, such as io.quarkus.platform:quarkus-cxf-bom -->
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.version>${quarkus.version}</quarkus.platform.version>
<quarkus-cxf.platform.group-id>io.quarkiverse.cxf</quarkus-cxf.platform.group-id>
<quarkus-cxf.platform.artifact-id>quarkus-cxf-bom</quarkus-cxf.platform.artifact-id>
<quarkus-cxf.platform.version>2.7.1-SNAPSHOT</quarkus-cxf.platform.version>
<quarkus-cxf.version>2.7.1-SNAPSHOT</quarkus-cxf.version><!-- This needs to be set to the underlying Quarkiverse CXF version from command line when testing against Platform BOMs -->

<maven.compiler.parameters>true</maven.compiler.parameters>

<quarkus.package.type>uber-jar</quarkus.package.type>
<quarkus.build.skip>false</quarkus.build.skip>
</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>
<dependency>
<groupId>${quarkus-cxf.platform.group-id}</groupId>
<artifactId>${quarkus-cxf.platform.artifact-id}</artifactId>
<version>${quarkus-cxf.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-bom-test</artifactId>
<version>${quarkus-cxf.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-rt-ws-rm</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-uber-jar</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<skipAttach>${quarkus.build.skip}</skipAttach>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${project.version}-runner.jar</file>
<classifier>runner</classifier>
<type>jar</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>virtualDependencies</id>
<activation>
<property>
<name>!noVirtualDependencies</name>
</property>
</activation>
<dependencies>
<!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-rt-features-logging-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-rt-ws-rm-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
quarkus.package.type = uber-jar

# Global WS-RM settings
quarkus.cxf.rm.namespace = http://docs.oasis-open.org/ws-rx/wsrm/200702
quarkus.cxf.rm.retransmission-interval = 6000
quarkus.cxf.rm.acknowledgement-interval = 2000

quarkus.cxf.endpoint."/wsrm".implementor = io.quarkiverse.cxf.it.ws.rm.server.WsrmHelloServiceImpl
quarkus.cxf.endpoint."/wsrm".logging.enabled = true
quarkus.cxf.endpoint."/wsrm".logging.pretty = true
Loading

0 comments on commit e03cdfd

Please sign in to comment.