Skip to content

Commit

Permalink
Quarkus renaming REST extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Karm committed Mar 20, 2024
1 parent ce63a51 commit 25cc2f9
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 24 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/builder_image_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ jobs:
mandrel-builder-image: '22.3-java17'
- quarkus-version: '2.16.12.Final'
mandrel-builder-image: '22.3-java17'
- quarkus-version: '3.2.9.Final'
- quarkus-version: '3.2.11.Final'
mandrel-builder-image: 'jdk-17'
- quarkus-version: '3.5.3'
mandrel-builder-image: 'jdk-21'
- quarkus-version: '3.6.0'
mandrel-builder-image: 'jdk-21'
- quarkus-version: '3.8.3'
mandrel-builder-image: 'jdk-21'
- quarkus-version: '3.9.0.CR2'
mandrel-builder-image: 'jdk-21'
steps:
- uses: actions/checkout@v3
with:
Expand Down
26 changes: 24 additions & 2 deletions .github/workflows/local_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ jobs:
os: 'ubuntu-20.04'
timeout-minutes: 80

- quarkus-version: '3.2.9.Final'
- quarkus-version: '3.2.11.Final'
mandrel-version: '23.0.2.1-Final'
java-version: '17'
os: 'windows-2022'
timeout-minutes: 80
- quarkus-version: '3.2.9.Final'
- quarkus-version: '3.2.11.Final'
mandrel-version: '23.0.2.1-Final'
java-version: '17'
os: 'ubuntu-20.04'
Expand All @@ -102,6 +102,28 @@ jobs:
java-version: '21'
os: 'ubuntu-20.04'
timeout-minutes: 130

- quarkus-version: '3.8.3'
mandrel-version: '23.1.2.0-Final'
java-version: '21'
os: 'windows-2022'
timeout-minutes: 80
- quarkus-version: '3.8.3'
mandrel-version: '23.1.2.0-Final'
java-version: '21'
os: 'ubuntu-20.04'
timeout-minutes: 130

- quarkus-version: '3.9.0.CR2'
mandrel-version: '23.1.2.0-Final'
java-version: '21'
os: 'windows-2022'
timeout-minutes: 80
- quarkus-version: '3.9.0.CR2'
mandrel-version: '23.1.2.0-Final'
java-version: '21'
os: 'ubuntu-20.04'
timeout-minutes: 130
steps:
- uses: actions/checkout@v3
with:
Expand Down
13 changes: 13 additions & 0 deletions apps/jfr-native-image-performance/quarkus_3.9.x.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/apps/jfr-native-image-performance/pom.xml b/apps/jfr-native-image-performance/pom.xml
index 771b835..60df02b 100644
--- a/apps/jfr-native-image-performance/pom.xml
+++ b/apps/jfr-native-image-performance/pom.xml
@@ -33,7 +33,7 @@
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
- <artifactId>quarkus-resteasy-reactive</artifactId>
+ <artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
42 changes: 42 additions & 0 deletions apps/quarkus-json/quarkus_3.9.x.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/apps/quarkus-json/pom.xml b/apps/quarkus-json/pom.xml
index 3d5fa5f..b1474e3 100644
--- a/apps/quarkus-json/pom.xml
+++ b/apps/quarkus-json/pom.xml
@@ -32,11 +32,11 @@
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
- <artifactId>quarkus-resteasy-reactive-jackson</artifactId>
+ <artifactId>quarkus-rest-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
- <artifactId>quarkus-resteasy-reactive</artifactId>
+ <artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
diff --git a/apps/quarkus-json/src/main/java/org/acme/ExampleResource.java b/apps/quarkus-json/src/main/java/org/acme/ExampleResource.java
index dfb224d..a37b4a3 100644
--- a/apps/quarkus-json/src/main/java/org/acme/ExampleResource.java
+++ b/apps/quarkus-json/src/main/java/org/acme/ExampleResource.java
@@ -1,12 +1,12 @@
package org.acme;

