From b14ce796b2bbb48eed4c56e9131963c3760efa83 Mon Sep 17 00:00:00 2001 From: Stefan Schultz <28778796+itsmestefanjay@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:31:10 +0200 Subject: [PATCH 1/7] move example and file api into different modules --- .gitignore | 1 - README.md | 2 +- connector-aws-s3-example/.gitignore | 38 ++ connector-aws-s3-example/pom.xml | 38 ++ .../connector/aws/s3/AppConfiguration.java | 16 + .../aws/s3/MyProcessApplication.java | 14 + .../s3/adapter/in/process/MyJobWorker.java | 2 +- .../main/resources/application.properties | 0 .../src}/main/resources/bpmn/example.bpmn | 0 connector-aws-s3/.gitignore | 38 ++ connector-aws-s3/pom.xml | 112 ++++++ .../aws/s3}/ConnectorConfiguration.java | 18 +- .../connector/aws/s3/ConnectorRuntimeApp.java | 0 .../adapter/in/process/ConnectorAdapter.java | 4 +- .../s3/adapter/in/process/RequestMapper.java | 2 +- .../model/AuthenticationRequestData.java | 0 .../in/process/model/ConnectorRequest.java | 0 .../in/process/model/ConnectorResponse.java | 2 +- .../in/process/model/OperationType.java | 0 .../in/process/model/RequestDetails.java | 0 .../adapter/out/cloud/CloudClientFactory.java | 0 .../adapter/out/cloud/CloudFileAdapter.java | 6 +- .../adapter/out/local/LocalFileAdapter.java | 2 +- ...tor.api.outbound.OutboundConnectorFunction | 0 .../src/main/resources/application.properties | 11 + .../src}/main/resources/logback.xml | 0 .../aws/s3/ConnectorAdapterContextTest.java | 0 .../aws/s3/ConnectorAdapterTest.java | 4 +- .../adapter/in/process/RequestMapperTest.java | 2 +- .../out/local/LocalFileAdapterTest.java | 0 connector-aws-s3/src/test/resources/.env | 20 ++ .../src}/test/resources/invoices/invoice.txt | 0 connector-file-api/.gitignore | 38 ++ connector-file-api/pom.xml | 47 +++ .../connector/file/api}/CloudFileCommand.java | 6 +- .../connector/file/api}/FileCommand.java | 4 +- .../connector/file/api}/LocalFileCommand.java | 2 +- .../file/api/impl}/CloudFileService.java | 12 +- .../file/api/impl}/model/FileContent.java | 2 +- .../file/api/impl}/model/RequestData.java | 2 +- .../file/api/impl}/CloudFileServiceTest.java | 12 +- docker/.env | 20 ++ docker/Dockerfile | 2 +- pom.xml | 337 +++++++++--------- 44 files changed, 597 insertions(+), 219 deletions(-) create mode 100644 connector-aws-s3-example/.gitignore create mode 100644 connector-aws-s3-example/pom.xml create mode 100644 connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/AppConfiguration.java create mode 100644 connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/MyProcessApplication.java rename {src => connector-aws-s3-example/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/MyJobWorker.java (96%) rename {src => connector-aws-s3-example/src}/main/resources/application.properties (100%) rename {src => connector-aws-s3-example/src}/main/resources/bpmn/example.bpmn (100%) create mode 100644 connector-aws-s3/.gitignore create mode 100644 connector-aws-s3/pom.xml rename {src/main/java/de/novatec/bpm/camunda/connector/aws/s3/common => connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3}/ConnectorConfiguration.java (66%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorRuntimeApp.java (100%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/ConnectorAdapter.java (93%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapper.java (94%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/AuthenticationRequestData.java (100%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorRequest.java (100%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorResponse.java (88%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/OperationType.java (100%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/RequestDetails.java (100%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudClientFactory.java (100%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudFileAdapter.java (94%) rename {src => connector-aws-s3/src}/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java (96%) rename {src => connector-aws-s3/src}/main/resources/META-INF/services/io.camunda.connector.api.outbound.OutboundConnectorFunction (100%) create mode 100644 connector-aws-s3/src/main/resources/application.properties rename {src => connector-aws-s3/src}/main/resources/logback.xml (100%) rename {src => connector-aws-s3/src}/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterContextTest.java (100%) rename {src => connector-aws-s3/src}/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterTest.java (98%) rename {src => connector-aws-s3/src}/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapperTest.java (98%) rename {src => connector-aws-s3/src}/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java (100%) create mode 100644 connector-aws-s3/src/test/resources/.env rename {src => connector-aws-s3/src}/test/resources/invoices/invoice.txt (100%) create mode 100644 connector-file-api/.gitignore create mode 100644 connector-file-api/pom.xml rename {src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/out => connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api}/CloudFileCommand.java (60%) rename {src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/in => connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api}/FileCommand.java (69%) rename {src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/out => connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api}/LocalFileCommand.java (82%) rename {src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain => connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl}/CloudFileService.java (78%) rename {src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain => connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl}/model/FileContent.java (74%) rename {src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain => connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl}/model/RequestData.java (82%) rename {src/test/java/de/novatec/bpm/camunda/connector/aws/s3/domain => connector-file-api/src/test/java/de/novatec/bpm/camunda/connector/file/api/impl}/CloudFileServiceTest.java (88%) create mode 100644 docker/.env diff --git a/.gitignore b/.gitignore index 3993542..8f596a3 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,5 @@ build/ .vscode/ # environment -docker/.env request*.json /.local/ diff --git a/README.md b/README.md index 6b39bff..512b50b 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ NOTE: This behaviour will most likely be improved in the future ## FileAdapter -The connector has two file adapters: +The connector uses two file adapters: - *cloud file adapter* to S3 - *local file adapter* to the local file system diff --git a/connector-aws-s3-example/.gitignore b/connector-aws-s3-example/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/connector-aws-s3-example/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/connector-aws-s3-example/pom.xml b/connector-aws-s3-example/pom.xml new file mode 100644 index 0000000..dff1cda --- /dev/null +++ b/connector-aws-s3-example/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + de.novatec.bpm.camunda.connector + connector-aws-s3-parent + 1.0.0-SNAPSHOT + + + de.novatec.bpm + connector-aws-s3-example + + + 17 + 17 + UTF-8 + + + + + de.novatec.bpm + connector-aws-s3 + 1.0.0-SNAPSHOT + + + de.novatec.bpm + connector-file-api + 1.0.0-SNAPSHOT + + + io.camunda.spring + spring-boot-starter-camunda + + + + \ No newline at end of file diff --git a/connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/AppConfiguration.java b/connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/AppConfiguration.java new file mode 100644 index 0000000..00ea678 --- /dev/null +++ b/connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/AppConfiguration.java @@ -0,0 +1,16 @@ +package de.novatec.bpm.camunda.connector.aws.s3; + +import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.MyJobWorker; +import de.novatec.bpm.camunda.connector.file.api.LocalFileCommand; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class AppConfiguration { + + @Bean + MyJobWorker jobWorker(LocalFileCommand localFileCommand) { + return new MyJobWorker(localFileCommand); + } + +} diff --git a/connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/MyProcessApplication.java b/connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/MyProcessApplication.java new file mode 100644 index 0000000..09881ce --- /dev/null +++ b/connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/MyProcessApplication.java @@ -0,0 +1,14 @@ +package de.novatec.bpm.camunda.connector.aws.s3; + +import io.camunda.zeebe.spring.client.annotation.Deployment; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@Deployment(resources = "bpmn/example.bpmn") +public class MyProcessApplication { + + public static void main(String[] args) { + SpringApplication.run(MyProcessApplication.class, args); + } +} diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/MyJobWorker.java b/connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/MyJobWorker.java similarity index 96% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/MyJobWorker.java rename to connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/MyJobWorker.java index f356d67..d440020 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/MyJobWorker.java +++ b/connector-aws-s3-example/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/MyJobWorker.java @@ -1,6 +1,6 @@ package de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.LocalFileCommand; import io.camunda.zeebe.client.api.response.ActivatedJob; import io.camunda.zeebe.spring.client.annotation.JobWorker; import io.camunda.zeebe.spring.client.annotation.Variable; diff --git a/src/main/resources/application.properties b/connector-aws-s3-example/src/main/resources/application.properties similarity index 100% rename from src/main/resources/application.properties rename to connector-aws-s3-example/src/main/resources/application.properties diff --git a/src/main/resources/bpmn/example.bpmn b/connector-aws-s3-example/src/main/resources/bpmn/example.bpmn similarity index 100% rename from src/main/resources/bpmn/example.bpmn rename to connector-aws-s3-example/src/main/resources/bpmn/example.bpmn diff --git a/connector-aws-s3/.gitignore b/connector-aws-s3/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/connector-aws-s3/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/connector-aws-s3/pom.xml b/connector-aws-s3/pom.xml new file mode 100644 index 0000000..676fbdd --- /dev/null +++ b/connector-aws-s3/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + + + de.novatec.bpm.camunda.connector + connector-aws-s3-parent + 1.0.0-SNAPSHOT + + + + + Camunda Platform Self-Managed Free Edition license + + https://camunda.com/legal/terms/cloud-terms-and-conditions/camunda-cloud-self-managed-free-edition-terms/ + + + + Camunda Platform Self-Managed Enterprise Edition license + + + + connector-aws-s3 + AWS S3 connector for Camunda 8 + de.novatec.bpm + connector-aws-s3 + + + 17 + 17 + UTF-8 + + + + + de.novatec.bpm + connector-file-api + 1.0.0-SNAPSHOT + + + software.amazon.awssdk + s3 + + + io.camunda.connector + connector-core + + + io.camunda.connector + connector-validation + + + io.camunda.connector + connector-test + + + io.camunda.connector + spring-boot-starter-camunda-connectors + + + org.slf4j + slf4j-api + + + ch.qos.logback + logback-classic + + + com.fasterxml.jackson.core + jackson-databind + + + org.projectlombok + lombok + + + + + + org.junit.jupiter + junit-jupiter + test + + + org.mockito + mockito-junit-jupiter + test + + + org.assertj + assertj-core + test + + + org.slf4j + slf4j-jdk14 + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/common/ConnectorConfiguration.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorConfiguration.java similarity index 66% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/common/ConnectorConfiguration.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorConfiguration.java index 00b902e..65451fa 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/common/ConnectorConfiguration.java +++ b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorConfiguration.java @@ -1,14 +1,13 @@ -package de.novatec.bpm.camunda.connector.aws.s3.common; +package de.novatec.bpm.camunda.connector.aws.s3; import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.ConnectorAdapter; -import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.MyJobWorker; import de.novatec.bpm.camunda.connector.aws.s3.adapter.out.cloud.CloudClientFactory; import de.novatec.bpm.camunda.connector.aws.s3.adapter.out.cloud.CloudFileAdapter; import de.novatec.bpm.camunda.connector.aws.s3.adapter.out.local.LocalFileAdapter; -import de.novatec.bpm.camunda.connector.aws.s3.domain.CloudFileService; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.in.FileCommand; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.CloudFileCommand; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.CloudFileCommand; +import de.novatec.bpm.camunda.connector.file.api.FileCommand; +import de.novatec.bpm.camunda.connector.file.api.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.impl.CloudFileService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -19,7 +18,7 @@ public class ConnectorConfiguration { @Bean - CloudFileCommand s3Command(CloudClientFactory clientFactory) { + CloudFileCommand cloudFileCommand(CloudClientFactory clientFactory) { return new CloudFileAdapter(clientFactory); } @@ -42,9 +41,4 @@ FileCommand fileCommand(CloudFileCommand cloudFileCommand, LocalFileCommand loca ConnectorAdapter connector(FileCommand fileCommand) { return new ConnectorAdapter(fileCommand); } - - @Bean - MyJobWorker jobWorker(LocalFileCommand localFileCommand) { - return new MyJobWorker(localFileCommand); - } } diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorRuntimeApp.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorRuntimeApp.java similarity index 100% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorRuntimeApp.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorRuntimeApp.java diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/ConnectorAdapter.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/ConnectorAdapter.java similarity index 93% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/ConnectorAdapter.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/ConnectorAdapter.java index c117950..f1e2556 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/ConnectorAdapter.java +++ b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/ConnectorAdapter.java @@ -2,8 +2,8 @@ import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.model.ConnectorRequest; import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.model.ConnectorResponse; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.in.FileCommand; +import de.novatec.bpm.camunda.connector.file.api.FileCommand; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import io.camunda.connector.api.annotation.OutboundConnector; import io.camunda.connector.api.outbound.OutboundConnectorContext; import io.camunda.connector.api.outbound.OutboundConnectorFunction; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapper.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapper.java similarity index 94% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapper.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapper.java index b569706..f73b6c5 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapper.java +++ b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapper.java @@ -1,7 +1,7 @@ package de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process; import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.model.ConnectorRequest; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import java.util.Objects; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/AuthenticationRequestData.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/AuthenticationRequestData.java similarity index 100% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/AuthenticationRequestData.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/AuthenticationRequestData.java diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorRequest.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorRequest.java similarity index 100% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorRequest.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorRequest.java diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorResponse.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorResponse.java similarity index 88% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorResponse.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorResponse.java index 650ed34..a585fd5 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorResponse.java +++ b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/ConnectorResponse.java @@ -1,6 +1,6 @@ package de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.model; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/OperationType.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/OperationType.java similarity index 100% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/OperationType.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/OperationType.java diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/RequestDetails.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/RequestDetails.java similarity index 100% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/RequestDetails.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/model/RequestDetails.java diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudClientFactory.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudClientFactory.java similarity index 100% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudClientFactory.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudClientFactory.java diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudFileAdapter.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudFileAdapter.java similarity index 94% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudFileAdapter.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudFileAdapter.java index 80797cb..b487108 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudFileAdapter.java +++ b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/cloud/CloudFileAdapter.java @@ -1,8 +1,8 @@ package de.novatec.bpm.camunda.connector.aws.s3.adapter.out.cloud; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.FileContent; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.CloudFileCommand; +import de.novatec.bpm.camunda.connector.file.api.CloudFileCommand; +import de.novatec.bpm.camunda.connector.file.api.impl.model.FileContent; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.core.ResponseInputStream; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java similarity index 96% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java rename to connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java index 049d465..9517485 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java +++ b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java @@ -1,6 +1,6 @@ package de.novatec.bpm.camunda.connector.aws.s3.adapter.out.local; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.LocalFileCommand; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/resources/META-INF/services/io.camunda.connector.api.outbound.OutboundConnectorFunction b/connector-aws-s3/src/main/resources/META-INF/services/io.camunda.connector.api.outbound.OutboundConnectorFunction similarity index 100% rename from src/main/resources/META-INF/services/io.camunda.connector.api.outbound.OutboundConnectorFunction rename to connector-aws-s3/src/main/resources/META-INF/services/io.camunda.connector.api.outbound.OutboundConnectorFunction diff --git a/connector-aws-s3/src/main/resources/application.properties b/connector-aws-s3/src/main/resources/application.properties new file mode 100644 index 0000000..05ba3d8 --- /dev/null +++ b/connector-aws-s3/src/main/resources/application.properties @@ -0,0 +1,11 @@ +#zeebe.client.cloud.region: my-region +#zeebe.client.cloud.clusterid: my-cluster-id +#zeebe.client.cloud.clientid: my-client-id +#zeebe.client.cloud.clientsecret: my-client-secret + +operate.client.enabled=true +camunda.operate.client.url=http://localhost:8081 +camunda.operate.client.username=demo +camunda.operate.client.password=demo +zeebe.client.broker.gateway-address=localhost:26500 +zeebe.client.security.plaintext=true \ No newline at end of file diff --git a/src/main/resources/logback.xml b/connector-aws-s3/src/main/resources/logback.xml similarity index 100% rename from src/main/resources/logback.xml rename to connector-aws-s3/src/main/resources/logback.xml diff --git a/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterContextTest.java b/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterContextTest.java similarity index 100% rename from src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterContextTest.java rename to connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterContextTest.java diff --git a/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterTest.java b/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterTest.java similarity index 98% rename from src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterTest.java rename to connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterTest.java index db8b58f..cd177a3 100644 --- a/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterTest.java +++ b/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/ConnectorAdapterTest.java @@ -6,8 +6,8 @@ import de.novatec.bpm.camunda.connector.aws.s3.adapter.out.cloud.CloudClientFactory; import de.novatec.bpm.camunda.connector.aws.s3.adapter.out.cloud.CloudFileAdapter; import de.novatec.bpm.camunda.connector.aws.s3.adapter.out.local.LocalFileAdapter; -import de.novatec.bpm.camunda.connector.aws.s3.domain.CloudFileService; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.in.FileCommand; +import de.novatec.bpm.camunda.connector.file.api.FileCommand; +import de.novatec.bpm.camunda.connector.file.api.impl.CloudFileService; import io.camunda.connector.test.outbound.OutboundConnectorContextBuilder; import io.camunda.connector.test.outbound.OutboundConnectorContextBuilder.TestConnectorContext; import org.junit.jupiter.api.BeforeEach; diff --git a/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapperTest.java b/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapperTest.java similarity index 98% rename from src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapperTest.java rename to connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapperTest.java index ca85ae3..aa4e584 100644 --- a/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapperTest.java +++ b/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/in/process/RequestMapperTest.java @@ -4,7 +4,7 @@ import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.model.ConnectorRequest; import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.model.OperationType; import de.novatec.bpm.camunda.connector.aws.s3.adapter.in.process.model.RequestDetails; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java b/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java similarity index 100% rename from src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java rename to connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java diff --git a/connector-aws-s3/src/test/resources/.env b/connector-aws-s3/src/test/resources/.env new file mode 100644 index 0000000..c2a153a --- /dev/null +++ b/connector-aws-s3/src/test/resources/.env @@ -0,0 +1,20 @@ +## Image versions ## +CAMUNDA_CONNECTORS_VERSION=0.18.1 +CAMUNDA_OPTIMIZE_VERSION=3.10.0 +CAMUNDA_PLATFORM_VERSION=8.2.13 +CAMUNDA_WEB_MODELER_VERSION=8.2.5 +ELASTIC_VERSION=7.17.9 +KEYCLOAK_SERVER_VERSION=19.0.3 +MAILPIT_VERSION=v1.5.4 +POSTGRES_VERSION=14.5-alpine + +## Configuration ## +# By default the zeebe api is public, when setting this to `identity` a valid zeebe client token is required +ZEEBE_AUTHENTICATION_MODE=none +ZEEBE_CLIENT_ID=zeebe +ZEEBE_CLIENT_SECRET=zecret + +# Set to 'true' to enable resource based authorizations for users and groups +# This can be used to limit access for users or groups to view/update specific +# processes and decisions in Operate and Tasklist +RESOURCE_AUTHORIZATIONS_ENABLED=false \ No newline at end of file diff --git a/src/test/resources/invoices/invoice.txt b/connector-aws-s3/src/test/resources/invoices/invoice.txt similarity index 100% rename from src/test/resources/invoices/invoice.txt rename to connector-aws-s3/src/test/resources/invoices/invoice.txt diff --git a/connector-file-api/.gitignore b/connector-file-api/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/connector-file-api/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/connector-file-api/pom.xml b/connector-file-api/pom.xml new file mode 100644 index 0000000..be0f7ca --- /dev/null +++ b/connector-file-api/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + de.novatec.bpm.camunda.connector + connector-aws-s3-parent + 1.0.0-SNAPSHOT + + + de.novatec.bpm + connector-file-api + + + 17 + 17 + UTF-8 + + + + + org.projectlombok + lombok + + + org.slf4j + slf4j-api + + + org.junit.jupiter + junit-jupiter + test + + + org.mockito + mockito-junit-jupiter + test + + + org.assertj + assertj-core + test + + + + \ No newline at end of file diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/out/CloudFileCommand.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/CloudFileCommand.java similarity index 60% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/out/CloudFileCommand.java rename to connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/CloudFileCommand.java index 57a0c99..be635ed 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/out/CloudFileCommand.java +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/CloudFileCommand.java @@ -1,7 +1,7 @@ -package de.novatec.bpm.camunda.connector.aws.s3.usecase.out; +package de.novatec.bpm.camunda.connector.file.api; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.FileContent; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; +import de.novatec.bpm.camunda.connector.file.api.impl.model.FileContent; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import java.io.IOException; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/in/FileCommand.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/FileCommand.java similarity index 69% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/in/FileCommand.java rename to connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/FileCommand.java index cd48068..2f3060a 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/in/FileCommand.java +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/FileCommand.java @@ -1,6 +1,6 @@ -package de.novatec.bpm.camunda.connector.aws.s3.usecase.in; +package de.novatec.bpm.camunda.connector.file.api; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import java.io.IOException; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/out/LocalFileCommand.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/LocalFileCommand.java similarity index 82% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/out/LocalFileCommand.java rename to connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/LocalFileCommand.java index 02af449..25fd233 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/usecase/out/LocalFileCommand.java +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/LocalFileCommand.java @@ -1,4 +1,4 @@ -package de.novatec.bpm.camunda.connector.aws.s3.usecase.out; +package de.novatec.bpm.camunda.connector.file.api; import java.io.IOException; import java.nio.file.Path; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/CloudFileService.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileService.java similarity index 78% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/CloudFileService.java rename to connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileService.java index d3d3cbd..fbc7971 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/CloudFileService.java +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileService.java @@ -1,10 +1,10 @@ -package de.novatec.bpm.camunda.connector.aws.s3.domain; +package de.novatec.bpm.camunda.connector.file.api.impl; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.FileContent; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.in.FileCommand; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.CloudFileCommand; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.CloudFileCommand; +import de.novatec.bpm.camunda.connector.file.api.FileCommand; +import de.novatec.bpm.camunda.connector.file.api.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.impl.model.FileContent; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import java.io.IOException; import java.util.Objects; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/model/FileContent.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/model/FileContent.java similarity index 74% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/model/FileContent.java rename to connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/model/FileContent.java index 9dedf4b..a8bdc40 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/model/FileContent.java +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/model/FileContent.java @@ -1,4 +1,4 @@ -package de.novatec.bpm.camunda.connector.aws.s3.domain.model; +package de.novatec.bpm.camunda.connector.file.api.impl.model; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/model/RequestData.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/model/RequestData.java similarity index 82% rename from src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/model/RequestData.java rename to connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/model/RequestData.java index b15ec60..671a21a 100644 --- a/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/domain/model/RequestData.java +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/model/RequestData.java @@ -1,4 +1,4 @@ -package de.novatec.bpm.camunda.connector.aws.s3.domain.model; +package de.novatec.bpm.camunda.connector.file.api.impl.model; import lombok.Builder; import lombok.Data; diff --git a/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/domain/CloudFileServiceTest.java b/connector-file-api/src/test/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileServiceTest.java similarity index 88% rename from src/test/java/de/novatec/bpm/camunda/connector/aws/s3/domain/CloudFileServiceTest.java rename to connector-file-api/src/test/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileServiceTest.java index 9d9a2fb..7467c43 100644 --- a/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/domain/CloudFileServiceTest.java +++ b/connector-file-api/src/test/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileServiceTest.java @@ -1,9 +1,9 @@ -package de.novatec.bpm.camunda.connector.aws.s3.domain; +package de.novatec.bpm.camunda.connector.file.api.impl; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.FileContent; -import de.novatec.bpm.camunda.connector.aws.s3.domain.model.RequestData; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.CloudFileCommand; -import de.novatec.bpm.camunda.connector.aws.s3.usecase.out.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.CloudFileCommand; +import de.novatec.bpm.camunda.connector.file.api.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.impl.model.FileContent; +import de.novatec.bpm.camunda.connector.file.api.impl.model.RequestData; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -16,6 +16,8 @@ import java.nio.file.Path; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) diff --git a/docker/.env b/docker/.env new file mode 100644 index 0000000..c2a153a --- /dev/null +++ b/docker/.env @@ -0,0 +1,20 @@ +## Image versions ## +CAMUNDA_CONNECTORS_VERSION=0.18.1 +CAMUNDA_OPTIMIZE_VERSION=3.10.0 +CAMUNDA_PLATFORM_VERSION=8.2.13 +CAMUNDA_WEB_MODELER_VERSION=8.2.5 +ELASTIC_VERSION=7.17.9 +KEYCLOAK_SERVER_VERSION=19.0.3 +MAILPIT_VERSION=v1.5.4 +POSTGRES_VERSION=14.5-alpine + +## Configuration ## +# By default the zeebe api is public, when setting this to `identity` a valid zeebe client token is required +ZEEBE_AUTHENTICATION_MODE=none +ZEEBE_CLIENT_ID=zeebe +ZEEBE_CLIENT_SECRET=zecret + +# Set to 'true' to enable resource based authorizations for users and groups +# This can be used to limit access for users or groups to view/update specific +# processes and decisions in Operate and Tasklist +RESOURCE_AUTHORIZATIONS_ENABLED=false \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index b85a36c..9574f77 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ FROM maven:3.9.3-eclipse-temurin-17 COPY ../pom.xml . RUN mvn dependency:go-offline -COPY ../src /src +COPY ../connector-aws-s3/src /src RUN mvn clean package -DskipTests COPY /target/connector-aws-s3-1.0.0-SNAPSHOT.jar /connector.jar ENV AWS_ACCESS_KEY=xxx diff --git a/pom.xml b/pom.xml index 5103c6e..9a0d15e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,186 +1,177 @@ - - 4.0.0 + + 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.1.3 - + + org.springframework.boot + spring-boot-starter-parent + 3.1.3 + - connector-aws-s3 - AWS S3 connector for Camunda 8 - de.novatec.bpm.camunda.connector - connector-aws-s3 - 1.0.0-SNAPSHOT - jar + connector-aws-s3-parent + + connector-aws-s3 + connector-aws-s3-example + connector-file-api + - - - Camunda Platform Self-Managed Free Edition license - https://camunda.com/legal/terms/cloud-terms-and-conditions/camunda-cloud-self-managed-free-edition-terms/ - - - Camunda Platform Self-Managed Enterprise Edition license - - + de.novatec.bpm.camunda.connector + connector-aws-s3-parent + 1.0.0-SNAPSHOT + pom - - 17 - UTF-8 - UTF-8 + + 17 + UTF-8 + UTF-8 - - 8.2.4 - 0.22.1 + + 8.2.4 + 0.22.1 - - 2.15.2 - 3.24.2 - 5.10.0 - 5.5.0 - 2.0.9 - 2.20.144 - 1.4.11 - 1.18.28 + + 2.15.2 + 3.24.2 + 5.10.0 + 5.5.0 + 2.0.9 + 2.20.144 + 1.4.11 + 1.18.28 - - 3.3.1 - 3.11.0 - 3.6.0 - 3.1.1 - 3.3.0 - 3.3.1 - 3.5.0 - 3.1.2 - + + 3.3.1 + 3.11.0 + 3.6.0 + 3.1.1 + 3.3.0 + 3.3.1 + 3.5.0 + 3.1.2 + - - - software.amazon.awssdk - s3 - ${version.aws-java-sdk} - - - io.camunda.connector - connector-core - ${version.connectors} - - - io.camunda.connector - connector-validation - ${version.connectors} - - - io.camunda.connector - connector-test - ${version.connectors} - - - io.camunda.connector - spring-boot-starter-camunda-connectors - ${version.connectors} - - - io.camunda.spring - spring-boot-starter-camunda - ${version.spring-zeebe} - - - org.slf4j - slf4j-api - ${version.slf4j} - - - ch.qos.logback - logback-classic - ${version.logback-classic} - - - com.fasterxml.jackson.core - jackson-databind - ${version.jackson} - - - org.projectlombok - lombok - ${version.lombok} - + + + + software.amazon.awssdk + s3 + ${version.aws-java-sdk} + + + io.camunda.connector + connector-core + ${version.connectors} + + + io.camunda.connector + connector-validation + ${version.connectors} + + + io.camunda.connector + connector-test + ${version.connectors} + + + io.camunda.connector + spring-boot-starter-camunda-connectors + ${version.connectors} + + + io.camunda.spring + spring-boot-starter-camunda + ${version.spring-zeebe} + + + org.slf4j + slf4j-api + ${version.slf4j} + + + ch.qos.logback + logback-classic + ${version.logback-classic} + + + com.fasterxml.jackson.core + jackson-databind + ${version.jackson} + + + org.projectlombok + lombok + ${version.lombok} + - - - org.junit.jupiter - junit-jupiter - ${version.junit-jupiter} - test - - - org.mockito - mockito-junit-jupiter - ${version.mockito} - test - - - org.assertj - assertj-core - ${version.assertj} - test - - - org.slf4j - slf4j-jdk14 - ${version.slf4j} - test - - + + + org.junit.jupiter + junit-jupiter + ${version.junit-jupiter} + test + + + org.mockito + mockito-junit-jupiter + ${version.mockito} + test + + + org.assertj + assertj-core + ${version.assertj} + test + + + org.slf4j + slf4j-jdk14 + ${version.slf4j} + test + + + - - - - - org.apache.maven.plugins - maven-clean-plugin - ${plugin.version.maven-clean-plugin} - - - org.apache.maven.plugins - maven-dependency-plugin - ${plugin.version.maven-dependency-plugin} - - - org.apache.maven.plugins - maven-resources-plugin - ${plugin.version.maven-resources-plugin} - - - org.apache.maven.plugins - maven-compiler-plugin - ${plugin.version.maven-compiler-plugin} - - - org.apache.maven.plugins - maven-jar-plugin - ${plugin.version.maven-jar-plugin} - - - org.apache.maven.plugins - maven-install-plugin - ${plugin.version.maven-install-plugin} - - - org.apache.maven.plugins - maven-surefire-plugin - ${plugin.version.maven-surefire-plugin} - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + + org.apache.maven.plugins + maven-clean-plugin + ${plugin.version.maven-clean-plugin} + + + org.apache.maven.plugins + maven-dependency-plugin + ${plugin.version.maven-dependency-plugin} + + + org.apache.maven.plugins + maven-resources-plugin + ${plugin.version.maven-resources-plugin} + + + org.apache.maven.plugins + maven-compiler-plugin + ${plugin.version.maven-compiler-plugin} + + + org.apache.maven.plugins + maven-jar-plugin + ${plugin.version.maven-jar-plugin} + + + org.apache.maven.plugins + maven-install-plugin + ${plugin.version.maven-install-plugin} + + + org.apache.maven.plugins + maven-surefire-plugin + ${plugin.version.maven-surefire-plugin} + + + + From 2bb8999116ef7f4da82f231256d5a1ec9e771ab2 Mon Sep 17 00:00:00 2001 From: Stefan Schultz <28778796+itsmestefanjay@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:35:29 +0200 Subject: [PATCH 2/7] update path to parent --- connector-aws-s3-example/pom.xml | 7 ++++--- connector-aws-s3/pom.xml | 5 +++-- connector-file-api/pom.xml | 4 +++- docker/Dockerfile | 2 +- pom.xml | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/connector-aws-s3-example/pom.xml b/connector-aws-s3-example/pom.xml index dff1cda..713a9a5 100644 --- a/connector-aws-s3-example/pom.xml +++ b/connector-aws-s3-example/pom.xml @@ -6,7 +6,8 @@ de.novatec.bpm.camunda.connector connector-aws-s3-parent - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT + ../pom.xml de.novatec.bpm @@ -22,12 +23,12 @@ de.novatec.bpm connector-aws-s3 - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT de.novatec.bpm connector-file-api - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT io.camunda.spring diff --git a/connector-aws-s3/pom.xml b/connector-aws-s3/pom.xml index 676fbdd..b8e46b5 100644 --- a/connector-aws-s3/pom.xml +++ b/connector-aws-s3/pom.xml @@ -7,7 +7,8 @@ de.novatec.bpm.camunda.connector connector-aws-s3-parent - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT + ../pom.xml @@ -37,7 +38,7 @@ de.novatec.bpm connector-file-api - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT software.amazon.awssdk diff --git a/connector-file-api/pom.xml b/connector-file-api/pom.xml index be0f7ca..7113764 100644 --- a/connector-file-api/pom.xml +++ b/connector-file-api/pom.xml @@ -6,11 +6,13 @@ de.novatec.bpm.camunda.connector connector-aws-s3-parent - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT + ../pom.xml de.novatec.bpm connector-file-api + 1.1.0-SNAPSHOT 17 diff --git a/docker/Dockerfile b/docker/Dockerfile index 9574f77..6e53df1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,7 +3,7 @@ COPY ../pom.xml . RUN mvn dependency:go-offline COPY ../connector-aws-s3/src /src RUN mvn clean package -DskipTests -COPY /target/connector-aws-s3-1.0.0-SNAPSHOT.jar /connector.jar +COPY /target/connector-aws-s3-1.1.0-SNAPSHOT.jar /connector.jar ENV AWS_ACCESS_KEY=xxx ENV AWS_SECRET_KEY=xxx # this is not yet working, since connection to Operate fails diff --git a/pom.xml b/pom.xml index 9a0d15e..45dc275 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ de.novatec.bpm.camunda.connector connector-aws-s3-parent - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT pom From 40e60e2701d1dc347306e03e7125f5a77bfb6687 Mon Sep 17 00:00:00 2001 From: Stefan Schultz <28778796+itsmestefanjay@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:55:17 +0200 Subject: [PATCH 3/7] fix Dockerfile for new submodules --- Dockerfile | 25 +++++++++++++++++++++++++ docker/Dockerfile | 10 ---------- 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 Dockerfile delete mode 100644 docker/Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..11186ab --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM maven:3.9.3-eclipse-temurin-17 as DEPS +WORKDIR /opt/app +COPY connector-aws-s3/pom.xml connector-aws-s3/pom.xml +COPY connector-aws-s3-example/pom.xml connector-aws-s3-example/pom.xml +COPY connector-file-api/pom.xml connector-file-api/pom.xml +COPY pom.xml . + +RUN mvn -B -e -C org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline -DexcludeArtifactIds=connector-file-api,connector-aws-s3-example + +FROM maven:3.9.3-eclipse-temurin-17 as BUILDER +WORKDIR /opt/app +COPY --from=DEPS /root/.m2 /root/.m2 +COPY --from=DEPS /opt/app/ /opt/app +COPY connector-aws-s3/src /opt/app/connector-aws-s3/src +COPY connector-aws-s3-example/src /opt/app/connector-aws-s3-example/src +COPY connector-file-api/src /opt/app/connector-file-api/src + +RUN mvn -B -e clean install -DskipTests=true + +FROM arm64v8/openjdk:17 +WORKDIR /opt/app +COPY --from=BUILDER /opt/app/connector-aws-s3/target/connector-aws-s3-1.1.0-SNAPSHOT.jar /connector.jar +ENV AWS_ACCESS_KEY=xxx +ENV AWS_SECRET_KEY=xxx +CMD [ "java", "-jar", "/connector.jar" ] \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 6e53df1..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM maven:3.9.3-eclipse-temurin-17 -COPY ../pom.xml . -RUN mvn dependency:go-offline -COPY ../connector-aws-s3/src /src -RUN mvn clean package -DskipTests -COPY /target/connector-aws-s3-1.1.0-SNAPSHOT.jar /connector.jar -ENV AWS_ACCESS_KEY=xxx -ENV AWS_SECRET_KEY=xxx -# this is not yet working, since connection to Operate fails -ENTRYPOINT ["java","-jar","/connector.jar"] \ No newline at end of file From 35d2f8a74a2b3a23e4b362cb0b7c4397f9970143 Mon Sep 17 00:00:00 2001 From: Stefan Schultz <28778796+itsmestefanjay@users.noreply.github.com> Date: Sat, 16 Sep 2023 15:32:00 +0200 Subject: [PATCH 4/7] update connector sdk to 0.23.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 45dc275..e5f1bb1 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ 8.2.4 - 0.22.1 + 0.23.0 2.15.2 From 5a4cee978ae699a5784ff8ef5f1687670ed08f3f Mon Sep 17 00:00:00 2001 From: Stefan Schultz <28778796+itsmestefanjay@users.noreply.github.com> Date: Sat, 16 Sep 2023 15:48:45 +0200 Subject: [PATCH 5/7] add local file exceptions --- .../s3/adapter/out/local/LocalFileAdapter.java | 11 +++++++++-- .../adapter/out/local/LocalFileAdapterTest.java | 15 ++++++++++++--- .../api/impl/exceptions/LocalFileException.java | 9 +++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/exceptions/LocalFileException.java diff --git a/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java index 9517485..004468b 100644 --- a/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java +++ b/connector-aws-s3/src/main/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapter.java @@ -1,6 +1,7 @@ package de.novatec.bpm.camunda.connector.aws.s3.adapter.out.local; import de.novatec.bpm.camunda.connector.file.api.LocalFileCommand; +import de.novatec.bpm.camunda.connector.file.api.impl.exceptions.LocalFileException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,6 +23,9 @@ public LocalFileAdapter(Path baseDir) { public Path saveFile(byte[] content, String filePath) throws IOException { Path file = baseDir.resolve(filePath); + if (Files.exists(file)) { + throw new LocalFileException(String.format("The file already exists: %s", filePath)); + } Path directories = Files.createDirectories(file.getParent()); logger.info("Created directories {}", directories); logger.info("Writing file to {}", filePath); @@ -34,6 +38,9 @@ public Path saveFile(byte[] content, String filePath) throws IOException { public byte[] loadFile(String filePath) throws IOException { Path file = baseDir.resolve(filePath); + if (!Files.exists(file)) { + throw new LocalFileException(String.format("The file doesn't exist: %s", filePath)); + } logger.info("Reading file from {}", filePath); try (InputStream stream = Files.newInputStream(file)) { byte[] bytes = stream.readAllBytes(); @@ -48,9 +55,9 @@ public void deleteFile(String filePath) throws IOException { logger.info("Deleting file {}", filePath); boolean deleted = Files.deleteIfExists(file); if (deleted) { - logger.debug("File deleted from disk."); + logger.debug("File deleted from disk: {}", filePath); } else { - logger.debug("File didn't exist."); + logger.debug("File didn't exist: {}", filePath); } } diff --git a/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java b/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java index 1784cba..14b4891 100644 --- a/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java +++ b/connector-aws-s3/src/test/java/de/novatec/bpm/camunda/connector/aws/s3/adapter/out/local/LocalFileAdapterTest.java @@ -1,5 +1,6 @@ package de.novatec.bpm.camunda.connector.aws.s3.adapter.out.local; +import de.novatec.bpm.camunda.connector.file.api.impl.exceptions.LocalFileException; import lombok.SneakyThrows; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -36,12 +37,12 @@ void setUp() { } @Test - @SneakyThrows(NoSuchFileException.class) + @SneakyThrows(LocalFileException.class) void file_is_written_and_loaded() throws IOException { adapter.saveFile("foo".getBytes(StandardCharsets.UTF_8), "foo.txt"); byte[] bytes = adapter.loadFile("foo.txt"); assertThat(new String(bytes)).isEqualTo("foo"); - adapter.loadFile("foo.txt"); + adapter.deleteFile("foo.txt"); } @Test @@ -55,10 +56,18 @@ void parent_dirs_are_created() throws IOException { @Test void loading_missing_file_throws_exception() { assertThatThrownBy(() -> adapter.loadFile("unknown.txt")) - .isExactlyInstanceOf(NoSuchFileException.class) + .isExactlyInstanceOf(LocalFileException.class) .hasMessageContaining("unknown.txt"); } + @Test + void saving_existing_file_throws_exception() throws IOException { + adapter.saveFile("text".getBytes(StandardCharsets.UTF_8), "known.txt"); + assertThatThrownBy(() -> adapter.saveFile("new text".getBytes(StandardCharsets.UTF_8), "known.txt")) + .isExactlyInstanceOf(LocalFileException.class) + .hasMessageContaining("known.txt"); + } + @Test void deleting_missing_file_throws_no_exception() { assertThatNoException() diff --git a/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/exceptions/LocalFileException.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/exceptions/LocalFileException.java new file mode 100644 index 0000000..3c8ca62 --- /dev/null +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/exceptions/LocalFileException.java @@ -0,0 +1,9 @@ +package de.novatec.bpm.camunda.connector.file.api.impl.exceptions; + +public class LocalFileException extends RuntimeException { + + public LocalFileException(String message) { + super(message); + } + +} From 280104a7648d5585581b4542543003f58fc41012 Mon Sep 17 00:00:00 2001 From: Stefan Schultz <28778796+itsmestefanjay@users.noreply.github.com> Date: Sat, 16 Sep 2023 15:49:34 +0200 Subject: [PATCH 6/7] add remote file exceptions --- .../file/api/impl/exceptions/RemoteFileException.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/exceptions/RemoteFileException.java diff --git a/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/exceptions/RemoteFileException.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/exceptions/RemoteFileException.java new file mode 100644 index 0000000..5708f6c --- /dev/null +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/exceptions/RemoteFileException.java @@ -0,0 +1,9 @@ +package de.novatec.bpm.camunda.connector.file.api.impl.exceptions; + +public class RemoteFileException extends RuntimeException { + + public RemoteFileException(String message) { + super(message); + } + +} From 2266855bf27ca842184e7f448172dd9344b43bb7 Mon Sep 17 00:00:00 2001 From: Stefan Schultz <28778796+itsmestefanjay@users.noreply.github.com> Date: Sat, 16 Sep 2023 15:53:06 +0200 Subject: [PATCH 7/7] add develop branch to actions --- .github/workflows/maven.yml | 2 +- .../bpm/camunda/connector/file/api/impl/CloudFileService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c410017..9db2e54 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -10,7 +10,7 @@ name: Java CI with Maven on: push: - branches: [ "main" ] + branches: [ "main" , "develop" ] pull_request: branches: [ "main" ] diff --git a/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileService.java b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileService.java index fbc7971..ae1e83a 100644 --- a/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileService.java +++ b/connector-file-api/src/main/java/de/novatec/bpm/camunda/connector/file/api/impl/CloudFileService.java @@ -20,7 +20,7 @@ public CloudFileService(CloudFileCommand cloudFileCommand, LocalFileCommand loca } public RequestData uploadFile(RequestData request) throws IOException { - String contentType = Objects.requireNonNull(request.getContentType(), "Content type variable is required for operation."); + String contentType = Objects.requireNonNull(request.getContentType(), "Content type must be set"); byte[] content = localFileCommand.loadFile(request.getFilePath()); cloudFileCommand.putObject(request, FileContent.builder() .content(content)