-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ks-no/fiks-io
Fiks io
- Loading branch information
Showing
14 changed files
with
297 additions
and
672 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -5,63 +5,110 @@ | |
<parent> | ||
<groupId>no.ks.fiks.pom</groupId> | ||
<artifactId>fiks-ekstern-super-pom</artifactId> | ||
<version>0.0.3</version> | ||
<version>0.0.8</version> | ||
</parent> | ||
<groupId>no.ks.fiks</groupId> | ||
<artifactId>svarinn2-send-klient</artifactId> | ||
<artifactId>fiks-io-send-klient</artifactId> | ||
<version>${revision}${changelist}</version> | ||
<name>Svarinn2 send-klient</name> | ||
<description>Klient for å sende meldinger til SvarInn</description> | ||
<url>https://github.com/ks-no/fiks-svarinn2</url> | ||
<name>FIKS IO send-klient</name> | ||
<description>Klient for å sende meldinger til FIKS IO</description> | ||
<url>https://github.com/ks-no/fiks-io</url> | ||
<scm> | ||
<connection>scm:git:[email protected]:ks-no/fiks-svarinn2-send-klient.git</connection> | ||
<developerConnection>scm:git:[email protected]:ks-no/fiks-svarinn2-send-klient.git</developerConnection> | ||
<url>https://github.com/ks-no/fiks-svarinn2-send-klient</url> | ||
<connection>scm:git:[email protected]:ks-no/fiks-io-send-klient.git</connection> | ||
<developerConnection>scm:git:[email protected]:ks-no/fiks-io-send-klient.git</developerConnection> | ||
<url>https://github.com/ks-no/fiks-io-send-klient</url> | ||
</scm> | ||
<properties> | ||
<revision>1.0.6</revision> | ||
<revision>1.1.0</revision> | ||
<changelist>-SNAPSHOT</changelist> | ||
<commons-io.version>2.6</commons-io.version> | ||
<jackson.version>2.9.8</jackson.version> | ||
<jetty-client.version>9.4.18.v20190429</jetty-client.version> | ||
<junit-jupiter.version>5.4.2</junit-jupiter.version> | ||
<junit-platform-commons.version>1.4.2</junit-platform-commons.version> | ||
<lombok.version>1.16.18</lombok.version> | ||
<maskinporten-client.version>1.0.11</maskinporten-client.version> | ||
<mockito.version>2.24.5</mockito.version> | ||
<validation-api.version>2.0.1.Final</validation-api.version> | ||
<vavr.version>0.10.0</vavr.version> | ||
<logback-classic.version>1.2.3</logback-classic.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.16.18</version> | ||
<version>${lombok.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.validation</groupId> | ||
<artifactId>validation-api</artifactId> | ||
<version>2.0.1.Final</version> | ||
<version>${validation-api.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.vavr</groupId> | ||
<artifactId>vavr</artifactId> | ||
<version>0.10.0</version> | ||
<version>${vavr.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-client</artifactId> | ||
<version>9.4.13.v20181111</version> | ||
<version>${jetty-client.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>2.9.8</version> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.9.8</version> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.6</version> | ||
<version>${commons-io.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>no.ks.fiks</groupId> | ||
<artifactId>maskinporten-client</artifactId> | ||
<version>1.0.8</version> | ||
<version>${maskinporten-client.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit-jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit-jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-commons</artifactId> | ||
<version>${junit-platform-commons.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>${logback-classic.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>${mockito.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-junit-jupiter</artifactId> | ||
<version>${mockito.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
|
2 changes: 1 addition & 1 deletion
2
...arinn2/klient/AuthenticationStrategy.java → ...iks/io/klient/AuthenticationStrategy.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package no.ks.fiks.svarinn2.klient; | ||
package no.ks.fiks.io.klient; | ||
|
||
import org.eclipse.jetty.client.api.Request; | ||
|
||
|
6 changes: 3 additions & 3 deletions
6
...svarinn2/klient/SvarInnHttpException.java → ...s/fiks/io/klient/FiksIOHttpException.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
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
90 changes: 90 additions & 0 deletions
90
src/main/java/no/ks/fiks/io/klient/FiksIOUtsendingKlientBuilder.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,90 @@ | ||
package no.ks.fiks.io.klient; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import lombok.NonNull; | ||
import org.eclipse.jetty.client.HttpClient; | ||
import org.eclipse.jetty.client.api.Request; | ||
|
||
import java.util.function.Function; | ||
|
||
/** | ||
* Builder that must be used to create | ||
*/ | ||
public class FiksIOUtsendingKlientBuilder { | ||
|
||
private HttpClient httpClient = new HttpClient(); | ||
|
||
private String scheme = "https"; | ||
|
||
private String hostName; | ||
|
||
private Integer portNumber; | ||
|
||
private AuthenticationStrategy authenticationStrategy; | ||
|
||
private Function<Request, Request> requestInterceptor; | ||
|
||
private ObjectMapper objectMapper = new ObjectMapper().findAndRegisterModules(); | ||
|
||
public FiksIOUtsendingKlientBuilder withHttpClient(@NonNull final HttpClient httpClient) { | ||
this.httpClient = httpClient; | ||
return this; | ||
} | ||
|
||
public FiksIOUtsendingKlientBuilder withScheme(@NonNull final String scheme) { | ||
this.scheme = scheme; | ||
return this; | ||
} | ||
|
||
public FiksIOUtsendingKlientBuilder withHostName(@NonNull final String hostName) { | ||
this.hostName = hostName; | ||
return this; | ||
} | ||
|
||
public FiksIOUtsendingKlientBuilder withPortNumber(@NonNull final Integer portNumber) { | ||
this.portNumber = portNumber; | ||
return this; | ||
} | ||
|
||
public FiksIOUtsendingKlientBuilder withAuthenticationStrategy(@NonNull final AuthenticationStrategy authenticationStrategy) { | ||
this.authenticationStrategy = authenticationStrategy; | ||
return this; | ||
} | ||
|
||
public FiksIOUtsendingKlientBuilder withRequestInterceptor(Function<Request, Request> requestInterceptor) { | ||
this.requestInterceptor = requestInterceptor; | ||
return this; | ||
} | ||
|
||
public FiksIOUtsendingKlientBuilder withObjectMapper(final ObjectMapper objectMapper) { | ||
this.objectMapper = objectMapper; | ||
return this; | ||
} | ||
|
||
public FiksIOUtsendingKlient build() { | ||
objectMapper = new ObjectMapper(); | ||
return new FiksIOUtsendingKlient( | ||
createRequestFactory(), | ||
authenticationStrategy, | ||
getOrCreateRequestInterceptor(), | ||
getOrCreateObjectMapper() | ||
); | ||
} | ||
|
||
private RequestFactory createRequestFactory() { | ||
return RequestFactoryImpl.builder() | ||
.client(httpClient) | ||
.scheme(scheme) | ||
.hostName(hostName) | ||
.portNumber(portNumber) | ||
.build(); | ||
} | ||
|
||
private Function<Request, Request> getOrCreateRequestInterceptor() { | ||
return requestInterceptor == null ? request -> request : requestInterceptor; | ||
} | ||
|
||
private ObjectMapper getOrCreateObjectMapper() { | ||
return objectMapper == null ? new ObjectMapper().findAndRegisterModules() : objectMapper; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
.../klient/MeldingSpesifikasjonApiModel.java → .../klient/MeldingSpesifikasjonApiModel.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package no.ks.fiks.svarinn2.klient; | ||
package no.ks.fiks.io.klient; | ||
|
||
import lombok.Builder; | ||
import lombok.Value; | ||
|
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,8 @@ | ||
package no.ks.fiks.io.klient; | ||
|
||
import org.eclipse.jetty.client.api.ContentProvider; | ||
import org.eclipse.jetty.client.api.Request; | ||
|
||
public interface RequestFactory { | ||
Request createSendToFiksIORequest(ContentProvider contentProvider); | ||
} |
Oops, something went wrong.