Skip to content
This repository was archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
Quarkus 2.0.2.Final Upgrade
Browse files Browse the repository at this point in the history
- Openshift Service default port has moved from 8080 to 80
- HtmlUnit lib has removed from universe bom
- Non-application endpoint doesn't do a redirection anymore
- io.quarkus.grpc.runtime.annotations.GrpcService annotation was renamed to io.quarkus.grpc.GrpcClient
- Vert.x4: some references as io.vertx.core.http.HttpMethod are not available anymore
- `quarkus.openshift.expose` property has been moved to `quarkus.openshift.route.expose`
- Upgrade to Java 11
- Remove avro-maven-plugin
  • Loading branch information
pablo gonzalez granados committed Jul 21, 2021
1 parent 4a22a74 commit 05645fb
Show file tree
Hide file tree
Showing 53 changed files with 88 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void collectAppMetadata(ContainerImageInfoBuildItem containerImage,
} else if (liveness.isPresent()) {
knownEndpoint = liveness.get().getPath();
} else {
knownEndpoint = httpRoot.adjustPath("/"); // TODO ?
knownEndpoint = httpRoot.resolvePath("/"); // TODO ?
}

String deploymentTarget = ConfigProvider.getConfig()
Expand Down
2 changes: 0 additions & 2 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private void setUpRestAssured(ExtensionContext context) throws Exception {
Route route = oc.routes().withName(metadata.appName).get();
if (route == null) {
throw new OpenShiftTestException(
"Missing route " + metadata.appName + ", did you set quarkus.openshift.expose=true?");
"Missing route " + metadata.appName + ", did you set quarkus.openshift.route.expose=true?");
}
if (route.getSpec().getTls() != null) {
RestAssured.useRelaxedHTTPSValidation();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.kubernetes-config.enabled=true
quarkus.kubernetes-config.secrets.enabled=true
quarkus.kubernetes-config.secrets=app-config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.openshift.app-secret=app-config

quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11:latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.kubernetes-config.enabled=true
quarkus.kubernetes-config.config-maps=app-config
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11:latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.openshift.app-config-map=app-config
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11:latest

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quarkus.application.name=deployment-strategy-quarkus

quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11:latest
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void testHello() {
public void testOpenApi() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/openapi")
.when().get(url + "/q/openapi")
.then()
.statusCode(OK.getStatusCode());
}
Expand All @@ -76,7 +76,7 @@ public void testOpenApi() {
public void testLiveness() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/health/live")
.when().get(url + "/q/health/live")
.then()
.statusCode(OK.getStatusCode());
}
Expand All @@ -85,7 +85,7 @@ public void testLiveness() {
public void testReadiness() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/health/ready")
.when().get(url + "/q/health/ready")
.then()
.statusCode(OK.getStatusCode());
}
Expand All @@ -94,7 +94,7 @@ public void testReadiness() {
public void testMetrics() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/metrics/application")
.when().get(url + "/q/metrics/application")
.then()
.statusCode(OK.getStatusCode());
}
Expand Down Expand Up @@ -179,7 +179,7 @@ public void testDeleteHero() {
public void testCalledOperationMetrics() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/metrics/application")
.when().get(url + "/q/metrics/application")
.then()
.statusCode(OK.getStatusCode())
.body("'io.quarkus.workshop.superheroes.hero.HeroResource.countCreateHero'", is(1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void testHello() {
public void testOpenApi() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/openapi")
.when().get(url + "/q/openapi")
.then()
.statusCode(OK.getStatusCode());
}
Expand All @@ -77,7 +77,7 @@ public void testOpenApi() {
public void testLiveness() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/health/live")
.when().get(url + "/q/health/live")
.then()
.statusCode(OK.getStatusCode());
}
Expand All @@ -86,7 +86,7 @@ public void testLiveness() {
public void testReadiness() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/health/ready")
.when().get(url + "/q/health/ready")
.then()
.statusCode(OK.getStatusCode());
}
Expand All @@ -95,7 +95,7 @@ public void testReadiness() {
public void testMetrics() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/metrics/application")
.when().get(url + "/q/metrics/application")
.then()
.statusCode(OK.getStatusCode());
}
Expand Down Expand Up @@ -180,7 +180,7 @@ public void testDeleteVillain() {
public void testCalledOperationMetrics() {
given()
.header(ACCEPT, APPLICATION_JSON)
.when().get(url + "/metrics/application")
.when().get(url + "/q/metrics/application")
.then()
.statusCode(OK.getStatusCode())
.body("'io.quarkus.workshop.superheroes.villain.VillainResource.countCreateVillain'", is(1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package io.quarkus.ts.openshift.http;

import javax.inject.Singleton;

import io.grpc.stub.StreamObserver;
import io.quarkus.example.GreeterGrpc;
import io.quarkus.example.HelloReply;
import io.quarkus.example.HelloRequest;
import io.quarkus.grpc.GrpcService;

@Singleton
public class GrpcService extends GreeterGrpc.GreeterImplBase {
@GrpcService
public class CustomGrpcService extends GreeterGrpc.GreeterImplBase {

@Override
public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

import io.quarkus.example.GreeterGrpc;
import io.quarkus.example.HelloRequest;
import io.quarkus.grpc.runtime.annotations.GrpcService;
import io.quarkus.grpc.GrpcClient;

@Path("/grpc")
public class GrpcResource {

@Inject
@GrpcService("hello")
@GrpcClient("hello")
GreeterGrpc.GreeterBlockingStub client;

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import javax.ws.rs.core.Response;

import io.quarkus.vertx.web.Route;
import io.vertx.core.http.HttpMethod;
import io.vertx.ext.web.RoutingContext;

@ApplicationScoped
public class HttpClientVersionResource {

protected static final String HTTP_VERSION = "x-http-version";

@Route(methods = HttpMethod.GET, path = "/httpVersion")
@Route(methods = Route.HttpMethod.GET, path = "/httpVersion")
public void clientHttpVersion(RoutingContext rc) {
String httpClientVersion = rc.request().version().name();
rc.response().headers().add(HTTP_VERSION, httpClientVersion);
Expand Down
16 changes: 1 addition & 15 deletions http/http-advanced/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

quarkus.application.name=test-http-advanced
quarkus.http.root-path=/api
quarkus.http.non-application-root-path=/q
quarkus.http.redirect-to-non-application-root-path=true

#quarkus.smallrye-metrics.path=/metricas
quarkus.http.port=8081
Expand All @@ -12,7 +10,7 @@ quarkus.swagger-ui.always-include=true
quarkus.health.openapi.included=true

quarkus.kubernetes.deployment-target=openshift
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11
quarkus.http.http2=true
quarkus.http.ssl-port=8443
Expand Down Expand Up @@ -50,18 +48,6 @@ quarkus.keycloak.policy-enforcer.enable=true
quarkus.keycloak.policy-enforcer.paths.health-redirection.path=/api/q/*
quarkus.keycloak.policy-enforcer.paths.health-redirection.enforcement-mode=DISABLED

quarkus.keycloak.policy-enforcer.paths.metrics.path=/api/metrics/*
quarkus.keycloak.policy-enforcer.paths.metrics.enforcement-mode=DISABLED

quarkus.keycloak.policy-enforcer.paths.openapi.path=/api/openapi/*
quarkus.keycloak.policy-enforcer.paths.openapi.enforcement-mode=DISABLED

quarkus.keycloak.policy-enforcer.paths.swagger-ui.path=/api/swagger-ui/*
quarkus.keycloak.policy-enforcer.paths.swagger-ui.enforcement-mode=DISABLED

quarkus.keycloak.policy-enforcer.paths.health.path=/api/health/*
quarkus.keycloak.policy-enforcer.paths.health.enforcement-mode=DISABLED

quarkus.keycloak.policy-enforcer.paths.version.path=/api/httpVersion/*
quarkus.keycloak.policy-enforcer.paths.version.enforcement-mode=DISABLED

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.when;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.in;
import static org.hamcrest.Matchers.is;
Expand Down Expand Up @@ -130,17 +129,13 @@ public void http2ClientAsync() throws Exception {

@Test
@DisplayName("Non-application endpoint move to /q/")
public void nonAppRedirections() {
public void nonAppEndpoints() {
List<String> endpoints = Arrays.asList(
"/openapi", "/swagger-ui", "/metrics/base", "/metrics/application",
"/metrics/vendor", "/metrics", "/health/group", "/health/well", "/health/ready",
"/health/live", "/health");
"q/openapi", "q/swagger-ui", "q/metrics/base", "q/metrics/application",
"q/metrics/vendor", "q/metrics", "q/health/group", "q/health/well", "q/health/ready",
"q/health/live", "q/health");

for (String endpoint : endpoints) {
given().redirects().follow(false)
.log().uri()
.expect().statusCode(301).header("Location", containsString("/q" + endpoint)).when().get(endpoint);

given().expect().statusCode(in(Arrays.asList(200, 204))).when().get(endpoint);
}
}
Expand All @@ -161,7 +156,7 @@ public void microprofileHttpClientRedirection() throws Exception {
public void vertxHttpClientRedirection() throws InterruptedException, URISyntaxException {
CountDownLatch done = new CountDownLatch(1);
Uni<Integer> statusCode = WebClient.create(Vertx.vertx(), defaultVertxHttpClientOptions())
.getAbs(getAppEndpoint() + "health")
.getAbs(getAppEndpoint() + "q/health")
.send().map(HttpResponse::statusCode)
.ifNoItem().after(Duration.ofSeconds(TIMEOUT_SEC)).fail()
.onFailure().retry().atMost(RETRY);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
quarkus.application.name=test-http
quarkus.http.root-path=/api
quarkus.kubernetes.deployment-target=openshift
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11

quarkus.kubernetes.readiness-probe.period=5s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ quarkus.infinispan-client.trust-store-password=password
quarkus.infinispan-client.trust-store-type=JKS

# instructs quarkus to build and deploy to kubernetes/openshift, and to trust the Kubernetes API since we're using self-signed
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11:latest

# configmap settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true

# We can't append arguments to the Java commend
# Not sure if the quarkus.openshift.arguments will be the right property to do this or there will be a new one.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package io.quarkus.ts.openshift.messaging.amqp;

import java.util.concurrent.TimeUnit;
import java.time.Duration;

import javax.enterprise.context.ApplicationScoped;

import org.eclipse.microprofile.reactive.messaging.Outgoing;
import org.jboss.logging.Logger;

import io.reactivex.Flowable;
import io.smallrye.mutiny.Multi;

@ApplicationScoped
public class PriceProducer {

private static final Logger LOG = Logger.getLogger(PriceProducer.class.getName());

@Outgoing("generated-price")
public Flowable<Integer> generate() {
public Multi<Integer> generate() {
LOG.info("generate fired...");
return Flowable.interval(1, TimeUnit.SECONDS)
.onBackpressureDrop()
return Multi.createFrom().ticks().every(Duration.ofSeconds(1))
.onOverflow().drop()
.map(tick -> ((tick.intValue() * 10) % 100) + 10);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11:latest

%test.amqp-host=localhost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import javax.jms.Message;
import javax.jms.Session;

import org.apache.commons.lang3.StringUtils;
import org.jboss.logging.Logger;

@ApplicationScoped
Expand Down Expand Up @@ -41,7 +40,7 @@ public String receiveAndAck(boolean ackIt) throws JMSException {
}

private String receiveMessagesInQueue(String queueName) {
String price = StringUtils.EMPTY;
String price = "";
try (JMSContext context = connectionFactory.createContext(Session.AUTO_ACKNOWLEDGE);
JMSConsumer consumer = context.createConsumer(context.createQueue(queueName))) {
Message message = consumer.receive(500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ quarkus.artemis.url=tcp://amq-broker-tcp:61616
quarkus.artemis.username=quarkus
quarkus.artemis.password=quarkus

quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11:latest

%test.quarkus.artemis.url=tcp://localhost:61616
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ quarkus.artemis.url=tcp://amq-broker-tcp:61616
quarkus.artemis.username=quarkus
quarkus.artemis.password=quarkus

quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-11:latest

%test.quarkus.artemis.url=tcp://localhost:61616
Expand Down
5 changes: 1 addition & 4 deletions messaging/kafka-avro-reactive-messaging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
</goals>
</execution>
</executions>
Expand All @@ -91,10 +92,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ mp.messaging.incoming.channel-stock-price.auto.offset.reset=earliest
mp.messaging.incoming.channel-stock-price.enable.auto.commit=true
mp.messaging.incoming.channel-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.utils.serde.avro.ReflectAvroDatumProvider

quarkus.openshift.expose=true
quarkus.openshift.route.expose=true
Loading

0 comments on commit 05645fb

Please sign in to comment.