-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KOGITO-9763] Add integration test for management addon
- Loading branch information
Showing
7 changed files
with
183 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
quarkus/addons/process-management/integration-tests/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>kogito-addons-quarkus-process-management-parent</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>kogito-addons-quarkus-process-management-integration-tests</artifactId> | ||
<name>Kogito:: Addons :: Quarkus:: Process Management :: Integration Test</name> | ||
<description>Process Management addon testing Testing</description> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>kogito-quarkus-serverless-workflow</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>kogito-addons-quarkus-process-management</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-jackson</artifactId> | ||
</dependency> | ||
<!-- hack for CI to work --> | ||
<dependency> | ||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>kogito-quarkus-serverless-workflow-deployment</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>native</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<properties> | ||
<quarkus.package.type>native</quarkus.package.type> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</project> |
2 changes: 2 additions & 0 deletions
2
...kus/addons/process-management/integration-tests/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
quarkus.devservices.enabled=false | ||
quarkus.http.test-port=0 |
36 changes: 36 additions & 0 deletions
36
quarkus/addons/process-management/integration-tests/src/main/resources/parallel.sw.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"id": "parallel", | ||
"version": "1.0", | ||
"name": "Welcome to the Parallel dimension", | ||
"description": "Testing parallelism", | ||
"start": "Parallel", | ||
"functions": [ | ||
{ | ||
"name": "concatA", | ||
"type": "expression", | ||
"operation": ".result|=.+\"A\"" | ||
}, | ||
{ | ||
"name": "concatB", | ||
"type": "expression", | ||
"operation": ".result|=.+\"B\"" | ||
}, | ||
{ | ||
"name": "concatC", | ||
"type": "expression", | ||
"operation": ".result|=.+\"C\"" | ||
} | ||
], | ||
"states":[ | ||
{ | ||
"name":"Parallel", | ||
"type":"parallel", | ||
"branches": [ {"name": "branch1", "actions": [{"name": "action1","functionRef":"concatA"}] }, {"name": "branch2","actions": [{"name": "action2", "functionRef":"concatB"}] },{"name": "branch3","actions": [{"name":"action3","functionRef":"concatC"}] }], | ||
"numCompleted" : ".numCompleted", | ||
"completionType" : "atLeast", | ||
"end": { | ||
"terminate": true | ||
} | ||
} | ||
] | ||
} |
42 changes: 42 additions & 0 deletions
42
...nt/integration-tests/src/test/java/org/kie/kogito/quarkus/workflows/ManagementFlowIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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.quarkus.workflows; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.kie.kogito.serverless.workflow.SWFConstants; | ||
|
||
import io.quarkus.test.junit.QuarkusIntegrationTest; | ||
import io.restassured.common.mapper.TypeRef; | ||
import io.restassured.http.ContentType; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@QuarkusIntegrationTest | ||
class ManagementFlowIT { | ||
|
||
@Test | ||
void testManagementAPI() { | ||
assertThat(given().contentType(ContentType.JSON).accept(ContentType.JSON).get("management/processes/parallel/nodes") | ||
.then().statusCode(200).extract().as(new TypeRef<List<Map<String, Object>>>() { | ||
}).stream().map(m -> (Map<String, Object>) m.get("metadata")).filter(m -> m.containsKey(SWFConstants.STATE_NAME) && m.containsKey(SWFConstants.ACTION_NAME) | ||
&& m.containsKey(SWFConstants.BRANCH_NAME)) | ||
.count()).isGreaterThanOrEqualTo(3); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters