aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/at')
-rw-r--r--src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java18
-rw-r--r--src/test/java/at/gv/egiz/moazs/JaxbMarshallerTest.java101
2 files changed, 12 insertions, 107 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
index 01b7745..5579f06 100644
--- a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
+++ b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
@@ -1,5 +1,8 @@
package at.gv.egiz.moazs;
+import at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.DeliveryRequestStatusType;
+import at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.DeliveryRequestStatusType.DeliveryRequestStatusTypeBuilder;
+import at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.DeliveryRequestStatusType.Success.SuccessBuilder;
import at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.ObjectFactory;
import at.gv.egiz.moazs.pipeline.DeliveryPipeline;
import at.gv.egiz.moazs.repository.DeliveryRepository;
@@ -42,16 +45,19 @@ public class App2MzsServiceTest {
@Autowired
private DeliveryRepository repository;
- private final ObjectFactory factory = new ObjectFactory();
-
@Bean
@Primary
public DeliveryPipeline deliveryPipelineThatAlwaysSucceeds() {
return appDeliveryId -> {
- var status = factory.createDeliveryRequestStatusType();
- var success = factory.createDeliveryRequestStatusTypeSuccess();
- success.setAppDeliveryID(appDeliveryId);
- status.setSuccess(success);
+
+ var success = new SuccessBuilder()
+ .withAppDeliveryID(appDeliveryId)
+ .build();
+
+ var status = new DeliveryRequestStatusTypeBuilder()
+ .withSuccess(success)
+ .build();
+
repository.add(status);
};
}
diff --git a/src/test/java/at/gv/egiz/moazs/JaxbMarshallerTest.java b/src/test/java/at/gv/egiz/moazs/JaxbMarshallerTest.java
deleted file mode 100644
index e85a5ba..0000000
--- a/src/test/java/at/gv/egiz/moazs/JaxbMarshallerTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package at.gv.egiz.moazs;
-
-import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.DeliveryRequestType;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import java.math.BigInteger;
-import java.nio.charset.Charset;
-import java.util.GregorianCalendar;
-
-public class JaxbMarshallerTest {
-
- private static final Logger logger = LoggerFactory.getLogger(JaxbMarshallerTest.class);
-
- private Marshaller createMarshaller() throws JAXBException {
- JAXBContext context = JAXBContext.newInstance(
- at.gv.e_government.reference.namespace.zustellung.mzs.persondata_.ObjectFactory.class,
- at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.ObjectFactory.class,
- at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.ObjectFactory.class,
- at.gv.e_government.reference.namespace.persondata.phase2._20181206_.ObjectFactory.class);
-
- var m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- return m;
-
- }
-
- private JAXBElement<DeliveryRequestType> generateSampleRequest() throws DatatypeConfigurationException {
- var pof = new at.gv.e_government.reference.namespace.zustellung.mzs.persondata_.ObjectFactory();
- var mzsof = new at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.ObjectFactory();
- var msgof = new at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.ObjectFactory();
-
- var deliveryRequest = new DeliveryRequestType();
-
- var sender = mzsof.createDeliveryRequestTypeSender();
- var corporateBody = pof.createCorporateBodyType();
- corporateBody.setFullName("Bundesministerium für Testzwecke");
- sender.setPerson(pof.createCorporateBody(corporateBody));
- deliveryRequest.setSender(sender);
-
- var receiver = mzsof.createDeliveryRequestTypeReceiver();
- var physicalPerson = pof.createPhysicalPersonType();
- var name = pof.createPersonNameType();
- name.setGivenName("Maxi");
- var familyName = pof.createPersonNameTypeFamilyName();
- familyName.setValue("Mustermann1");
- name.setFamilyName(familyName);
- physicalPerson.setName(name);
- var cal = new GregorianCalendar(1984, 1, 24);
- var xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
- physicalPerson.setDateOfBirth(pof.createDateOfBirth(xmlDate).getValue());
- receiver.setPerson(pof.createPhysicalPerson(physicalPerson));
- var postal = pof.createPostalAddressType();
- postal.setCountryCode("AT");
- postal.setPostalCode("1010");
- postal.setMunicipality("Wien");
- var deliveryAddress = pof.createPostalAddressTypeDeliveryAddress();
- deliveryAddress.setStreetName("Musterstraße");
- deliveryAddress.setBuildingNumber("10");
- postal.setDeliveryAddress(deliveryAddress);
- receiver.getAddress().add(pof.createAddress(postal));
- deliveryRequest.setReceiver(receiver);
-
- var metadata = msgof.createMetaData();
- metadata.setAppDeliveryID("asd");
- metadata.setSubject("Wichtige Mitteilung!");
- metadata.setDeliveryQuality("RSa");
- deliveryRequest.setMetaData(metadata);
-
- var payload = mzsof.createDeliveryRequestTypePayload();
- payload.setDocumentReference("https://authority.gv.at/files/73bdf969781ba41fa07df1ff8439cf685c0db1c3");
- payload.setFileName("brief.xml");
- payload.setMIMEType("text/xml");
- payload.setSize(BigInteger.valueOf(123401));
- var checksum = msgof.createCheckSumType();
- checksum.setAlgorithmID("SHA1");
- checksum.setValue("random".getBytes(Charset.forName("UTF-8")));
- payload.setCheckSum(checksum);
- deliveryRequest.getPayload().add(payload);
-
- return mzsof.createDeliveryRequest(deliveryRequest);
- }
-
- @Test
- public void testMarshalling() throws JAXBException, DatatypeConfigurationException {
-
- logger.info("test marshalling....");
- var request = generateSampleRequest();
- var m = createMarshaller();
- m.marshal(request, System.out);
-
- }
-
-}