-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
840 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This workflow will build a Java project with Maven | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
|
||
name: Maven Build | ||
|
||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 21 | ||
|
||
- name: Check Dependencies | ||
run: mvn -B dependency:analysis versions:display-dependency-updates --file pom.xml | ||
|
||
- name: Unit Tests | ||
run: mvn -B test --file pom.xml | ||
|
||
- name: Build | ||
run: mvn -B package --file 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
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
File renamed without changes.
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>com.micasa.tutorial</groupId> | ||
<artifactId>camunda-java</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>camunda-java-service-orchestration</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>service-orchestration</name> | ||
<packaging>jar</packaging> | ||
|
||
</project> |
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
44 changes: 44 additions & 0 deletions
44
...ce-orchestration/src/main/java/com/micasa/tutorial/handler/CreditCardChargingHandler.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,44 @@ | ||
package com.micasa.tutorial.handler; | ||
|
||
import com.micasa.tutorial.service.CreditCard; | ||
import com.micasa.tutorial.service.CreditCardService; | ||
import io.camunda.zeebe.client.api.response.ActivatedJob; | ||
import io.camunda.zeebe.client.api.worker.JobClient; | ||
import io.camunda.zeebe.client.api.worker.JobHandler; | ||
|
||
import java.time.YearMonth; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Map; | ||
|
||
public class CreditCardChargingHandler implements JobHandler { | ||
|
||
private final CreditCardService creditCardService; | ||
|
||
public CreditCardChargingHandler(CreditCardService creditCardService) { | ||
this.creditCardService = creditCardService; | ||
} | ||
|
||
public CreditCardChargingHandler() { | ||
this(new CreditCardService()); | ||
} | ||
|
||
@Override | ||
public void handle(JobClient client, ActivatedJob job) throws Exception { | ||
var reference = (String) job.getVariable("orderReference"); | ||
var amount = (Double) job.getVariable("orderAmount"); | ||
var creditCard = new CreditCard( | ||
(String) job.getVariable("cardNumber"), | ||
YearMonth.parse((String) job.getVariable("cardExpiry"), DateTimeFormatter.ofPattern("MM/yyyy")), | ||
(String) job.getVariable("cardCVC") | ||
); | ||
|
||
var confirmationNumber = creditCardService.chargeCreditCard(reference, amount, creditCard); | ||
|
||
// Inform Zeebe that the job was completed successfully and pass along the confirmation number | ||
var outputVariables = Map.of("confirmation", confirmationNumber); | ||
client.newCompleteCommand(job.getKey()) | ||
.variables(outputVariables) | ||
.send() | ||
.join(); | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes.
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,3 @@ | ||
# Service Orchestration | ||
|
||
This is the implementation for [Camunda 8 - Testing Processes](https://academy.camunda.com/c8-testing-processes). |
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,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>com.micasa.tutorial</groupId> | ||
<artifactId>camunda-java</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>camunda-java-testing</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>testing</name> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.camunda</groupId> | ||
<artifactId>zeebe-process-test-extension</artifactId> | ||
<version>${camunda.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
Oops, something went wrong.