-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import java.io.ByteArrayOutputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
16 changes: 15 additions & 1 deletion testsuite/src/it/java/org/graalvm/tests/integration/JFRTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.graalvm.tests.integration.utils.Logs;
import org.graalvm.tests.integration.utils.WebpageTester;
import org.graalvm.tests.integration.utils.versions.IfMandrelVersion;
import org.graalvm.tests.integration.utils.versions.IfQuarkusVersion;
import org.graalvm.tests.integration.utils.versions.QuarkusVersion;
import org.graalvm.tests.integration.utils.versions.UsedVersion;
import org.jboss.logging.Logger;
import org.json.JSONObject;
Expand Down Expand Up @@ -64,6 +66,7 @@
import static org.graalvm.tests.integration.utils.Commands.BUILDER_IMAGE;
import static org.graalvm.tests.integration.utils.Commands.CONTAINER_RUNTIME;
import static org.graalvm.tests.integration.utils.Commands.IS_THIS_WINDOWS;
import static org.graalvm.tests.integration.utils.Commands.QUARKUS_VERSION;
import static org.graalvm.tests.integration.utils.Commands.builderRoutine;
import static org.graalvm.tests.integration.utils.Commands.cleanTarget;
import static org.graalvm.tests.integration.utils.Commands.cleanup;
Expand Down Expand Up @@ -164,6 +167,7 @@ public void jfrSmokeTest(TestInfo testInfo) throws IOException, InterruptedExcep
@Tag("jfr")
@Tag("builder-image")
@IfMandrelVersion(min = "23.0.0", inContainer = true) // Thread park event is introduced in 23.0
@IfQuarkusVersion(min = "3.0")
public void jfrPerfContainerTest(TestInfo testInfo) throws IOException, InterruptedException {
jfrPerfTestRun(testInfo, true);
}
Expand All @@ -172,6 +176,7 @@ public void jfrPerfContainerTest(TestInfo testInfo) throws IOException, Interrup
@Tag("jfr-perf")
@Tag("jfr")
@IfMandrelVersion(min = "23.0.0") // Thread park event is introduced in 23.0
@IfQuarkusVersion(min = "3.0")
public void jfrPerfTest(TestInfo testInfo) throws IOException, InterruptedException {
jfrPerfTestRun(testInfo, false);
}
Expand All @@ -187,6 +192,7 @@ public void jfrPerfTestRun(TestInfo testInfo, boolean inContainer) throws IOExce
final String mn = testInfo.getTestMethod().get().getName();
final Path measurementsLog = Paths.get(Logs.getLogsDir(cn, mn).toString(), "measurements.csv");
final Path jfrPerfJfc = Paths.get(appDir.getAbsolutePath(), "jfr-perf.jfc");
String patch = null;

try {
// Cleanup
Expand All @@ -202,11 +208,16 @@ public void jfrPerfTestRun(TestInfo testInfo, boolean inContainer) throws IOExce

generateJFRConfigurationFile(inContainer, jfrPerfJfc, processLog);


Map<String, String> switches = null;
if (UsedVersion.getVersion(inContainer).compareTo(Version.create(23, 1, 0)) >= 0) {
switches = Map.of("-H:+SignalHandlerBasedExecutionSampler", "-H:+UnlockExperimentalVMOptions,-H:+SignalHandlerBasedExecutionSampler,-H:-UnlockExperimentalVMOptions");
}

if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_9_0) >= 0) {
patch = "quarkus_3.9.x.patch";
runCommand(getRunCommand("git", "apply", patch), appDir);
}

