Skip to content

Commit

Permalink
[KOGITO-8961][KSW-Operator] Split use case and test examples
Browse files Browse the repository at this point in the history
Signed-off-by: desmax74 <mdessi@redhat.com>
  • Loading branch information
desmax74 committed Jun 5, 2023
1 parent 2b67a98 commit cbf8e6e
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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.

FROM quay.io/kiegroup/kogito-swf-builder-nightly:latest AS builder

# Kogito User
USER 1001

# User home from base image
WORKDIR /home/kogito/kogito-base

# Copy from build context to skeleton resources project
COPY * ./src/main/resources/

# Maven vars enhirited from the base image
RUN ${MAVEN_HOME}/bin/mvn -U -B ${MAVEN_ARGS_APPEND} -s ${MAVEN_SETTINGS_PATH} clean install -DskipTests

#=============================
# Runtime Run
#=============================
FROM registry.access.redhat.com/ubi8/openjdk-11:1.11

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

# 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/kogito-base/target/quarkus-app/lib/ /deployments/lib/
COPY --from=builder --chown=185 /home/kogito/kogito-base/target/quarkus-app/*.jar /deployments/
COPY --from=builder --chown=185 /home/kogito/kogito-base/target/quarkus-app/app/ /deployments/app/
COPY --from=builder --chown=185 /home/kogito/kogito-base/target/quarkus-app/quarkus/ /deployments/quarkus/

EXPOSE 8080
USER 185
ENV AB_JOLOKIA_OFF=""
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
67 changes: 67 additions & 0 deletions test/builder/greetings.sw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"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
}
}
]
}

0 comments on commit cbf8e6e

Please sign in to comment.