Skip to content

Commit

Permalink
[incubator-kie-issues#1575] Upgrade quarkus to 3.15 (#2141)
Browse files Browse the repository at this point in the history
* Upgrade quarkus to 3.15

* Add quarkus test profiles for h2 and PostgresSql

* Fix test failure

* Fix test failure- Unrestricted schema compatibility checks

Fix test failure- Schema compatibility changes ISPN-15974

Fix test failure- Schema compatibility changes ISPN-15974

* Upgrade infinispan to 15.0.11.Final

* Some artifacts renaming as per migration guide 3.9

* Updating quarkus.package.type property as per migration guide

* fix formatting error

* - fix formatting + Header

---------

Co-authored-by: Pere Fernández <[email protected]>
  • Loading branch information
RishiRajAnand and pefernan authored Jan 28, 2025
1 parent 03210e5 commit 0ab2453
Show file tree
Hide file tree
Showing 81 changed files with 528 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-client-oidc-filter</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-quarkus-test-utils</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
<artifactId>quarkus-messaging-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.reactivemessaging.http</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-client-oidc-filter</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-messaging</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
<artifactId>quarkus-messaging-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-client-oidc-filter</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>integration-tests-jobs-service-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-client-oidc-filter</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-messaging</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
<artifactId>quarkus-messaging-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-client-oidc-filter</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-events-process</artifactId>
Expand All @@ -63,7 +67,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
<artifactId>quarkus-messaging-kafka</artifactId>
</dependency>
<!-- Used to enable the proto generation set in the data-index -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
</property>
</activation>
<properties>
<quarkus.package.type>native</quarkus.package.type>
<quarkus.native.enabled>true</quarkus.native.enabled>
</properties>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive-jackson</artifactId>
<artifactId>quarkus-rest-client-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
Expand All @@ -101,7 +101,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive</artifactId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
<groupId>io.cloudevents</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void testAddBrokenProtoFile() {
fail("Registering broken proto file should fail");
} catch (Exception ex) {
assertThat(ex.getMessage())
.isEqualTo("Failed to resolve type of field \"org.demo.travels.traveller\". Type not found : stringa");
.isEqualTo("Failed to resolve type of field \"org.demo.travels.traveller\" in \"domainModel\". Type not found : stringa");
}
}

Expand Down Expand Up @@ -136,30 +136,6 @@ void testProtoWithoutSortingAttribute() throws Exception {
.then().log().ifValidationFails().statusCode(200).body("data.Books", isA(Collection.class));
}

@Test
//Reproducer for KOGITO-172
void testAddProtoFileTwice() throws Exception {
protobufService.registerProtoBufferType(getProtoBufferFileV1());
given().contentType(ContentType.JSON)
.body("{ \"query\" : \"{Game{ player, id, name, metadata { processInstances { id } } } }\" }")
.when().post("/graphql")
.then().log().ifValidationFails().statusCode(200).body("data.Game", isA(Collection.class));
given().contentType(ContentType.JSON)
.body("{ \"query\" : \"{ProcessInstances{ id, processId, rootProcessId, rootProcessInstanceId, parentProcessInstanceId } }\" }")
.when().post("/graphql")
.then().log().ifValidationFails().statusCode(200).body("data.ProcessInstances", isA(Collection.class));

protobufService.registerProtoBufferType(getProtoBufferFileV2());
given().contentType(ContentType.JSON)
.body("{ \"query\" : \"{Game{ id, name, company, metadata { processInstances { id } } } }\" }")
.when().post("/graphql")
.then().log().ifValidationFails().statusCode(200).body("data.Game", isA(Collection.class));
given().contentType(ContentType.JSON)
.body("{ \"query\" : \"{ProcessInstances{ id, processId, rootProcessId, rootProcessInstanceId, parentProcessInstanceId } }\" }")
.when().post("/graphql")
.then().log().ifValidationFails().statusCode(200).body("data.ProcessInstances", isA(Collection.class));
}