// Container build requires an additional step: docker build...
builderRoutine(inContainer ? 2 : 1, appJfr, report, cn, mn, appDir, processLog, null, switches);
builderRoutine(inContainer ? 2 : 1, appNoJfr, report, cn, mn, appDir, processLog, null, switches);
Expand Down Expand Up @@ -235,6 +246,9 @@ public void jfrPerfTestRun(TestInfo testInfo, boolean inContainer) throws IOExce
removeContainers(ContainerNames.JFR_PERFORMANCE_BUILDER_IMAGE.name, ContainerNames.JFR_PLAINTEXT_BUILDER_IMAGE.name);
}
enableTurbo();
if (patch != null) {
runCommand(getRunCommand("git", "apply", "-R", patch), appDir);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.graalvm.tests.integration.utils.versions.UsedVersion;
import org.jboss.logging.Logger;
import org.jboss.resteasy.spi.HttpResponseCodes;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
Expand Down Expand Up @@ -133,14 +132,22 @@ public void testQuarkusJSONParseOnce(TestInfo testInfo) throws IOException, Inte
final List<Map<String, String>> reports = new ArrayList<>(3);
// Test data tmp storage
final File json = Path.of(appDir.getAbsolutePath(), "logs", "record.json").toFile();
String patch = null;

try {
// Cleanup
cleanTarget(app);
Files.createDirectories(Paths.get(appDir.getAbsolutePath(), "logs"));
assertTrue(app.buildAndRunCmds.cmds.length > 1);

if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_0_0) >= 0) {
runCommand(getRunCommand("git", "apply", "quarkus_3.x.patch"), appDir);
if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_9_0) >= 0) {
patch = "quarkus_3.9.x.patch";
} else if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_0_0) >= 0) {
patch = "quarkus_3.x.patch";
}

if (patch != null) {
runCommand(getRunCommand("git", "apply", patch), appDir);
}

// Build executables
Expand All @@ -158,10 +165,10 @@ public void testQuarkusJSONParseOnce(TestInfo testInfo) throws IOException, Inte
report.put("timeToFirstOKRequestMs", String.valueOf(timeToFirstOKRequestMs));
// Test web pages
try (final ReadableByteChannel readableByteChannel = Channels.newChannel(new URL(app.urlContent.urlContent[1][0]).openStream());
final FileOutputStream fileOutputStream = new FileOutputStream(json)) {
final FileOutputStream fileOutputStream = new FileOutputStream(json)) {
fileOutputStream.getChannel().transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
}
final String[] headers = new String[]{
final String[] headers = new String[] {
"Content-Type", "application/json",
"Accept", "text/plain"
};
Expand Down Expand Up @@ -196,7 +203,7 @@ public void testQuarkusJSONParseOnce(TestInfo testInfo) throws IOException, Inte
report.put("branches", String.valueOf(pr.branches));
report.put("branchMisses", String.valueOf(pr.branchMisses));
report.put("secondsTimeElapsed", String.valueOf(pr.secondsTimeElapsed));
Assertions.assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
"Main port is still open");
final Commands.SerialGCLog l;
if (!statsFor.contains("-jar")) {
Expand Down Expand Up @@ -231,7 +238,7 @@ public void testQuarkusJSONParseOnce(TestInfo testInfo) throws IOException, Inte
}
}
LOGGER.info("Gonna wait for ports closed...");
Assertions.assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
"Main port is still open");
Logs.checkLog(cn, mn, app, processLog);
} finally {
Expand All @@ -245,8 +252,8 @@ public void testQuarkusJSONParseOnce(TestInfo testInfo) throws IOException, Inte
"quarkus-json_+ParseOnce-native-image-source-jar", "quarkus-json_plus-ParseOnce.json").toFile());
Logs.archiveLog(cn, mn, processLog);
cleanTarget(app);
if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_0_0) >= 0) {
runCommand(getRunCommand("git", "apply", "-R", "quarkus_3.x.patch"), appDir);
if (patch != null) {
runCommand(getRunCommand("git", "apply", "-R", patch), appDir);
}
}
}
Expand All @@ -264,14 +271,22 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx
final List<Map<String, String>> reports = new ArrayList<>(2);
// Test data tmp storage
final File json = Path.of(appDir.getAbsolutePath(), "logs", "record.json").toFile();
String patch = null;

