aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at/gv
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-06-27 14:41:51 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-06-27 14:47:22 +0200
commit9556dc6bd7e327dfbfc3c2d5228ad920ad7b9f8e (patch)
tree01db0a1c4c94c66118256e17ecdb821e04ed657c /src/test/java/at/gv
parenta8e726382b0472ad030d7a579fe8d6878a216bd4 (diff)
downloadmoa-zs-9556dc6bd7e327dfbfc3c2d5228ad920ad7b9f8e.tar.gz
moa-zs-9556dc6bd7e327dfbfc3c2d5228ad920ad7b9f8e.tar.bz2
moa-zs-9556dc6bd7e327dfbfc3c2d5228ad920ad7b9f8e.zip
Inject Configurable HTTP Policies to MsgClient
- Refactor: Get rid of MsgClient, because MsgClientFactory can do all the work. - Add Connection Timeout and Request Timeout (Policies of HTTP Client) to mzs:DeliveryRequest/Config and application.yaml. - Update readme: Add JDK 12 Requirement
Diffstat (limited to 'src/test/java/at/gv')
-rw-r--r--src/test/java/at/gv/egiz/moazs/MsgClientTest.java10
-rw-r--r--src/test/java/at/gv/egiz/moazs/SameThreadDeliveryPipelineTest.java12
2 files changed, 10 insertions, 12 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/MsgClientTest.java b/src/test/java/at/gv/egiz/moazs/MsgClientTest.java
index 294b2b8..7c9bf7d 100644
--- a/src/test/java/at/gv/egiz/moazs/MsgClientTest.java
+++ b/src/test/java/at/gv/egiz/moazs/MsgClientTest.java
@@ -1,6 +1,5 @@
package at.gv.egiz.moazs;
-import at.gv.egiz.moazs.msg.MsgClient;
import at.gv.egiz.moazs.msg.MsgClientFactory;
import at.gv.egiz.moazs.msg.StoreSOAPBodyBinaryInRepositoryInterceptor;
import at.gv.egiz.moazs.scheme.Marshaller;
@@ -19,6 +18,7 @@ import javax.xml.bind.JAXBElement;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
+import java.math.BigInteger;
import static at.gv.zustellung.app2mzs.xsd.KeyStoreType.keyStoreTypeBuilder;
import static at.gv.zustellung.app2mzs.xsd.SSLType.SSLTypeBuilder;
@@ -28,7 +28,7 @@ import static at.gv.zustellung.app2mzs.xsd.SSLType.SSLTypeBuilder;
public class MsgClientTest {
- private final static Logger log = LoggerFactory.getLogger(MsgClient.class);
+ private final static Logger log = LoggerFactory.getLogger(MsgClientTest.class);
private final String basePath = "src/test/resources/at/gv/egiz/moazs/MsgClientTest/";
@Autowired
@@ -54,7 +54,7 @@ public class MsgClientTest {
var client = factory.create(clientParams);
try{
- var status = client.send(request);
+ var status = client.delivery(request);
log.info("status: " + msgMarshaller.marshallXml(OF.createDeliveryResponse(status)));
} catch (Exception ex) {
System.out.println(ex.getMessage());
@@ -69,7 +69,7 @@ public class MsgClientTest {
var clientParams = generateSSLClientParams(sslServiceUri);
var client = factory.create(clientParams);
- var status = client.send(request);
+ var status = client.delivery(request);
log.info("status: " + msgMarshaller.marshallXml(OF.createDeliveryRequestStatus(status)));
}
@@ -98,6 +98,8 @@ public class MsgClientTest {
return ClientType.clientTypeBuilder()
.withURL(sslServiceUri)
.withSSL(sslParams)
+ .withReceiveTimeout(BigInteger.ZERO)
+ .withConnectionTimeout(BigInteger.ZERO)
.build();
}
diff --git a/src/test/java/at/gv/egiz/moazs/SameThreadDeliveryPipelineTest.java b/src/test/java/at/gv/egiz/moazs/SameThreadDeliveryPipelineTest.java
index df54ef7..e685816 100644
--- a/src/test/java/at/gv/egiz/moazs/SameThreadDeliveryPipelineTest.java
+++ b/src/test/java/at/gv/egiz/moazs/SameThreadDeliveryPipelineTest.java
@@ -1,8 +1,6 @@
package at.gv.egiz.moazs;
-import at.gv.egiz.moazs.msg.MsgClient;
import at.gv.egiz.moazs.msg.MsgClientFactory;
-import at.gv.egiz.moazs.msg.StoreSOAPBodyBinaryInRepositoryInterceptor;
import at.gv.egiz.moazs.pipeline.DeliveryPipeline;
import at.gv.egiz.moazs.pipeline.SameThreadDeliveryPipeline;
import at.gv.egiz.moazs.repository.DeliveryRepository;
@@ -12,6 +10,7 @@ import at.gv.egiz.moazs.tnvz.TnvzClient;
import at.gv.egiz.moazs.tnvz.TnvzResultVerifier;
import at.gv.egiz.moazs.verify.MoaSPSSSignatureVerifier;
import at.gv.zustellung.app2mzs.xsd.DeliveryRequestType;
+import at.gv.zustellung.msg.xsd.App2ZusePort;
import at.gv.zustellung.msg.xsd.DeliveryRequestStatusType;
import at.gv.zustellung.msg.xsd.MetaData;
import at.gv.zustellung.tnvz.xsd.MimeTypeList;
@@ -55,15 +54,12 @@ public class SameThreadDeliveryPipelineTest {
private MsgClientFactory msgClientFactory;
@Mock
- private MsgClient msgClient;
+ private App2ZusePort msgClient;
@Mock
private Mzs2MsgConverter converter;
@Mock
- private StoreSOAPBodyBinaryInRepositoryInterceptor interceptor;
-
- @Mock
private MoaSPSSSignatureVerifier verifier;
@@ -72,7 +68,7 @@ public class SameThreadDeliveryPipelineTest {
@Before
public void setup() {
pipeline = new SameThreadDeliveryPipeline(repository, tnvzClient, new TnvzResultVerifier(),
- converter,interceptor, msgClientFactory, verifier);
+ converter, msgClientFactory, verifier);
}
@Test
@@ -174,7 +170,7 @@ public class SameThreadDeliveryPipelineTest {
when(converter.convert(eq(mzsRequest) )).thenReturn(msgRequest);
when(converter.convert(eq(mzsRequest), any())).thenReturn(msgRequest);
when(msgClientFactory.create(any())).thenReturn(msgClient);
- when(msgClient.send(msgRequest)).thenReturn(status);
+ when(msgClient.delivery(msgRequest)).thenReturn(status);
return status;