aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java9
-rw-r--r--src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java35
-rw-r--r--src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-notification.xml1
-rw-r--r--src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-request-status.xml1
4 files changed, 26 insertions, 20 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java b/src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java
index 95c7140..2794fcd 100644
--- a/src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java
+++ b/src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java
@@ -12,8 +12,6 @@ import at.gv.zustellung.msg.xsd.DeliveryRequestStatusType;
import at.gv.zustellung.msg.xsd.DeliveryRequestType;
import at.gv.zustellung.tnvz.xsd.TNVZServicePort;
import org.apache.commons.io.FileUtils;
-import org.awaitility.Awaitility;
-import org.awaitility.Duration;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,7 +40,7 @@ import java.util.function.Consumer;
import static at.gv.zustellung.app2mzs.xsd.DeliveryNotificationACKType.deliveryNotificationACKTypeBuilder;
import static at.gv.zustellung.app2mzs.xsd.persondata.IdentificationType.Value.valueBuilder;
import static at.gv.zustellung.app2mzs.xsd.persondata.IdentificationType.identificationTypeBuilder;
-import static at.gv.zustellung.msg.xsd.DeliveryAnswerType.deliveryAnswerTypeBuilder;
+import static at.gv.zustellung.msg.xsd.DeliveryRequestStatusType.PartialSuccess.partialSuccessBuilder;
import static at.gv.zustellung.msg.xsd.DeliveryRequestStatusType.deliveryRequestStatusTypeBuilder;
import static java.net.http.HttpResponse.BodyHandlers.ofString;
import static org.apache.commons.io.FileUtils.readFileToString;
@@ -82,7 +80,6 @@ public class ITEndToEndTest {
public Consumer<byte[]> signatureVerifier() {
return bytes -> {};
}
-
@Bean
@Primary
public ClientFactory mockClientFactory() {
@@ -116,7 +113,7 @@ public class ITEndToEndTest {
.withValue(value).withId("id").withType("type").build();
var tnvzHelperTest = new TnvzHelperTest();
tnvzHelperTest.setup();
- var tnvzSuccess = tnvzHelperTest.tnvzSuccess(List.of("*/*"), receiverId);
+ var tnvzSuccess = tnvzHelperTest.tnvzSuccess(List.of(""), true, receiverId);
when(tnvz.queryPerson(any())).thenReturn(tnvzSuccess);
return tnvz;
@@ -133,7 +130,7 @@ public class ITEndToEndTest {
var appDeliveryID = request.getMetaData().getAppDeliveryID();
var zsDeliveryID = "ZSDID-" + appDeliveryID;
var responseID = RequestStatusResponse.getResponseID(appDeliveryID);
- var answer = deliveryAnswerTypeBuilder()
+ var answer = partialSuccessBuilder()
.withDeliverySystem(DELIVERY_SYSTEM)
.withAppDeliveryID(appDeliveryID)
.withZSDeliveryID(zsDeliveryID)
diff --git a/src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java b/src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java
index 550f089..0d5fe9d 100644
--- a/src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java
+++ b/src/test/java/at/gv/egiz/moazs/TnvzHelperTest.java
@@ -1,13 +1,13 @@
package at.gv.egiz.moazs;
-import at.gv.egiz.moazs.scheme.Mzs2MsgConverter;
import at.gv.egiz.moazs.client.TnvzHelper;
+import at.gv.egiz.moazs.scheme.Mzs2MsgConverter;
import at.gv.zustellung.app2mzs.xsd.DeliveryRequestType;
import at.gv.zustellung.app2mzs.xsd.persondata.IdentificationType;
-import at.gv.zustellung.msg.xsd.MetaData;
-import at.gv.zustellung.msg.xsd.SystemComponentType;
+import at.gv.zustellung.msg.xsd.ObjectFactory;
import at.gv.zustellung.tnvz.xsd.MimeTypeList;
+import at.gv.zustellung.tnvz.xsd.MimeTypeListType;
import at.gv.zustellung.tnvz.xsd.QueryPersonResponse;
import at.gv.zustellung.tnvz.xsd.TNVZServicePort;
import org.junit.Before;
@@ -29,6 +29,7 @@ import static at.gv.zustellung.msg.xsd.ErrorInfoType.errorInfoTypeBuilder;
import static at.gv.zustellung.msg.xsd.MetaData.metaDataBuilder;
import static at.gv.zustellung.msg.xsd.SystemComponentType.systemComponentTypeBuilder;
import static at.gv.zustellung.tnvz.xsd.MimeTypeList.mimeTypeListBuilder;
+import static at.gv.zustellung.tnvz.xsd.MimeTypeListType.mimeTypeListTypeBuilder;
import static at.gv.zustellung.tnvz.xsd.PersonResultSuccessType.personResultSuccessTypeBuilder;
import static at.gv.zustellung.tnvz.xsd.PersonResultType.Error.errorBuilder;
import static at.gv.zustellung.tnvz.xsd.PersonResultType.personResultTypeBuilder;
@@ -42,6 +43,8 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class TnvzHelperTest {
+ private static final ObjectFactory FACTORY = new ObjectFactory();
+
private TnvzHelper helper;
@Mock
@@ -57,11 +60,11 @@ public class TnvzHelperTest {
@Test
public void acceptWildcardMimetype() {
- List<String> acceptedTypes = List.of("*/*");
+ List<String> acceptedTypes = List.of();
List<String> attachedTypes = List.of("pdf", "xml", "html", "random/attachedtype");
var receiverId = identification("zbpk", "receiver-id-value");
var deliveryRequest = deliveryRequest(attachedTypes, receiverId);
- var success = tnvzSuccess(acceptedTypes, receiverId);
+ var success = tnvzSuccess(acceptedTypes, true, receiverId);
when(port.queryPerson(any())).thenReturn(success);
var actual = helper.performQueryPersonRequest(deliveryRequest, port);
@@ -86,7 +89,7 @@ public class TnvzHelperTest {
List<String> attachedTypes = List.of("pdf", "xml", "html", "random/attachedtype");
var receiverId = identification("zbpk", "receiver-id-value");
var deliveryRequest = deliveryRequest(attachedTypes, receiverId);
- var success = tnvzSuccess(acceptedTypes, receiverId);
+ var success = tnvzSuccess(acceptedTypes, false, receiverId);
when(port.queryPerson(any())).thenReturn(success);
helper.performQueryPersonRequest(deliveryRequest, port);
@@ -98,7 +101,7 @@ public class TnvzHelperTest {
List<String> attachedTypes = List.of("pdf", "xml");
var receiverId = identification("zbpk", "receiver-id-value");
var deliveryRequest = deliveryRequest(attachedTypes, receiverId);
- var success = tnvzSuccess(acceptedTypes, receiverId);
+ var success = tnvzSuccess(acceptedTypes, false, receiverId);
when(port.queryPerson(any())).thenReturn(success);
var actual = helper.performQueryPersonRequest(deliveryRequest, port);
@@ -156,23 +159,31 @@ public class TnvzHelperTest {
.collect(toList());
}
- public QueryPersonResponse tnvzSuccess(List<String> mimeTypes, IdentificationType receiverId) {
+ public QueryPersonResponse tnvzSuccess(List<String> mimeTypes, boolean allMimetypesAccepted, IdentificationType receiverId) {
- var success = personResultSuccessTypeBuilder()
+ var successBuilder = personResultSuccessTypeBuilder()
.withMimeTypeList(setupMimeTypeList(mimeTypes))
- .withIdentification(converter.convert(receiverId))
- .build();
+ .withIdentification(converter.convert(receiverId));
+
+ if(allMimetypesAccepted) {
+ successBuilder.withAllStandardMimeTypes(FACTORY.createIndicatorType());
+ }
var personResult = personResultTypeBuilder()
- .withSuccess(success)
+ .withSuccess(successBuilder.build())
.build();
var queryResultList = queryResultListBuilder()
.withQueryResult(List.of(personResult))
.build();
+ MimeTypeListType standardList = mimeTypeListTypeBuilder()
+ .withMimeType(List.of())
+ .build();
+
return queryPersonResponseBuilder()
.withQueryResultList(queryResultList)
+ .withStandardMimeTypeList(standardList)
.build();
}
diff --git a/src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-notification.xml b/src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-notification.xml
index 2f99af5..82af5cc 100644
--- a/src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-notification.xml
+++ b/src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-notification.xml
@@ -33,7 +33,6 @@
<p:DateOfBirth>1984-01-24</p:DateOfBirth>
</p:PhysicalPerson>
</msg:ReceiverDetails>
- <msg:RelayedViaERV>false</msg:RelayedViaERV>
<msg:Timestamp>%s</msg:Timestamp>
<msg:Answer xsi:type="msg:AcceptedType">
<msg:NotificationsPerformed>
diff --git a/src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-request-status.xml b/src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-request-status.xml
index f81a554..f61531f 100644
--- a/src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-request-status.xml
+++ b/src/test/resources/at/gv/egiz/moazs/ITEndToEndTest/msg-delivery-request-status.xml
@@ -11,7 +11,6 @@
<msg:AppDeliveryID>%s</msg:AppDeliveryID>
<msg:GZ>%s</msg:GZ>
<msg:DeliveryTimestamp>%s</msg:DeliveryTimestamp>
- <msg:RelayedViaERV>false</msg:RelayedViaERV>
</msg:Success>
<dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Id="signature-1-1">
<dsig:SignedInfo>