diff --git a/api/pom.xml b/api/pom.xml
new file mode 100644
index 0000000..fec27ac
--- /dev/null
+++ b/api/pom.xml
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+
+ net.interfax
+ parent
+ 0.20-SNAPSHOT
+ ../parent/pom.xml
+
+
+ api
+ bundle
+
+
+ net.interfax.rest.client
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+
+
+
+
diff --git a/src/main/java/net/interfax/rest/client/InterFAX.java b/api/src/main/java/net/interfax/rest/client/InterFAX.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/InterFAX.java
rename to api/src/main/java/net/interfax/rest/client/InterFAX.java
diff --git a/src/main/java/net/interfax/rest/client/domain/APIResponse.java b/api/src/main/java/net/interfax/rest/client/domain/APIResponse.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/APIResponse.java
rename to api/src/main/java/net/interfax/rest/client/domain/APIResponse.java
diff --git a/src/main/java/net/interfax/rest/client/domain/DocumentUploadSessionOptions.java b/api/src/main/java/net/interfax/rest/client/domain/DocumentUploadSessionOptions.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/DocumentUploadSessionOptions.java
rename to api/src/main/java/net/interfax/rest/client/domain/DocumentUploadSessionOptions.java
diff --git a/src/main/java/net/interfax/rest/client/domain/GetFaxListOptions.java b/api/src/main/java/net/interfax/rest/client/domain/GetFaxListOptions.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/GetFaxListOptions.java
rename to api/src/main/java/net/interfax/rest/client/domain/GetFaxListOptions.java
diff --git a/src/main/java/net/interfax/rest/client/domain/GetInboundFaxListOptions.java b/api/src/main/java/net/interfax/rest/client/domain/GetInboundFaxListOptions.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/GetInboundFaxListOptions.java
rename to api/src/main/java/net/interfax/rest/client/domain/GetInboundFaxListOptions.java
diff --git a/src/main/java/net/interfax/rest/client/domain/GetUploadedDocumentsListOptions.java b/api/src/main/java/net/interfax/rest/client/domain/GetUploadedDocumentsListOptions.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/GetUploadedDocumentsListOptions.java
rename to api/src/main/java/net/interfax/rest/client/domain/GetUploadedDocumentsListOptions.java
diff --git a/src/main/java/net/interfax/rest/client/domain/InboundFaxStructure.java b/api/src/main/java/net/interfax/rest/client/domain/InboundFaxStructure.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/InboundFaxStructure.java
rename to api/src/main/java/net/interfax/rest/client/domain/InboundFaxStructure.java
diff --git a/src/main/java/net/interfax/rest/client/domain/InboundFaxesEmailsStructure.java b/api/src/main/java/net/interfax/rest/client/domain/InboundFaxesEmailsStructure.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/InboundFaxesEmailsStructure.java
rename to api/src/main/java/net/interfax/rest/client/domain/InboundFaxesEmailsStructure.java
diff --git a/src/main/java/net/interfax/rest/client/domain/OutboundFaxStructure.java b/api/src/main/java/net/interfax/rest/client/domain/OutboundFaxStructure.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/OutboundFaxStructure.java
rename to api/src/main/java/net/interfax/rest/client/domain/OutboundFaxStructure.java
diff --git a/src/main/java/net/interfax/rest/client/domain/SearchFaxOptions.java b/api/src/main/java/net/interfax/rest/client/domain/SearchFaxOptions.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/SearchFaxOptions.java
rename to api/src/main/java/net/interfax/rest/client/domain/SearchFaxOptions.java
diff --git a/src/main/java/net/interfax/rest/client/domain/SendFaxOptions.java b/api/src/main/java/net/interfax/rest/client/domain/SendFaxOptions.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/SendFaxOptions.java
rename to api/src/main/java/net/interfax/rest/client/domain/SendFaxOptions.java
diff --git a/src/main/java/net/interfax/rest/client/domain/UploadedDocumentStatus.java b/api/src/main/java/net/interfax/rest/client/domain/UploadedDocumentStatus.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/UploadedDocumentStatus.java
rename to api/src/main/java/net/interfax/rest/client/domain/UploadedDocumentStatus.java
diff --git a/src/main/java/net/interfax/rest/client/domain/enums/Disposition.java b/api/src/main/java/net/interfax/rest/client/domain/enums/Disposition.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/enums/Disposition.java
rename to api/src/main/java/net/interfax/rest/client/domain/enums/Disposition.java
diff --git a/src/main/java/net/interfax/rest/client/domain/enums/Sharing.java b/api/src/main/java/net/interfax/rest/client/domain/enums/Sharing.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/domain/enums/Sharing.java
rename to api/src/main/java/net/interfax/rest/client/domain/enums/Sharing.java
diff --git a/src/main/java/net/interfax/rest/client/exception/UnsuccessfulStatusCodeException.java b/api/src/main/java/net/interfax/rest/client/exception/UnsuccessfulStatusCodeException.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/exception/UnsuccessfulStatusCodeException.java
rename to api/src/main/java/net/interfax/rest/client/exception/UnsuccessfulStatusCodeException.java
diff --git a/common/pom.xml b/common/pom.xml
new file mode 100644
index 0000000..4a12981
--- /dev/null
+++ b/common/pom.xml
@@ -0,0 +1,48 @@
+
+
+ 4.0.0
+
+
+ net.interfax
+ parent
+ 0.20-SNAPSHOT
+ ../parent/pom.xml
+
+
+ common
+ bundle
+
+
+ net.interfax.rest.client.config
+
+
+
+
+ net.interfax
+ api
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.apache.commons
+ commons-lang3
+
+
+ com.google.guava
+ guava
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-yaml
+
+
+
+
diff --git a/src/main/java/net/interfax/rest/client/config/ClientConfig.java b/common/src/main/java/net/interfax/rest/client/config/ClientConfig.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/config/ClientConfig.java
rename to common/src/main/java/net/interfax/rest/client/config/ClientConfig.java
diff --git a/src/main/java/net/interfax/rest/client/config/ClientCredentials.java b/common/src/main/java/net/interfax/rest/client/config/ClientCredentials.java
similarity index 71%
rename from src/main/java/net/interfax/rest/client/config/ClientCredentials.java
rename to common/src/main/java/net/interfax/rest/client/config/ClientCredentials.java
index 903abe4..c926386 100644
--- a/src/main/java/net/interfax/rest/client/config/ClientCredentials.java
+++ b/common/src/main/java/net/interfax/rest/client/config/ClientCredentials.java
@@ -5,6 +5,15 @@ public class ClientCredentials {
private String username;
private String password;
+ public ClientCredentials() {
+
+ }
+
+ public ClientCredentials(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
public String getUsername() {
return username;
}
@@ -20,4 +29,5 @@ public String getPassword() {
public void setPassword(final String password) {
this.password = password;
}
+
}
diff --git a/src/main/java/net/interfax/rest/client/config/ConfigLoader.java b/common/src/main/java/net/interfax/rest/client/config/ConfigLoader.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/config/ConfigLoader.java
rename to common/src/main/java/net/interfax/rest/client/config/ConfigLoader.java
diff --git a/src/main/java/net/interfax/rest/client/config/EnvironmentVariableLookup.java b/common/src/main/java/net/interfax/rest/client/config/EnvironmentVariableLookup.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/config/EnvironmentVariableLookup.java
rename to common/src/main/java/net/interfax/rest/client/config/EnvironmentVariableLookup.java
diff --git a/src/main/java/net/interfax/rest/client/config/InterFAX.java b/common/src/main/java/net/interfax/rest/client/config/InterFAX.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/config/InterFAX.java
rename to common/src/main/java/net/interfax/rest/client/config/InterFAX.java
diff --git a/common/src/main/java/net/interfax/rest/client/config/spi/ContentTypeDetector.java b/common/src/main/java/net/interfax/rest/client/config/spi/ContentTypeDetector.java
new file mode 100644
index 0000000..a7fd549
--- /dev/null
+++ b/common/src/main/java/net/interfax/rest/client/config/spi/ContentTypeDetector.java
@@ -0,0 +1,8 @@
+package net.interfax.rest.client.config.spi;
+
+import java.io.File;
+import java.io.IOException;
+
+public interface ContentTypeDetector {
+ String detect(File file) throws IOException;
+}
diff --git a/common/src/main/java/net/interfax/rest/client/config/spi/UriEncoder.java b/common/src/main/java/net/interfax/rest/client/config/spi/UriEncoder.java
new file mode 100644
index 0000000..505ac83
--- /dev/null
+++ b/common/src/main/java/net/interfax/rest/client/config/spi/UriEncoder.java
@@ -0,0 +1,7 @@
+package net.interfax.rest.client.config.spi;
+
+public interface UriEncoder {
+
+ String encode(String raw);
+
+}
diff --git a/src/main/resources/interfax-api-config.yaml b/common/src/main/resources/interfax-api-config.yaml
similarity index 100%
rename from src/main/resources/interfax-api-config.yaml
rename to common/src/main/resources/interfax-api-config.yaml
diff --git a/src/main/resources/interfax-api-credentials.yaml b/common/src/main/resources/interfax-api-credentials.yaml
similarity index 100%
rename from src/main/resources/interfax-api-credentials.yaml
rename to common/src/main/resources/interfax-api-credentials.yaml
diff --git a/jaxrs/cxf/pom.xml b/jaxrs/cxf/pom.xml
new file mode 100644
index 0000000..3a48184
--- /dev/null
+++ b/jaxrs/cxf/pom.xml
@@ -0,0 +1,47 @@
+
+
+ 4.0.0
+
+
+ net.interfax
+ jaxrs
+ 0.20-SNAPSHOT
+
+
+ jaxrs-client-cxf
+ bundle
+
+
+ net.interfax.rest.client.jaxrs.cxf
+
+
+
+
+ net.interfax
+ jaxrs-client-shared
+
+
+
+ org.apache.cxf
+ cxf-rt-rs-client
+
+
+ org.apache.cxf
+ cxf-rt-features-logging
+
+
+ com.fasterxml.jackson.jaxrs
+ jackson-jaxrs-json-provider
+
+
+
+ net.interfax
+ jaxrs-client-test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+
+
diff --git a/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/BasicInterceptor.java b/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/BasicInterceptor.java
new file mode 100644
index 0000000..f199511
--- /dev/null
+++ b/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/BasicInterceptor.java
@@ -0,0 +1,18 @@
+package net.interfax.rest.client.jaxrs.cxf;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+
+public class BasicInterceptor implements ClientRequestFilter {
+
+ private final String credentials;
+
+ public BasicInterceptor(String credentials) {
+ this.credentials = credentials;
+ }
+
+ @Override
+ public void filter(ClientRequestContext requestContext) {
+ requestContext.getHeaders().add("Authorization", "Basic " + credentials);
+ }
+}
diff --git a/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/CxfClient.java b/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/CxfClient.java
new file mode 100644
index 0000000..5cf3462
--- /dev/null
+++ b/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/CxfClient.java
@@ -0,0 +1,79 @@
+package net.interfax.rest.client.jaxrs.cxf;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+import net.interfax.rest.client.InterFAX;
+import net.interfax.rest.client.config.ClientConfig;
+import net.interfax.rest.client.config.ClientCredentials;
+import net.interfax.rest.client.config.ConfigLoader;
+import net.interfax.rest.client.config.spi.ContentTypeDetector;
+import net.interfax.rest.client.config.spi.UriEncoder;
+import net.interfax.rest.client.jaxrs.cxf.multipart.AttachmentMultiPart;
+import net.interfax.rest.client.jaxrs.shared.AbstractJaxRsInterFAXClient;
+import net.interfax.rest.client.jaxrs.shared.FaxMultiPart;
+import net.interfax.rest.client.jaxrs.shared.JdkEncoder;
+import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.jaxrs.provider.MultipartProvider;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import java.util.Base64;
+import java.util.concurrent.TimeUnit;
+
+public class CxfClient extends AbstractJaxRsInterFAXClient implements InterFAX {
+
+ public CxfClient() {
+ this(
+ new ConfigLoader<>(ClientConfig.class, "interfax-api-config.yaml")
+ .getTestConfig(),
+ new ConfigLoader<>(ClientCredentials.class, "interfax-api-credentials.yaml")
+ .getTestConfig()
+ );
+ }
+ public CxfClient(ClientCredentials clientCredentials) {
+ this(
+ new ConfigLoader<>(ClientConfig.class, "interfax-api-config.yaml")
+ .getTestConfig(),
+ clientCredentials
+ );
+ }
+
+ public CxfClient(ClientConfig clientConfig, ClientCredentials clientCredentials) {
+ super(clientConfig, clientCredentials);
+ }
+
+ public CxfClient(ClientConfig clientConfig, ClientCredentials clientCredentials, ContentTypeDetector detector) {
+ super(clientConfig, clientCredentials, detector);
+ }
+
+ protected Client initializeClient(ClientCredentials clientCredentials) {
+ // build client
+ String credentials = Base64.getEncoder().encodeToString(
+ (clientCredentials.getUsername() + ":" + clientCredentials.getPassword()).getBytes()
+ );
+ Client client = ClientBuilder.newClient();
+ client.property("http.receive.timeout", TimeUnit.MINUTES.toMillis(1));
+ client.register(new BasicInterceptor(credentials));
+ client.register(new MultipartProvider());
+ client.register(new JacksonJsonProvider());
+ LoggingFeature loggingFeature = new LoggingFeature();
+ loggingFeature.setLogBinary(false);
+ loggingFeature.setLogMultipart(false);
+ client.register(loggingFeature);
+
+ // required for the document upload API, to set Content-Length header
+ System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
+
+ return client;
+ }
+
+ @Override
+ protected FaxMultiPart createMultiPart() {
+ return new AttachmentMultiPart();
+ }
+
+ @Override
+ protected UriEncoder createUriEncoder() {
+ return new JdkEncoder();
+ }
+
+}
\ No newline at end of file
diff --git a/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/multipart/AttachmentMultiPart.java b/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/multipart/AttachmentMultiPart.java
new file mode 100644
index 0000000..8b90cce
--- /dev/null
+++ b/jaxrs/cxf/src/main/java/net/interfax/rest/client/jaxrs/cxf/multipart/AttachmentMultiPart.java
@@ -0,0 +1,49 @@
+package net.interfax.rest.client.jaxrs.cxf.multipart;
+
+import net.interfax.rest.client.jaxrs.shared.FaxMultiPart;
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.apache.cxf.jaxrs.ext.multipart.ContentDisposition;
+import org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource;
+import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+import javax.ws.rs.core.MediaType;
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AttachmentMultiPart implements FaxMultiPart {
+
+ private static final MediaType MULTIPART_MIXED_MEDIA_TYPE = new MediaType("multipart", "mixed");
+
+ private final List attachments = new ArrayList<>();
+
+ @Override
+ public void add(String entityName, File file, MediaType mediaType) {
+ String type = mediaType.toString();
+ attachments.add(new Attachment(
+ entityName, type, new DataHandler(new FileDataSource(file), type)
+ ));
+ }
+
+ @Override
+ public void add(String entityName, InputStream inputStream, MediaType mediaType) {
+ String type = mediaType.toString();
+ attachments.add(new Attachment(
+ entityName, type, new DataHandler(new InputStreamDataSource(inputStream, type, entityName))
+ ));
+ }
+
+ @Override
+ public MediaType getMediaType() {
+ return MULTIPART_MIXED_MEDIA_TYPE;
+ }
+
+ @Override
+ public Object getMultiPart() {
+ return new MultipartBody(attachments);
+ }
+
+}
diff --git a/jaxrs/cxf/src/test/java/net/interfax/rest/client/jaxrs/cxf/CxfClientTest.java b/jaxrs/cxf/src/test/java/net/interfax/rest/client/jaxrs/cxf/CxfClientTest.java
new file mode 100644
index 0000000..43d7e8e
--- /dev/null
+++ b/jaxrs/cxf/src/test/java/net/interfax/rest/client/jaxrs/cxf/CxfClientTest.java
@@ -0,0 +1,19 @@
+package net.interfax.rest.client.jaxrs.cxf;
+
+import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
+import net.interfax.rest.client.InterFAX;
+import net.interfax.rest.client.test.InterFAXClientTest;
+
+public class CxfClientTest extends InterFAXClientTest {
+
+ @Override
+ protected InterFAX createClient() {
+ return new CxfClient();
+ }
+
+ @Override
+ protected WireMockConfiguration customize(WireMockConfiguration configuration) {
+ return configuration.usingFilesUnderDirectory("../test/src/main/resources");
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/resources/interfax-api-config.yaml b/jaxrs/cxf/src/test/resources/interfax-api-config.yaml
similarity index 100%
rename from src/test/resources/interfax-api-config.yaml
rename to jaxrs/cxf/src/test/resources/interfax-api-config.yaml
diff --git a/src/test/resources/interfax-api-credentials.yaml b/jaxrs/cxf/src/test/resources/interfax-api-credentials.yaml
similarity index 100%
rename from src/test/resources/interfax-api-credentials.yaml
rename to jaxrs/cxf/src/test/resources/interfax-api-credentials.yaml
diff --git a/jaxrs/jersey/pom.xml b/jaxrs/jersey/pom.xml
new file mode 100644
index 0000000..49313aa
--- /dev/null
+++ b/jaxrs/jersey/pom.xml
@@ -0,0 +1,61 @@
+
+
+ 4.0.0
+
+
+ net.interfax
+ jaxrs
+ 0.20-SNAPSHOT
+
+
+ jaxrs-client-jersey
+ bundle
+
+
+ net.interfax.rest.client.jaxrs.jersey
+
+
+
+
+ net.interfax
+ jaxrs-client-shared
+
+
+
+ org.glassfish.jersey.core
+ jersey-client
+ 2.23.2
+
+
+ org.glassfish.jersey.media
+ jersey-media-multipart
+ 2.23.2
+
+
+ org.glassfish.jersey.media
+ jersey-media-json-jackson
+ 2.23.2
+
+
+
+ org.apache.tika
+ tika-core
+ 1.13
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.2
+
+
+
+ net.interfax
+ jaxrs-client-test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+
+
diff --git a/jaxrs/jersey/src/main/java/net/interfax/rest/client/jaxrs/jersey/DefaultInterFAXClient.java b/jaxrs/jersey/src/main/java/net/interfax/rest/client/jaxrs/jersey/DefaultInterFAXClient.java
new file mode 100644
index 0000000..3ef564b
--- /dev/null
+++ b/jaxrs/jersey/src/main/java/net/interfax/rest/client/jaxrs/jersey/DefaultInterFAXClient.java
@@ -0,0 +1,69 @@
+package net.interfax.rest.client.jaxrs.jersey;
+
+import net.interfax.rest.client.jaxrs.jersey.multipart.JerseyMultiPart;
+import net.interfax.rest.client.InterFAX;
+import net.interfax.rest.client.config.ClientConfig;
+import net.interfax.rest.client.config.ClientCredentials;
+import net.interfax.rest.client.config.ConfigLoader;
+import net.interfax.rest.client.config.spi.UriEncoder;
+import net.interfax.rest.client.jaxrs.shared.AbstractJaxRsInterFAXClient;
+import net.interfax.rest.client.jaxrs.shared.FaxMultiPart;
+import net.interfax.rest.client.jaxrs.shared.JdkEncoder;
+import org.glassfish.jersey.client.RequestEntityProcessing;
+import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.glassfish.jersey.jackson.JacksonFeature;
+import org.glassfish.jersey.media.multipart.MultiPartFeature;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+public class DefaultInterFAXClient extends AbstractJaxRsInterFAXClient implements InterFAX {
+
+ public DefaultInterFAXClient() {
+ this(
+ new ConfigLoader<>(ClientConfig.class, "interfax-api-config.yaml")
+ .getTestConfig(),
+ new ConfigLoader<>(ClientCredentials.class, "interfax-api-credentials.yaml")
+ .getTestConfig()
+ );
+ }
+ public DefaultInterFAXClient(ClientCredentials clientCredentials) {
+ this(
+ new ConfigLoader<>(ClientConfig.class, "interfax-api-config.yaml")
+ .getTestConfig(),
+ clientCredentials
+ );
+ }
+
+ public DefaultInterFAXClient(ClientConfig clientConfig, ClientCredentials clientCredentials) {
+ super(clientConfig, clientCredentials);
+ }
+
+ @Override
+ protected UriEncoder createUriEncoder() {
+ return new JdkEncoder();
+ }
+
+ protected final Client initializeClient(ClientCredentials clientCredentials) {
+ // build client
+ HttpAuthenticationFeature httpAuthenticationFeature = HttpAuthenticationFeature.basic(clientCredentials.getUsername(),
+ clientCredentials.getPassword());
+
+ Client client = ClientBuilder.newClient();
+ client.register(httpAuthenticationFeature);
+ client.register(MultiPartFeature.class);
+ client.register(RequestEntityProcessing.CHUNKED);
+ client.register(JacksonFeature.class);
+
+ // required for the document upload API, to set Content-Length header
+ System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
+
+ return client;
+ }
+
+ @Override
+ protected FaxMultiPart createMultiPart() {
+ return new JerseyMultiPart();
+ }
+
+}
\ No newline at end of file
diff --git a/jaxrs/jersey/src/main/java/net/interfax/rest/client/jaxrs/jersey/multipart/JerseyMultiPart.java b/jaxrs/jersey/src/main/java/net/interfax/rest/client/jaxrs/jersey/multipart/JerseyMultiPart.java
new file mode 100644
index 0000000..9e7654d
--- /dev/null
+++ b/jaxrs/jersey/src/main/java/net/interfax/rest/client/jaxrs/jersey/multipart/JerseyMultiPart.java
@@ -0,0 +1,36 @@
+package net.interfax.rest.client.jaxrs.jersey.multipart;
+
+import net.interfax.rest.client.jaxrs.shared.FaxMultiPart;
+import org.glassfish.jersey.media.multipart.MultiPart;
+import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
+import org.glassfish.jersey.media.multipart.file.StreamDataBodyPart;
+
+import javax.ws.rs.core.MediaType;
+import java.io.File;
+import java.io.InputStream;
+
+public class JerseyMultiPart implements FaxMultiPart {
+
+ private final MultiPart multiPart = new MultiPart();
+
+ @Override
+ public void add(String entityName, File file, MediaType mediaType) {
+ multiPart.bodyPart(new FileDataBodyPart(entityName, file, mediaType));
+ }
+
+ @Override
+ public void add(String entityName, InputStream inputStream, MediaType mediaType) {
+ multiPart.bodyPart(new StreamDataBodyPart(entityName, inputStream, entityName, mediaType));
+ }
+
+ @Override
+ public MediaType getMediaType() {
+ return multiPart.getMediaType();
+ }
+
+ @Override
+ public Object getMultiPart() {
+ return multiPart;
+ }
+
+}
diff --git a/jaxrs/jersey/src/test/java/net/interfax/rest/client/jaxrs/jersey/DefaultInterFAXClientTest.java b/jaxrs/jersey/src/test/java/net/interfax/rest/client/jaxrs/jersey/DefaultInterFAXClientTest.java
new file mode 100644
index 0000000..40db011
--- /dev/null
+++ b/jaxrs/jersey/src/test/java/net/interfax/rest/client/jaxrs/jersey/DefaultInterFAXClientTest.java
@@ -0,0 +1,19 @@
+package net.interfax.rest.client.jaxrs.jersey;
+
+import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
+import net.interfax.rest.client.InterFAX;
+import net.interfax.rest.client.test.InterFAXClientTest;
+
+public class DefaultInterFAXClientTest extends InterFAXClientTest {
+
+ @Override
+ protected InterFAX createClient() {
+ return new DefaultInterFAXClient();
+ }
+
+ @Override
+ protected WireMockConfiguration customize(WireMockConfiguration configuration) {
+ return configuration.usingFilesUnderDirectory("../test/src/main/resources");
+ }
+
+}
\ No newline at end of file
diff --git a/jaxrs/jersey/src/test/resources/interfax-api-config.yaml b/jaxrs/jersey/src/test/resources/interfax-api-config.yaml
new file mode 100644
index 0000000..611c651
--- /dev/null
+++ b/jaxrs/jersey/src/test/resources/interfax-api-config.yaml
@@ -0,0 +1,19 @@
+interFAX:
+ scheme: "http"
+ hostname: "localhost"
+ port: 8089
+ outboundFaxesEndpoint: "/outbound/faxes"
+ outboundFaxesCompletedEndpoint: "/outbound/faxes/completed"
+ outboundFaxesRecordEndpoint: "/outbound/faxes/%s"
+ outboundFaxImageEndpoint: "/outbound/faxes/%s/image"
+ outboundFaxesCancelEndpoint: "/outbound/faxes/%s/cancel"
+ outboundFaxesResendEndpoint: "/outbound/faxes/%s/resend"
+ outboundFaxesHideEndpoint: "/outbound/faxes/%s/hide"
+ outboundSearchEndpoint: "/outbound/search"
+ outboundDocumentsEndpoint: "/outbound/documents"
+ accountsBalanceEndpoint: "/accounts/self/ppcards/balance"
+ inboundFaxesEndpoint: "/inbound/faxes"
+ inboundFaxesImageEndpoint: "/inbound/faxes/%s/image"
+ inboundFaxesEmailsEndpoint: "/inbound/faxes/%s/emails"
+ inboundFaxesMarkEndpoint: "/inbound/faxes/%s/mark"
+ inboundFaxesResendEndpoint: "/inbound/faxes/%s/resend"
\ No newline at end of file
diff --git a/jaxrs/jersey/src/test/resources/interfax-api-credentials.yaml b/jaxrs/jersey/src/test/resources/interfax-api-credentials.yaml
new file mode 100644
index 0000000..743ae8c
--- /dev/null
+++ b/jaxrs/jersey/src/test/resources/interfax-api-credentials.yaml
@@ -0,0 +1,2 @@
+username: ${INTERFAX_USERNAME:-username}
+password: ${INTERFAX_PASSWORD:-password}
\ No newline at end of file
diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml
new file mode 100644
index 0000000..2452bbf
--- /dev/null
+++ b/jaxrs/pom.xml
@@ -0,0 +1,22 @@
+
+
+ 4.0.0
+
+
+ net.interfax
+ parent
+ 0.20-SNAPSHOT
+ ../parent/pom.xml
+
+
+ jaxrs
+ pom
+
+
+ shared
+ cxf
+ jersey
+ test
+
+
+
diff --git a/jaxrs/shared/pom.xml b/jaxrs/shared/pom.xml
new file mode 100644
index 0000000..2bdd982
--- /dev/null
+++ b/jaxrs/shared/pom.xml
@@ -0,0 +1,41 @@
+
+
+ 4.0.0
+
+
+ net.interfax
+ jaxrs
+ 0.20-SNAPSHOT
+
+
+ jaxrs-client-shared
+ bundle
+
+
+ net.interfax.rest.client.jaxrs.shared
+
+
+ !${osgi.namespace},
+ org.apache.tika.*;resolution:=optional,
+ *
+
+
+
+
+
+ net.interfax
+ common
+
+
+
+ javax.ws.rs
+ javax.ws.rs-api
+
+
+ org.apache.tika
+ tika-core
+ 1.13
+
+
+
+
diff --git a/src/main/java/net/interfax/rest/client/impl/AbstractInterFAXClient.java b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/AbstractInterFAXClient.java
similarity index 52%
rename from src/main/java/net/interfax/rest/client/impl/AbstractInterFAXClient.java
rename to jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/AbstractInterFAXClient.java
index 1399e84..7c8414d 100644
--- a/src/main/java/net/interfax/rest/client/impl/AbstractInterFAXClient.java
+++ b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/AbstractInterFAXClient.java
@@ -1,75 +1,76 @@
-package net.interfax.rest.client.impl;
+package net.interfax.rest.client.jaxrs.shared;
import net.interfax.rest.client.config.ClientConfig;
-import net.interfax.rest.client.config.ClientCredentials;
-import net.interfax.rest.client.config.ConfigLoader;
+import net.interfax.rest.client.config.spi.UriEncoder;
import net.interfax.rest.client.domain.DocumentUploadSessionOptions;
import net.interfax.rest.client.domain.GetUploadedDocumentsListOptions;
import net.interfax.rest.client.domain.SendFaxOptions;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.message.BasicNameValuePair;
import javax.ws.rs.core.UriBuilder;
import java.io.File;
+import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
import java.util.Optional;
public abstract class AbstractInterFAXClient {
- protected static String username;
- protected static String password;
- protected static String scheme;
- protected static String hostname;
- protected static int port;
- protected static String outboundFaxesEndpoint;
- protected static String outboundFaxesCompletedEndpoint;
- protected static String outboundFaxesRecordEndpoint;
- protected static String outboundFaxImageEndpoint;
- protected static String outboundFaxesCancelEndpoint;
- protected static String outboundFaxesResendEndpoint;
- protected static String outboundFaxesHideEndpoint;
- protected static String outboundSearchEndpoint;
- protected static String outboundDocumentsEndpoint;
- protected static String accountsBalanceEndpoint;
- protected static String inboundFaxesEndpoint;
- protected static String inboundFaxesImageEndpoint;
- protected static String inboundFaxesEmailsEndpoint;
- protected static String inboundFaxesMarkEndpoint;
- protected static String inboundFaxesResendEndpoint;
-
+ protected final UriEncoder uriEncoder;
+
+ protected String scheme;
+ protected String hostname;
+ protected int port;
+ protected String outboundFaxesEndpoint;
+ protected String outboundFaxesCompletedEndpoint;
+ protected String outboundFaxesRecordEndpoint;
+ protected String outboundFaxImageEndpoint;
+ protected String outboundFaxesCancelEndpoint;
+ protected String outboundFaxesResendEndpoint;
+ protected String outboundFaxesHideEndpoint;
+ protected String outboundSearchEndpoint;
+ protected String outboundDocumentsEndpoint;
+ protected String accountsBalanceEndpoint;
+ protected String inboundFaxesEndpoint;
+ protected String inboundFaxesImageEndpoint;
+ protected String inboundFaxesEmailsEndpoint;
+ protected String inboundFaxesMarkEndpoint;
+ protected String inboundFaxesResendEndpoint;
+
+ public AbstractInterFAXClient(ClientConfig clientConfig) {
+ readConfigAndInitializeEndpoints(clientConfig);
+ this.uriEncoder = createUriEncoder();
+ }
protected URI getSendFaxUri(final String faxNumber, final Optional options)
throws URISyntaxException {
- URIBuilder uriBuilder = new URIBuilder();
- uriBuilder.setHost(hostname).setScheme(scheme).setPort(port).setPath(outboundFaxesEndpoint);
- List params = new ArrayList<>();
- params.add(new BasicNameValuePair("faxNumber", faxNumber));
+ UriBuilder uriBuilder = UriBuilder.fromPath("").scheme(scheme).host(hostname).port(port).path(outboundFaxesEndpoint);
+ uriBuilder.queryParam("faxNumber", faxNumber);
+
+ param(uriBuilder, "contact", options.flatMap(SendFaxOptions::getContact));
+ param(uriBuilder, "csid", options.flatMap(SendFaxOptions::getCsid));
+ param(uriBuilder, "fitToPage", options.flatMap(SendFaxOptions::getFitToPage));
+ param(uriBuilder, "pageHeader", options.flatMap(SendFaxOptions::getPageHeader));
+ param(uriBuilder, "pageOrientation", options.flatMap(SendFaxOptions::getPageOrientation));
+ param(uriBuilder, "pageSize", options.flatMap(SendFaxOptions::getPageSize));
+ param(uriBuilder, "postponeTime", options.flatMap(SendFaxOptions::getPostponeTime));
+ param(uriBuilder, "reference", options.flatMap(SendFaxOptions::getReference));
+ param(uriBuilder, "rendering", options.flatMap(SendFaxOptions::getRendering));
+ param(uriBuilder, "replyAddress", options.flatMap(SendFaxOptions::getReplyAddress));
+ param(uriBuilder, "resolution", options.flatMap(SendFaxOptions::getResolution));
+ param(uriBuilder, "retriesToPerform", options.flatMap(SendFaxOptions::getRetriesToPerform));
- if (options.isPresent()) {
- SendFaxOptions reqOptions = options.orElse(null);
- reqOptions.getContact().ifPresent( x -> params.add(new BasicNameValuePair("contact", x)));
- reqOptions.getCsid().ifPresent( x -> params.add(new BasicNameValuePair("csid", x)));
- reqOptions.getFitToPage().ifPresent( x -> params.add(new BasicNameValuePair("fitToPage", x)));
- reqOptions.getPageHeader().ifPresent( x -> params.add(new BasicNameValuePair("pageHeader", x)));
- reqOptions.getPageOrientation().ifPresent( x -> params.add(new BasicNameValuePair("pageOrientation", x)));
- reqOptions.getPageSize().ifPresent( x -> params.add(new BasicNameValuePair("pageSize", x)));
- reqOptions.getPostponeTime().ifPresent( x -> params.add(new BasicNameValuePair("postponeTime", x.toString())));
- reqOptions.getReference().ifPresent( x -> params.add(new BasicNameValuePair("reference", x)));
- reqOptions.getRendering().ifPresent( x -> params.add(new BasicNameValuePair("rendering", x)));
- reqOptions.getReplyAddress().ifPresent( x -> params.add(new BasicNameValuePair("replyAddress", x)));
- reqOptions.getResolution().ifPresent( x -> params.add(new BasicNameValuePair("resolution", x)));
- reqOptions.getRetriesToPerform().ifPresent( x -> params.add(new BasicNameValuePair("retriesToPerform", String.valueOf(x))));
- }
-
- uriBuilder.setParameters(params);
return uriBuilder.build();
}
+ private void param(UriBuilder builder, String paramName, Optional> value) {
+ value.map(Object::toString)
+ .map(uriEncoder::encode)
+ .ifPresent(encoded -> builder.queryParam(paramName, encoded));
+ }
+
protected URI getOutboundDocumentsUri(final File fileToUpload, final Optional options) {
DocumentUploadSessionOptions reqOptions = options.orElse(null);
@@ -108,16 +109,12 @@ protected URI getUploadedDocumentListUri(final Optional(ClientCredentials.class, "interfax-api-credentials.yaml").getTestConfig();
-
- username = clientCredentials.getUsername();
- password = clientCredentials.getPassword();
- }
-
protected void readConfigAndInitializeEndpoints(ClientConfig clientConfig) {
+ // read config from yaml
+ scheme = clientConfig.getInterFAX().getScheme();
+ hostname = clientConfig.getInterFAX().getHostname();
+ port = clientConfig.getInterFAX().getPort();
outboundFaxesEndpoint = clientConfig.getInterFAX().getOutboundFaxesEndpoint();
outboundFaxesCompletedEndpoint = clientConfig.getInterFAX().getOutboundFaxesCompletedEndpoint();
outboundFaxesRecordEndpoint = clientConfig.getInterFAX().getOutboundFaxesRecordEndpoint();
@@ -134,4 +131,7 @@ protected void readConfigAndInitializeEndpoints(ClientConfig clientConfig) {
inboundFaxesMarkEndpoint = clientConfig.getInterFAX().getInboundFaxesMarkEndpoint();
inboundFaxesResendEndpoint = clientConfig.getInterFAX().getInboundFaxesResendEndpoint();
}
+
+ protected abstract UriEncoder createUriEncoder();
+
}
diff --git a/src/main/java/net/interfax/rest/client/impl/DefaultInterFAXClient.java b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/AbstractJaxRsInterFAXClient.java
similarity index 86%
rename from src/main/java/net/interfax/rest/client/impl/DefaultInterFAXClient.java
rename to jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/AbstractJaxRsInterFAXClient.java
index 703ac34..c803d16 100644
--- a/src/main/java/net/interfax/rest/client/impl/DefaultInterFAXClient.java
+++ b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/AbstractJaxRsInterFAXClient.java
@@ -1,8 +1,10 @@
-package net.interfax.rest.client.impl;
+package net.interfax.rest.client.jaxrs.shared;
import net.interfax.rest.client.InterFAX;
import net.interfax.rest.client.config.ClientConfig;
+import net.interfax.rest.client.config.ClientCredentials;
import net.interfax.rest.client.config.ConfigLoader;
+import net.interfax.rest.client.config.spi.ContentTypeDetector;
import net.interfax.rest.client.domain.APIResponse;
import net.interfax.rest.client.domain.DocumentUploadSessionOptions;
import net.interfax.rest.client.domain.GetFaxListOptions;
@@ -16,20 +18,11 @@
import net.interfax.rest.client.domain.UploadedDocumentStatus;
import net.interfax.rest.client.exception.UnsuccessfulStatusCodeException;
import net.interfax.rest.client.util.ArrayUtil;
-import org.apache.tika.Tika;
import org.apache.tika.io.IOUtils;
-import org.glassfish.jersey.client.RequestEntityProcessing;
-import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
-import org.glassfish.jersey.jackson.JacksonFeature;
-import org.glassfish.jersey.media.multipart.MultiPart;
-import org.glassfish.jersey.media.multipart.MultiPartFeature;
-import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
-import org.glassfish.jersey.media.multipart.file.StreamDataBodyPart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
@@ -46,29 +39,39 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.concurrent.locks.ReentrantLock;
-public class DefaultInterFAXClient extends AbstractInterFAXClient implements InterFAX {
+public abstract class AbstractJaxRsInterFAXClient extends AbstractInterFAXClient implements InterFAX {
- private static Client client;
- private static Tika tika;
+ private static final Logger log = LoggerFactory.getLogger(AbstractJaxRsInterFAXClient.class);
- private final ReentrantLock reentrantLock = new ReentrantLock();
+ private final Client client;
- private static final Logger log = LoggerFactory.getLogger(DefaultInterFAXClient.class);
+ private final ContentTypeDetector contentTypeDetector;
- public DefaultInterFAXClient(String username, String password) {
-
- DefaultInterFAXClient.username = username;
- DefaultInterFAXClient.password = password;
-
- initializeClient(username, password);
+ public AbstractJaxRsInterFAXClient() {
+ this(
+ new ConfigLoader<>(ClientConfig.class, "interfax-api-config.yaml")
+ .getTestConfig(),
+ new ConfigLoader<>(ClientCredentials.class, "interfax-api-credentials.yaml")
+ .getTestConfig()
+ );
+ }
+ public AbstractJaxRsInterFAXClient(ClientCredentials clientCredentials) {
+ this(
+ new ConfigLoader<>(ClientConfig.class, "interfax-api-config.yaml")
+ .getTestConfig(),
+ clientCredentials
+ );
}
- public DefaultInterFAXClient() {
+ public AbstractJaxRsInterFAXClient(ClientConfig clientConfig, ClientCredentials clientCredentials) {
+ this(clientConfig, clientCredentials, new TikaContentTypeDetector());
+ }
- initialiseCredentials();
- initializeClient(username, password);
+ public AbstractJaxRsInterFAXClient(ClientConfig clientConfig, ClientCredentials clientCredentials, ContentTypeDetector detector) {
+ super(clientConfig);
+ this.client = initializeClient(clientCredentials);
+ this.contentTypeDetector = detector;
}
@Override
@@ -83,7 +86,7 @@ public APIResponse sendFax(final String faxNumber,
final File fileToSendAsFax,
final Optional options) throws IOException, URISyntaxException {
- String contentType = tika.detect(fileToSendAsFax);
+ String contentType = contentTypeDetector.detect(fileToSendAsFax);
URI uri = getSendFaxUri(faxNumber, options);
return executePostRequest(
@@ -114,19 +117,18 @@ public APIResponse sendFax(final String faxNumber,
final File[] filesToSendAsFax,
final Optional options) throws IOException, URISyntaxException {
- MultiPart multiPart = new MultiPart();
+ FaxMultiPart multiPart = createMultiPart();
int count = 1;
for (File file : filesToSendAsFax) {
- String contentType = tika.detect(file);
+ String contentType = contentTypeDetector.detect(file);
String entityName = "file"+count++;
- FileDataBodyPart fileDataBodyPart = new FileDataBodyPart(entityName, file, MediaType.valueOf(contentType));
- multiPart.bodyPart(fileDataBodyPart);
+ multiPart.add(entityName, file, MediaType.valueOf(contentType));
}
return sendMultiPartFax(faxNumber, multiPart, options);
}
- @Override
+ @Override
public APIResponse sendFax(String faxNumber,
InputStream[] streamsToSendAsFax,
String[] mediaTypes,
@@ -136,15 +138,10 @@ public APIResponse sendFax(String faxNumber,
throw new IllegalArgumentException("Stream and file name arrays do not have the same length");
}
- MultiPart multiPart = new MultiPart();
+ FaxMultiPart multiPart = createMultiPart();
for (int i=0; i < streamsToSendAsFax.length; i++) {
final String entityName = "file"+i;
- final StreamDataBodyPart streamDataBodyPart = new StreamDataBodyPart(
- entityName,
- streamsToSendAsFax[i],
- entityName,
- MediaType.valueOf(mediaTypes[i]));
- multiPart.bodyPart(streamDataBodyPart);
+ multiPart.add(entityName, streamsToSendAsFax[i], MediaType.valueOf(mediaTypes[i]));
}
return sendMultiPartFax(faxNumber, multiPart, options);
@@ -225,7 +222,7 @@ public OutboundFaxStructure[] getCompletedFaxList(final String[] ids) throws Uns
.host(hostname)
.scheme(scheme)
.port(port)
- .queryParam("ids", getCsvIds(ids))
+ .queryParam("ids", uriEncoder.encode(getCsvIds(ids)))
.build();
return (OutboundFaxStructure[]) executeGetRequest(
outboundFaxesCompletedUri,
@@ -560,7 +557,7 @@ public void closeClient() {
client.close();
}
- private APIResponse sendMultiPartFax(String faxNumber, MultiPart multiPart, Optional options)
+ private APIResponse sendMultiPartFax(String faxNumber, FaxMultiPart multiPart, Optional options)
throws URISyntaxException {
final URI uri = getSendFaxUri(faxNumber, options);
@@ -570,11 +567,11 @@ private APIResponse sendMultiPartFax(String faxNumber, MultiPart multiPart, Opti
target
.request()
.header("Content-Type", "multipart/mixed")
- .post(Entity.entity(multiPart, multiPart.getMediaType()))
+ .post(Entity.entity(multiPart.getMultiPart(), multiPart.getMediaType()))
);
}
- private APIResponse executePostRequest(URI uri, JerseyRequestExecutor executor) {
+ private APIResponse executePostRequest(URI uri, RequestExecutor executor) {
Response response = null;
APIResponse apiResponse = new APIResponse();
@@ -600,7 +597,7 @@ private APIResponse executePostRequest(URI uri, JerseyRequestExecutor executor)
return apiResponse;
}
- private Object executeGetRequest(URI uri, Class responseEntityClass, JerseyRequestExecutor executor)
+ private Object executeGetRequest(URI uri, Class responseEntityClass, RequestExecutor executor)
throws UnsuccessfulStatusCodeException {
Response response = null;
@@ -680,35 +677,8 @@ private void close(Response response) {
}
}
- private void initializeClient(String username, String password) {
+ protected abstract Client initializeClient(ClientCredentials clientCredentials);
+
+ protected abstract FaxMultiPart createMultiPart();
- reentrantLock.lock();
- try {
- if (client != null)
- return;
-
- // build client
- ClientConfig clientConfig = new ConfigLoader<>(ClientConfig.class, "interfax-api-config.yaml").getTestConfig();
- HttpAuthenticationFeature httpAuthenticationFeature = HttpAuthenticationFeature.basic(username, password);
- client = ClientBuilder.newClient();
- client.register(httpAuthenticationFeature);
- client.register(MultiPartFeature.class);
- client.register(RequestEntityProcessing.CHUNKED);
- client.register(JacksonFeature.class);
-
- // required for the document upload API, to set Content-Length header
- System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
-
- // for automatically deriving content type given a file
- tika = new Tika();
-
- // read config from yaml
- scheme = clientConfig.getInterFAX().getScheme();
- hostname = clientConfig.getInterFAX().getHostname();
- port = clientConfig.getInterFAX().getPort();
- readConfigAndInitializeEndpoints(clientConfig);
- } finally {
- reentrantLock.unlock();
- }
- }
}
\ No newline at end of file
diff --git a/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/FaxMultiPart.java b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/FaxMultiPart.java
new file mode 100644
index 0000000..5b2e5bd
--- /dev/null
+++ b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/FaxMultiPart.java
@@ -0,0 +1,14 @@
+package net.interfax.rest.client.jaxrs.shared;
+
+import javax.ws.rs.core.MediaType;
+import java.io.File;
+import java.io.InputStream;
+
+public interface FaxMultiPart {
+ void add(String entityName, File file, MediaType mediaType);
+ void add(String entityName, InputStream inputStream, MediaType mediaType);
+
+ MediaType getMediaType();
+
+ Object getMultiPart();
+}
diff --git a/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/JdkEncoder.java b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/JdkEncoder.java
new file mode 100644
index 0000000..16004fa
--- /dev/null
+++ b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/JdkEncoder.java
@@ -0,0 +1,18 @@
+package net.interfax.rest.client.jaxrs.shared;
+
+import net.interfax.rest.client.config.spi.UriEncoder;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+
+public class JdkEncoder implements UriEncoder {
+ @Override
+ public String encode(String raw) {
+ try {
+ return URLEncoder.encode(raw, Charset.defaultCharset().name());
+ } catch (UnsupportedEncodingException e) {
+ return URLEncoder.encode(raw);
+ }
+ }
+}
diff --git a/src/main/java/net/interfax/rest/client/impl/JerseyRequestExecutor.java b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/RequestExecutor.java
similarity index 65%
rename from src/main/java/net/interfax/rest/client/impl/JerseyRequestExecutor.java
rename to jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/RequestExecutor.java
index 24f6b41..7811154 100644
--- a/src/main/java/net/interfax/rest/client/impl/JerseyRequestExecutor.java
+++ b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/RequestExecutor.java
@@ -1,10 +1,10 @@
-package net.interfax.rest.client.impl;
+package net.interfax.rest.client.jaxrs.shared;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
@FunctionalInterface
-public interface JerseyRequestExecutor {
+public interface RequestExecutor {
Response readyTheTargetAndExecute(WebTarget target);
}
diff --git a/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/TikaContentTypeDetector.java b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/TikaContentTypeDetector.java
new file mode 100644
index 0000000..777038d
--- /dev/null
+++ b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/TikaContentTypeDetector.java
@@ -0,0 +1,28 @@
+package net.interfax.rest.client.jaxrs.shared;
+
+import net.interfax.rest.client.config.spi.ContentTypeDetector;
+import org.apache.tika.Tika;
+
+import java.io.File;
+import java.io.IOException;
+
+public class TikaContentTypeDetector implements ContentTypeDetector {
+
+ private static final Tika DEFAULT_TIKA = new Tika();
+
+ private final Tika tika;
+
+ public TikaContentTypeDetector() {
+ this(DEFAULT_TIKA);
+ }
+
+ public TikaContentTypeDetector(Tika tika) {
+ this.tika = tika;
+ }
+
+ @Override
+ public String detect(File file) throws IOException {
+ return tika.detect(file);
+ }
+
+}
diff --git a/src/main/java/net/interfax/rest/client/util/ArrayUtil.java b/jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/util/ArrayUtil.java
similarity index 100%
rename from src/main/java/net/interfax/rest/client/util/ArrayUtil.java
rename to jaxrs/shared/src/main/java/net/interfax/rest/client/jaxrs/shared/util/ArrayUtil.java
diff --git a/jaxrs/test/pom.xml b/jaxrs/test/pom.xml
new file mode 100644
index 0000000..39f566a
--- /dev/null
+++ b/jaxrs/test/pom.xml
@@ -0,0 +1,31 @@
+
+
+ 4.0.0
+
+
+ net.interfax
+ jaxrs
+ 0.20-SNAPSHOT
+
+
+ jaxrs-client-test
+
+
+
+ net.interfax
+ jaxrs-client-shared
+
+
+
+ junit
+ junit
+ compile
+
+
+ com.github.tomakehurst
+ wiremock
+ compile
+
+
+
+
diff --git a/jaxrs/test/src/main/java/net/interfax/rest/client/test/EnhancedMultipartJettyHttpServer.java b/jaxrs/test/src/main/java/net/interfax/rest/client/test/EnhancedMultipartJettyHttpServer.java
new file mode 100644
index 0000000..8ce53f0
--- /dev/null
+++ b/jaxrs/test/src/main/java/net/interfax/rest/client/test/EnhancedMultipartJettyHttpServer.java
@@ -0,0 +1,390 @@
+package net.interfax.rest.client.test;
+
+import com.github.tomakehurst.wiremock.common.*;
+import com.github.tomakehurst.wiremock.core.Options;
+import com.github.tomakehurst.wiremock.core.WireMockApp;
+import com.github.tomakehurst.wiremock.http.AdminRequestHandler;
+import com.github.tomakehurst.wiremock.http.HttpServer;
+import com.github.tomakehurst.wiremock.http.RequestHandler;
+import com.github.tomakehurst.wiremock.http.StubRequestHandler;
+import com.github.tomakehurst.wiremock.http.trafficlistener.WiremockNetworkTrafficListener;
+import com.github.tomakehurst.wiremock.jetty9.CustomizedSslContextFactory;
+import com.github.tomakehurst.wiremock.jetty9.JettyFaultInjectorFactory;
+import com.github.tomakehurst.wiremock.jetty9.JettyHttpServer;
+import com.github.tomakehurst.wiremock.jetty9.NotFoundHandler;
+import com.github.tomakehurst.wiremock.servlet.ContentTypeSettingFilter;
+import com.github.tomakehurst.wiremock.servlet.FaultInjectorFactory;
+import com.github.tomakehurst.wiremock.servlet.TrailingSlashFilter;
+import com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.io.Resources;
+import org.apache.commons.lang3.ArrayUtils;
+import org.eclipse.jetty.http.MimeTypes;
+import org.eclipse.jetty.io.NetworkTrafficListener;
+import org.eclipse.jetty.server.*;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.servlet.DefaultServlet;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.servlets.CrossOriginFilter;
+import org.eclipse.jetty.servlets.GzipFilter;
+import org.eclipse.jetty.servlets.MultiPartFilter;
+
+import javax.servlet.DispatcherType;
+import javax.servlet.MultipartConfigElement;
+import java.net.Socket;
+import java.nio.ByteBuffer;
+import java.util.EnumSet;
+import java.util.concurrent.ScheduledExecutorService;
+
+import static com.github.tomakehurst.wiremock.common.Exceptions.throwUnchecked;
+import static com.github.tomakehurst.wiremock.core.WireMockApp.ADMIN_CONTEXT_ROOT;
+import static java.util.concurrent.Executors.newScheduledThreadPool;
+
+public class EnhancedMultipartJettyHttpServer implements HttpServer {
+
+ private static final String FILES_URL_MATCH = String.format("/%s/*", WireMockApp.FILES_ROOT);
+
+ private final Server jettyServer;
+ private final ServerConnector httpConnector;
+ private final ServerConnector httpsConnector;
+
+ public EnhancedMultipartJettyHttpServer(
+ Options options,
+ AdminRequestHandler adminRequestHandler,
+ StubRequestHandler stubRequestHandler
+ ) {
+ jettyServer = createServer(options);
+
+ NetworkTrafficListenerAdapter networkTrafficListenerAdapter = new NetworkTrafficListenerAdapter(options.networkTrafficListener());
+ httpConnector = createHttpConnector(
+ options.bindAddress(),
+ options.portNumber(),
+ options.jettySettings(),
+ networkTrafficListenerAdapter
+ );
+ jettyServer.addConnector(httpConnector);
+
+ if (options.httpsSettings().enabled()) {
+ httpsConnector = createHttpsConnector(
+ options.bindAddress(),
+ options.httpsSettings(),
+ options.jettySettings(),
+ networkTrafficListenerAdapter);
+ jettyServer.addConnector(httpsConnector);
+ } else {
+ httpsConnector = null;
+ }
+
+ jettyServer.setHandler(createHandler(options, adminRequestHandler, stubRequestHandler));
+
+ finalizeSetup(options);
+ }
+
+ protected HandlerCollection createHandler(Options options, AdminRequestHandler adminRequestHandler, StubRequestHandler stubRequestHandler) {
+ Notifier notifier = options.notifier();
+ ServletContextHandler adminContext = addAdminContext(
+ adminRequestHandler,
+ notifier
+ );
+ ServletContextHandler mockServiceContext = addMockServiceContext(
+ stubRequestHandler,
+ options.filesRoot(),
+ options.getAsynchronousResponseSettings(),
+ notifier
+ );
+
+ HandlerCollection handlers = new HandlerCollection();
+ handlers.setHandlers(ArrayUtils.addAll(extensionHandlers(), adminContext, mockServiceContext));
+ return handlers;
+ }
+
+ protected void finalizeSetup(Options options) {
+ if(!options.jettySettings().getStopTimeout().isPresent()) {
+ jettyServer.setStopTimeout(0);
+ }
+ }
+
+ protected Server createServer(Options options) {
+ final Server server = new Server(options.threadPoolFactory().buildThreadPool(options));
+ final JettySettings jettySettings = options.jettySettings();
+ final Optional stopTimeout = jettySettings.getStopTimeout();
+ if(stopTimeout.isPresent()) {
+ server.setStopTimeout(stopTimeout.get());
+ }
+ return server;
+ }
+
+ /**
+ * Extend only this method if you want to add additional handlers to Jetty.
+ */
+ protected Handler[] extensionHandlers() {
+ return new Handler[]{};
+ }
+
+ @Override
+ public void start() {
+ try {
+ jettyServer.start();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ long timeout = System.currentTimeMillis() + 30000;
+ while (!jettyServer.isStarted()) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // no-op
+ }
+ if (System.currentTimeMillis() > timeout) {
+ throw new RuntimeException("Server took too long to start up.");
+ }
+ }
+ }
+
+ @Override
+ public void stop() {
+ try {
+ jettyServer.stop();
+ jettyServer.join();
+ } catch (Exception e) {
+ throwUnchecked(e);
+ }
+ }
+
+ @Override
+ public boolean isRunning() {
+ return jettyServer.isRunning();
+ }
+
+ @Override
+ public int port() {
+ return httpConnector.getLocalPort();
+ }
+
+ @Override
+ public int httpsPort() {
+ return httpsConnector.getLocalPort();
+ }
+
+ protected long stopTimeout() {
+ return jettyServer.getStopTimeout();
+ }
+
+ protected ServerConnector createHttpConnector(
+ String bindAddress,
+ int port,
+ JettySettings jettySettings,
+ NetworkTrafficListener listener) {
+
+ HttpConfiguration httpConfig = createHttpConfig(jettySettings);
+
+ ServerConnector connector = createServerConnector(
+ bindAddress,
+ jettySettings,
+ port,
+ listener,
+ new HttpConnectionFactory(httpConfig)
+ );
+
+ return connector;
+ }
+
+ protected ServerConnector createHttpsConnector(
+ String bindAddress,
+ HttpsSettings httpsSettings,
+ JettySettings jettySettings,
+ NetworkTrafficListener listener) {
+
+ //Added to support Android https communication.
+ CustomizedSslContextFactory sslContextFactory = new CustomizedSslContextFactory();
+
+ sslContextFactory.setKeyStorePath(httpsSettings.keyStorePath());
+ sslContextFactory.setKeyManagerPassword(httpsSettings.keyStorePassword());
+ sslContextFactory.setKeyStoreType(httpsSettings.keyStoreType());
+ if (httpsSettings.hasTrustStore()) {
+ sslContextFactory.setTrustStorePath(httpsSettings.trustStorePath());
+ sslContextFactory.setTrustStorePassword(httpsSettings.trustStorePassword());
+ sslContextFactory.setTrustStoreType(httpsSettings.trustStoreType());
+ }
+ sslContextFactory.setNeedClientAuth(httpsSettings.needClientAuth());
+
+ HttpConfiguration httpConfig = createHttpConfig(jettySettings);
+ httpConfig.addCustomizer(new SecureRequestCustomizer());
+
+ final int port = httpsSettings.port();
+
+ return createServerConnector(
+ bindAddress,
+ jettySettings,
+ port,
+ listener,
+ new SslConnectionFactory(
+ sslContextFactory,
+ "http/1.1"
+ ),
+ new HttpConnectionFactory(httpConfig)
+ );
+ }
+
+ protected HttpConfiguration createHttpConfig(JettySettings jettySettings) {
+ HttpConfiguration httpConfig = new HttpConfiguration();
+ httpConfig.setRequestHeaderSize(
+ jettySettings.getRequestHeaderSize().or(8192)
+ );
+ httpConfig.setSendDateHeader(false);
+ return httpConfig;
+ }
+
+ protected ServerConnector createServerConnector(String bindAddress,
+ JettySettings jettySettings,
+ int port, NetworkTrafficListener listener,
+ ConnectionFactory... connectionFactories) {
+ int acceptors = jettySettings.getAcceptors().or(2);
+ NetworkTrafficServerConnector connector = new NetworkTrafficServerConnector(
+ jettyServer,
+ null,
+ null,
+ null,
+ acceptors,
+ 2,
+ connectionFactories
+ );
+ connector.setPort(port);
+
+ connector.setStopTimeout(0);
+ connector.getSelectorManager().setStopTimeout(0);
+
+ connector.addNetworkTrafficListener(listener);
+
+ setJettySettings(jettySettings, connector);
+
+ connector.setHost(bindAddress);
+
+ return connector;
+ }
+
+ private void setJettySettings(JettySettings jettySettings, ServerConnector connector) {
+ if (jettySettings.getAcceptQueueSize().isPresent()) {
+ connector.setAcceptQueueSize(jettySettings.getAcceptQueueSize().get());
+ }
+ }
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ private ServletContextHandler addMockServiceContext(
+ StubRequestHandler stubRequestHandler,
+ FileSource fileSource,
+ AsynchronousResponseSettings asynchronousResponseSettings,
+ Notifier notifier
+ ) {
+ ServletContextHandler mockServiceContext = new ServletContextHandler(jettyServer, "/");
+
+ mockServiceContext.setInitParameter("org.eclipse.jetty.servlet.Default.maxCacheSize", "0");
+ mockServiceContext.setInitParameter("org.eclipse.jetty.servlet.Default.resourceBase", fileSource.getPath());
+ mockServiceContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
+
+ mockServiceContext.addServlet(DefaultServlet.class, FILES_URL_MATCH);
+
+ mockServiceContext.setAttribute(JettyFaultInjectorFactory.class.getName(), new JettyFaultInjectorFactory());
+ mockServiceContext.setAttribute(StubRequestHandler.class.getName(), stubRequestHandler);
+ mockServiceContext.setAttribute(Notifier.KEY, notifier);
+ ServletHolder servletHolder = mockServiceContext.addServlet(WireMockHandlerDispatchingServlet.class, "/");
+ servletHolder.setInitParameter(RequestHandler.HANDLER_CLASS_KEY, StubRequestHandler.class.getName());
+ servletHolder.setInitParameter(FaultInjectorFactory.INJECTOR_CLASS_KEY, JettyFaultInjectorFactory.class.getName());
+ servletHolder.setInitParameter(WireMockHandlerDispatchingServlet.SHOULD_FORWARD_TO_FILES_CONTEXT, "true");
+
+ if (asynchronousResponseSettings.isEnabled()) {
+ ScheduledExecutorService scheduledExecutorService = newScheduledThreadPool(asynchronousResponseSettings.getThreads());
+ mockServiceContext.setAttribute(WireMockHandlerDispatchingServlet.ASYNCHRONOUS_RESPONSE_EXECUTOR, scheduledExecutorService);
+ }
+
+ MimeTypes mimeTypes = new MimeTypes();
+ mimeTypes.addMimeMapping("json", "application/json");
+ mimeTypes.addMimeMapping("html", "text/html");
+ mimeTypes.addMimeMapping("xml", "application/xml");
+ mimeTypes.addMimeMapping("txt", "text/plain");
+ mockServiceContext.setMimeTypes(mimeTypes);
+ mockServiceContext.setWelcomeFiles(new String[]{"index.json", "index.html", "index.xml", "index.txt"});
+
+ mockServiceContext.setErrorHandler(new NotFoundHandler());
+
+ mockServiceContext.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD));
+ mockServiceContext.addFilter(ContentTypeSettingFilter.class, FILES_URL_MATCH, EnumSet.of(DispatcherType.FORWARD));
+ mockServiceContext.addFilter(TrailingSlashFilter.class, FILES_URL_MATCH, EnumSet.allOf(DispatcherType.class));
+
+ return mockServiceContext;
+ }
+
+ private ServletContextHandler addAdminContext(
+ AdminRequestHandler adminRequestHandler,
+ Notifier notifier
+ ) {
+ ServletContextHandler adminContext = new ServletContextHandler(jettyServer, ADMIN_CONTEXT_ROOT);
+
+ adminContext.setInitParameter("org.eclipse.jetty.servlet.Default.maxCacheSize", "0");
+
+ String javaVendor = System.getProperty("java.vendor");
+ if (javaVendor != null && javaVendor.toLowerCase().contains("android")) {
+ //Special case for Android, fixes IllegalArgumentException("resource assets not found."):
+ // The Android ClassLoader apparently does not resolve directories.
+ // Furthermore, lib assets will be merged into a single asset directory when a jar file is assimilated into an apk.
+ // As resources can be addressed like "assets/swagger-ui/index.html", a static path element will suffice.
+ adminContext.setInitParameter("org.eclipse.jetty.servlet.Default.resourceBase", "assets");
+ } else {
+ adminContext.setInitParameter("org.eclipse.jetty.servlet.Default.resourceBase", Resources.getResource("assets").toString());
+ }
+
+ Resources.getResource("assets/swagger-ui/index.html");
+
+ adminContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
+ adminContext.addServlet(DefaultServlet.class, "/swagger-ui/*");
+ adminContext.addServlet(DefaultServlet.class, "/recorder/*");
+
+ ServletHolder servletHolder = adminContext.addServlet(WireMockHandlerDispatchingServlet.class, "/");
+ servletHolder.setInitParameter(RequestHandler.HANDLER_CLASS_KEY, AdminRequestHandler.class.getName());
+ adminContext.setAttribute(AdminRequestHandler.class.getName(), adminRequestHandler);
+ adminContext.setAttribute(Notifier.KEY, notifier);
+
+ FilterHolder filterHolder = new FilterHolder(CrossOriginFilter.class);
+ filterHolder.setInitParameters(ImmutableMap.of(
+ "chainPreflight", "false",
+ "allowedOrigins", "*",
+ "allowedHeaders", "X-Requested-With,Content-Type,Accept,Origin,Authorization",
+ "allowedMethods", "OPTIONS,GET,POST,PUT,PATCH,DELETE"));
+
+ adminContext.addFilter(filterHolder, "/*", EnumSet.of(DispatcherType.REQUEST));
+
+ return adminContext;
+ }
+
+ private static class NetworkTrafficListenerAdapter implements NetworkTrafficListener {
+ private final WiremockNetworkTrafficListener wiremockNetworkTrafficListener;
+
+ NetworkTrafficListenerAdapter(WiremockNetworkTrafficListener wiremockNetworkTrafficListener) {
+ this.wiremockNetworkTrafficListener = wiremockNetworkTrafficListener;
+ }
+
+ @Override
+ public void opened(Socket socket) {
+ wiremockNetworkTrafficListener.opened(socket);
+ }
+
+ @Override
+ public void incoming(Socket socket, ByteBuffer bytes) {
+ wiremockNetworkTrafficListener.incoming(socket, bytes);
+ }
+
+ @Override
+ public void outgoing(Socket socket, ByteBuffer bytes) {
+ wiremockNetworkTrafficListener.outgoing(socket, bytes);
+ }
+
+ @Override
+ public void closed(Socket socket) {
+ wiremockNetworkTrafficListener.closed(socket);
+ }
+ }
+
+}
diff --git a/jaxrs/test/src/main/java/net/interfax/rest/client/test/EnhancedMultipartJettyServer.java b/jaxrs/test/src/main/java/net/interfax/rest/client/test/EnhancedMultipartJettyServer.java
new file mode 100644
index 0000000..d069c46
--- /dev/null
+++ b/jaxrs/test/src/main/java/net/interfax/rest/client/test/EnhancedMultipartJettyServer.java
@@ -0,0 +1,24 @@
+package net.interfax.rest.client.test;
+
+import com.github.tomakehurst.wiremock.core.Options;
+import com.github.tomakehurst.wiremock.http.AdminRequestHandler;
+import com.github.tomakehurst.wiremock.http.HttpServer;
+import com.github.tomakehurst.wiremock.http.HttpServerFactory;
+import com.github.tomakehurst.wiremock.http.StubRequestHandler;
+
+public class EnhancedMultipartJettyServer implements HttpServerFactory {
+
+ @Override
+ public HttpServer buildHttpServer(
+ Options options,
+ AdminRequestHandler adminRequestHandler,
+ StubRequestHandler stubRequestHandler
+ ) {
+ return new EnhancedMultipartJettyHttpServer(
+ options,
+ adminRequestHandler,
+ stubRequestHandler
+ );
+ }
+
+}
diff --git a/src/test/java/net/interfax/rest/client/impl/DefaultInterFAXClientTest.java b/jaxrs/test/src/main/java/net/interfax/rest/client/test/InterFAXClientTest.java
similarity index 88%
rename from src/test/java/net/interfax/rest/client/impl/DefaultInterFAXClientTest.java
rename to jaxrs/test/src/main/java/net/interfax/rest/client/test/InterFAXClientTest.java
index 4dca771..9c44118 100644
--- a/src/test/java/net/interfax/rest/client/impl/DefaultInterFAXClientTest.java
+++ b/jaxrs/test/src/main/java/net/interfax/rest/client/test/InterFAXClientTest.java
@@ -1,5 +1,6 @@
-package net.interfax.rest.client.impl;
+package net.interfax.rest.client.test;
+import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import net.interfax.rest.client.InterFAX;
import net.interfax.rest.client.domain.APIResponse;
@@ -17,6 +18,7 @@
import net.interfax.rest.client.domain.enums.Sharing;
import net.interfax.rest.client.exception.UnsuccessfulStatusCodeException;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -26,12 +28,12 @@
import java.util.Optional;
-public class DefaultInterFAXClientTest {
+public abstract class InterFAXClientTest {
private String faxNumber = "+442084978672";
@Rule
- public WireMockRule wireMockRule = new WireMockRule(8089);
+ public WireMockRule wireMockRule = new WireMockRule(createConfig());
@Test
public void testSendFax() throws Exception {
@@ -39,7 +41,7 @@ public void testSendFax() throws Exception {
String absoluteFilePath = this.getClass().getClassLoader().getResource("test.pdf").getFile();
File file = new File(absoluteFilePath);
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.sendFax(faxNumber, file);
Assert.assertEquals("[https://rest.interfax.net/outbound/faxes/666639902]", apiResponse.getHeaders().get("Location").toString());
Assert.assertEquals(201, apiResponse.getStatusCode());
@@ -56,7 +58,7 @@ public void testSendFaxWithOptions() throws Exception {
String pageHeader = "To: {To} From: {From} Pages: {TotalPages}";
sendFaxOptions.setPageHeader(Optional.of(pageHeader));
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.sendFax(faxNumber, file, Optional.of(sendFaxOptions));
Assert.assertEquals("[https://rest.interfax.net/outbound/faxes/666639902]", apiResponse.getHeaders().get("Location").toString());
Assert.assertEquals(201, apiResponse.getStatusCode());
@@ -71,7 +73,7 @@ public void testSendMultipleFilesAsFax() throws Exception {
File[] files = {file1, file2};
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.sendFax(faxNumber, files);
Assert.assertEquals("[https://rest.interfax.net/outbound/faxes/667457707]", apiResponse.getHeaders().get("Location").toString());
Assert.assertEquals(201, apiResponse.getStatusCode());
@@ -89,7 +91,7 @@ public void testSendMultipleFilesAsFaxWithOptions() throws Exception {
SendFaxOptions sendFaxOptions = new SendFaxOptions();
sendFaxOptions.setPageSize(Optional.of("a4"));
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.sendFax(faxNumber, files, Optional.of(sendFaxOptions));
Assert.assertEquals("[https://rest.interfax.net/outbound/faxes/667457707]", apiResponse.getHeaders().get("Location").toString());
Assert.assertEquals(201, apiResponse.getStatusCode());
@@ -106,7 +108,7 @@ public void testSendMultipleInputStreamsAsFax() throws Exception {
InputStream[] inputStreams = {inputStream1, inputStream2};
String[] mediaTypes = {"application/pdf", "application/pdf"};
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.sendFax(faxNumber, inputStreams, mediaTypes);
Assert.assertEquals("[https://rest.interfax.net/outbound/faxes/667457707]", apiResponse.getHeaders().get("Location").toString());
Assert.assertEquals(201, apiResponse.getStatusCode());
@@ -125,7 +127,7 @@ public void testSendMultipleInputStreamsAsFaxWithOptions() throws Exception {
SendFaxOptions sendFaxOptions = new SendFaxOptions();
sendFaxOptions.setPageSize(Optional.of("a4"));
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.sendFax(faxNumber, inputStreams, mediaTypes, Optional.of(sendFaxOptions));
Assert.assertEquals("[https://rest.interfax.net/outbound/faxes/667457707]", apiResponse.getHeaders().get("Location").toString());
Assert.assertEquals(201, apiResponse.getStatusCode());
@@ -135,7 +137,7 @@ public void testSendMultipleInputStreamsAsFaxWithOptions() throws Exception {
@Test
public void testSendFaxUsingPreviouslyUploadedDocUrl() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.sendFax(faxNumber, "https://rest.interfax.net/outbound/documents/90bd5477d5944c6d884c610171b75258");
Assert.assertEquals(201, apiResponse.getStatusCode());
}
@@ -146,7 +148,7 @@ public void testSendFaxUsingPreviouslyUploadedDocUrlWithOptions() throws Excepti
SendFaxOptions sendFaxOptions = new SendFaxOptions();
sendFaxOptions.setReplyAddress(Optional.of("reply@example.com"));
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.sendFax(
faxNumber,
"https://rest.interfax.net/outbound/documents/90bd5477d5944c6d884c610171b75258",
@@ -158,7 +160,7 @@ public void testSendFaxUsingPreviouslyUploadedDocUrlWithOptions() throws Excepti
@Test
public void testResendFax() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.resendFax("667915471", Optional.empty());
Assert.assertEquals(201, apiResponse.getStatusCode());
}
@@ -166,7 +168,7 @@ public void testResendFax() throws Exception {
@Test
public void testResendFaxWithOptions() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.resendFax("667915471", Optional.of(faxNumber));
Assert.assertEquals(201, apiResponse.getStatusCode());
}
@@ -174,7 +176,7 @@ public void testResendFaxWithOptions() throws Exception {
@Test
public void testGetFaxList() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
OutboundFaxStructure[] outboundFaxStructures = interFAX.getFaxList();
Assert.assertEquals(25, outboundFaxStructures.length);
}
@@ -185,7 +187,7 @@ public void testGetFaxListWithOptions() throws Exception {
GetFaxListOptions getFaxListOptions = new GetFaxListOptions();
getFaxListOptions.setLimit(Optional.of(5));
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
OutboundFaxStructure[] outboundFaxStructures = interFAX.getFaxList(Optional.of(getFaxListOptions));
Assert.assertEquals(5, outboundFaxStructures.length);
}
@@ -193,7 +195,7 @@ public void testGetFaxListWithOptions() throws Exception {
@Test
public void testGetCompletedFaxList() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
OutboundFaxStructure[] outboundFaxStructures = interFAX.getCompletedFaxList(new String[]{"667915751", "667915471"});
Assert.assertEquals(2, outboundFaxStructures.length);
Assert.assertEquals("667915751", outboundFaxStructures[1].getId());
@@ -202,7 +204,7 @@ public void testGetCompletedFaxList() throws Exception {
@Test
public void testGetOutboundFaxRecord() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
OutboundFaxStructure outboundFaxStructure = interFAX.getOutboundFaxRecord("667915751");
Assert.assertEquals("667915751", outboundFaxStructure.getId());
Assert.assertEquals("2016-10-03T00:36:41", outboundFaxStructure.getSubmitTime());
@@ -211,7 +213,7 @@ public void testGetOutboundFaxRecord() throws Exception {
@Test
public void testGetOutboundFaxImage() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
byte[] faxImage = interFAX.getOutboundFaxImage("667915751");
Assert.assertEquals(30072, faxImage.length);
}
@@ -220,7 +222,7 @@ public void testGetOutboundFaxImage() throws Exception {
public void testGetOutboundFaxImageWithInvalidId() throws Exception {
try {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
interFAX.getOutboundFaxImage("1234");
} catch (UnsuccessfulStatusCodeException e) {
Assert.assertEquals("Unsuccessful response from API", e.getMessage());
@@ -232,7 +234,7 @@ public void testGetOutboundFaxImageWithInvalidId() throws Exception {
@Test
public void testCancelFax() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.cancelFax("279499862");
Assert.assertEquals(404, apiResponse.getStatusCode());
}
@@ -240,7 +242,7 @@ public void testCancelFax() throws Exception {
@Test
public void testSearchFaxList() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
OutboundFaxStructure[] outboundFaxStructures = interFAX.searchFaxList();
Assert.assertEquals(25, outboundFaxStructures.length);
Assert.assertEquals("667915751", outboundFaxStructures[0].getId());
@@ -252,7 +254,7 @@ public void testSearchFaxListWithOptions() throws Exception {
SearchFaxOptions searchFaxOptions = new SearchFaxOptions();
searchFaxOptions.setLimit(Optional.of(3));
searchFaxOptions.setFaxNumber(Optional.of("+442084978672"));
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
OutboundFaxStructure[] outboundFaxStructures = interFAX.searchFaxList(Optional.of(searchFaxOptions));
Assert.assertEquals(3, outboundFaxStructures.length);
Assert.assertEquals("667915476", outboundFaxStructures[1].getId());
@@ -261,7 +263,7 @@ public void testSearchFaxListWithOptions() throws Exception {
@Test
public void testHideFax() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.hideFax("667915469");
Assert.assertEquals(200, apiResponse.getStatusCode());
}
@@ -272,7 +274,7 @@ public void testUploadDocument() throws Exception {
String absoluteFilePath = this.getClass().getClassLoader().getResource("A17_FlightPlan.pdf").getFile();
File file = new File(absoluteFilePath);
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.uploadDocument(file);
Assert.assertEquals(200, apiResponse.getStatusCode());
}
@@ -283,7 +285,7 @@ public void testUploadDocumentWithOptions() throws Exception {
String absoluteFilePath = this.getClass().getClassLoader().getResource("A17_FlightPlan.pdf").getFile();
File file = new File(absoluteFilePath);
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
DocumentUploadSessionOptions documentUploadSessionOptions = new DocumentUploadSessionOptions();
documentUploadSessionOptions.setName(Optional.of("overriddenname.pdf"));
documentUploadSessionOptions.setSize(Optional.of(Integer.toUnsignedLong(12345)));
@@ -296,7 +298,7 @@ public void testUploadDocumentWithOptions() throws Exception {
@Test
public void testGetUploadedDocumentsList() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
UploadedDocumentStatus[] uploadedDocumentStatuses = interFAX.getUploadedDocumentsList();
Assert.assertEquals(2, uploadedDocumentStatuses.length);
@@ -307,7 +309,7 @@ public void testGetUploadedDocumentsList() throws Exception {
@Test
public void testGetUploadedDocumentsListWithOptions() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
GetUploadedDocumentsListOptions getUploadedDocumentsListOptions = new GetUploadedDocumentsListOptions();
getUploadedDocumentsListOptions.setLimit(Optional.of(5));
getUploadedDocumentsListOptions.setOffset(Optional.of(1));
@@ -322,7 +324,7 @@ public void testGetUploadedDocumentsListWithOptions() throws Exception {
@Test
public void testGetUploadedDocumentStatus() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
UploadedDocumentStatus uploadedDocumentStatus = interFAX.getUploadedDocumentStatus("deca890355b44b42944970d9773962b5");
Assert.assertEquals("A17_FlightPlan.pdf", uploadedDocumentStatus.getFileName());
@@ -331,7 +333,7 @@ public void testGetUploadedDocumentStatus() throws Exception {
@Test
public void testCancelDocumentUploadSession() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.cancelDocumentUploadSession("deca890355b44b42944970d9773962b5");
Assert.assertEquals(200, apiResponse.getStatusCode());
@@ -340,7 +342,7 @@ public void testCancelDocumentUploadSession() throws Exception {
@Test
public void testGetAccountCredits() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
Double balance = interFAX.getAccountCredits();
Assert.assertEquals(Double.valueOf(3.8500), balance);
}
@@ -348,7 +350,7 @@ public void testGetAccountCredits() throws Exception {
@Test
public void testGetInboundFaxList() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
InboundFaxStructure[] inboundFaxStructures = interFAX.getInboundFaxList();
Assert.assertEquals(25, inboundFaxStructures.length);
Assert.assertEquals(292957796, inboundFaxStructures[0].getMessageId());
@@ -361,7 +363,7 @@ public void testGetInboundFaxListWithOptions() throws Exception {
getInboundFaxListOptions.setAllUsers(Optional.of(true));
getInboundFaxListOptions.setUnreadOnly(Optional.of(true));
getInboundFaxListOptions.setLimit(Optional.of(3));
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
InboundFaxStructure[] inboundFaxStructures
= interFAX.getInboundFaxList(Optional.of(getInboundFaxListOptions));
Assert.assertEquals(3, inboundFaxStructures.length);
@@ -371,7 +373,7 @@ public void testGetInboundFaxListWithOptions() throws Exception {
@Test
public void testGetInboundFaxRecord() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
InboundFaxStructure inboundFaxStructure = interFAX.getInboundFaxRecord("292626603");
Assert.assertEquals(292626603, inboundFaxStructure.getMessageId());
Assert.assertEquals(2, inboundFaxStructure.getPages());
@@ -380,7 +382,7 @@ public void testGetInboundFaxRecord() throws Exception {
@Test
public void testGetInboundFaxImage() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
byte[] faxImage = interFAX.getInboundFaxImage(292626603);
Assert.assertEquals(37194, faxImage.length);
}
@@ -388,7 +390,7 @@ public void testGetInboundFaxImage() throws Exception {
@Test
public void testGetInboundFaxForwardingEmails() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
InboundFaxesEmailsStructure inboundFaxesEmailsStructure = interFAX.getInboundFaxForwardingEmails("1234567");
Assert.assertEquals("username@interfax.net", inboundFaxesEmailsStructure.getEmailAddress());
}
@@ -396,7 +398,7 @@ public void testGetInboundFaxForwardingEmails() throws Exception {
@Test
public void testMarkInboundFax() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.markInboundFax("292626603", Optional.empty());
Assert.assertEquals(200, apiResponse.getStatusCode());
Assert.assertEquals("true", apiResponse.getResponseBody());
@@ -405,9 +407,18 @@ public void testMarkInboundFax() throws Exception {
@Test
public void testResendInboundFax() throws Exception {
- InterFAX interFAX = new DefaultInterFAXClient();
+ InterFAX interFAX = createClient();
APIResponse apiResponse = interFAX.resendInboundFax("292626603", Optional.of("someone@example.com"));
Assert.assertEquals(200, apiResponse.getStatusCode());
Assert.assertEquals("true", apiResponse.getResponseBody());
}
+
+ protected final WireMockConfiguration createConfig() {
+ return customize(WireMockConfiguration.wireMockConfig().port(8089)).httpServerFactory(new EnhancedMultipartJettyServer());
+ }
+
+ protected abstract InterFAX createClient();
+
+ protected abstract WireMockConfiguration customize(WireMockConfiguration configuration);
+
}
\ No newline at end of file
diff --git a/src/test/resources/A17_FlightPlan.pdf b/jaxrs/test/src/main/resources/A17_FlightPlan.pdf
similarity index 100%
rename from src/test/resources/A17_FlightPlan.pdf
rename to jaxrs/test/src/main/resources/A17_FlightPlan.pdf
diff --git a/src/test/resources/__files/body-1234-image-R21X4.json b/jaxrs/test/src/main/resources/__files/body-1234-image-R21X4.json
similarity index 100%
rename from src/test/resources/__files/body-1234-image-R21X4.json
rename to jaxrs/test/src/main/resources/__files/body-1234-image-R21X4.json
diff --git a/src/test/resources/__files/body-279499862-cancel-RHmWy.json b/jaxrs/test/src/main/resources/__files/body-279499862-cancel-RHmWy.json
similarity index 100%
rename from src/test/resources/__files/body-279499862-cancel-RHmWy.json
rename to jaxrs/test/src/main/resources/__files/body-279499862-cancel-RHmWy.json
diff --git a/src/test/resources/__files/body-292626603-emails-FZgeX.json b/jaxrs/test/src/main/resources/__files/body-292626603-emails-FZgeX.json
similarity index 100%
rename from src/test/resources/__files/body-292626603-emails-FZgeX.json
rename to jaxrs/test/src/main/resources/__files/body-292626603-emails-FZgeX.json
diff --git a/src/test/resources/__files/body-292626603-image-qYpTg.pdf b/jaxrs/test/src/main/resources/__files/body-292626603-image-qYpTg.pdf
similarity index 100%
rename from src/test/resources/__files/body-292626603-image-qYpTg.pdf
rename to jaxrs/test/src/main/resources/__files/body-292626603-image-qYpTg.pdf
diff --git a/src/test/resources/__files/body-292626603-mark-Delb3.json b/jaxrs/test/src/main/resources/__files/body-292626603-mark-Delb3.json
similarity index 100%
rename from src/test/resources/__files/body-292626603-mark-Delb3.json
rename to jaxrs/test/src/main/resources/__files/body-292626603-mark-Delb3.json
diff --git a/src/test/resources/__files/body-292626603-resend-6oyjM.json b/jaxrs/test/src/main/resources/__files/body-292626603-resend-6oyjM.json
similarity index 100%
rename from src/test/resources/__files/body-292626603-resend-6oyjM.json
rename to jaxrs/test/src/main/resources/__files/body-292626603-resend-6oyjM.json
diff --git a/src/test/resources/__files/body-667915469-hide-nAvhT.json b/jaxrs/test/src/main/resources/__files/body-667915469-hide-nAvhT.json
similarity index 100%
rename from src/test/resources/__files/body-667915469-hide-nAvhT.json
rename to jaxrs/test/src/main/resources/__files/body-667915469-hide-nAvhT.json
diff --git a/src/test/resources/__files/body-667915471-resend-6Pf2m.json b/jaxrs/test/src/main/resources/__files/body-667915471-resend-6Pf2m.json
similarity index 100%
rename from src/test/resources/__files/body-667915471-resend-6Pf2m.json
rename to jaxrs/test/src/main/resources/__files/body-667915471-resend-6Pf2m.json
diff --git a/src/test/resources/__files/body-667915471-resend-n4sqD.json b/jaxrs/test/src/main/resources/__files/body-667915471-resend-n4sqD.json
similarity index 100%
rename from src/test/resources/__files/body-667915471-resend-n4sqD.json
rename to jaxrs/test/src/main/resources/__files/body-667915471-resend-n4sqD.json
diff --git a/src/test/resources/__files/body-667915751-image-Z4hvu.tiff b/jaxrs/test/src/main/resources/__files/body-667915751-image-Z4hvu.tiff
similarity index 100%
rename from src/test/resources/__files/body-667915751-image-Z4hvu.tiff
rename to jaxrs/test/src/main/resources/__files/body-667915751-image-Z4hvu.tiff
diff --git a/src/test/resources/__files/body-documents-deca890355b44b42944970d9773962b5-Fijre.json b/jaxrs/test/src/main/resources/__files/body-documents-deca890355b44b42944970d9773962b5-Fijre.json
similarity index 100%
rename from src/test/resources/__files/body-documents-deca890355b44b42944970d9773962b5-Fijre.json
rename to jaxrs/test/src/main/resources/__files/body-documents-deca890355b44b42944970d9773962b5-Fijre.json
diff --git a/src/test/resources/__files/body-documents-deca890355b44b42944970d9773962b5-I40Se.json b/jaxrs/test/src/main/resources/__files/body-documents-deca890355b44b42944970d9773962b5-I40Se.json
similarity index 100%
rename from src/test/resources/__files/body-documents-deca890355b44b42944970d9773962b5-I40Se.json
rename to jaxrs/test/src/main/resources/__files/body-documents-deca890355b44b42944970d9773962b5-I40Se.json
diff --git a/src/test/resources/__files/body-faxes-292626603-8Dl4c.json b/jaxrs/test/src/main/resources/__files/body-faxes-292626603-8Dl4c.json
similarity index 100%
rename from src/test/resources/__files/body-faxes-292626603-8Dl4c.json
rename to jaxrs/test/src/main/resources/__files/body-faxes-292626603-8Dl4c.json
diff --git a/src/test/resources/__files/body-faxes-667915751-CDggR.json b/jaxrs/test/src/main/resources/__files/body-faxes-667915751-CDggR.json
similarity index 100%
rename from src/test/resources/__files/body-faxes-667915751-CDggR.json
rename to jaxrs/test/src/main/resources/__files/body-faxes-667915751-CDggR.json
diff --git a/src/test/resources/__files/body-faxes-completed-9iOLU.json b/jaxrs/test/src/main/resources/__files/body-faxes-completed-9iOLU.json
similarity index 100%
rename from src/test/resources/__files/body-faxes-completed-9iOLU.json
rename to jaxrs/test/src/main/resources/__files/body-faxes-completed-9iOLU.json
diff --git a/src/test/resources/__files/body-inbound-faxes-msx2X.json b/jaxrs/test/src/main/resources/__files/body-inbound-faxes-msx2X.json
similarity index 100%
rename from src/test/resources/__files/body-inbound-faxes-msx2X.json
rename to jaxrs/test/src/main/resources/__files/body-inbound-faxes-msx2X.json
diff --git a/src/test/resources/__files/body-inbound-faxes-y9Fif.json b/jaxrs/test/src/main/resources/__files/body-inbound-faxes-y9Fif.json
similarity index 100%
rename from src/test/resources/__files/body-inbound-faxes-y9Fif.json
rename to jaxrs/test/src/main/resources/__files/body-inbound-faxes-y9Fif.json
diff --git a/src/test/resources/__files/body-outbound-documents-QxROz.json b/jaxrs/test/src/main/resources/__files/body-outbound-documents-QxROz.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-documents-QxROz.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-documents-QxROz.json
diff --git a/src/test/resources/__files/body-outbound-documents-documentId-upload-chunks.json b/jaxrs/test/src/main/resources/__files/body-outbound-documents-documentId-upload-chunks.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-documents-documentId-upload-chunks.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-documents-documentId-upload-chunks.json
diff --git a/src/test/resources/__files/body-outbound-documents-zYbWQ.json b/jaxrs/test/src/main/resources/__files/body-outbound-documents-zYbWQ.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-documents-zYbWQ.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-documents-zYbWQ.json
diff --git a/src/test/resources/__files/body-outbound-faxes-49RgJ.json b/jaxrs/test/src/main/resources/__files/body-outbound-faxes-49RgJ.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-faxes-49RgJ.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-faxes-49RgJ.json
diff --git a/src/test/resources/__files/body-outbound-faxes-IaUjI.json b/jaxrs/test/src/main/resources/__files/body-outbound-faxes-IaUjI.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-faxes-IaUjI.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-faxes-IaUjI.json
diff --git a/src/test/resources/__files/body-outbound-faxes-RBc8I.json b/jaxrs/test/src/main/resources/__files/body-outbound-faxes-RBc8I.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-faxes-RBc8I.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-faxes-RBc8I.json
diff --git a/src/test/resources/__files/body-outbound-faxes-geyUE.json b/jaxrs/test/src/main/resources/__files/body-outbound-faxes-geyUE.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-faxes-geyUE.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-faxes-geyUE.json
diff --git a/src/test/resources/__files/body-outbound-faxes-zfEBX.json b/jaxrs/test/src/main/resources/__files/body-outbound-faxes-zfEBX.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-faxes-zfEBX.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-faxes-zfEBX.json
diff --git a/src/test/resources/__files/body-outbound-search-hb4cM.json b/jaxrs/test/src/main/resources/__files/body-outbound-search-hb4cM.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-search-hb4cM.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-search-hb4cM.json
diff --git a/src/test/resources/__files/body-outbound-search-uqvQG.json b/jaxrs/test/src/main/resources/__files/body-outbound-search-uqvQG.json
similarity index 100%
rename from src/test/resources/__files/body-outbound-search-uqvQG.json
rename to jaxrs/test/src/main/resources/__files/body-outbound-search-uqvQG.json
diff --git a/src/test/resources/__files/body-ppcards-balance-iURPk.json b/jaxrs/test/src/main/resources/__files/body-ppcards-balance-iURPk.json
similarity index 100%
rename from src/test/resources/__files/body-ppcards-balance-iURPk.json
rename to jaxrs/test/src/main/resources/__files/body-ppcards-balance-iURPk.json
diff --git a/jaxrs/test/src/main/resources/log4j.properties b/jaxrs/test/src/main/resources/log4j.properties
new file mode 100644
index 0000000..3ce7a3b
--- /dev/null
+++ b/jaxrs/test/src/main/resources/log4j.properties
@@ -0,0 +1,10 @@
+log4j.rootLogger=INFO, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%t | %-5p | %c | %m%n
+
+#log4j.logger.org.eclipse.jetty=TRACE
+
+log4j.logger.WireMock=TRACE
+log4j.logger.com.github.tomakehurst.wiremock=TRACE
\ No newline at end of file
diff --git a/src/test/resources/mappings/mapping-1234-image-R21X4.json b/jaxrs/test/src/main/resources/mappings/mapping-1234-image-R21X4.json
similarity index 100%
rename from src/test/resources/mappings/mapping-1234-image-R21X4.json
rename to jaxrs/test/src/main/resources/mappings/mapping-1234-image-R21X4.json
diff --git a/src/test/resources/mappings/mapping-279499862-cancel-RHmWy.json b/jaxrs/test/src/main/resources/mappings/mapping-279499862-cancel-RHmWy.json
similarity index 100%
rename from src/test/resources/mappings/mapping-279499862-cancel-RHmWy.json
rename to jaxrs/test/src/main/resources/mappings/mapping-279499862-cancel-RHmWy.json
diff --git a/src/test/resources/mappings/mapping-292626603-emails-FZgeX.json b/jaxrs/test/src/main/resources/mappings/mapping-292626603-emails-FZgeX.json
similarity index 100%
rename from src/test/resources/mappings/mapping-292626603-emails-FZgeX.json
rename to jaxrs/test/src/main/resources/mappings/mapping-292626603-emails-FZgeX.json
diff --git a/src/test/resources/mappings/mapping-292626603-image-qYpTg.json b/jaxrs/test/src/main/resources/mappings/mapping-292626603-image-qYpTg.json
similarity index 100%
rename from src/test/resources/mappings/mapping-292626603-image-qYpTg.json
rename to jaxrs/test/src/main/resources/mappings/mapping-292626603-image-qYpTg.json
diff --git a/src/test/resources/mappings/mapping-292626603-mark-Delb3.json b/jaxrs/test/src/main/resources/mappings/mapping-292626603-mark-Delb3.json
similarity index 100%
rename from src/test/resources/mappings/mapping-292626603-mark-Delb3.json
rename to jaxrs/test/src/main/resources/mappings/mapping-292626603-mark-Delb3.json
diff --git a/src/test/resources/mappings/mapping-292626603-resend-6oyjM.json b/jaxrs/test/src/main/resources/mappings/mapping-292626603-resend-6oyjM.json
similarity index 100%
rename from src/test/resources/mappings/mapping-292626603-resend-6oyjM.json
rename to jaxrs/test/src/main/resources/mappings/mapping-292626603-resend-6oyjM.json
diff --git a/src/test/resources/mappings/mapping-667915469-hide-nAvhT.json b/jaxrs/test/src/main/resources/mappings/mapping-667915469-hide-nAvhT.json
similarity index 100%
rename from src/test/resources/mappings/mapping-667915469-hide-nAvhT.json
rename to jaxrs/test/src/main/resources/mappings/mapping-667915469-hide-nAvhT.json
diff --git a/src/test/resources/mappings/mapping-667915471-resend-6Pf2m.json b/jaxrs/test/src/main/resources/mappings/mapping-667915471-resend-6Pf2m.json
similarity index 100%
rename from src/test/resources/mappings/mapping-667915471-resend-6Pf2m.json
rename to jaxrs/test/src/main/resources/mappings/mapping-667915471-resend-6Pf2m.json
diff --git a/src/test/resources/mappings/mapping-667915471-resend-n4sqD.json b/jaxrs/test/src/main/resources/mappings/mapping-667915471-resend-n4sqD.json
similarity index 100%
rename from src/test/resources/mappings/mapping-667915471-resend-n4sqD.json
rename to jaxrs/test/src/main/resources/mappings/mapping-667915471-resend-n4sqD.json
diff --git a/src/test/resources/mappings/mapping-667915751-image-Z4hvu.json b/jaxrs/test/src/main/resources/mappings/mapping-667915751-image-Z4hvu.json
similarity index 100%
rename from src/test/resources/mappings/mapping-667915751-image-Z4hvu.json
rename to jaxrs/test/src/main/resources/mappings/mapping-667915751-image-Z4hvu.json
diff --git a/src/test/resources/mappings/mapping-documents-deca890355b44b42944970d9773962b5-Fijre.json b/jaxrs/test/src/main/resources/mappings/mapping-documents-deca890355b44b42944970d9773962b5-Fijre.json
similarity index 100%
rename from src/test/resources/mappings/mapping-documents-deca890355b44b42944970d9773962b5-Fijre.json
rename to jaxrs/test/src/main/resources/mappings/mapping-documents-deca890355b44b42944970d9773962b5-Fijre.json
diff --git a/src/test/resources/mappings/mapping-documents-deca890355b44b42944970d9773962b5-I40Se.json b/jaxrs/test/src/main/resources/mappings/mapping-documents-deca890355b44b42944970d9773962b5-I40Se.json
similarity index 100%
rename from src/test/resources/mappings/mapping-documents-deca890355b44b42944970d9773962b5-I40Se.json
rename to jaxrs/test/src/main/resources/mappings/mapping-documents-deca890355b44b42944970d9773962b5-I40Se.json
diff --git a/src/test/resources/mappings/mapping-faxes-292626603-8Dl4c.json b/jaxrs/test/src/main/resources/mappings/mapping-faxes-292626603-8Dl4c.json
similarity index 100%
rename from src/test/resources/mappings/mapping-faxes-292626603-8Dl4c.json
rename to jaxrs/test/src/main/resources/mappings/mapping-faxes-292626603-8Dl4c.json
diff --git a/src/test/resources/mappings/mapping-faxes-667915751-CDggR.json b/jaxrs/test/src/main/resources/mappings/mapping-faxes-667915751-CDggR.json
similarity index 100%
rename from src/test/resources/mappings/mapping-faxes-667915751-CDggR.json
rename to jaxrs/test/src/main/resources/mappings/mapping-faxes-667915751-CDggR.json
diff --git a/src/test/resources/mappings/mapping-faxes-completed-9iOLU.json b/jaxrs/test/src/main/resources/mappings/mapping-faxes-completed-9iOLU.json
similarity index 100%
rename from src/test/resources/mappings/mapping-faxes-completed-9iOLU.json
rename to jaxrs/test/src/main/resources/mappings/mapping-faxes-completed-9iOLU.json
diff --git a/src/test/resources/mappings/mapping-inbound-faxes-msx2X.json b/jaxrs/test/src/main/resources/mappings/mapping-inbound-faxes-msx2X.json
similarity index 100%
rename from src/test/resources/mappings/mapping-inbound-faxes-msx2X.json
rename to jaxrs/test/src/main/resources/mappings/mapping-inbound-faxes-msx2X.json
diff --git a/src/test/resources/mappings/mapping-inbound-faxes-y9Fif.json b/jaxrs/test/src/main/resources/mappings/mapping-inbound-faxes-y9Fif.json
similarity index 100%
rename from src/test/resources/mappings/mapping-inbound-faxes-y9Fif.json
rename to jaxrs/test/src/main/resources/mappings/mapping-inbound-faxes-y9Fif.json
diff --git a/src/test/resources/mappings/mapping-outbound-documents-QxROz.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-QxROz.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-documents-QxROz.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-QxROz.json
diff --git a/src/test/resources/mappings/mapping-outbound-documents-documentId-upload-chunks.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-documentId-upload-chunks.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-documents-documentId-upload-chunks.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-documentId-upload-chunks.json
diff --git a/src/test/resources/mappings/mapping-outbound-documents-documentId-upload-last-chunk.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-documentId-upload-last-chunk.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-documents-documentId-upload-last-chunk.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-documentId-upload-last-chunk.json
diff --git a/src/test/resources/mappings/mapping-outbound-documents-get-uploaded-documents-list-with-options-zYbWQ.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-get-uploaded-documents-list-with-options-zYbWQ.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-documents-get-uploaded-documents-list-with-options-zYbWQ.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-get-uploaded-documents-list-with-options-zYbWQ.json
diff --git a/src/test/resources/mappings/mapping-outbound-documents-get-uploaded-documents-list-zYbWQ.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-get-uploaded-documents-list-zYbWQ.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-documents-get-uploaded-documents-list-zYbWQ.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-get-uploaded-documents-list-zYbWQ.json
diff --git a/src/test/resources/mappings/mapping-outbound-documents-with-options.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-with-options.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-documents-with-options.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-documents-with-options.json
diff --git a/src/test/resources/mappings/mapping-outbound-faxes-multiple-files-with-options.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-files-with-options.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-faxes-multiple-files-with-options.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-files-with-options.json
diff --git a/src/test/resources/mappings/mapping-outbound-faxes-multiple-files.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-files.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-faxes-multiple-files.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-files.json
diff --git a/src/test/resources/mappings/mapping-outbound-faxes-multiple-inputstreams-with-options.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-inputstreams-with-options.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-faxes-multiple-inputstreams-with-options.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-inputstreams-with-options.json
diff --git a/src/test/resources/mappings/mapping-outbound-faxes-multiple-inputstreams.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-inputstreams.json
similarity index 68%
rename from src/test/resources/mappings/mapping-outbound-faxes-multiple-inputstreams.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-inputstreams.json
index 6be74d7..b7f733e 100644
--- a/src/test/resources/mappings/mapping-outbound-faxes-multiple-inputstreams.json
+++ b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-multiple-inputstreams.json
@@ -11,9 +11,27 @@
}
},
"method" : "POST",
- "bodyPatterns" : [ {
- "matches" : ".*file0.*file1.*"
- } ]
+ "multipartPatterns" : [{
+ "matchingType" : "ALL",
+ "headers" : {
+ "Content-Type" : {
+ "equalTo" : "application/pdf"
+ },
+ "Content-ID" : {
+ "contains" : "file0"
+ }
+ }
+ },{
+ "matchingType" : "ALL",
+ "headers" : {
+ "Content-Type" : {
+ "equalTo" : "application/pdf"
+ },
+ "Content-ID" : {
+ "contains" : "file1"
+ }
+ }
+ }]
},
"response" : {
"status" : 201,
diff --git a/src/test/resources/mappings/mapping-outbound-faxes-single-file-with-options.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-single-file-with-options.json
similarity index 99%
rename from src/test/resources/mappings/mapping-outbound-faxes-single-file-with-options.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-single-file-with-options.json
index fd47ec5..1d591b9 100644
--- a/src/test/resources/mappings/mapping-outbound-faxes-single-file-with-options.json
+++ b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-single-file-with-options.json
@@ -1,7 +1,7 @@
{
"uuid" : "292f2cd5-4bf3-4393-8cef-87b1942d9e4f",
"request" : {
- "url" : "/outbound/faxes?faxNumber=%2B442084978672&contact=testContactName&pageHeader=To%3A+%7BTo%7D+From%3A+%7BFrom%7D+Pages%3A+%7BTotalPages%7D",
+ "url" : "/outbound/faxes?faxNumber=%2B442084978672&contact=testContactName&pageHeader=To%3A%2B%7BTo%7D%2BFrom%3A%2B%7BFrom%7D%2BPages%3A%2B%7BTotalPages%7D",
"headers": {
"Authorization": {
"equalTo" : "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
diff --git a/src/test/resources/mappings/mapping-outbound-faxes-single-file.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-single-file.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-faxes-single-file.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-single-file.json
diff --git a/src/test/resources/mappings/mapping-outbound-faxes-using-pre-uploaded-doc-RBc8I.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-using-pre-uploaded-doc-RBc8I.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-faxes-using-pre-uploaded-doc-RBc8I.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-using-pre-uploaded-doc-RBc8I.json
diff --git a/src/test/resources/mappings/mapping-outbound-faxes-using-pre-uploaded-doc-with-options-RBc8I.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-using-pre-uploaded-doc-with-options-RBc8I.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-faxes-using-pre-uploaded-doc-with-options-RBc8I.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-faxes-using-pre-uploaded-doc-with-options-RBc8I.json
diff --git a/src/test/resources/mappings/mapping-outbound-get-faxes-list-IaUjI.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-get-faxes-list-IaUjI.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-get-faxes-list-IaUjI.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-get-faxes-list-IaUjI.json
diff --git a/src/test/resources/mappings/mapping-outbound-get-faxes-list-with-options-zfEBX.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-get-faxes-list-with-options-zfEBX.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-get-faxes-list-with-options-zfEBX.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-get-faxes-list-with-options-zfEBX.json
diff --git a/src/test/resources/mappings/mapping-outbound-search-hb4cM.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-search-hb4cM.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-search-hb4cM.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-search-hb4cM.json
diff --git a/src/test/resources/mappings/mapping-outbound-search-uqvQG.json b/jaxrs/test/src/main/resources/mappings/mapping-outbound-search-uqvQG.json
similarity index 100%
rename from src/test/resources/mappings/mapping-outbound-search-uqvQG.json
rename to jaxrs/test/src/main/resources/mappings/mapping-outbound-search-uqvQG.json
diff --git a/src/test/resources/mappings/mapping-ppcards-balance-iURPk.json b/jaxrs/test/src/main/resources/mappings/mapping-ppcards-balance-iURPk.json
similarity index 100%
rename from src/test/resources/mappings/mapping-ppcards-balance-iURPk.json
rename to jaxrs/test/src/main/resources/mappings/mapping-ppcards-balance-iURPk.json
diff --git a/src/test/resources/test.pdf b/jaxrs/test/src/main/resources/test.pdf
similarity index 100%
rename from src/test/resources/test.pdf
rename to jaxrs/test/src/main/resources/test.pdf
diff --git a/parent/pom.xml b/parent/pom.xml
new file mode 100644
index 0000000..5b0bf01
--- /dev/null
+++ b/parent/pom.xml
@@ -0,0 +1,309 @@
+
+
+ 4.0.0
+
+
+ net.interfax
+ interfax
+ 0.20-SNAPSHOT
+
+
+ parent
+ 0.20-SNAPSHOT
+ pom
+
+
+ 3.5.0
+ 2.10.3
+ 2.4
+ 1.6.3
+ 1.6
+
+ 2.8.9
+ 2.27
+ 3.2.4
+
+ 3.5
+ 2.1
+ 4.12
+ 1.7.21
+ 2.16.0
+ 20.0
+ 9.4.9.v20180320
+
+ 3.2.4
+
+ ${project.groupId}.${project.artifactId}
+
+ !${osgi.namespace}.*,
+ *
+
+
+ !${osgi.namespace}.internal.*,
+ ${osgi.namespace}.*
+
+
+
+
+
+
+ net.interfax
+ api
+ ${project.version}
+
+
+ net.interfax
+ common
+ ${project.version}
+
+
+ net.interfax
+ jaxrs-client-shared
+ ${project.version}
+
+
+ net.interfax
+ jaxrs-client-jersey
+ ${project.version}
+
+
+ net.interfax
+ jaxrs-client-cxf
+ ${project.version}
+
+
+ net.interfax
+ jaxrs-client-test
+ ${project.version}
+ test
+
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ ${jackson.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ ${jackson.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson.version}
+
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-yaml
+ ${jackson.version}
+
+
+ com.fasterxml.jackson.module
+ jackson-module-jaxb-annotations
+ ${jackson.version}
+
+
+ com.fasterxml.jackson.jaxrs
+ jackson-jaxrs-json-provider
+ ${jackson.version}
+
+
+ javax.ws.rs
+ javax.ws.rs-api
+ ${jaxrs.version}
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
+ com.google.guava
+ guava
+ ${guava.version}
+
+
+
+ org.apache.cxf
+ cxf-api
+ ${cxf.version}
+
+
+ org.apache.cxf
+ cxf-core
+ ${cxf.version}
+
+
+ org.apache.cxf
+ cxf-rt-core
+ ${cxf.version}
+
+
+ org.apache.cxf
+ cxf-rt-rs
+ ${cxf.version}
+
+
+ org.apache.cxf
+ cxf-rt-rs-client
+ ${cxf.version}
+
+
+ org.apache.cxf
+ cxf-rt-features-logging
+ ${cxf.version}
+
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+ org.slf4j
+ slf4j-log4j12
+ ${slf4j.version}
+ test
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+ com.github.tomakehurst
+ wiremock
+ ${wiremock.version}
+ test
+
+
+
+ org.eclipse.jetty
+ jetty-server
+ ${jetty.version}
+
+
+ org.eclipse.jetty
+ jetty-servlet
+ ${jetty.version}
+
+
+ org.eclipse.jetty
+ jetty-servlets
+ ${jetty.version}
+
+
+ org.eclipse.jetty
+ jetty-webapp
+ ${jetty.version}
+
+
+
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ ${maven-bundle-plugin.version}
+
+
+ ${osgi.import}
+ ${osgi.export}
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+ 1.8
+ 1.8
+ UTF-8
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+
+
+
+
+ release
+
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+ -Xdoclint:none
+
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ ${nexus-staging-maven-plugin.version}
+ true
+
+ ossrh
+ https://oss.sonatype.org/
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ ${maven-gpg-plugin.version}
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index b400d0c..8d393a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,14 +3,22 @@
4.0.0
net.interfax
- api-client
- 0.15-SNAPSHOT
+ interfax
+ 0.20-SNAPSHOT
+ pom
InterFAX Java Client
Library that enables using InterFAX HTTP APIs using Java
https://www.interfax.net/en
2016
+
+ parent
+ api
+ common
+ jaxrs
+
+
MIT License
@@ -30,8 +38,8 @@
scm:git:git@github.com:interfax/interfax-java.git
scm:git:git@github.com:interfax/interfax-java.git
git@github.com:interfax/interfax-java.git
- HEAD
-
+ HEAD
+
@@ -44,96 +52,8 @@
-
- 2.10.3
- 2.4
- 1.6.3
- 1.6
-
-
-
-
- org.glassfish.jersey.core
- jersey-client
- 2.23.2
-
-
- org.glassfish.jersey.media
- jersey-media-multipart
- 2.23.2
-
-
- org.glassfish.jersey.media
- jersey-media-json-jackson
- 2.23.2
-
-
- com.fasterxml.jackson.core
- jackson-annotations
- 2.8.3
-
-
- org.slf4j
- slf4j-api
- 1.7.21
-
-
- org.apache.commons
- commons-lang3
- 3.5
-
-
- com.google.guava
- guava
- 20.0
-
-
- junit
- junit
- 4.12
- test
-
-
- org.slf4j
- slf4j-log4j12
- 1.7.21
- test
-
-
- com.github.tomakehurst
- wiremock
- 2.1.12
- test
-
-
- com.fasterxml.jackson.dataformat
- jackson-dataformat-yaml
- 2.7.6
-
-
- org.apache.tika
- tika-core
- 1.13
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.2
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.1
-
- 1.8
- 1.8
- UTF-8
-
-
org.apache.maven.plugins
maven-release-plugin
@@ -145,71 +65,4 @@
-
-
- release
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- ${maven-source-plugin.version}
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- ${maven-javadoc-plugin.version}
-
- -Xdoclint:none
-
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- ${nexus-staging-maven-plugin.version}
- true
-
- ossrh
- https://oss.sonatype.org/
- true
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- ${maven-gpg-plugin.version}
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
-
-
-
-
diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties
deleted file mode 100644
index b9be98e..0000000
--- a/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-log4j.rootLogger=info, stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%t %-5p %c{2} - %m%n
\ No newline at end of file