diff --git a/pom.xml b/pom.xml
index 243191c484..8c32cacf3a 100755
--- a/pom.xml
+++ b/pom.xml
@@ -51,12 +51,16 @@
10.1.5.Final
2.2.3.Final
+ quay.io/infinispan/server:${container.image.infinispan.version}
+ 10.1.5.Final
1.12.4
2.4.0
2.1.0
2.22.0
2.8.2
+
+ 0.33.0
@@ -187,6 +191,11 @@
+
+ io.fabric8
+ docker-maven-plugin
+ ${version.docker.plugin}
+
io.quarkus
quarkus-maven-plugin
diff --git a/process-infinispan-persistence-quarkus/pom.xml b/process-infinispan-persistence-quarkus/pom.xml
index a4a4f57347..b8f1a1b5bd 100644
--- a/process-infinispan-persistence-quarkus/pom.xml
+++ b/process-infinispan-persistence-quarkus/pom.xml
@@ -1,8 +1,8 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0">
4.0.0
@@ -16,9 +16,6 @@
Kogito Examples :: Process Infinispan Persistence Quarkus
Process with Infinispan persistence - Quarkus
-
-
-
@@ -47,7 +44,6 @@
io.quarkus
quarkus-smallrye-openapi
-
org.kie.kogito
infinispan-persistence-addon
@@ -62,11 +58,57 @@
rest-assured
test
-
${project.artifactId}
+
+ io.fabric8
+ docker-maven-plugin
+
+
+
+ ${container.image.infinispan}
+ infinispan
+
+
+ 11222:11222
+
+
+ admin
+ admin
+
+
+ Infinispan:
+ default
+ cyan
+
+
+ .*started.*
+
+
+
+
+
+
+
+
+ docker-start
+ pre-integration-test
+
+ stop
+ start
+
+
+
+ docker-stop
+ post-integration-test
+
+ stop
+
+
+
+
io.quarkus
quarkus-maven-plugin
@@ -86,6 +128,22 @@
+
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+ org.jboss.logmanager.LogManager
+
+
+
diff --git a/process-infinispan-persistence-quarkus/src/test/java/org/acme/deals/DealsRestIT.java b/process-infinispan-persistence-quarkus/src/test/java/org/acme/deals/DealsRestIT.java
new file mode 100644
index 0000000000..38787b0366
--- /dev/null
+++ b/process-infinispan-persistence-quarkus/src/test/java/org/acme/deals/DealsRestIT.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2020 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.acme.deals;
+
+import java.util.Map;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@QuarkusTest
+public class DealsRestIT {
+
+ @Test
+ public void testDealsRest() {
+ // test adding new deal
+ String addDealPayload = "{\"name\" : \"my fancy deal\", \"traveller\" : { \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"email\" : \"jon.doe@example.com\", \"nationality\" : \"American\",\"address\" : { \"street\" : \"main street\", \"city\" : \"Boston\", \"zipCode\" : \"10005\", \"country\" : \"US\" }}}";
+ String dealId = given().contentType(ContentType.JSON).accept(ContentType.JSON).body(addDealPayload)
+ .when().post("/deals")
+ .then().log().ifValidationFails().statusCode(200).body("id", notNullValue()).extract().path("id");
+
+ // test getting the created deal
+ given().accept(ContentType.JSON)
+ .when().get("/deals")
+ .then().log().ifValidationFails().statusCode(200).body("$.size()", is(1), "[0].id", is(dealId));
+
+ // test getting order by id
+ given().accept(ContentType.JSON)
+ .when().get("/deals/" + dealId)
+ .then().log().ifValidationFails().statusCode(200).body("id", is(dealId));
+
+ // get deals for review
+ String dealReviewId = given().accept(ContentType.JSON)
+ .when().get("/dealreviews")
+ .then().log().ifValidationFails().statusCode(200).body("$.size()", is(1)).body("[0].id", notNullValue()).extract().path("[0].id");
+
+ // get task for john
+ Map tasks = given().accept(ContentType.JSON)
+ .when().get("/dealreviews/{uuid}/tasks?user=john", dealReviewId)
+ .then().log().ifValidationFails().statusCode(200).extract().as(Map.class);
+ assertNotNull(tasks);
+ assertEquals(1, tasks.size());
+
+ // complete review task
+ given().contentType(ContentType.JSON).accept(ContentType.JSON).body("{\"review\" : \"very good work\"}")
+ .when().post("/dealreviews/{uuid}/review/{tuuid}?user=john", dealReviewId, tasks.keySet().iterator().next())
+ .then().log().ifValidationFails().statusCode(200);
+
+ //verify no deals to review
+ given().accept(ContentType.JSON)
+ .when().get("/dealreviews")
+ .then().log().ifValidationFails().statusCode(200).body("$.size()", is(0));
+
+ //verify no deals
+ given().accept(ContentType.JSON)
+ .when().get("/deals")
+ .then().log().ifValidationFails().statusCode(200).body("$.size()", is(0));
+ }
+}
\ No newline at end of file
diff --git a/process-infinispan-persistence-quarkus/src/test/resources/application.properties b/process-infinispan-persistence-quarkus/src/test/resources/application.properties
new file mode 100644
index 0000000000..03b05663ee
--- /dev/null
+++ b/process-infinispan-persistence-quarkus/src/test/resources/application.properties
@@ -0,0 +1,4 @@
+# Infinispan
+quarkus.infinispan-client.use-auth=true
+quarkus.infinispan-client.auth-username=admin
+quarkus.infinispan-client.auth-password=admin
\ No newline at end of file
diff --git a/process-infinispan-persistence-springboot/pom.xml b/process-infinispan-persistence-springboot/pom.xml
index ffbf016d4a..c7accf63ae 100644
--- a/process-infinispan-persistence-springboot/pom.xml
+++ b/process-infinispan-persistence-springboot/pom.xml
@@ -1,7 +1,7 @@
-
+
4.0.0
org.kie.kogito
@@ -64,8 +64,8 @@
- org.springframework.boot
- spring-boot-starter-test
+ io.rest-assured
+ rest-assured
test
@@ -73,16 +73,87 @@
${project.artifactId}
+
+ io.fabric8
+ docker-maven-plugin
+
+
+
+ ${container.image.infinispan}
+ infinispan
+
+
+ 11222:11222
+
+
+ admin
+ admin
+
+
+ Infinispan:
+ default
+ cyan
+
+
+ .*started.*
+
+
+
+
+
+
+
+
+ docker-start
+ pre-integration-test
+
+ stop
+ start
+
+
+
+ docker-stop
+ post-integration-test
+
+ stop
+
+
+
+
org.springframework.boot
spring-boot-maven-plugin
${springboot.version}
+ repackage
repackage
+
+ pre-integration-test
+
+ start
+
+
+
+ --infinispan.remote.use-auth=true
+ --infinispan.remote.auth-username=admin
+ --infinispan.remote.auth-password=admin
+ --infinispan.remote.sasl-mechanism=DIGEST-MD5
+
+
+ it
+
+
+
+
+ post-integration-test
+
+ stop
+
+
@@ -118,6 +189,17 @@
+
+ maven-failsafe-plugin
+
+
+
+ integration-test
+ verify
+
+
+
+
diff --git a/process-infinispan-persistence-springboot/src/main/java/org/kie/kogito/tests/KogitoApplication.java b/process-infinispan-persistence-springboot/src/main/java/org/kie/kogito/tests/KogitoApplication.java
new file mode 100644
index 0000000000..606a32ab9e
--- /dev/null
+++ b/process-infinispan-persistence-springboot/src/main/java/org/kie/kogito/tests/KogitoApplication.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2020 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.tests;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = {"org.kie.kogito.**", "org.acme.deals.**"})
+public class KogitoApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(KogitoApplication.class, args);
+ }
+}
diff --git a/process-infinispan-persistence-springboot/src/main/java/org/kie/kogito/tests/KogitoInfinispanSpringbootApplication.java b/process-infinispan-persistence-springboot/src/main/java/org/kie/kogito/tests/KogitoInfinispanSpringbootApplication.java
deleted file mode 100644
index ac39b5bc93..0000000000
--- a/process-infinispan-persistence-springboot/src/main/java/org/kie/kogito/tests/KogitoInfinispanSpringbootApplication.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.kie.kogito.tests;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication(scanBasePackages={"org.kie.kogito.**","org.acme.deals.**"})
-public class KogitoInfinispanSpringbootApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(KogitoInfinispanSpringbootApplication.class, args);
- }
-
-
-}
diff --git a/process-infinispan-persistence-springboot/src/test/java/org/kie/kogito/tests/DealsRestIT.java b/process-infinispan-persistence-springboot/src/test/java/org/kie/kogito/tests/DealsRestIT.java
new file mode 100644
index 0000000000..44a95d6462
--- /dev/null
+++ b/process-infinispan-persistence-springboot/src/test/java/org/kie/kogito/tests/DealsRestIT.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2020 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.tests;
+
+import java.util.Map;
+
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+public class DealsRestIT {
+
+ @BeforeAll
+ public static void setup() {
+ RestAssured.port = 8080;
+ }
+
+ @Test
+ public void testDealsRest() {
+ // test adding new deal
+ String addDealPayload = "{\"name\" : \"my fancy deal\", \"traveller\" : { \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"email\" : \"jon.doe@example.com\", \"nationality\" : \"American\",\"address\" : { \"street\" : \"main street\", \"city\" : \"Boston\", \"zipCode\" : \"10005\", \"country\" : \"US\" }}}";
+ String dealId = given().contentType(ContentType.JSON).accept(ContentType.JSON).body(addDealPayload)
+ .when().post("/deals")
+ .then().log().ifValidationFails().statusCode(200).body("id", notNullValue()).extract().path("id");
+
+ // test getting the created deal
+ given().accept(ContentType.JSON)
+ .when().get("/deals")
+ .then().log().ifValidationFails().statusCode(200).body("$.size()", is(1), "[0].id", is(dealId));
+
+ // test getting order by id
+ given().accept(ContentType.JSON)
+ .when().get("/deals/" + dealId)
+ .then().log().ifValidationFails().statusCode(200).body("id", is(dealId));
+
+ // get deals for review
+ String dealReviewId = given().accept(ContentType.JSON)
+ .when().get("/dealreviews")
+ .then().log().ifValidationFails().statusCode(200).body("$.size()", is(1)).body("[0].id", notNullValue()).extract().path("[0].id");
+
+ // get task for john
+ Map tasks = given().accept(ContentType.JSON)
+ .when().get("/dealreviews/{uuid}/tasks?user=john", dealReviewId)
+ .then().log().ifValidationFails().statusCode(200).extract().as(Map.class);
+ assertNotNull(tasks);
+ assertEquals(1, tasks.size());
+
+ // complete review task
+ given().contentType(ContentType.JSON).accept(ContentType.JSON).body("{\"review\" : \"very good work\"}")
+ .when().post("/dealreviews/{uuid}/review/{tuuid}?user=john", dealReviewId, tasks.keySet().iterator().next())
+ .then().log().ifValidationFails().statusCode(200);
+
+ //verify no deals to review
+ given().accept(ContentType.JSON)
+ .when().get("/dealreviews")
+ .then().log().ifValidationFails().statusCode(200).body("$.size()", is(0));
+
+ //verify no deals
+ given().accept(ContentType.JSON)
+ .when().get("/deals")
+ .then().log().ifValidationFails().statusCode(200).body("$.size()", is(0));
+ }
+}
\ No newline at end of file