aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pom.xml6
-rw-r--r--readme.md17
-rw-r--r--src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java12
-rw-r--r--src/main/java/at/gv/egiz/moazs/scheme/SOAPUtils.java2
-rw-r--r--src/test/java/at/gv/egiz/moazs/ITMsgClientTest.java7
-rw-r--r--src/test/java/at/gv/egiz/moazs/SOAPUtilsTest.java63
6 files changed, 73 insertions, 34 deletions
diff --git a/pom.xml b/pom.xml
index 6b8e060..bd135fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -130,12 +130,6 @@
<artifactId>javax.jws-api</artifactId>
<version>${jwsapi.version}</version>
</dependency>
- <!-- egov utils -->
- <dependency>
- <groupId>at.gv.util</groupId>
- <artifactId>egovutils</artifactId>
- <version>${egovutils.version}</version>
- </dependency>
<!-- eaaf components. See readme.md for installation -->
<dependency>
<groupId>at.gv.egiz.eaaf</groupId>
diff --git a/readme.md b/readme.md
index 51d82dd..9b7c04d 100644
--- a/readme.md
+++ b/readme.md
@@ -5,9 +5,8 @@
For compiling MOAZS, do the following:
1. Checkout MoaZS repository (directory name `moazs.git`)
-2. Install `at.gv.egiz.eaaf.{eaaf_module_moa-sig, core}` to local repository.
-3. Install `at.gv.util.egovutils` to local mvn repository.
-4. Make `eaaf_module_moa-sig`'s transitive dependencies available by copying or symlinking `eaaf_module_moa-sig`'s repository into MOAZS repository.
+1. Install `at.gv.egiz.eaaf.{eaaf_module_moa-sig, core}` to local repository.
+1. Make `eaaf_module_moa-sig`'s transitive dependencies available by copying or symlinking `eaaf_module_moa-sig`'s repository into MOAZS repository.
Certain artifacts are not in the mvn central repo. You need to
install those articats to your local maven repository.
@@ -24,18 +23,6 @@ cd eaaf_components
git checkout $EAAF_COMPONENTS_VERSION
mvn clean package source:jar install
```
-### How to Install `at.gv.util.egovutils`
-
-Requirements: JDK 1.8
-
-```
-export EGOV_UTILS_VERSION=2.0.7-snapshot
-cd /path/to/working/dir
-git clone https://gitlab.iaik.tugraz.at/egiz/egovutils
-cd egovutils
-git checkout $EGOV_UTILS_VERSION
-mvn clean package install
-```
### Workaround: Make eaaf_module_moa-sig's Transitive Dependencies Available
diff --git a/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java b/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java
index d007286..4ebd2d0 100644
--- a/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java
+++ b/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java
@@ -15,8 +15,9 @@ import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
-import static at.gv.egiz.moazs.MoaZSException.moaZSExceptionBuilder;
+import static at.gv.egiz.moazs.MoaZSException.moaZSException;
@Component
public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInterceptor<Message> {
@@ -41,17 +42,18 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt
try {
byte[] content = messageUtils.copyContent(message);
+ log.trace("Interceptor received this SOAP message: {}. ", new String(content, StandardCharsets.UTF_8));
+
if(content.length > 0) {
Element document = soapUtils.toDOM(content);
byte[] status = soapUtils.unwrapSoapEnvelope(document);
String appDeliveryID = soapUtils.getAppDeliveryIDFrom(document);
repository.addSignedDeliveryRequestStatus(status, appDeliveryID);
- log.info("Store binary DeliveryRequestStatus with AppDeliveryID={}", appDeliveryID);
+ log.trace("DeliveryRequestStatus with AppDeliveryID={} unwrapped and stored: {}. ",
+ appDeliveryID, new String(status, StandardCharsets.UTF_8));
}
} catch (ParserConfigurationException | SAXException | IOException | NullPointerException e) {
- throw moaZSExceptionBuilder("Could not extract signed data from message.")
- .withCause(e)
- .build();
+ throw moaZSException("Could not extract signed data from message.", e);
}
}
diff --git a/src/main/java/at/gv/egiz/moazs/scheme/SOAPUtils.java b/src/main/java/at/gv/egiz/moazs/scheme/SOAPUtils.java
index eee1152..8b8219a 100644
--- a/src/main/java/at/gv/egiz/moazs/scheme/SOAPUtils.java
+++ b/src/main/java/at/gv/egiz/moazs/scheme/SOAPUtils.java
@@ -1,6 +1,6 @@
package at.gv.egiz.moazs.scheme;
-import at.gv.util.DOMUtils;
+import at.gv.egiz.eaaf.core.impl.utils.DOMUtils;
import org.apache.cxf.binding.soap.Soap11;
import org.springframework.stereotype.Component;
import org.w3c.dom.Element;
diff --git a/src/test/java/at/gv/egiz/moazs/ITMsgClientTest.java b/src/test/java/at/gv/egiz/moazs/ITMsgClientTest.java
index 10c2859..2b758a9 100644
--- a/src/test/java/at/gv/egiz/moazs/ITMsgClientTest.java
+++ b/src/test/java/at/gv/egiz/moazs/ITMsgClientTest.java
@@ -7,11 +7,8 @@ import at.gv.zustellung.app2mzs.xsd.ClientType;
import at.gv.zustellung.app2mzs.xsd.KeyStoreType;
import at.gv.zustellung.msg.xsd.DeliveryRequestType;
import at.gv.zustellung.msg.xsd.ObjectFactory;
-import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@@ -32,7 +29,6 @@ import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
public class ITMsgClientTest {
- private final static Logger log = LoggerFactory.getLogger(ITMsgClientTest.class);
private static final Object VALID_MZS_REQUEST_ID = "valid-delivery-request-id" ;
private final String basePath = "src/test/resources/at/gv/egiz/moazs/ITMsgClientTest/";
@@ -42,9 +38,6 @@ public class ITMsgClientTest {
@Autowired
private MsgClientFactory factory;
- @Autowired
- private StoreSOAPBodyBinaryInRepositoryInterceptor interceptor;
-
private static final ObjectFactory OF = new ObjectFactory();
diff --git a/src/test/java/at/gv/egiz/moazs/SOAPUtilsTest.java b/src/test/java/at/gv/egiz/moazs/SOAPUtilsTest.java
new file mode 100644
index 0000000..31aa197
--- /dev/null
+++ b/src/test/java/at/gv/egiz/moazs/SOAPUtilsTest.java
@@ -0,0 +1,63 @@
+package at.gv.egiz.moazs;
+
+import at.gv.egiz.moazs.scheme.SOAPUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SOAPUtilsTest {
+
+ SOAPUtils utils;
+
+ private static final String SOAP_MESSAGE =
+ "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body>" +
+ "<DeliveryResponse xmlns=\"http://reference.e-government.gv.at/namespace/zustellung/msg/phas" +
+ "e2/20181206#\" xmlns:ns2=\"http://reference.e-government.gv.at/namespace/persondata/phase2/" +
+ "20181206#\" xmlns:ns3=\"http://www.w3.org/2000/09/xmldsig#\"><PartialSuccess><DeliverySyste" +
+ "m>https://testzustellsystem.egiz.gv.at</DeliverySystem><ZSDeliveryID>zs-valid-delivery-requ" +
+ "est-id</ZSDeliveryID><AppDeliveryID>valid-delivery-request-id</AppDeliveryID><GZ>12345</GZ>" +
+ "</PartialSuccess></DeliveryResponse></soap:Body></soap:Envelope>";
+
+ @Before
+ public void setup() {
+ utils = new SOAPUtils();
+ }
+
+ @Test
+ public void toDom() throws ParserConfigurationException, SAXException, IOException {
+ byte[] bytes = SOAP_MESSAGE.getBytes(StandardCharsets.UTF_8);
+
+ Element root = utils.toDOM(bytes);
+
+ assertThat(root.getTagName()).isEqualTo("soap:Envelope");
+ }
+
+ @Test
+ public void unwrapSoapEnvelope() throws ParserConfigurationException, SAXException, IOException {
+ byte[] bytes = SOAP_MESSAGE.getBytes(StandardCharsets.UTF_8);
+ Element soapRoot = utils.toDOM(bytes);
+
+ byte[] unwrappedMessage = utils.unwrapSoapEnvelope(soapRoot);
+
+ Element deliveryResponseRoot = utils.toDOM(unwrappedMessage);
+ assertThat(deliveryResponseRoot.getTagName()).isEqualTo("DeliveryResponse");
+ }
+
+ @Test
+ public void getAppDeliveryID() throws ParserConfigurationException, SAXException, IOException {
+ byte[] bytes = SOAP_MESSAGE.getBytes(StandardCharsets.UTF_8);
+ Element soapRoot = utils.toDOM(bytes);
+
+ String appDeliveryID = utils.getAppDeliveryIDFrom(soapRoot);
+
+ assertThat(appDeliveryID).isEqualTo("valid-delivery-request-id");
+ }
+
+}