try {
// Cleanup
cleanTarget(app);
Files.createDirectories(Paths.get(appDir.getAbsolutePath(), "logs"));
assertTrue(app.buildAndRunCmds.cmds.length > 1);

if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_0_0) >= 0) {
runCommand(getRunCommand("git", "apply", "quarkus_3.x.patch"), appDir);
if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_9_0) >= 0) {
patch = "quarkus_3.9.x.patch";
} else if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_0_0) >= 0) {
patch = "quarkus_3.x.patch";
}

if (patch != null) {
runCommand(getRunCommand("git", "apply", patch), appDir);
}

// Build executables
Expand Down Expand Up @@ -326,7 +341,7 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx
report.put("branches", String.valueOf(pr.branches));
report.put("branchMisses", String.valueOf(pr.branchMisses));
report.put("secondsTimeElapsed", String.valueOf(pr.secondsTimeElapsed));
Assertions.assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
"Main port is still open");
final Commands.SerialGCLog l;
if (!statsFor.contains("-jar")) {
Expand Down Expand Up @@ -360,7 +375,7 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx
}
}
LOGGER.info("Gonna wait for ports closed...");
Assertions.assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
"Main port is still open");
Logs.checkLog(cn, mn, app, processLog);
} finally {
Expand All @@ -372,8 +387,8 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx
"quarkus-json-native-image-source-jar", "quarkus-json.json").toFile());
Logs.archiveLog(cn, mn, processLog);
cleanTarget(app);
if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_0_0) >= 0) {
runCommand(getRunCommand("git", "apply", "-R", "quarkus_3.x.patch"), appDir);
if (patch != null) {
runCommand(getRunCommand("git", "apply", "-R", patch), appDir);
}
}
}
Expand Down Expand Up @@ -453,7 +468,7 @@ public void testQuarkusFullMicroProfile(TestInfo testInfo) throws IOException, I
report.put("branches", String.valueOf(pr.branches));
report.put("branchMisses", String.valueOf(pr.branchMisses));
report.put("secondsTimeElapsed", String.valueOf(pr.secondsTimeElapsed));
Assertions.assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
"Main port is still open");
final Commands.SerialGCLog l;
if (!statsFor.contains("-jar")) {
Expand Down Expand Up @@ -486,7 +501,7 @@ public void testQuarkusFullMicroProfile(TestInfo testInfo) throws IOException, I
}
}
LOGGER.info("Gonna wait for ports closed...");
Assertions.assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
assertTrue(waitForTcpClosed("localhost", parsePort(app.urlContent.urlContent[0][0]), 60),
"Main port is still open");
Logs.checkLog(cn, mn, app, processLog);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1165,15 +1165,18 @@ public static void replaceInSmallTextFile(Pattern search, String replace, Path f

/**
* Finds the first matching executable in a given dir,
* *does not dive into the tree*, is not recursive...
* <b>does not dive into the tree</b>, is not recursive...
*
* @param dir
* @param regexp
* @return null or the found file
*/
public static File findExecutable(Path dir, Pattern regexp) {
if (dir == null || Files.notExists(dir) || regexp == null) {
throw new IllegalArgumentException("Path to " + dir + "must exist and regexp must nut be null.");
if (regexp == null) {
throw new IllegalArgumentException("Regexp must not be null.");
}
if (dir == null || Files.notExists(dir)) {
throw new IllegalArgumentException("Path to " + dir + " must exist.");
}
final File[] f = dir.toFile().listFiles(pathname -> {
if (pathname.isFile() && Files.isExecutable(pathname.toPath())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class QuarkusVersion implements Comparable<QuarkusVersion> {
public static final QuarkusVersion V_3_0_0 = new QuarkusVersion("3.0.0");
public static final QuarkusVersion V_3_6_0 = new QuarkusVersion("3.6.0");
public static final QuarkusVersion V_3_7_0 = new QuarkusVersion("3.7.0");
public static final QuarkusVersion V_3_9_0 = new QuarkusVersion("3.9.0");

private final String version;
private final int major;
private final int minor;
Expand Down

0 comments on commit 25cc2f9

Please sign in to comment.