Skip to content

Commit

Permalink
feat(example): Create example/demo module
Browse files Browse the repository at this point in the history
  • Loading branch information
boddissattva authored Aug 8, 2024
1 parent 941ea43 commit c1b793a
Show file tree
Hide file tree
Showing 1,386 changed files with 3,901 additions and 1,674 deletions.
1 change: 0 additions & 1 deletion .github/actions/build-chutney/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,3 @@ runs:
path: ${{inputs.cache-artifacts}}
retention-days: 1
overwrite: true

8 changes: 4 additions & 4 deletions .github/actions/build-dsl/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: 'build all projects'
description: 'build all projects sequentially'
name: 'build dsl'
description: 'build dsl'
inputs:
goals:
default: "clean build :chutney-kotlin-dsl:publishToMavenLocal"
default: "clean build publishToMavenLocal"
description: "Gradle goals to execute"
cache-artifacts:
default: ""
Expand All @@ -18,7 +18,7 @@ runs:
run: |
cd ./kotlin-dsl
echo "Running: ${{inputs.goals}}"
./gradlew ${{inputs.goals}} :chutney-kotlin-dsl:publishToMavenLocal
./gradlew ${{inputs.goals}} publishToMavenLocal
cd ..
- name: Temporarily cache jar artifacts
Expand Down
31 changes: 31 additions & 0 deletions .github/actions/build-example/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'build example'
description: 'build example'
inputs:
goals:
default: "clean install -V -B"
description: "Maven goals to execute"
cache-artifacts:
default: ""
description: "path of artifacts to be cached"

runs:
using: "composite"
steps:
- uses: actions/checkout@v4

- name: Build Example
shell: bash
run: |
cd ./example
echo "Running: ${{inputs.goals}}"
mvn ${{inputs.goals}}
cd ..
- name: Temporarily cache jar artifacts
if: inputs.cache-artifacts != ''
uses: actions/upload-artifact@v4
with:
name: plugin-artifacts
path: ${{inputs.cache-artifacts}}
retention-days: 1
overwrite: true
4 changes: 2 additions & 2 deletions .github/actions/build-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'build all projects'
description: 'build all projects sequentially'
name: 'build plugin'
description: 'build plugin'
inputs:
goals:
default: "clean buildPlugin"
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build-all-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ jobs:
goals: ${{steps.dsl-goals.outputs.DSL_GOALS}}
cache-artifacts: ${{ inputs.cache-artifacts }}

- name: Build Example
if: ${{! inputs.release}}
id: build-example
uses: ./.github/actions/build-example
with:
goals: ${{steps.chutney-goals.outputs.CHUTNEY_GOALS}}
cache-artifacts: ${{ inputs.cache-artifacts }}

