Skip to content
Snippets Groups Projects
Commit 874d5847 authored by Martin Vogel's avatar Martin Vogel
Browse files

Merge branch 'main' into 'renovate/jackson-annotations.version'

# Conflicts:
#   pom.xml
parents cb7b2842 50e320f2
No related branches found
No related tags found
1 merge request!195fix(deps): update dependency com.fasterxml.jackson.core:jackson-annotations to v2.15.2
Showing
with 193 additions and 70 deletions
......@@ -60,6 +60,7 @@ package:
paths:
- api/target/*.jar
- core/target/*.jar
- cli/target/*.jar
- client/target/*.jar
- integration-tests/target/*.jar
expire_in: 1 day
......@@ -70,6 +71,6 @@ deploy:
stage: deploy
before_script: *gpg-setup
script:
- ./mvnw $MAVEN_CLI_OPTS deploy -DskipTests -P '!integration-tests' -Pgpg-sign
- ./mvnw $MAVEN_CLI_OPTS deploy -DskipTests -P '!integration-tests' -P '!cli' -Pgpg-sign
needs:
- package
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files: api/src/* client/src/* core/src/* integration-tests/src/*
api/README.md client/README.md core/README.md
Files: api/src/* client/src/* cli/src/* core/src/* integration-tests/src/*
api/README.md cli/README.md core/README.md
README.md CHANGELOG.md SECURITY.md
Copyright: 2022 FIT-Connect contributors
License: EUPL-1.2
......@@ -10,7 +10,7 @@ Files: .mvn/wrapper/* mvnw mvnw.cmd
Copyright: 2013-2022 The Apache Software Foundation
License: Apache-2.0
Files: pom.xml api/pom.xml core/pom.xml client/pom.xml integration-tests/pom.xml
Files: pom.xml api/pom.xml core/pom.xml client/pom.xml cli/pom.xml integration-tests/pom.xml
.gitlab-ci.yml .gitignore .m2/release.xml
renovate.json checkstyle.xml checkstyle-suppressions.xml config.yml
Copyright: 2022 FIT-Connect contributors
......
......@@ -4,7 +4,6 @@
<br/>
![](https://git.fitko.de/fit-connect/sdk-java/badges/main/pipeline.svg)
## About the FIT-Connect Java SDK
The Java SDK for FIT-Connect enables to build clients for senders and subscribers without directly interacting with any REST-Endpoints.
......@@ -77,11 +76,11 @@ If you use a snapshot version, please add the maven snapshot repo to your pom.
## Modules
See the projects' module documentation for more specific information:
See the projects' module documentation and the javadoc on the badge for more specific information:
* [API Module ](api/README.md)
* [Core Module ](core/README.md)
* [Client Module ](client/README.md)
* [API Module ](api/README.md) </br> [![javadoc](https://javadoc.io/badge2/dev.fitko.fitconnect.sdk/api/javadoc.svg)](https://javadoc.io/doc/dev.fitko.fitconnect.sdk/api)
* [Core Module ](core/README.md) </br>[![javadoc](https://javadoc.io/badge2/dev.fitko.fitconnect.sdk/core/javadoc.svg)](https://javadoc.io/doc/dev.fitko.fitconnect.sdk/core)
* [Client Module ](client/README.md) </br> [![javadoc](https://javadoc.io/badge2/dev.fitko.fitconnect.sdk/client/javadoc.svg)](https://javadoc.io/doc/dev.fitko.fitconnect.sdk/client)
* [Integration-Test Module ](integration-tests/README.md)
## Setup
......
File moved
<?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">
<parent>
<artifactId>sdk-java</artifactId>
<groupId>dev.fitko.fitconnect.sdk</groupId>
<version>1.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cli</artifactId>
<packaging>jar</packaging>
<name>FIT-Connect Java SDK - Command-Line Interface</name>
<dependencies>
<dependency>
<groupId>dev.fitko.fitconnect.sdk</groupId>
<artifactId>api</artifactId>
</dependency>
<dependency>
<groupId>dev.fitko.fitconnect.sdk</groupId>
<artifactId>client</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
</dependency>
<!-- Tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>dev.fitko.fitconnect.cli.CommandLineRunner</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>fit-connect-client</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package dev.fitko.fitconnect.client.cli;
package dev.fitko.fitconnect.cli;
import dev.fitko.fitconnect.api.domain.model.submission.SentSubmission;
import dev.fitko.fitconnect.api.domain.model.submission.SubmissionForPickup;
import dev.fitko.fitconnect.api.exceptions.internal.BatchImportException;
import dev.fitko.fitconnect.cli.batch.ImportRecord;
import dev.fitko.fitconnect.cli.commands.GetAllSubmissionsCommand;
import dev.fitko.fitconnect.cli.commands.GetOneSubmissionCommand;
import dev.fitko.fitconnect.cli.commands.ListAllSubmissionsCommand;
import dev.fitko.fitconnect.cli.commands.SendBatchCommand;
import dev.fitko.fitconnect.cli.commands.SendSubmissionCommand;
import dev.fitko.fitconnect.client.SenderClient;
import dev.fitko.fitconnect.client.SubscriberClient;
import dev.fitko.fitconnect.client.cli.batch.BatchImporter;
import dev.fitko.fitconnect.client.cli.batch.ImportRecord;
import dev.fitko.fitconnect.client.cli.commands.GetAllSubmissionsCommand;
import dev.fitko.fitconnect.client.cli.commands.GetOneSubmissionCommand;
import dev.fitko.fitconnect.client.cli.commands.ListAllSubmissionsCommand;
import dev.fitko.fitconnect.client.cli.commands.SendBatchCommand;
import dev.fitko.fitconnect.client.cli.commands.SendSubmissionCommand;
import dev.fitko.fitconnect.client.cli.util.AttachmentDataType;
import dev.fitko.fitconnect.cli.batch.BatchImporter;
import dev.fitko.fitconnect.cli.util.AttachmentDataType;
import dev.fitko.fitconnect.client.sender.model.Attachment;
import dev.fitko.fitconnect.client.sender.model.SendableSubmission;
import dev.fitko.fitconnect.client.subscriber.ReceivedSubmission;
......@@ -22,6 +22,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
......@@ -115,7 +116,7 @@ class CommandExecutor {
final SendableSubmission sendableSubmission = SendableSubmission.Builder()
.setDestination(sendSubmissionCommand.destinationId)
.setServiceType(sendSubmissionCommand.leikaKey, sendSubmissionCommand.serviceName)
.setJsonData(getDataAsString(sendSubmissionCommand.data), sendSubmissionCommand.schemaUri)
.setJsonData(getDataAsString(sendSubmissionCommand.data), URI.create(sendSubmissionCommand.schemaUri))
.addAttachments(attachments)
.build();
......@@ -127,7 +128,7 @@ class CommandExecutor {
final SendableSubmission sendableSubmission = SendableSubmission.Builder()
.setDestination(sendSubmissionCommand.destinationId)
.setServiceType(sendSubmissionCommand.leikaKey, sendSubmissionCommand.serviceName)
.setXmlData(getDataAsString(sendSubmissionCommand.data), sendSubmissionCommand.schemaUri)
.setXmlData(getDataAsString(sendSubmissionCommand.data), URI.create(sendSubmissionCommand.schemaUri))
.addAttachments(attachments)
.build();
......
package dev.fitko.fitconnect.client.cli;
package dev.fitko.fitconnect.cli;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.ParameterException;
import dev.fitko.fitconnect.client.SenderClient;
import dev.fitko.fitconnect.client.SubscriberClient;
import dev.fitko.fitconnect.client.cli.batch.CsvImporter;
import dev.fitko.fitconnect.client.cli.commands.*;
import dev.fitko.fitconnect.cli.batch.CsvImporter;
import dev.fitko.fitconnect.cli.commands.GetAllSubmissionsCommand;
import dev.fitko.fitconnect.cli.commands.GetOneSubmissionCommand;
import dev.fitko.fitconnect.cli.commands.ListAllSubmissionsCommand;
import dev.fitko.fitconnect.cli.commands.SendBatchCommand;
import dev.fitko.fitconnect.cli.commands.SendSubmissionCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -27,21 +31,21 @@ class CommandLineClient {
CommandLineClient(final SenderClient senderClient, final SubscriberClient subscriberClient) {
this.sendSubmissionCommand = new SendSubmissionCommand();
this.listAllSubmissionsCommand = new ListAllSubmissionsCommand();
this.getOneSubmissionCommand = new GetOneSubmissionCommand();
this.getAllSubmissionsCommand = new GetAllSubmissionsCommand();
this.sendBatchCommand = new SendBatchCommand();
sendSubmissionCommand = new SendSubmissionCommand();
listAllSubmissionsCommand = new ListAllSubmissionsCommand();
getOneSubmissionCommand = new GetOneSubmissionCommand();
getAllSubmissionsCommand = new GetAllSubmissionsCommand();
sendBatchCommand = new SendBatchCommand();
this.commandExecutor = new CommandExecutor(senderClient, subscriberClient, new CsvImporter());
commandExecutor = new CommandExecutor(senderClient, subscriberClient, new CsvImporter());
this.jc = getJCommander();
jc = getJCommander();
}
void run(final String... args) {
final var parsedCommand = parseCommandFromArguments(args);
if (parsedCommand == null) {
this.jc.usage();
jc.usage();
return;
}
try {
......@@ -53,30 +57,30 @@ class CommandLineClient {
private JCommander getJCommander() {
return JCommander.newBuilder()
.addCommand(this.sendSubmissionCommand)
.addCommand(this.listAllSubmissionsCommand)
.addCommand(this.getOneSubmissionCommand)
.addCommand(this.getAllSubmissionsCommand)
.addCommand(this.sendBatchCommand)
.addCommand(sendSubmissionCommand)
.addCommand(listAllSubmissionsCommand)
.addCommand(getOneSubmissionCommand)
.addCommand(getAllSubmissionsCommand)
.addCommand(sendBatchCommand)
.build();
}
private void executeCommand(final String parsedCommand) throws IOException {
switch (parsedCommand) {
case SendSubmissionCommand.SEND_CMD_NAME:
this.commandExecutor.sendSubmission(this.sendSubmissionCommand);
commandExecutor.sendSubmission(sendSubmissionCommand);
break;
case ListAllSubmissionsCommand.LIST_CMD_NAME:
this.commandExecutor.listSubmissions(this.listAllSubmissionsCommand);
commandExecutor.listSubmissions(listAllSubmissionsCommand);
break;
case GetOneSubmissionCommand.GET_CMD_NAME:
this.commandExecutor.getOneSubmission(this.getOneSubmissionCommand);
commandExecutor.getOneSubmission(getOneSubmissionCommand);
break;
case GetAllSubmissionsCommand.GET_ALL_CMD_NAME:
this.commandExecutor.getAllSubmissions(this.getAllSubmissionsCommand);
commandExecutor.getAllSubmissions(getAllSubmissionsCommand);
break;
case SendBatchCommand.SEND_BATCH_CMD_NAME:
this.commandExecutor.sendBatch(this.sendBatchCommand);
commandExecutor.sendBatch(sendBatchCommand);
break;
default:
break;
......@@ -85,8 +89,8 @@ class CommandLineClient {
private String parseCommandFromArguments(final String[] args) {
try {
this.jc.parse(args);
return this.jc.getParsedCommand();
jc.parse(args);
return jc.getParsedCommand();
} catch (final ParameterException e) {
LOGGER.error(e.getMessage(), "\n");
return null;
......
package dev.fitko.fitconnect.client.cli;
package dev.fitko.fitconnect.cli;
import dev.fitko.fitconnect.api.config.ApplicationConfig;
import dev.fitko.fitconnect.client.SenderClient;
......
package dev.fitko.fitconnect.client.cli.batch;
package dev.fitko.fitconnect.cli.batch;
import java.io.IOException;
import java.util.List;
......
package dev.fitko.fitconnect.client.cli.batch;
package dev.fitko.fitconnect.cli.batch;
import com.opencsv.bean.CsvToBeanBuilder;
import com.opencsv.bean.exceptionhandler.CsvExceptionHandler;
......
package dev.fitko.fitconnect.client.cli.batch;
package dev.fitko.fitconnect.cli.batch;
import dev.fitko.fitconnect.client.cli.util.AttachmentDataType;
import dev.fitko.fitconnect.cli.util.AttachmentDataType;
import lombok.Data;
import java.net.URI;
import java.util.UUID;
@Data
......@@ -13,7 +12,7 @@ public class ImportRecord {
private String serviceName;
private String leikaKey;
private String data;
private URI submissionDataSchemaUri;
private String submissionDataSchemaUri;
private AttachmentDataType dataType;
private String attachments;
}
package dev.fitko.fitconnect.client.cli.commands;
package dev.fitko.fitconnect.cli.commands;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import dev.fitko.fitconnect.client.cli.util.UUIDConverter;
import dev.fitko.fitconnect.client.cli.util.UUIDValidator;
import dev.fitko.fitconnect.cli.util.UUIDConverter;
import dev.fitko.fitconnect.cli.util.UUIDValidator;
import java.util.UUID;
......
package dev.fitko.fitconnect.client.cli.commands;
package dev.fitko.fitconnect.cli.commands;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import dev.fitko.fitconnect.client.cli.util.UUIDConverter;
import dev.fitko.fitconnect.client.cli.util.UUIDValidator;
import dev.fitko.fitconnect.cli.util.UUIDConverter;
import dev.fitko.fitconnect.cli.util.UUIDValidator;
import java.util.UUID;
......
package dev.fitko.fitconnect.client.cli.commands;
package dev.fitko.fitconnect.cli.commands;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import dev.fitko.fitconnect.client.cli.util.UUIDConverter;
import dev.fitko.fitconnect.client.cli.util.UUIDValidator;
import dev.fitko.fitconnect.cli.util.UUIDConverter;
import dev.fitko.fitconnect.cli.util.UUIDValidator;
import java.util.UUID;
......
package dev.fitko.fitconnect.client.cli.commands;
package dev.fitko.fitconnect.cli.commands;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
......
package dev.fitko.fitconnect.client.cli.commands;
package dev.fitko.fitconnect.cli.commands;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import dev.fitko.fitconnect.client.cli.util.AttachmentDataType;
import dev.fitko.fitconnect.client.cli.util.UUIDConverter;
import dev.fitko.fitconnect.client.cli.util.UUIDValidator;
import dev.fitko.fitconnect.cli.util.AttachmentDataType;
import dev.fitko.fitconnect.cli.util.UUIDConverter;
import dev.fitko.fitconnect.cli.util.UUIDValidator;
import lombok.Data;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
......@@ -47,8 +46,8 @@ public class SendSubmissionCommand {
public
List<String> attachments = Collections.emptyList();
@Parameter(names = "--schemaUri", description = "Schema URI to be used on subscriber side", required = true)
@Parameter(names = "--schemaUri", description = "Schema URI to validate submission data", required = true)
public
URI schemaUri;
String schemaUri;
}
package dev.fitko.fitconnect.client.cli.util;
package dev.fitko.fitconnect.cli.util;
import dev.fitko.fitconnect.api.domain.model.metadata.data.MimeType;
......
package dev.fitko.fitconnect.client.cli.util;
package dev.fitko.fitconnect.cli.util;
import com.beust.jcommander.converters.BaseConverter;
......
package dev.fitko.fitconnect.client.cli.util;
package dev.fitko.fitconnect.cli.util;
import com.beust.jcommander.IParameterValidator;
import com.beust.jcommander.ParameterException;
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>
%d{HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{36}) %msg %n
</pattern>
</encoder>
</appender>
<logger name="okhttp3.OkHttpClient" level="info" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
</configuration>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment