created test-utils module
This commit is contained in:
92
.github/workflows/build-and-publish.yaml
vendored
92
.github/workflows/build-and-publish.yaml
vendored
@@ -4,11 +4,32 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'main'
|
- 'main'
|
||||||
|
- 'test-utils-module'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
loan-agreement-build-and-push:
|
build-test-utils:
|
||||||
name: Build JAR and push Docker image
|
name: Build Test Utils
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./test-utils
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 17
|
||||||
|
- name: Maven Package
|
||||||
|
run: mvn clean package
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: test-utils-package
|
||||||
|
path: test-utils/target/test-utils.jar
|
||||||
|
|
||||||
|
loan-agreement-build:
|
||||||
|
name: Build Loan Agreement JAR
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
needs: [ build-test-utils ]
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: ./loan-agreement
|
working-directory: ./loan-agreement
|
||||||
@@ -20,8 +41,39 @@ jobs:
|
|||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
- uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: test-utils-package
|
||||||
|
path: ./loan-agreement
|
||||||
|
- name: Install Test Utils
|
||||||
|
run: mvn install:install-file -Dfile=./test-utils.jar -DgroupId=de.weinbrecht.luc.bpm.architecture -DartifactId=test-utils -Dversion=1.0.0 -Dpackaging=jar
|
||||||
- name: Maven Package
|
- name: Maven Package
|
||||||
run: mvn clean package
|
run: mvn clean package
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: loan-agreement
|
||||||
|
path: loan-agreement/target/loan-agreement.jar
|
||||||
|
|
||||||
|
loan-agreement-publish:
|
||||||
|
name: Push Loan Agreement Docker image
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
needs: [ loan-agreement-build ]
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./loan-agreement
|
||||||
|
env:
|
||||||
|
repo: lwluc/camunda-ddd-and-clean-architecture
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 17
|
||||||
|
- uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: loan-agreement
|
||||||
|
- name: Move to Directory
|
||||||
|
run: mkdir target && mv loan-agreement.jar ./target/loan-agreement.jar
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
run: docker login -u ${{ secrets.DOCKER_USER }} -p '${{ secrets.DOCKER_TOKEN }}'
|
run: docker login -u ${{ secrets.DOCKER_USER }} -p '${{ secrets.DOCKER_TOKEN }}'
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
@@ -29,9 +81,10 @@ jobs:
|
|||||||
- name: Publish Docker image
|
- name: Publish Docker image
|
||||||
run: docker push ${{env.repo}}-loan-agreement
|
run: docker push ${{env.repo}}-loan-agreement
|
||||||
|
|
||||||
recommentdation-build-and-push:
|
recommendation-build:
|
||||||
name: Build JAR and push Docker image
|
name: Build Recommendation JAR
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
needs: [ build-test-utils ]
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: ./recommendation
|
working-directory: ./recommendation
|
||||||
@@ -43,8 +96,39 @@ jobs:
|
|||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
- uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: test-utils-package
|
||||||
|
path: ./recommendation
|
||||||
|
- name: Install Test Utils
|
||||||
|
run: mvn install:install-file -Dfile=./test-utils.jar -DgroupId=de.weinbrecht.luc.bpm.architecture -DartifactId=test-utils -Dversion=1.0.0 -Dpackaging=jar
|
||||||
- name: Maven Package
|
- name: Maven Package
|
||||||
run: mvn clean package
|
run: mvn clean package
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: recommendation
|
||||||
|
path: recommendation/target/recommendation.jar
|
||||||
|
|
||||||
|
recommendation-publish:
|
||||||
|
name: Push Recommendation Docker Image
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
needs: [ recommendation-build ]
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./recommendation
|
||||||
|
env:
|
||||||
|
repo: lwluc/camunda-ddd-and-clean-architecture
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 17
|
||||||
|
- uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: recommendation
|
||||||
|
- name: Move to Directory
|
||||||
|
run: mkdir target && mv recommendation.jar ./target/recommendation.jar
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
run: docker login -u ${{ secrets.DOCKER_USER }} -p '${{ secrets.DOCKER_TOKEN }}'
|
run: docker login -u ${{ secrets.DOCKER_USER }} -p '${{ secrets.DOCKER_TOKEN }}'
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
|
|||||||
@@ -1,16 +1,6 @@
|
|||||||
FROM maven:3.8.5-openjdk-17 as build
|
|
||||||
|
|
||||||
COPY ./pom.xml .
|
|
||||||
|
|
||||||
RUN mvn -B dependency:go-offline
|
|
||||||
|
|
||||||
COPY ./src src
|
|
||||||
|
|
||||||
RUN mvn -B package
|
|
||||||
|
|
||||||
FROM openjdk:11-jre-slim-buster
|
FROM openjdk:11-jre-slim-buster
|
||||||
|
|
||||||
COPY --from=build ./target/loan-agreement.jar .
|
COPY ./target/loan-agreement.jar .
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,14 @@
|
|||||||
<version>${version.archunitJunit5}</version>
|
<version>${version.archunitJunit5}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- TODO: Parent POM or published to own Repository-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.weinbrecht.luc.bpm.architecture</groupId>
|
||||||
|
<artifactId>test-utils</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package de.weinbrecht.luc.bpm.architecture.loan.agreement;
|
|
||||||
|
|
||||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
|
||||||
import com.tngtech.archunit.junit.ArchTest;
|
|
||||||
import com.tngtech.archunit.lang.ArchRule;
|
|
||||||
|
|
||||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
|
|
||||||
|
|
||||||
@AnalyzeClasses(packages = "de.weinbrecht.luc.bpm.architecture.loan.agreement")
|
|
||||||
class ArchitectureRuleTests {
|
|
||||||
private final static String DOMAIN = "..domain..";
|
|
||||||
private final static String USE_CASE = "..usecase..";
|
|
||||||
private final static String ADAPTER = "..adapter..";
|
|
||||||
|
|
||||||
@ArchTest
|
|
||||||
static final ArchRule domain_use_case_should_not_import_adapters =
|
|
||||||
noClasses()
|
|
||||||
.that().resideInAPackage(DOMAIN)
|
|
||||||
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
|
||||||
|
|
||||||
@ArchTest
|
|
||||||
static final ArchRule use_case_should_not_import_adapters =
|
|
||||||
noClasses()
|
|
||||||
.that().resideInAPackage(USE_CASE)
|
|
||||||
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package de.weinbrecht.luc.bpm.architecture.loan.agreement;
|
||||||
|
|
||||||
|
import de.weinbrecht.luc.bpm.architecture.ArchitectureRuleTests;
|
||||||
|
|
||||||
|
class ArchitectureTests implements ArchitectureRuleTests {
|
||||||
|
@Override
|
||||||
|
public String basePackage() {
|
||||||
|
return "de.weinbrecht.luc.bpm.architecture.loan.agreement";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +1,6 @@
|
|||||||
FROM maven:3.8.5-openjdk-17 as build
|
|
||||||
|
|
||||||
COPY ./pom.xml .
|
|
||||||
|
|
||||||
RUN mvn -B dependency:go-offline
|
|
||||||
|
|
||||||
COPY ./src src
|
|
||||||
|
|
||||||
RUN mvn -B package
|
|
||||||
|
|
||||||
FROM openjdk:11-jre-slim-buster
|
FROM openjdk:11-jre-slim-buster
|
||||||
|
|
||||||
COPY --from=build ./target/recommendation.jar .
|
COPY ./target/recommendation.jar .
|
||||||
|
|
||||||
EXPOSE 8081
|
EXPOSE 8081
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,14 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- TODO: Parent POM or published to own Repository-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.weinbrecht.luc.bpm.architecture</groupId>
|
||||||
|
<artifactId>test-utils</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package de.weinbrecht.luc.bpm.architecture.recommendation;
|
|
||||||
|
|
||||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
|
||||||
import com.tngtech.archunit.junit.ArchTest;
|
|
||||||
import com.tngtech.archunit.lang.ArchRule;
|
|
||||||
|
|
||||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
|
|
||||||
|
|
||||||
@AnalyzeClasses(packages = "de.weinbrecht.luc.bpm.architecture.recommendation")
|
|
||||||
class ArchitectureRuleTests {
|
|
||||||
private final static String DOMAIN = "..domain..";
|
|
||||||
private final static String USE_CASE = "..usecase..";
|
|
||||||
private final static String ADAPTER = "..adapter..";
|
|
||||||
|
|
||||||
@ArchTest
|
|
||||||
static final ArchRule domain_use_case_should_not_import_adapters =
|
|
||||||
noClasses()
|
|
||||||
.that().resideInAPackage(DOMAIN)
|
|
||||||
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
|
||||||
|
|
||||||
@ArchTest
|
|
||||||
static final ArchRule use_case_should_not_import_adapters =
|
|
||||||
noClasses()
|
|
||||||
.that().resideInAPackage(USE_CASE)
|
|
||||||
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package de.weinbrecht.luc.bpm.architecture.recommendation;
|
||||||
|
|
||||||
|
import de.weinbrecht.luc.bpm.architecture.ArchitectureRuleTests;
|
||||||
|
|
||||||
|
class ArchitectureTests implements ArchitectureRuleTests {
|
||||||
|
@Override
|
||||||
|
public String basePackage() {
|
||||||
|
return "de.weinbrecht.luc.bpm.architecture.recommendation";
|
||||||
|
}
|
||||||
|
}
|
||||||
57
test-utils/pom.xml
Normal file
57
test-utils/pom.xml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>de.weinbrecht.luc.bpm.architecture</groupId>
|
||||||
|
<artifactId>test-utils</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
||||||
|
<version.junit5>5.8.2</version.junit5>
|
||||||
|
<version.bpmAssert>1.1.0</version.bpmAssert>
|
||||||
|
<version.camundaMockito>6.17.0</version.camundaMockito>
|
||||||
|
<version.archunitJunit5>0.23.1</version.archunitJunit5>
|
||||||
|
<version.surefirePlugin>3.0.0-M6</version.surefirePlugin>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>${version.junit5}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tngtech.archunit</groupId>
|
||||||
|
<artifactId>archunit-junit5</artifactId>
|
||||||
|
<version>${version.archunitJunit5}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.camunda.bpm.extension</groupId>
|
||||||
|
<artifactId>camunda-bpm-junit5</artifactId>
|
||||||
|
<version>${version.bpmAssert}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.camunda.community.mockito</groupId>
|
||||||
|
<artifactId>camunda-platform-7-mockito</artifactId>
|
||||||
|
<version>${version.camundaMockito}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tngtech.archunit</groupId>
|
||||||
|
<artifactId>archunit-junit5</artifactId>
|
||||||
|
<version>${version.archunitJunit5}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package de.weinbrecht.luc.bpm.architecture;
|
||||||
|
|
||||||
|
import com.tngtech.archunit.core.domain.JavaClasses;
|
||||||
|
import com.tngtech.archunit.core.importer.ClassFileImporter;
|
||||||
|
import com.tngtech.archunit.lang.ArchRule;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
|
||||||
|
|
||||||
|
public interface ArchitectureRuleTests {
|
||||||
|
String DOMAIN = "..domain..";
|
||||||
|
String USE_CASE = "..usecase..";
|
||||||
|
String ADAPTER = "..adapter..";
|
||||||
|
|
||||||
|
String basePackage();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
default void domain_use_case_should_not_import_adapters() {
|
||||||
|
JavaClasses classes = new ClassFileImporter().importPackages(basePackage());
|
||||||
|
|
||||||
|
ArchRule rule = noClasses()
|
||||||
|
.that().resideInAPackage(DOMAIN)
|
||||||
|
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
||||||
|
|
||||||
|
rule.check(classes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
default void use_case_should_not_import_adapters() {
|
||||||
|
JavaClasses classes = new ClassFileImporter().importPackages(basePackage());
|
||||||
|
|
||||||
|
ArchRule rule = noClasses()
|
||||||
|
.that().resideInAPackage(USE_CASE)
|
||||||
|
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
||||||
|
|
||||||
|
rule.check(classes);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user