- name: Resolve plugin gradle goal from inputs
if: ${{! inputs.release}}
id: plugin-goals
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/release-docker-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,14 @@ jobs:
WEBSITE=artifacts/chutney/ui/dist
CONF=chutney/.docker/ui
- name: Build and push demo docker image
uses: docker/build-push-action@v2
with:
context: ${{ github.workspace }}
file: ${{ github.workspace }}/example/.docker/demo/Dockerfile
tags: |
ghcr.io/chutney-testing/chutney/chutney-demo:latest
ghcr.io/chutney-testing/chutney/chutney-demo:${{ inputs.version }}
push: true
build-args: |
CONF=example/.docker/demo
19 changes: 12 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ It is forbidden to use _wildcard imports_ (e.g., `import static org.assertj.core

### Javadoc

* Javadoc comments should be wrapped after 80 characters whenever possible.
* Javadoc's comments should be wrapped after 80 characters whenever possible.
* This first paragraph must be a single, concise sentence that ends with a period (".").
* Place `<p>` on the same line as the first line in a new paragraph and precede `<p>` with a blank line.
* Insert a blank line before at-clauses/tags.
Expand Down Expand Up @@ -333,8 +333,9 @@ git switch -c release/<RELEASE_VERSION>
git add CHANGELOG.md (see Update Changelog file section)
Update manually `chutneyVersion` in [idea-plugin/gradle.properties](https://github.com/chutney-testing/chutney/blob/main/idea-plugin/gradle.properties)
Update manually `chutneyVersion` in [kotlin-dsl/gradle.properties](https://github.com/chutney-testing/chutney/blob/main/kotlin-dsl/gradle.properties)
mvn versions:set -DnewVersion=<RELEASE_VERSION> -DgenerateBackupPoms=false
mvn versions:set-scm-tag -DnewTag=<RELEASE_VERSION> -DgenerateBackupPoms=false
mvn versions:set -DnewVersion=<RELEASE_VERSION> -DgenerateBackupPoms=false -f chutney/pom.xml
mvn versions:set-scm-tag -DnewTag=<RELEASE_VERSION> -DgenerateBackupPoms=false -f chutney/pom.xml
mvn versions:set -DnewVersion=<RELEASE_VERSION> -DgenerateBackupPoms=false -f example/pom.xml
git add .
git diff --staged
git commit -m "chore: Release <RELEASE_VERSION>"
Expand Down Expand Up @@ -375,8 +376,11 @@ In order to effectively release artifacts :
#### Prepare next development

```shell
mvn versions:set -DnewVersion=<NEXT_DEV_VERSION> -DgenerateBackupPoms=false
mvn versions:set-scm-tag -DnewTag=HEAD -DgenerateBackupPoms=false
Update manually `chutneyVersion` in [idea-plugin/gradle.properties](https://github.com/chutney-testing/chutney/blob/main/idea-plugin/gradle.properties)
Update manually `chutneyVersion` in [kotlin-dsl/gradle.properties](https://github.com/chutney-testing/chutney/blob/main/kotlin-dsl/gradle.properties)
mvn versions:set -DnewVersion=<NEXT_DEV_VERSION> -DgenerateBackupPoms=false -f chutney/pom.xml
mvn versions:set-scm-tag -DnewTag=HEAD -DgenerateBackupPoms=false -f chutney/pom.xml
mvn versions:set -DnewVersion=<NEXT_DEV_VERSION> -DgenerateBackupPoms=false -f example/pom.xml
git diff HEAD
git add . && git commit -m "chore: Prepare next development <NEXT_DEV_VERSION>"
git push origin
Expand All @@ -398,8 +402,9 @@ git switch -c release/<RELEASE_VERSION>
git add CHANGELOG.md (see Update Changelog file section)
Update manually `chutneyVersion` in [idea-plugin/gradle.properties](https://github.com/chutney-testing/chutney/blob/main/idea-plugin/gradle.properties)
Update manually `chutneyVersion` in [kotlin-dsl/gradle.properties](https://github.com/chutney-testing/chutney/blob/main/kotlin-dsl/gradle.properties)
mvn versions:set -DnewVersion=<RELEASE_VERSION> -DgenerateBackupPoms=false
mvn versions:set-scm-tag -DnewTag=<RELEASE_VERSION> -DgenerateBackupPoms=false
mvn versions:set -DnewVersion=<RELEASE_VERSION> -DgenerateBackupPoms=false -f chutney/pom.xml
mvn versions:set-scm-tag -DnewTag=<RELEASE_VERSION> -DgenerateBackupPoms=false -f chutney/pom.xml
mvn versions:set -DnewVersion=<RELEASE_VERSION> -DgenerateBackupPoms=false -f example/pom.xml
git add .
git diff --staged
git commit -m "chore: Release <RELEASE_VERSION>"
Expand Down
22 changes: 14 additions & 8 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ Everything you need to run the app and start coding.

## <a name="use"></a> How to run Chutney server

### Run in local-dev mode
### Run with docker
To launch Chutney, two docker images could be used :
* The [local-dev server](chutney/.docker) directly
* The [demo server](example/.docker) with some example scenarios

### Run in local-dev mode manually
To launch Chutney in _local-dev_ mode, use
* the classpath of [packaging/local-dev](chutney/packaging/local-dev) module
* `com.chutneytesting.ServerBootstrap` as main class
Expand All @@ -18,6 +23,7 @@ To launch Chutney in _local-dev_ mode, use

### Prerequisites

* [Java](https://adoptium.net/fr/temurin/releases/?package=jdk&version=17) - version 17
* [Maven](https://maven.apache.org/) - version 3.9.2 or higher - Java dependency management
* [Node](https://nodejs.org/en/) - version 20.10.0 or higher - JavaScript runtime
* [Npm] (https://www.npmjs.com/) - version 6.14.4 or higher - JavaScript package manager
Expand All @@ -28,16 +34,16 @@ Upon running **direnv allow** inside ui module folder, it will install node, npm

You can use a Javascript launcher such as [Volta](https://volta.sh/) to take care of **Node** and **Npm** by using the additional command line property: `-DuseExternalNpm=true`

## How to build
## How to build

* Build and install Chutney: `chutney/mvn clean install -DskipTests`
* Build and install kotlin-dsl: `kotlin-dsl/gradlew clean build -x test :chutney-kotlin-dsl:publishToMavenLocal`
* Install local-api-insecure-jar: use install-local-api-unsecure-jar [run configuration](https://github.com/chutney-testing/chutney/blob/main/.idea/runConfigurations/install_local_api_unsecure_jar.xml)
* Build and install Chutney: `mvn clean install -DskipTests -f chutney/pom.xml`
* Build and install kotlin-dsl: `cd kotlin-dsl && gradlew clean build -x test publishToMavenLocal`
* Install local-api-insecure-jar: use install-local-api-unsecure-jar [run configuration](https://github.com/chutney-testing/chutney/blob/main/.idea/runConfigurations/install_local_api_unsecure_jar.xml) or manually run maven command with options in this file as arguments.
* Build plugin: `idea-plugin/gradlew clean buildPlugin`

## Modules explanation

* chutney: server with ui to show and execute scenario
* chutney: server with ui to show and execute scenario with local-dev docker image
* engine: Execution engine which sole responsibility is to execute scenarios and provide a report for each execution
* packaging: default packaging used to start Chutney
* server/server-core: Main module that
Expand All @@ -53,5 +59,5 @@ You can use a Javascript launcher such as [Volta](https://volta.sh/) to take car
* ui : Front-end of Chutney
* kotlin-dsl: dsl to test as code and synchronise scenario with a server
* idea-plugin: plugin intellij to have interaction with a Chutney server
* docs: documenation as code for [chutney-testing](https://www.chutney-testing.com)

* docs: documentation as code for [chutney-testing](https://www.chutney-testing.com)
* example : Example project demonstrating the use of kotlin DSL with demo docker image
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ You can find all the documentation of [how to write a scenario here](https://www
### Example of a scenario

Here is an example of a scenario written in Kotlin.
* [Scenario source](https://github.com/chutney-testing/chutney/blob/main/kotlin-dsl/example/src/main/kotlin/com/chutneytesting/example/scenario/http_scenario.kt)
* [How to run it locally with test containers](https://github.com/chutney-testing/chutney/blob/main/kotlin-dsl/example/src/test/kotlin/com/chutneytesting/example/http/HttpScenarioTest.kt)
* [Scenario source](https://github.com/chutney-testing/chutney/blob/main/example/src/main/kotlin/com/chutneytesting/example/scenario/http_scenario.kt)
* [How to run it locally with test containers](https://github.com/chutney-testing/chutney/blob/main/example/src/test/kotlin/com/chutneytesting/example/http/HttpScenarioTest.kt)

```kotlin
const val HTTP_TARGET_NAME = "HTTP_TARGET"
Expand Down Expand Up @@ -143,7 +143,7 @@ Here is an example of a scenario written in Kotlin.
* In this example the scenario will save the content of FILM to an external server.
* Then it will update it, fetch it and finally verify that the FILM has indeed been updated.
* In this scenario we perform Http Actions, you can find [all available Chutney Actions here](https://www.chutney-testing.com/documentation/actions/)
* You can find some other example with jms, kafka, rabbit or sql [here](https://github.com/chutney-testing/chutney/tree/main/kotlin-dsl/example/src/main/kotlin/com/chutneytesting/example/scenario)
* You can find some other example with jms, kafka, rabbit or sql [here](https://github.com/chutney-testing/chutney/tree/main/example/src/main/kotlin/com/chutneytesting/example/scenario)
-------------

## <a name="documentation"></a> Documentation
Expand All @@ -166,9 +166,9 @@ You don't need to be a developer to contribute, nor do much, you can simply:
* [Give us advices or ideas](https://github.com/chutney-testing/chutney/discussions/categories/ideas),
* etc.
To help you start, we invite you to read [Contributing](chutney/CONTRIBUTING.md), which gives you rules and code conventions to respect
To help you start, we invite you to read [Contributing](CONTRIBUTING.md), which gives you rules and code conventions to respect
To contribute to this documentation (README, CONTRIBUTING, etc.), we conforms to the [CommonMark Spec](https://spec.commonmark.org/)
To contribute to this documentation (README, CONTRIBUTING, etc.), we conform to the [CommonMark Spec](https://spec.commonmark.org/)
## <a name="support"></a> Support
Expand Down
31 changes: 15 additions & 16 deletions chutney/.docker/README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
### build docker images
### Build docker images

from project root folder, run:
**server**
From project root folder, run:

**server**
```shell
docker build --tag ghcr.io/chutney-testing/chutney/server:latest . -f ./.docker/server/Dockerfile
docker build --tag ghcr.io/chutney-testing/chutney/chutney-server:latest . -f ./.docker/server/Dockerfile
```

**ui**

```shell
docker build --tag ghcr.io/chutney-testing/chutney/ui:latest . -f ./.docker/ui/Dockerfile
docker build --tag ghcr.io/chutney-testing/chutney/chutney-ui:latest . -f ./.docker/ui/Dockerfile
```

### push docker image to github registry
### Push docker image to github registry

- push will be done by github actions during release workflow
- it's possible to push manually :
Push will be done by github actions during release workflow.

To push manually :
```shell
//login
docker login ghcr.io -u ${your_username} --password ${your_personal_github_token}
// push
docker push ghcr.io/chutney-testing/chutney/server:latest
docker push ghcr.io/chutney-testing/chutney/ui:latest
docker push ghcr.io/chutney-testing/chutney/chutney-server:latest
docker push ghcr.io/chutney-testing/chutney/chutney-ui:latest
```

### run ui and server containers using docker compose
### Run ui and server containers using docker compose

```shell
docker-compose -f ./.docker/docker-compose-local-dev.yml up -d
```

**notes:**
**Notes :**

- by default server container will run with local-dev configuration(see packaging/local-dev module)
- it's possible to override default configuration by passing configuration folder as volume when running server container (see docker-compose-custom-config.yml file for more details)
* By default, server container will run with local-dev configuration(see packaging/local-dev module)
* It's possible to override default configuration by passing configuration folder as volume when running server container (see docker-compose-custom-config.yml file for more details)

### enjoy app
### Enjoy app

visit https://localhost

Expand Down
4 changes: 2 additions & 2 deletions chutney/.docker/docker-compose-custom-config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
server:
image: ghcr.io/chutney-testing/chutney/server:latest
image: ghcr.io/chutney-testing/chutney/chutney-server:latest
container_name: server
ports:
- "8081:8443"
Expand All @@ -12,7 +12,7 @@ services:
- ../server/.chutney/:/.chutney
- ../packaging/local-dev/src/main/resources/:/config/
ui:
image: ghcr.io/chutney-testing/chutney/ui:latest
image: ghcr.io/chutney-testing/chutney/chutney-ui:latest
container_name: ui
ports:
- "80:80"
Expand Down
4 changes: 2 additions & 2 deletions chutney/.docker/docker-compose-local-dev.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: '3.7'
services:
server:
image: ghcr.io/chutney-testing/chutney/server:latest
image: ghcr.io/chutney-testing/chutney/chutney-server:latest
container_name: server
ports:
- "8081:8443"
volumes:
- ../server/.chutney/:/.chutney
restart: unless-stopped
ui:
image: ghcr.io/chutney-testing/chutney/ui:latest
image: ghcr.io/chutney-testing/chutney/chutney-ui:latest
container_name: ui
ports:
- "80:80"
Expand Down
2 changes: 1 addition & 1 deletion chutney/.docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:17-alpine
FROM eclipse-temurin:17-jre
VOLUME /config
VOLUME /.chutney
ARG JAR_PATH=packaging/local-dev/target
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Enedis
* Copyright 2017-2024 Enedis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit c1b793a

Please sign in to comment.