diff --git a/tests/shell/kogito-swf-builder/.vscode/launch.json b/tests/shell/kogito-swf-builder/.vscode/launch.json deleted file mode 100644 index f329b9513..000000000 --- a/tests/shell/kogito-swf-builder/.vscode/launch.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "RunTests-port-4004", - "request": "attach", - "hostName": "localhost", - "port": 4004 - }, - { - "type": "java", - "name": "Debug (Launch) - RunTests", - "request": "launch", - "mainClass": "RunTests", - "projectName": "RunTests" - } - ] -} diff --git a/tests/shell/kogito-swf-builder/.vscode/settings.json b/tests/shell/kogito-swf-builder/.vscode/settings.json deleted file mode 100644 index ca7dd1980..000000000 --- a/tests/shell/kogito-swf-builder/.vscode/settings.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "java.import.gradle.enabled": false, - "java.import.maven.enabled": false, - "java.eclipse.downloadSources": true, - "files.exclude": { - "bin/": true, - ".eclipse/": true, - ".project": true, - ".classpath": true, - "build.gradle": true - }, - "java.completion.importOrder": [ - "", - "javax", - "java", - "#" - ] -} \ No newline at end of file diff --git a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/.mvn/jvm.config b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/.mvn/jvm.config deleted file mode 100644 index df7809fac..000000000 --- a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/.mvn/jvm.config +++ /dev/null @@ -1 +0,0 @@ --Xms1024m \ No newline at end of file diff --git a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile deleted file mode 100644 index da41c621f..000000000 --- a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile +++ /dev/null @@ -1,59 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# - -ARG BUILDER_IMAGE_TAG="docker.io/apache/incubator-kie-sonataflow-builder:2.0" - -FROM ${BUILDER_IMAGE_TAG} AS builder - -# Kogito user -USER 1001 - -ARG QUARKUS_PACKAGE_TYPE="jar" -ARG SCRIPT_DEBUG="true" -ARG MAVEN_DOWNLOAD_OUTPUT="true" -ARG MAVEN_OFFLINE_MODE="true" - -# Copy from build context to resources directory -COPY --chown=1001 . ./resources - -# Build app with given resources -RUN "${KOGITO_HOME}"/launch/build-app.sh './resources' - -#============================= -# Runtime Run -#============================= -FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:latest - -ARG QUARKUS_LAUNCH_DEVMODE=false - -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' -# Default name is 'serverless-workflow-project' -ARG PROJECT_ARTIFACT_ID='serverless-workflow-project' - -# We make four distinct layers so if there are application changes the library layers can be re-used -COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/lib/ /deployments/lib/ -COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/*.jar /deployments/ -COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/app/ /deployments/app/ -COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/quarkus/ /deployments/quarkus/ - -EXPOSE 8080 -USER 185 -ENV AB_JOLOKIA_OFF="" -ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" -ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/greet.sw.json b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/greet.sw.json deleted file mode 100644 index 183e2101f..000000000 --- a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/greet.sw.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "id": "greeting", - "description": "Greeting example on k8s!", - "version": "0.0.1", - "start": { - "stateName": "ChooseOnLanguage" - }, - "dataInputSchema": { - "schema": "schemas/input.json", - "failOnValidationErrors": true - }, - "specVersion": "0.8", - "expressionLang": "jq", - "states": [ - { - "name": "ChooseOnLanguage", - "type": "switch", - "defaultCondition": { - "transition": { - "nextState": "GreetInEnglish" - } - }, - "dataConditions": [ - { - "condition": "${ .language == \"English\" }", - "transition": { - "nextState": "GreetInEnglish" - } - }, - { - "condition": "${ .language == \"Spanish\" }", - "transition": { - "nextState": "GreetInSpanish" - } - } - ] - }, - { - "name": "GreetInEnglish", - "type": "inject", - "transition": { - "nextState": "GreetPerson" - }, - "data": { - "greeting": "Hello from JSON Workflow, " - } - }, - { - "name": "GreetInSpanish", - "type": "inject", - "transition": { - "nextState": "GreetPerson" - }, - "data": { - "greeting": "Saludos desde JSON Workflow, " - } - }, - { - "name": "GreetPerson", - "type": "operation", - "end": { - "terminate": true - }, - "actionMode": "sequential", - "actions": [ - { - "name": "greetAction", - "functionRef": { - "refName": "greetFunction", - "arguments": { - "message": ".greeting+.name" - }, - "invoke": "sync" - }, - "actionDataFilter": { - "useResults": true - } - } - ] - } - ], - "functions": [ - { - "name": "greetFunction", - "operation": "sysout", - "type": "custom" - } - ] -} \ No newline at end of file diff --git a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/schemas/input.json b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/schemas/input.json deleted file mode 100644 index 1874fd25b..000000000 --- a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/schemas/input.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "properties": { - "language": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "language", - "name" - ] -} \ No newline at end of file diff --git a/tests/shell/kogito-swf-builder/resources/greet/.mvn/jvm.config b/tests/shell/kogito-swf-builder/resources/greet/.mvn/jvm.config deleted file mode 100644 index df7809fac..000000000 --- a/tests/shell/kogito-swf-builder/resources/greet/.mvn/jvm.config +++ /dev/null @@ -1 +0,0 @@ --Xms1024m \ No newline at end of file diff --git a/tests/shell/kogito-swf-builder/resources/greet/Dockerfile b/tests/shell/kogito-swf-builder/resources/greet/Dockerfile deleted file mode 100644 index da41c621f..000000000 --- a/tests/shell/kogito-swf-builder/resources/greet/Dockerfile +++ /dev/null @@ -1,59 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# - -ARG BUILDER_IMAGE_TAG="docker.io/apache/incubator-kie-sonataflow-builder:2.0" - -FROM ${BUILDER_IMAGE_TAG} AS builder - -# Kogito user -USER 1001 - -ARG QUARKUS_PACKAGE_TYPE="jar" -ARG SCRIPT_DEBUG="true" -ARG MAVEN_DOWNLOAD_OUTPUT="true" -ARG MAVEN_OFFLINE_MODE="true" - -# Copy from build context to resources directory -COPY --chown=1001 . ./resources - -# Build app with given resources -RUN "${KOGITO_HOME}"/launch/build-app.sh './resources' - -#============================= -# Runtime Run -#============================= -FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:latest - -ARG QUARKUS_LAUNCH_DEVMODE=false - -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' -# Default name is 'serverless-workflow-project' -ARG PROJECT_ARTIFACT_ID='serverless-workflow-project' - -# We make four distinct layers so if there are application changes the library layers can be re-used -COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/lib/ /deployments/lib/ -COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/*.jar /deployments/ -COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/app/ /deployments/app/ -COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/quarkus/ /deployments/quarkus/ - -EXPOSE 8080 -USER 185 -ENV AB_JOLOKIA_OFF="" -ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" -ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/tests/shell/kogito-swf-builder/resources/greet/greet.sw.json b/tests/shell/kogito-swf-builder/resources/greet/greet.sw.json deleted file mode 100644 index a619b3b8b..000000000 --- a/tests/shell/kogito-swf-builder/resources/greet/greet.sw.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "id": "jsongreet", - "version": "1.0", - "name": "Greeting workflow", - "description": "JSON based greeting workflow", - "start": "ChooseOnLanguage", - "functions": [ - { - "name": "greetFunction", - "type": "custom", - "operation": "sysout" - } - ], - "states": [ - { - "name": "ChooseOnLanguage", - "type": "switch", - "dataConditions": [ - { - "condition": "${ .language == \"English\" }", - "transition": "GreetInEnglish" - }, - { - "condition": "${ .language == \"Spanish\" }", - "transition": "GreetInSpanish" - } - ], - "defaultCondition": { - "transition": "GreetInEnglish" - } - }, - { - "name": "GreetInEnglish", - "type": "inject", - "data": { - "greeting": "Hello from JSON Workflow, " - }, - "transition": "GreetPerson" - }, - { - "name": "GreetInSpanish", - "type": "inject", - "data": { - "greeting": "Saludos desde JSON Workflow, " - }, - "transition": "GreetPerson" - }, - { - "name": "GreetPerson", - "type": "operation", - "actions": [ - { - "name": "greetAction", - "functionRef": { - "refName": "greetFunction", - "arguments": { - "message": ".greeting+.name" - } - } - } - ], - "end": { - "terminate": true - } - } - ] -} diff --git a/tests/shell/kogito-swf-builder/src/RunTests.java b/tests/shell/kogito-swf-builder/src/RunTests.java deleted file mode 100644 index 2ec43afad..000000000 --- a/tests/shell/kogito-swf-builder/src/RunTests.java +++ /dev/null @@ -1,140 +0,0 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? - -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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. - -//DEPS org.slf4j:slf4j-simple:2.0.9 - -// Junit console to start the test engine: -//DEPS org.junit.platform:junit-platform-console:1.10.1 - -// engine to run the tests (tests are written with Junit5): -//DEPS org.junit.jupiter:junit-jupiter-engine:5.10.1 - -// testcontainers -//DEPS org.testcontainers:testcontainers:1.19.3 -//DEPS org.testcontainers:junit-jupiter:1.19.3 - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.net.http.HttpResponse.BodyHandlers; -import java.nio.file.Paths; -import java.time.Duration; -import org.junit.jupiter.api.Test; -import org.junit.platform.console.ConsoleLauncher; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.output.Slf4jLogConsumer; -import org.testcontainers.containers.wait.strategy.Wait; -import org.testcontainers.images.builder.ImageFromDockerfile; -import org.testcontainers.junit.jupiter.Container; -import org.testcontainers.junit.jupiter.Testcontainers; - -@Testcontainers -public class RunTests { - - private static Logger LOGGER = LoggerFactory.getLogger(RunTests.class); - - private Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(LOGGER); - - @Container - private GenericContainer greetBuiltImage = new GenericContainer( - new ImageFromDockerfile( - "dev.local/jbang-test/swf-test:" + Math.round(Math.random() * 1000000.00)) - .withDockerfile(Paths.get(getScriptDirPath(), "resources/greet", "Dockerfile")) - .withBuildArg("BUILDER_IMAGE_TAG", getTestImage())) - .withExposedPorts(8080) - .withEnv("KOGITO_SERVICE_URL", "http://localhost:8080") - .waitingFor(Wait.forHttp("/jsongreet")) - .withLogConsumer(logConsumer); - - @Test - public void testBuiltContainerAnswerCorrectly() throws URISyntaxException, IOException, InterruptedException { - greetBuiltImage.start(); - HttpRequest request = HttpRequest.newBuilder() - .uri(new URI("http://" + greetBuiltImage.getHost() + ":" - + greetBuiltImage.getFirstMappedPort() + "/jsongreet")) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .timeout(Duration.ofSeconds(10)) - .POST(HttpRequest.BodyPublishers - .ofString("{\"workflowdata\" : {\"name\": \"John\", \"language\": \"English\"}}")) - .build(); - HttpResponse response = HttpClient.newHttpClient().send(request, BodyHandlers.ofString()); - assertEquals(201, response.statusCode()); - greetBuiltImage.stop(); - } - - @Container - private GenericContainer greetWithInputSchemaBuiltImage = new GenericContainer( - new ImageFromDockerfile( - "dev.local/jbang-test/swf-test:" + Math.round(Math.random() * 1000000.00)) - .withDockerfile(Paths.get(getScriptDirPath(), - "resources/greet-with-inputschema", "Dockerfile")) - .withBuildArg("BUILDER_IMAGE_TAG", getTestImage())) - .withExposedPorts(8080) - .withEnv("KOGITO_SERVICE_URL", "http://localhost:8080") - .waitingFor(Wait.forHttp("/greeting")) - .withLogConsumer(logConsumer); - - @Test - public void testBuiltContainerWithInputSchemaAnswerCorrectly() - throws URISyntaxException, IOException, InterruptedException { - greetWithInputSchemaBuiltImage.start(); - HttpRequest request = HttpRequest.newBuilder() - .uri(new URI("http://" + greetWithInputSchemaBuiltImage.getHost() + ":" - + greetWithInputSchemaBuiltImage.getFirstMappedPort() + "/greeting")) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .timeout(Duration.ofSeconds(10)) - .POST(HttpRequest.BodyPublishers - .ofString("{\"name\": \"John\", \"language\": \"English\"}")) - .build(); - HttpResponse response = HttpClient.newHttpClient().send(request, BodyHandlers.ofString()); - assertEquals(201, response.statusCode()); - greetWithInputSchemaBuiltImage.stop(); - } - - public static void main(String... args) throws Exception { - // Log docker build. Source: - // https://github.com/testcontainers/testcontainers-java/issues/3093 - System.setProperty( - "org.slf4j.simpleLogger.log.com.github.dockerjava.api.command.BuildImageResultCallback", - "debug"); - ConsoleLauncher.main("--select-class=" + RunTests.class.getName(), - "--reports-dir=" + Paths.get(getOutputDir()).toString()); - } - - static String getTestImage() { - return System.getenv("TEST_IMAGE"); - } - - static String getOutputDir() { - return System.getenv("OUTPUT_DIR"); - } - - static String getScriptDirPath() { - return System.getenv("TESTS_SCRIPT_DIR_PATH"); - } -} \ No newline at end of file diff --git a/tests/shell/kogito-swf-devmode/.vscode/launch.json b/tests/shell/kogito-swf-devmode/.vscode/launch.json deleted file mode 100644 index f329b9513..000000000 --- a/tests/shell/kogito-swf-devmode/.vscode/launch.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "RunTests-port-4004", - "request": "attach", - "hostName": "localhost", - "port": 4004 - }, - { - "type": "java", - "name": "Debug (Launch) - RunTests", - "request": "launch", - "mainClass": "RunTests", - "projectName": "RunTests" - } - ] -} diff --git a/tests/shell/kogito-swf-devmode/.vscode/settings.json b/tests/shell/kogito-swf-devmode/.vscode/settings.json deleted file mode 100644 index ca7dd1980..000000000 --- a/tests/shell/kogito-swf-devmode/.vscode/settings.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "java.import.gradle.enabled": false, - "java.import.maven.enabled": false, - "java.eclipse.downloadSources": true, - "files.exclude": { - "bin/": true, - ".eclipse/": true, - ".project": true, - ".classpath": true, - "build.gradle": true - }, - "java.completion.importOrder": [ - "", - "javax", - "java", - "#" - ] -} \ No newline at end of file diff --git a/tests/shell/kogito-swf-devmode/resources/greet.sw.json b/tests/shell/kogito-swf-devmode/resources/greet.sw.json deleted file mode 100644 index a619b3b8b..000000000 --- a/tests/shell/kogito-swf-devmode/resources/greet.sw.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "id": "jsongreet", - "version": "1.0", - "name": "Greeting workflow", - "description": "JSON based greeting workflow", - "start": "ChooseOnLanguage", - "functions": [ - { - "name": "greetFunction", - "type": "custom", - "operation": "sysout" - } - ], - "states": [ - { - "name": "ChooseOnLanguage", - "type": "switch", - "dataConditions": [ - { - "condition": "${ .language == \"English\" }", - "transition": "GreetInEnglish" - }, - { - "condition": "${ .language == \"Spanish\" }", - "transition": "GreetInSpanish" - } - ], - "defaultCondition": { - "transition": "GreetInEnglish" - } - }, - { - "name": "GreetInEnglish", - "type": "inject", - "data": { - "greeting": "Hello from JSON Workflow, " - }, - "transition": "GreetPerson" - }, - { - "name": "GreetInSpanish", - "type": "inject", - "data": { - "greeting": "Saludos desde JSON Workflow, " - }, - "transition": "GreetPerson" - }, - { - "name": "GreetPerson", - "type": "operation", - "actions": [ - { - "name": "greetAction", - "functionRef": { - "refName": "greetFunction", - "arguments": { - "message": ".greeting+.name" - } - } - } - ], - "end": { - "terminate": true - } - } - ] -} diff --git a/tests/shell/kogito-swf-devmode/src/RunTests.java b/tests/shell/kogito-swf-devmode/src/RunTests.java deleted file mode 100644 index 893c445df..000000000 --- a/tests/shell/kogito-swf-devmode/src/RunTests.java +++ /dev/null @@ -1,103 +0,0 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? - -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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. - -//DEPS org.slf4j:slf4j-simple:2.0.9 - -// Junit console to start the test engine: -//DEPS org.junit.platform:junit-platform-console:1.10.1 - -// engine to run the tests (tests are written with Junit5): -//DEPS org.junit.jupiter:junit-jupiter-engine:5.10.1 - -// testcontainers -//DEPS org.testcontainers:testcontainers:1.19.3 -//DEPS org.testcontainers:junit-jupiter:1.19.3 - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.net.http.HttpResponse.BodyHandlers; -import java.nio.file.Paths; -import java.time.Duration; -import org.junit.jupiter.api.Test; -import org.junit.platform.console.ConsoleLauncher; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testcontainers.containers.BindMode; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.output.Slf4jLogConsumer; -import org.testcontainers.containers.wait.strategy.Wait; -import org.testcontainers.junit.jupiter.Container; -import org.testcontainers.junit.jupiter.Testcontainers; - -@Testcontainers -public class RunTests { - - private static Logger LOGGER = LoggerFactory.getLogger(RunTests.class); - - private Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(LOGGER); - - @Container - private GenericContainer devModeImage = new GenericContainer(getTestImage()) - .withEnv("MAVEN_ARGS_APPEND", "-Ddebug=false -Dquarkus.devservices.enabled=false") - .withFileSystemBind(getScriptDirPath() + "/resources", - "/home/kogito/serverless-workflow-project/src/main/resources", BindMode.READ_ONLY) - .withExposedPorts(8080) - .waitingFor(Wait.forHttp("/jsongreet")) - .withStartupTimeout(Duration.ofMinutes(2)) - .withLogConsumer(logConsumer); - - @Test - public void testBuiltContainerAnswerCorrectly() throws URISyntaxException, IOException, InterruptedException { - devModeImage.start(); - HttpRequest request = HttpRequest.newBuilder() - .uri(new URI( - "http://" + devModeImage.getHost() + ":" + devModeImage.getFirstMappedPort() + "/jsongreet")) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .timeout(Duration.ofSeconds(10)) - .POST(HttpRequest.BodyPublishers - .ofString("{\"workflowdata\" : {\"name\": \"John\", \"language\": \"English\"}}")) - .build(); - HttpResponse response = HttpClient.newHttpClient().send(request, BodyHandlers.ofString()); - assertEquals(201, response.statusCode()); - } - - public static void main(String... args) throws Exception { - ConsoleLauncher.main("--select-class=" + RunTests.class.getName(), - "--reports-dir=" + Paths.get(getOutputDir()).toString()); - } - - static String getTestImage() { - return System.getenv("TEST_IMAGE"); - } - - static String getOutputDir() { - return System.getenv("OUTPUT_DIR"); - } - - static String getScriptDirPath() { - return System.getenv("TESTS_SCRIPT_DIR_PATH"); - } -} \ No newline at end of file