Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2] Backports and Quarkus bump to 3.2.9 #1537

Merged
merged 12 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
echo "Running modules: ${MODULES_ARG}"
echo "MODULES_MAVEN_PARAM=[\" -pl ${MODULES_ARG} -Dall-modules\"]" >> $GITHUB_OUTPUT
else
echo "MODULES_MAVEN_PARAM=[' -P root-modules,spring-modules,http-modules,test-tooling-modules', ' -P security-modules,sql-db-modules,messaging-modules,websockets-modules,monitoring-modules']" >> $GITHUB_OUTPUT
echo "MODULES_MAVEN_PARAM=[' -P root-modules,cache-modules,spring-modules,http-modules,test-tooling-modules', ' -P security-modules,sql-db-modules,messaging-modules,websockets-modules,monitoring-modules']" >> $GITHUB_OUTPUT
fi
outputs:
MODULES_MAVEN_PARAM: ${{ steps.prepare-modules-mvn-param.outputs.MODULES_MAVEN_PARAM }}
Expand All @@ -73,7 +73,7 @@ jobs:
strategy:
matrix:
java: [ 17 ]
cli: [ 3.2.8.Final ]
cli: [ 3.2.9.Final ]
module-mvn-args: ${{ fromJSON(needs.prepare-jvm-latest-modules-mvn-param.outputs.MODULES_MAVEN_PARAM) }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
strategy:
matrix:
java: [ 11 ]
cli: [ 3.2.8.Final ]
cli: [ 3.2.9.Final ]
steps:
- uses: actions/checkout@v3
- name: Reclaim Disk Space
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The following subsections will introduce how to deploy and run the test suite in
If you have a look the main `pom.xml` you will notice that there are several profiles or in other words the test suite is a maven monorepo that you can compile and verify at once or by topics. Let's review the main profiles:

* root-modules: talk about Quarkus "core stuff" as configuration or properties. Is a basic stuff that should work as a pre-requisite to other modules.
* cache-modules: cover Quarkus application data caching
* http-modules: talk about HTTP extensions and no-application endpoints like `/q/health`
* security-modules: cover all security stuff like OAuth, JWT, OpenId, Keycloak etc
* messaging-modules: is focus on brokers as Kafka or Artemis-AMQP
Expand Down Expand Up @@ -1084,6 +1085,15 @@ It covers different usages:
3. from a blocking endpoint
4. from a reactive endpoint

### `cache/redis`

Verifies the `quarkus-redis-cache` extension using `@CacheResult`, `@CacheInvalidate`, `@CacheInvalidateAll` and `@CacheKey`.
It covers different usages:
1. from an application scoped service
2. from a request scoped service

Also verify that Qute correctly indicate that does not work with remote cache.

### `cache/spring`

Verifies the `quarkus-spring-cache` extension using `@Cacheable`, `@CacheEvict` and `@CachePut`.
Expand Down
36 changes: 36 additions & 0 deletions cache/redis/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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.quarkus.ts.qe</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>cache-redis</artifactId>
<packaging>jar</packaging>
<name>Quarkus QE TS: Cache: Redis</name>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-cache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-redis-cache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-qute</artifactId>
</dependency>
<!--> Added dependency to check https://github.com/quarkusio/quarkus/issues/35680 <-->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-mailer</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.quarkus.ts.cache.caffeine;

import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class ApplicationScopeService extends BaseServiceWithCache {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.quarkus.ts.cache.caffeine;

import io.quarkus.cache.CacheInvalidate;
import io.quarkus.cache.CacheInvalidateAll;
import io.quarkus.cache.CacheKey;
import io.quarkus.cache.CacheResult;

public abstract class BaseServiceWithCache {

private static final String CACHE_NAME = "service-cache";

private static int counter = 0;

@CacheResult(cacheName = CACHE_NAME)
public String getValue() {
return "Value: " + counter++;
}

@CacheInvalidate(cacheName = CACHE_NAME)
public void invalidate() {
// do nothing
}

@CacheResult(cacheName = CACHE_NAME)
public String getValueWithPrefix(@CacheKey String prefix) {
return prefix + ": " + counter++;
}

@CacheInvalidate(cacheName = CACHE_NAME)
public void invalidateWithPrefix(@CacheKey String prefix) {
// do nothing
}

@CacheInvalidateAll(cacheName = CACHE_NAME)
public void invalidateAll() {
// do nothing
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.quarkus.ts.cache.caffeine;

import jakarta.enterprise.context.RequestScoped;

@RequestScoped
public class RequestScopeService extends BaseServiceWithCache {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package io.quarkus.ts.cache.caffeine;

import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

@Path("/services")
public class ServiceWithCacheResource {

public static final String APPLICATION_SCOPE_SERVICE_PATH = "application-scope";
public static final String REQUEST_SCOPE_SERVICE_PATH = "request-scope";

@Inject
ApplicationScopeService applicationScopeService;

@Inject
RequestScopeService requestScopeService;

@GET
@Path("/{service}")
@Produces(MediaType.TEXT_PLAIN)
public String getValueFromService(@PathParam("service") String service) {
return lookupServiceByPathParam(service).getValue();
}

@POST
@Path("/{service}/invalidate-cache")
public void invalidateCacheFromService(@PathParam("service") String service) {
lookupServiceByPathParam(service).invalidate();
}

@POST
@Path("/{service}/invalidate-cache-all")
public void invalidateCacheAllFromService(@PathParam("service") String service) {
lookupServiceByPathParam(service).invalidateAll();
}

@GET
@Path("/{service}/using-prefix/{prefix}")
@Produces(MediaType.TEXT_PLAIN)
public String getValueUsingPrefixFromService(@PathParam("service") String service, @PathParam("prefix") String prefix) {
return lookupServiceByPathParam(service).getValueWithPrefix(prefix);
}

@POST
@Path("/{service}/using-prefix/{prefix}/invalidate-cache")
public void invalidateCacheUsingPrefixFromService(@PathParam("service") String service,
@PathParam("prefix") String prefix) {
lookupServiceByPathParam(service).invalidateWithPrefix(prefix);
}

private BaseServiceWithCache lookupServiceByPathParam(String service) {
if (APPLICATION_SCOPE_SERVICE_PATH.equals(service)) {
return applicationScopeService;
} else if (REQUEST_SCOPE_SERVICE_PATH.equals(service)) {
return requestScopeService;
}

throw new IllegalArgumentException("Service " + service + " is not recognised");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.quarkus.ts.cache.caffeine;

import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;

import io.quarkus.qute.Template;

@Path("template")
public class TemplateCacheResource {

@Inject
Template cached;

/**
* Check for remote cache with Qute template. Qute should not use remote cache.
* See https://github.com/quarkusio/quarkus/issues/35680#issuecomment-1711153725
*
* @return Should return error contains `not supported for remote caches`
*/
@GET
@Path("error")
public String getQuteTemplate() {
try {
return cached.render();
} catch (IllegalStateException e) {
return e.getMessage();
}
}

}
Empty file.
1 change: 1 addition & 0 deletions cache/redis/src/main/resources/templates/cached.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{#cached}This cached template won't be working with remote cache like redis.{/cached}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.quarkus.ts.cache.redis;

import io.quarkus.test.scenarios.OpenShiftScenario;

@OpenShiftScenario
public class OpenShiftRedisCacheIT extends RedisCacheIT {
}
Loading