@Test
void testAddProtoFile() throws Exception {
String processId = "travels";
Expand Down Expand Up @@ -779,38 +755,6 @@ private String getBrokenProtoBufferFile() {
"\n";
}

private String getProtoBufferFileV1() {
return "package org.demo;\n" +
"import \"kogito-index.proto\";\n" +
"option kogito_model=\"Game\";\n" +
"option kogito_id=\"game\";\n" +
"/* @Indexed */\n" +
"message Game {\n" +
" optional string player = 1;\n" +
" /* @Field(index = Index.YES, store = Store.YES) @SortableField */\n" +
" optional string id = 2;\n" +
" optional string name = 3;\n" +
" optional org.kie.kogito.index.model.KogitoMetadata metadata = 4;\n" +
"}\n" +
"\n";
}

private String getProtoBufferFileV2() {
return "package org.demo;\n" +
"import \"kogito-index.proto\";\n" +
"option kogito_model=\"Game\";\n" +
"option kogito_id=\"game\";\n" +
"/* @Indexed */\n" +
"message Game {\n" +
" /* @Field(index = Index.YES, store = Store.YES) @SortableField */\n" +
" optional string id = 1;\n" +
" optional string name = 2;\n" +
" optional string company = 3;\n" +
" optional org.kie.kogito.index.model.KogitoMetadata metadata = 4;\n" +
"}\n" +
"\n";
}

protected abstract String getProcessProtobufFileContent() throws Exception;

protected abstract String getUserTaskProtobufFileContent() throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
<artifactId>quarkus-messaging-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down Expand Up @@ -96,6 +96,10 @@
<artifactId>json-unit-assertj</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-client-hotrod</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-quarkus-test-utils</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ version: '2.1'
services:

infinispan:
image: infinispan/server:14.0.4.Final
image: infinispan/server:15.0.11.Final
container_name: infinispan
ports:
- 11222:11222
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ services:
LOG_DIR: "/tmp/logs"

infinispan:
image: infinispan/server:14.0.4.Final
image: infinispan/server:15.0.11.Final
container_name: data-index-infinispan
ports:
- "11222:11222"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,30 @@
*/
package org.kie.kogito.index.service;

import java.util.Collection;

import org.junit.jupiter.api.Test;
import org.kie.kogito.index.service.test.InMemoryMessageTestProfile;
import org.kie.kogito.index.test.TestUtils;
import org.kie.kogito.persistence.protobuf.ProtobufService;

import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import io.restassured.http.ContentType;

import jakarta.inject.Inject;

import static io.restassured.RestAssured.given;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.isA;

@QuarkusTest
@TestProfile(InMemoryMessageTestProfile.class)
class InfinispanDomainIndexingServiceIT extends AbstractDomainIndexingServiceIT {

@Inject
ProtobufService protobufService;

@Override
protected String getProcessProtobufFileContent() throws Exception {
return TestUtils.getTravelsProtoBufferFile();
Expand All @@ -37,4 +51,57 @@ protected String getProcessProtobufFileContent() throws Exception {
protected String getUserTaskProtobufFileContent() throws Exception {
return TestUtils.getDealsProtoBufferFile();
}

@Test
// Schema compatibility checks introduced in ISPN-15974
void testAddProtoFileTwice() throws Exception {
protobufService.registerProtoBufferType(getProtoBufferFileV1());
given().contentType(ContentType.JSON)
.body("{ \"query\" : \"{Game{ player, id, name, metadata { processInstances { id } } } }\" }")
.when().post("/graphql")
.then().log().ifValidationFails().statusCode(200).body("data.Game", isA(Collection.class));
given().contentType(ContentType.JSON)
.body("{ \"query\" : \"{ProcessInstances{ id, processId, rootProcessId, rootProcessInstanceId, parentProcessInstanceId } }\" }")
.when().post("/graphql")
.then().log().ifValidationFails().statusCode(200).body("data.ProcessInstances", isA(Collection.class));

try {
protobufService.registerProtoBufferType(getProtoBufferFileV2());
} catch (Exception ex) {
assertThat(ex.getMessage())
.contains("Incompatible schema changes");
}
}

private String getProtoBufferFileV1() {
return "package org.demo;\n" +
"import \"kogito-index.proto\";\n" +
"option kogito_model=\"Game\";\n" +
"option kogito_id=\"game\";\n" +
"/* @Indexed */\n" +
"message Game {\n" +
" optional string player = 1;\n" +
" /* @Field(index = Index.YES, store = Store.YES) @SortableField */\n" +
" optional string id = 2;\n" +
" optional string name = 3;\n" +
" optional org.kie.kogito.index.model.KogitoMetadata metadata = 4;\n" +
"}\n" +
"\n";
}

private String getProtoBufferFileV2() {
return "package org.demo;\n" +
"import \"kogito-index.proto\";\n" +
"option kogito_model=\"Game\";\n" +
"option kogito_id=\"game\";\n" +
"/* @Indexed */\n" +
"message Game {\n" +
" /* @Field(index = Index.YES, store = Store.YES) @SortableField */\n" +
" optional string id = 1;\n" +
" optional string name = 2;\n" +
" optional string company = 3;\n" +
" optional org.kie.kogito.index.model.KogitoMetadata metadata = 4;\n" +
"}\n" +
"\n";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
<artifactId>quarkus-messaging-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
Loading

0 comments on commit 0ab2453

Please sign in to comment.