From ae3ff7010918b37d3235cc95c0fd9841c30596e8 Mon Sep 17 00:00:00 2001 From: Cristiano Nicolai <570894+cristianonicolai@users.noreply.github.com> Date: Tue, 29 Aug 2023 23:35:42 +1000 Subject: [PATCH] Springboot 3 fixes (#3191) --- .../patches/0022_spring_boot_it_fix.patch | 57 +++++++++++++++ .../0023_spring_boot_openapi_fix.patch | 70 +++++++++++++++++++ .../patches/0023_springboot_webflux.patch | 64 ----------------- .../0024_spring_boot_wiremock_fix.patch | 28 ++++++++ .../patches/0025_openapi_codegen_fix.patch | 20 ++++++ 5 files changed, 175 insertions(+), 64 deletions(-) create mode 100644 .ci/environments/quarkus-3/patches/0023_spring_boot_openapi_fix.patch delete mode 100644 .ci/environments/quarkus-3/patches/0023_springboot_webflux.patch create mode 100644 .ci/environments/quarkus-3/patches/0024_spring_boot_wiremock_fix.patch create mode 100644 .ci/environments/quarkus-3/patches/0025_openapi_codegen_fix.patch diff --git a/.ci/environments/quarkus-3/patches/0022_spring_boot_it_fix.patch b/.ci/environments/quarkus-3/patches/0022_spring_boot_it_fix.patch index 4ca4fd7bb4d..ffe3ce3b298 100644 --- a/.ci/environments/quarkus-3/patches/0022_spring_boot_it_fix.patch +++ b/.ci/environments/quarkus-3/patches/0022_spring_boot_it_fix.patch @@ -135,3 +135,60 @@ index 9eed010a53..627c1085c3 100644 org.springframework.security spring-security-core +diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/PMMLTreeTest.java b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/PMMLTreeTest.java +--- a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/PMMLTreeTest.java (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/PMMLTreeTest.java (date 1693288356561) +@@ -40,7 +40,7 @@ + @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = KogitoSpringbootApplication.class) + class PMMLTreeTest extends BaseRestTest { + +- private static final String BASE_PATH = "/PMMLTree/SampleMine/"; ++ private static final String BASE_PATH = "/PMMLTree/SampleMine"; + private static final String TARGET = "decision"; + + static { +diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/PMMLRegressionTest.java b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/PMMLRegressionTest.java +--- a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/PMMLRegressionTest.java (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/PMMLRegressionTest.java (date 1693288356557) +@@ -43,7 +43,7 @@ + @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = KogitoSpringbootApplication.class) + class PMMLRegressionTest extends BaseRestTest { + +- private static final String BASE_PATH = "/PMMLRegression/LinReg/"; ++ private static final String BASE_PATH = "/PMMLRegression/LinReg"; + private static final String TARGET = "fld4"; + + static { +diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/CommonPMMLTestUtils.java b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/CommonPMMLTestUtils.java +--- a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/CommonPMMLTestUtils.java (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/src/test/java/org/kie/kogito/integrationtests/springboot/CommonPMMLTestUtils.java (date 1693288384011) +@@ -61,7 +61,7 @@ + final String basePath, + final String targetField, + final Map expectedResultMap) { +- String path = basePath + "descriptive"; ++ String path = basePath + "/descriptive"; + final Response response = given() + .contentType(ContentType.JSON) + .body(inputData) +diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-kafka-it/src/test/java/org/kie/kogito/integrationtests/springboot/PingPongMessageTest.java b/springboot/integration-tests/src/it/integration-tests-springboot-kafka-it/src/test/java/org/kie/kogito/integrationtests/springboot/PingPongMessageTest.java +--- a/springboot/integration-tests/src/it/integration-tests-springboot-kafka-it/src/test/java/org/kie/kogito/integrationtests/springboot/PingPongMessageTest.java (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/integration-tests/src/it/integration-tests-springboot-kafka-it/src/test/java/org/kie/kogito/integrationtests/springboot/PingPongMessageTest.java (date 1693286486274) +@@ -82,7 +82,7 @@ + .untilAsserted(() -> given() + .contentType(ContentType.JSON) + .when() +- .get("/pong_message/") ++ .get("/pong_message") + .then() + .statusCode(200) + .body("$.size()", equalTo(1))); +@@ -90,7 +90,7 @@ + String pId = given() + .contentType(ContentType.JSON) + .when() +- .get("/pong_message/") ++ .get("/pong_message") + .then() + .statusCode(200) + .body("$.size()", equalTo(1)) diff --git a/.ci/environments/quarkus-3/patches/0023_spring_boot_openapi_fix.patch b/.ci/environments/quarkus-3/patches/0023_spring_boot_openapi_fix.patch new file mode 100644 index 00000000000..c954f74f13f --- /dev/null +++ b/.ci/environments/quarkus-3/patches/0023_spring_boot_openapi_fix.patch @@ -0,0 +1,70 @@ +diff --git a/springboot/bom/pom.xml b/springboot/bom/pom.xml +--- a/springboot/bom/pom.xml (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/bom/pom.xml (date 1693298572368) +@@ -16,7 +16,7 @@ + + + 2.2.7 +- 1.6.14 ++ 2.1.0 + + + 2.4.16 +@@ -39,7 +39,7 @@ + + + org.springdoc +- springdoc-openapi-ui ++ springdoc-openapi-starter-webmvc-ui + ${version.org.springdoc} + + +diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-norest-it/pom.xml b/springboot/integration-tests/src/it/integration-tests-springboot-norest-it/pom.xml +--- a/springboot/integration-tests/src/it/integration-tests-springboot-norest-it/pom.xml (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/integration-tests/src/it/integration-tests-springboot-norest-it/pom.xml (date 1693298572352) +@@ -61,7 +61,7 @@ + + + org.springdoc +- springdoc-openapi-ui ++ springdoc-openapi-starter-webmvc-ui + + + io.swagger.parser.v3 +diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml +--- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml (date 1693298572361) +@@ -95,7 +95,7 @@ + + + org.springdoc +- springdoc-openapi-ui ++ springdoc-openapi-starter-webmvc-ui + + + io.swagger.parser.v3 +diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/pom.xml b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/pom.xml +--- a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/pom.xml (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/pom.xml (date 1693298572365) +@@ -75,7 +75,7 @@ + + + org.springdoc +- springdoc-openapi-ui ++ springdoc-openapi-starter-webmvc-ui + + + io.swagger.parser.v3 +diff --git a/springboot/starters/pom.xml b/springboot/starters/pom.xml +--- a/springboot/starters/pom.xml (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/starters/pom.xml (date 1693298572356) +@@ -57,7 +57,7 @@ + + + org.springdoc +- springdoc-openapi-ui ++ springdoc-openapi-starter-webmvc-ui + + + +\ No newline at end of file diff --git a/.ci/environments/quarkus-3/patches/0023_springboot_webflux.patch b/.ci/environments/quarkus-3/patches/0023_springboot_webflux.patch deleted file mode 100644 index 10ad2763b01..00000000000 --- a/.ci/environments/quarkus-3/patches/0023_springboot_webflux.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/pom.xml b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/pom.xml -index 7f8a6eeffa..83d9891853 100644 ---- a/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/pom.xml -+++ b/springboot/integration-tests/src/it/integration-tests-springboot-decisions-it/pom.xml -@@ -28,6 +28,11 @@ - spring-boot-starter - - -+ -+ org.springframework.boot -+ spring-boot-starter-webflux -+ -+ - - org.kie.kogito - kogito-decisions-spring-boot-starter -diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-kafka-it/pom.xml b/springboot/integration-tests/src/it/integration-tests-springboot-kafka-it/pom.xml -index 6d48948451..c0e4bfbb16 100644 ---- a/springboot/integration-tests/src/it/integration-tests-springboot-kafka-it/pom.xml -+++ b/springboot/integration-tests/src/it/integration-tests-springboot-kafka-it/pom.xml -@@ -44,6 +44,11 @@ - spring-boot-starter - - -+ -+ org.springframework.boot -+ spring-boot-starter-webflux -+ -+ - - org.kie.kogito - kogito-spring-boot-starter -diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-norest-it/pom.xml b/springboot/integration-tests/src/it/integration-tests-springboot-norest-it/pom.xml -index 80be856a36..88389c9ede 100644 ---- a/springboot/integration-tests/src/it/integration-tests-springboot-norest-it/pom.xml -+++ b/springboot/integration-tests/src/it/integration-tests-springboot-norest-it/pom.xml -@@ -24,6 +24,11 @@ - spring-boot-starter - - -+ -+ org.springframework.boot -+ spring-boot-starter-webflux -+ -+ - - org.kie.kogito - kogito-spring-boot-starter -diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml -index e02ba47ec4..d73682973c 100644 ---- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml -+++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml -@@ -28,6 +28,11 @@ - spring-boot-starter - - -+ -+ org.springframework.boot -+ spring-boot-starter-webflux -+ -+ - - org.kie.kogito - kogito-processes-spring-boot-starter diff --git a/.ci/environments/quarkus-3/patches/0024_spring_boot_wiremock_fix.patch b/.ci/environments/quarkus-3/patches/0024_spring_boot_wiremock_fix.patch new file mode 100644 index 00000000000..dbe1a1f3e6c --- /dev/null +++ b/.ci/environments/quarkus-3/patches/0024_spring_boot_wiremock_fix.patch @@ -0,0 +1,28 @@ +diff --git a/kogito-build/kogito-dependencies-bom/pom.xml b/kogito-build/kogito-dependencies-bom/pom.xml +--- a/kogito-build/kogito-dependencies-bom/pom.xml (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/kogito-build/kogito-dependencies-bom/pom.xml (date 1693299114156) +@@ -505,6 +505,12 @@ + ${version.com.github.tomakehurst.wiremock} + test + ++ ++ com.github.tomakehurst ++ wiremock-jre8-standalone ++ ${version.com.github.tomakehurst.wiremock} ++ test ++ + + + org.apache.maven.shared +diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml +--- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml (revision 9e11adb52d8ca94fd2f25beebf07cd5925983ac4) ++++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/pom.xml (date 1693298751800) +@@ -89,7 +89,7 @@ + + + com.github.tomakehurst +- wiremock-jre8 ++ wiremock-jre8-standalone + test + + diff --git a/.ci/environments/quarkus-3/patches/0025_openapi_codegen_fix.patch b/.ci/environments/quarkus-3/patches/0025_openapi_codegen_fix.patch new file mode 100644 index 00000000000..c993eb33a17 --- /dev/null +++ b/.ci/environments/quarkus-3/patches/0025_openapi_codegen_fix.patch @@ -0,0 +1,20 @@ +diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/openapi/WorkflowOpenApiHandlerGenerator.java b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/openapi/WorkflowOpenApiHandlerGenerator.java +--- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/openapi/WorkflowOpenApiHandlerGenerator.java (revision eae1492e2f8e90587095c369fe0506ae272ec12a) ++++ b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/openapi/WorkflowOpenApiHandlerGenerator.java (date 1693311380768) +@@ -27,6 +27,7 @@ + import org.jboss.jandex.DotName; + import org.jboss.jandex.MethodInfo; + import org.jboss.jandex.Type; ++import org.jboss.jandex.VoidType; + import org.kie.kogito.codegen.api.context.KogitoBuildContext; + import org.kie.kogito.quarkus.serverless.workflow.ClassAnnotatedWorkflowHandlerGenerator; + import org.kie.kogito.quarkus.serverless.workflow.WorkflowCodeGenUtils; +@@ -88,7 +89,7 @@ + BlockStmt body = executeMethod.createBody(); + MethodCallExpr methodCallExpr = new MethodCallExpr(new NameExpr(OPEN_API_REF), m.name()); + final NameExpr parameters = new NameExpr(WORK_ITEM_PARAMETERS); +- if (m.returnType().name().equals(DotName.createSimple(Response.class.getName()))) { ++ if (m.returnType().name().equals(DotName.createSimple(Response.class.getName())) || (m.returnType() instanceof VoidType)) { + body.addStatement(methodCallExpr).addStatement(new ReturnStmt(new NullLiteralExpr())); + } else { + body.addStatement(new ReturnStmt(methodCallExpr));