diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/pom.xml index 4acb9cf187..e06d3c58d0 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/pom.xml @@ -22,10 +22,6 @@ org.kie.kogito kogito-addons-quarkus-data-index-common-runtime - - org.kie.kogito - kogito-addons-quarkus-process-svg-deployment - org.kie.kogito kogito-addons-quarkus-source-files-deployment diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/pom.xml index aa336fa354..1182a0f13a 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/pom.xml @@ -21,7 +21,7 @@ org.kie.kogito - kogito-addons-quarkus-process-svg + kogito-addons-process-svg org.kie.kogito diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/src/main/java/org/kie/kogito/index/addon/api/KogitoAddonRuntimeClientImpl.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/src/main/java/org/kie/kogito/index/addon/api/KogitoAddonRuntimeClientImpl.java index 46ac64d395..4508553b7a 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/src/main/java/org/kie/kogito/index/addon/api/KogitoAddonRuntimeClientImpl.java +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/src/main/java/org/kie/kogito/index/addon/api/KogitoAddonRuntimeClientImpl.java @@ -53,10 +53,10 @@ public class KogitoAddonRuntimeClientImpl implements KogitoRuntimeClient { private Processes processes; @Inject - public KogitoAddonRuntimeClientImpl(ProcessSvgService processSvgService, + public KogitoAddonRuntimeClientImpl(Instance processSvgService, SourceFilesProvider sourceFilesProvider, Instance processesInstance) { - this.processSvgService = processSvgService; + this.processSvgService = processSvgService.isResolvable() ? processSvgService.get() : null; this.sourceFilesProvider = sourceFilesProvider; this.processes = processesInstance.isResolvable() ? processesInstance.get() : null; } @@ -90,7 +90,11 @@ public CompletableFuture updateProcessInstanceVariables(String serviceUR @Override public CompletableFuture getProcessInstanceDiagram(String serviceURL, ProcessInstance processInstance) { - return CompletableFuture.supplyAsync(() -> processSvgService.getProcessInstanceSvg(processInstance.getProcessId(), processInstance.getId(), null).orElse(null), managedExecutor); + if (processSvgService == null) { + return CompletableFuture.completedFuture(null); + } else { + return CompletableFuture.supplyAsync(() -> processSvgService.getProcessInstanceSvg(processInstance.getProcessId(), processInstance.getId(), null).orElse(null), managedExecutor); + } } @Override diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/pom.xml new file mode 100644 index 0000000000..fcd964a031 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + + org.kie.kogito + kogito-addons-quarkus-data-index-infinispan-parent + 1.40.1-SNAPSHOT + + kogito-addons-quarkus-data-index-infinispan-integration-tests-process + Kogito Apps :: Kogito Addons Quarkus Data Index Infinispan :: Integration Tests :: Process + + + + org.kie.kogito + kogito-quarkus-processes + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + org.kie.kogito + kogito-addons-quarkus-data-index-infinispan + + + org.kie.kogito + kogito-addons-quarkus-persistence-infinispan + + + org.kie.kogito + kogito-addons-quarkus-process-svg + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.kie.kogito + kogito-addons-quarkus-data-index-infinispan-deployment + ${project.version} + pom + test + + + * + * + + + + + + + + io.quarkus + quarkus-maven-plugin + ${version.io.quarkus} + + + + build + + + + + + + + + native + + + native + + + + native + **/*IT.java + + + + diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg new file mode 100644 index 0000000000..716974fb87 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/main/resources/application.properties similarity index 100% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/main/resources/application.properties rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/main/resources/application.properties diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/main/resources/hello.bpmn b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/main/resources/hello.bpmn new file mode 100644 index 0000000000..939c411bbd --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/main/resources/hello.bpmn @@ -0,0 +1,47 @@ + + + + + + + + + _9FD38FF8-A530-41E7-8EA0-E1F71353CBB3 + + + _9FD38FF8-A530-41E7-8EA0-E1F71353CBB3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _hT2oIPJzEDuE8tm0q8uK_w + _hT2oIPJzEDuE8tm0q8uK_w + + \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java similarity index 88% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java index 0e2fa4d7d5..fcef753f74 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Red Hat, Inc. and/or its affiliates. + * Copyright 2023 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import static org.hamcrest.CoreMatchers.notNullValue; @QuarkusIntegrationTest -class PostgreSQLQuarkusAddonDataIndexIT { +class InfinispanQuarkusAddonDataIndexIT { static { RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); @@ -43,11 +43,10 @@ void testDataIndexAddon() { String id = given() .contentType(ContentType.JSON) .accept(ContentType.JSON) - .body("{\"workflowdata\" : {\"name\" : \"John\", \"language\":\"English\"}}").when() - .post("/greet") + .post("/hello") .then() .statusCode(201) - .body("workflowdata.greeting", is("Hello from JSON Workflow,")) + .body("id", is(notNullValue())) .extract().path("id"); given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessInstances{ id, state, diagram, source, nodeDefinitions { name } } }\" }") @@ -58,7 +57,7 @@ void testDataIndexAddon() { .body("data.ProcessInstances[0].state", is("COMPLETED")) .body("data.ProcessInstances[0].diagram", is(notNullValue())) .body("data.ProcessInstances[0].source", is(notNullValue())) - .body("data.ProcessInstances[0].nodeDefinitions.size()", is(12)); + .body("data.ProcessInstances[0].nodeDefinitions.size()", is(2)); } @Test diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/pom.xml similarity index 98% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/pom.xml rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/pom.xml index 40369d0877..bda6a6a8a6 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/pom.xml @@ -7,8 +7,8 @@ kogito-addons-quarkus-data-index-infinispan-parent 1.40.1-SNAPSHOT - kogito-addons-quarkus-data-index-infinispan-integration-tests - Kogito Apps :: Kogito Addons Quarkus Data Index Infinispan :: Integration Tests + kogito-addons-quarkus-data-index-infinispan-integration-tests-sw + Kogito Apps :: Kogito Addons Quarkus Data Index Infinispan :: Integration Tests :: SW diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/src/main/resources/application.properties new file mode 100644 index 0000000000..a247c8061f --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/src/main/resources/application.properties @@ -0,0 +1,3 @@ +kogito.persistence.type=infinispan + +quarkus.kogito.data-index.graphql.ui.always-include=true \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/main/resources/greet.sw.json b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/src/main/resources/greet.sw.json similarity index 100% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/main/resources/greet.sw.json rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/src/main/resources/greet.sw.json diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java similarity index 95% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java index ecc79c5c62..e438eb4843 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexIT.java @@ -25,6 +25,7 @@ import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; @QuarkusIntegrationTest class InfinispanQuarkusAddonDataIndexIT { @@ -56,7 +57,7 @@ void testDataIndexAddon() { .body("data.ProcessInstances.size()", is(1)) .body("data.ProcessInstances[0].id", is(id)) .body("data.ProcessInstances[0].state", is("COMPLETED")) - .body("data.ProcessInstances[0].diagram", is(notNullValue())) + .body("data.ProcessInstances[0].diagram", is(nullValue())) .body("data.ProcessInstances[0].source", is(notNullValue())) .body("data.ProcessInstances[0].nodeDefinitions.size()", is(12)); } diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/main/resources/META-INF/processSVG/greet.svg b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/main/resources/META-INF/processSVG/greet.svg deleted file mode 100644 index 2398d96928..0000000000 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests/src/main/resources/META-INF/processSVG/greet.svg +++ /dev/null @@ -1 +0,0 @@ -StartEndChooseOnLanguageGreetInEnglishGreetInSpanishGreetPerson \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/pom.xml index 76710ff6a6..7b89a22a3b 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/pom.xml @@ -15,7 +15,21 @@ deployment runtime - integration-tests + integration-tests-sw + + + default + + + !productized + + + + integration-tests-process + + + + diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/pom.xml new file mode 100644 index 0000000000..d621462fc0 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/pom.xml @@ -0,0 +1,88 @@ + + + 4.0.0 + + org.kie.kogito + kogito-addons-quarkus-data-index-inmemory-parent + 1.40.1-SNAPSHOT + + kogito-addons-quarkus-data-index-inmemory-integration-tests-process + Kogito Apps :: Kogito Addons Quarkus Data Index In-memory :: Integration Tests :: Process + + + + org.kie.kogito + kogito-quarkus-processes + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + org.kie.kogito + kogito-addons-quarkus-data-index-inmemory + + + org.kie.kogito + kogito-addons-quarkus-process-svg + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.kie.kogito + kogito-addons-quarkus-data-index-inmemory-deployment + ${project.version} + pom + test + + + * + * + + + + + + + + io.quarkus + quarkus-maven-plugin + ${version.io.quarkus} + + + + build + + + + + + + + + native + + + native + + + + native + **/*IT.java + + + + diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg new file mode 100644 index 0000000000..716974fb87 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/main/resources/application.properties similarity index 100% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/main/resources/application.properties rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/main/resources/application.properties diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/main/resources/hello.bpmn b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/main/resources/hello.bpmn new file mode 100644 index 0000000000..939c411bbd --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/main/resources/hello.bpmn @@ -0,0 +1,47 @@ + + + + + + + + + _9FD38FF8-A530-41E7-8EA0-E1F71353CBB3 + + + _9FD38FF8-A530-41E7-8EA0-E1F71353CBB3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _hT2oIPJzEDuE8tm0q8uK_w + _hT2oIPJzEDuE8tm0q8uK_w + + \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java new file mode 100644 index 0000000000..6e737994ef --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java @@ -0,0 +1,71 @@ +/* + * Copyright 2023 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.kie.kogito.addons.quarkus.data.index.it; + +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; + +@QuarkusIntegrationTest +class InMemoryQuarkusAddonDataIndexIT { + + static { + RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); + } + + @Test + void testDataIndexAddon() { + given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessInstances{ id } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(0)); + + String id = given() + .contentType(ContentType.JSON) + .accept(ContentType.JSON) + .post("/hello") + .then() + .statusCode(201) + .body("id", is(notNullValue())) + .extract().path("id"); + + given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessInstances{ id, state, diagram, source, nodeDefinitions { name } } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(1)) + .body("data.ProcessInstances[0].id", is(id)) + .body("data.ProcessInstances[0].state", is("COMPLETED")) + .body("data.ProcessInstances[0].diagram", is(notNullValue())) + .body("data.ProcessInstances[0].source", is(notNullValue())) + .body("data.ProcessInstances[0].nodeDefinitions.size()", is(2)); + } + + @Test + void testGraphQLUI() { + given().contentType(ContentType.HTML) + .when().get("/q/graphql-ui/") + .then().statusCode(200) + .body("html.head.title", is("GraphiQL")); + } + +} diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/pom.xml similarity index 97% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/pom.xml rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/pom.xml index ba1140fbcd..c7d6caea4a 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/pom.xml @@ -7,8 +7,8 @@ kogito-addons-quarkus-data-index-inmemory-parent 1.40.1-SNAPSHOT - kogito-addons-quarkus-data-index-inmemory-integration-tests - Kogito Apps :: Kogito Addons Quarkus Data Index In-memory :: Integration Tests + kogito-addons-quarkus-data-index-inmemory-integration-tests-sw + Kogito Apps :: Kogito Addons Quarkus Data Index In-memory :: Integration Tests :: SW diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/src/main/resources/application.properties new file mode 100644 index 0000000000..b111c27b59 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/src/main/resources/application.properties @@ -0,0 +1 @@ +quarkus.kogito.data-index.graphql.ui.always-include=true \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/main/resources/greet.sw.json b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/src/main/resources/greet.sw.json similarity index 100% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/main/resources/greet.sw.json rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/src/main/resources/greet.sw.json diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java similarity index 95% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java index 7e1b165bf6..76e962a79b 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InMemoryQuarkusAddonDataIndexIT.java @@ -25,6 +25,7 @@ import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; @QuarkusIntegrationTest class InMemoryQuarkusAddonDataIndexIT { @@ -56,7 +57,7 @@ void testDataIndexAddon() { .body("data.ProcessInstances.size()", is(1)) .body("data.ProcessInstances[0].id", is(id)) .body("data.ProcessInstances[0].state", is("COMPLETED")) - .body("data.ProcessInstances[0].diagram", is(notNullValue())) + .body("data.ProcessInstances[0].diagram", is(nullValue())) .body("data.ProcessInstances[0].source", is(notNullValue())) .body("data.ProcessInstances[0].nodeDefinitions.size()", is(12)); } diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/main/resources/META-INF/processSVG/greet.svg b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/main/resources/META-INF/processSVG/greet.svg deleted file mode 100644 index 2398d96928..0000000000 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests/src/main/resources/META-INF/processSVG/greet.svg +++ /dev/null @@ -1 +0,0 @@ -StartEndChooseOnLanguageGreetInEnglishGreetInSpanishGreetPerson \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/pom.xml index a8111afe00..62d973d118 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/pom.xml @@ -15,7 +15,21 @@ deployment runtime - integration-tests + integration-tests-sw + + + default + + + !productized + + + + integration-tests-process + + + + diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/pom.xml new file mode 100644 index 0000000000..f9b1b7f4f0 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + + org.kie.kogito + kogito-addons-quarkus-data-index-mongodb-parent + 1.40.1-SNAPSHOT + + kogito-addons-quarkus-data-index-mongodb-integration-tests-process + Kogito Apps :: Kogito Addons Quarkus Data Index MongoDB :: Integration Tests :: Process + + + + org.kie.kogito + kogito-quarkus-processes + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + org.kie.kogito + kogito-addons-quarkus-persistence-mongodb + + + org.kie.kogito + kogito-addons-quarkus-data-index-mongodb + + + org.kie.kogito + kogito-addons-quarkus-process-svg + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.kie.kogito + kogito-addons-quarkus-data-index-mongodb-deployment + ${project.version} + pom + test + + + * + * + + + + + + + + io.quarkus + quarkus-maven-plugin + ${version.io.quarkus} + + + + build + + + + + + + + + native + + + native + + + + native + **/*IT.java + + + + diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg new file mode 100644 index 0000000000..716974fb87 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/main/resources/application.properties similarity index 100% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/main/resources/application.properties rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/main/resources/application.properties diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/main/resources/hello.bpmn b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/main/resources/hello.bpmn new file mode 100644 index 0000000000..939c411bbd --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/main/resources/hello.bpmn @@ -0,0 +1,47 @@ + + + + + + + + + _9FD38FF8-A530-41E7-8EA0-E1F71353CBB3 + + + _9FD38FF8-A530-41E7-8EA0-E1F71353CBB3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _hT2oIPJzEDuE8tm0q8uK_w + _hT2oIPJzEDuE8tm0q8uK_w + + \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java new file mode 100644 index 0000000000..ad93365b56 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java @@ -0,0 +1,71 @@ +/* + * Copyright 2023 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.kie.kogito.addons.quarkus.data.index.it; + +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; + +@QuarkusIntegrationTest +class MongoQuarkusAddonDataIndexIT { + + static { + RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); + } + + @Test + void testDataIndexAddon() { + given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessInstances{ id } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(0)); + + String id = given() + .contentType(ContentType.JSON) + .accept(ContentType.JSON) + .post("/hello") + .then() + .statusCode(201) + .body("id", is(notNullValue())) + .extract().path("id"); + + given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessInstances{ id, state, diagram, source, nodeDefinitions { name } } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(1)) + .body("data.ProcessInstances[0].id", is(id)) + .body("data.ProcessInstances[0].state", is("COMPLETED")) + .body("data.ProcessInstances[0].diagram", is(notNullValue())) + .body("data.ProcessInstances[0].source", is(notNullValue())) + .body("data.ProcessInstances[0].nodeDefinitions.size()", is(2)); + } + + @Test + void testGraphQLUI() { + given().contentType(ContentType.HTML) + .when().get("/q/graphql-ui/") + .then().statusCode(200) + .body("html.head.title", is("GraphiQL")); + } + +} diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/pom.xml similarity index 97% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/pom.xml rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/pom.xml index 78f87eadde..b5f29f9089 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/pom.xml @@ -7,8 +7,8 @@ kogito-addons-quarkus-data-index-mongodb-parent 1.40.1-SNAPSHOT - kogito-addons-quarkus-data-index-mongodb-integration-tests - Kogito Apps :: Kogito Addons Quarkus Data Index MongoDB :: Integration Tests + kogito-addons-quarkus-data-index-mongodb-integration-tests-sw + Kogito Apps :: Kogito Addons Quarkus Data Index MongoDB :: Integration Tests :: SW diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/src/main/resources/application.properties new file mode 100644 index 0000000000..8e215c2eed --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/src/main/resources/application.properties @@ -0,0 +1,5 @@ +kogito.persistence.type=mongodb + +quarkus.kogito.data-index.graphql.ui.always-include=true +# MongoDB +quarkus.mongodb.database=kogito \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/main/resources/greet.sw.json b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/src/main/resources/greet.sw.json similarity index 100% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/main/resources/greet.sw.json rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/src/main/resources/greet.sw.json diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java similarity index 95% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java index 8be600c288..2b30191cda 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexIT.java @@ -25,6 +25,7 @@ import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; @QuarkusIntegrationTest class MongoQuarkusAddonDataIndexIT { @@ -56,7 +57,7 @@ void testDataIndexAddon() { .body("data.ProcessInstances.size()", is(1)) .body("data.ProcessInstances[0].id", is(id)) .body("data.ProcessInstances[0].state", is("COMPLETED")) - .body("data.ProcessInstances[0].diagram", is(notNullValue())) + .body("data.ProcessInstances[0].diagram", is(nullValue())) .body("data.ProcessInstances[0].source", is(notNullValue())) .body("data.ProcessInstances[0].nodeDefinitions.size()", is(12)); } diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/main/resources/META-INF/processSVG/greet.svg b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/main/resources/META-INF/processSVG/greet.svg deleted file mode 100644 index 2398d96928..0000000000 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests/src/main/resources/META-INF/processSVG/greet.svg +++ /dev/null @@ -1 +0,0 @@ -StartEndChooseOnLanguageGreetInEnglishGreetInSpanishGreetPerson \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/pom.xml index 21c794954b..24042957a8 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/pom.xml @@ -15,7 +15,21 @@ deployment runtime - integration-tests + integration-tests-sw + + + default + + + !productized + + + + integration-tests-process + + + + diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/pom.xml new file mode 100644 index 0000000000..20cc8db847 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/pom.xml @@ -0,0 +1,100 @@ + + + 4.0.0 + + org.kie.kogito + kogito-addons-quarkus-data-index-postgresql-parent + 1.40.1-SNAPSHOT + + kogito-addons-quarkus-data-index-postgresql-integration-tests-process + Kogito Apps :: Kogito Addons Quarkus Data Index PostgreSQL :: Integration Tests :: Process + + + + org.kie.kogito + kogito-quarkus-processes + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + org.kie.kogito + kogito-addons-quarkus-data-index-postgresql + + + org.kie.kogito + kogito-addons-quarkus-persistence-jdbc + + + org.kie.kogito + kogito-addons-quarkus-process-svg + + + io.quarkus + quarkus-agroal + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.kie.kogito + kogito-addons-quarkus-data-index-postgresql-deployment + ${project.version} + pom + test + + + * + * + + + + + + + + io.quarkus + quarkus-maven-plugin + ${version.io.quarkus} + + + + build + + + + + + + + + native + + + native + + + + native + **/*IT.java + + + + diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg new file mode 100644 index 0000000000..716974fb87 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/META-INF/processSVG/hello.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/application.properties similarity index 100% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/main/resources/application.properties rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/application.properties diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/hello.bpmn b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/hello.bpmn new file mode 100644 index 0000000000..939c411bbd --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/hello.bpmn @@ -0,0 +1,47 @@ + + + + + + + + + _9FD38FF8-A530-41E7-8EA0-E1F71353CBB3 + + + _9FD38FF8-A530-41E7-8EA0-E1F71353CBB3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _hT2oIPJzEDuE8tm0q8uK_w + _hT2oIPJzEDuE8tm0q8uK_w + + \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java new file mode 100644 index 0000000000..1ff945d238 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java @@ -0,0 +1,73 @@ +/* + * Copyright 2023 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.kie.kogito.addons.quarkus.data.index.it; + +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; + +@QuarkusIntegrationTest +class PostgreSQLQuarkusAddonDataIndexIT { + + static { + RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); + } + + @Test + void testDataIndexAddon() { + given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessInstances{ id } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(greaterThanOrEqualTo(0))); + + String processInstanceId = given() + .contentType(ContentType.JSON) + .accept(ContentType.JSON) + .post("/hello") + .then() + .statusCode(201) + .body("id", is(notNullValue())) + .extract().path("id"); + + given().contentType(ContentType.JSON) + .body("{ \"query\" : \"{ProcessInstances(where: { id: {equal: \\\"" + processInstanceId + "\\\"}}){ id, state, diagram, source, nodeDefinitions { name } } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(1)) + .body("data.ProcessInstances[0].id", is(processInstanceId)) + .body("data.ProcessInstances[0].state", is("COMPLETED")) + .body("data.ProcessInstances[0].diagram", is(notNullValue())) + .body("data.ProcessInstances[0].source", is(notNullValue())) + .body("data.ProcessInstances[0].nodeDefinitions.size()", is(2)); + } + + @Test + void testGraphQLUI() { + given().contentType(ContentType.HTML) + .when().get("/q/graphql-ui/") + .then().statusCode(200) + .body("html.head.title", is("GraphiQL")); + } + +} diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/pom.xml similarity index 97% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/pom.xml rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/pom.xml index 5f1fd2382d..5b4a209646 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/pom.xml @@ -7,8 +7,8 @@ kogito-addons-quarkus-data-index-postgresql-parent 1.40.1-SNAPSHOT - kogito-addons-quarkus-data-index-postgresql-integration-tests - Kogito Apps :: Kogito Addons Quarkus Data Index PostgreSQL :: Integration Tests + kogito-addons-quarkus-data-index-postgresql-integration-tests-sw + Kogito Apps :: Kogito Addons Quarkus Data Index PostgreSQL :: Integration Tests :: SW diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/application.properties new file mode 100644 index 0000000000..115d80eed3 --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/application.properties @@ -0,0 +1,6 @@ +kogito.persistence.type=jdbc +quarkus.flyway.migrate-at-start=true + +quarkus.kogito.data-index.graphql.ui.always-include=true + +quarkus.datasource.db-kind=postgresql diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/main/resources/greet.sw.json b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/greet.sw.json similarity index 100% rename from data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/main/resources/greet.sw.json rename to data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/greet.sw.json diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java new file mode 100644 index 0000000000..6a6a24aebd --- /dev/null +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexIT.java @@ -0,0 +1,75 @@ +/* + * Copyright 2022 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.kie.kogito.addons.quarkus.data.index.it; + +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; + +@QuarkusIntegrationTest +class PostgreSQLQuarkusAddonDataIndexIT { + + static { + RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); + } + + @Test + void testDataIndexAddon() { + given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessInstances{ id } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(greaterThanOrEqualTo(0))); + + String processInstanceId = given() + .contentType(ContentType.JSON) + .accept(ContentType.JSON) + .body("{\"workflowdata\" : {\"name\" : \"John\", \"language\":\"English\"}}").when() + .post("/greet") + .then() + .statusCode(201) + .body("workflowdata.greeting", is("Hello from JSON Workflow,")) + .extract().path("id"); + + given().contentType(ContentType.JSON) + .body("{ \"query\" : \"{ProcessInstances(where: { id: {equal: \\\"" + processInstanceId + "\\\"}}){ id, state, diagram, source, nodeDefinitions { name } } }\" }") + .when().post("/graphql") + .then().statusCode(200) + .body("data.ProcessInstances.size()", is(1)) + .body("data.ProcessInstances[0].id", is(processInstanceId)) + .body("data.ProcessInstances[0].state", is("COMPLETED")) + .body("data.ProcessInstances[0].diagram", is(nullValue())) + .body("data.ProcessInstances[0].source", is(notNullValue())) + .body("data.ProcessInstances[0].nodeDefinitions.size()", is(12)); + } + + @Test + void testGraphQLUI() { + given().contentType(ContentType.HTML) + .when().get("/q/graphql-ui/") + .then().statusCode(200) + .body("html.head.title", is("GraphiQL")); + } + +} diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/main/resources/META-INF/processSVG/greet.svg b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/main/resources/META-INF/processSVG/greet.svg deleted file mode 100644 index 2398d96928..0000000000 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests/src/main/resources/META-INF/processSVG/greet.svg +++ /dev/null @@ -1 +0,0 @@ -StartEndChooseOnLanguageGreetInEnglishGreetInSpanishGreetPerson \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/pom.xml index 951b340eb1..420b0f435b 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/pom.xml @@ -15,7 +15,21 @@ deployment runtime - integration-tests + integration-tests-sw + + + default + + + !productized + + + + integration-tests-process + + + +