aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/repository
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-22 13:02:19 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-22 13:02:19 +0200
commitcb9a76eaafd37f921006822bcfe043655288bc63 (patch)
tree76c2463e181ac293134f4c5bfc7e342607f3f399 /src/main/java/at/gv/egiz/moazs/repository
parentd873625c0ced62e712dc1b1a7570b63482fd0a0a (diff)
downloadmoa-zs-cb9a76eaafd37f921006822bcfe043655288bc63.tar.gz
moa-zs-cb9a76eaafd37f921006822bcfe043655288bc63.tar.bz2
moa-zs-cb9a76eaafd37f921006822bcfe043655288bc63.zip
Test Flow of DeliveryRequest from "End-To-End" & Fix Bugs
Schema Changes: - Remove mzs:DeliveryRequest/TnvzMetaData because all metadata fields can be collected from DeliveryRequest and redundancy is not needed. Fixes and Refactoring in preprocess: - MzsDeliveryRequestValidator: Instead of returning false, throw an exception when a condition is not met, and explain which condition is not met / why it is not met in the exception's message. - Integrate interface change in ConfigProfileGenerator and DeliveryRequestAugmenter. - Rewrite and simplify DeliveryRequestAugmenter's augmentation. - ConfigUtil Fixes: Ensure that we do not override the wrong parameters while merging. This error appeared in tnvz / msg client, connection / receive timeout, key / trust store, and lax hostname verification / trust all. Fix Bugs in Interceptor / SoapUtils: - Problem: DOM access and information extraction was implemented somewhat sloppy. - SolutioN: Change DOM access interface to access DOM more efficiently. Add boundary checks and handle edge cases while extracting information from SOAP Messages. - Test those changes properly. Testing: - Implement Delivery Request Flow in ITEndToEndTest. - Start application on random port instead of fixed port when running integration tests. - Add assertions to tests in ITMzsServiceTest suite. Others Bug Fixes: - ServicesConfig: Ensure that mzs service and msg service run on different endpoint addresses (/msg and /mzs). - DeliveryRequestBackend: Throw exception when binary message is missing. Don't wrap the exception. - SaveResponseToFileSink: Wrap Response in JAXB Element (otherwise, marshaller does not recognize it)
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/repository')
-rw-r--r--src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java b/src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java
index 41b742b..b8a6d78 100644
--- a/src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java
+++ b/src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java
@@ -4,6 +4,8 @@ package at.gv.egiz.moazs.repository;
import at.gv.egiz.moazs.scheme.MsgResponse;
import at.gv.zustellung.app2mzs.xsd.DeliveryRequestType;
import com.google.common.cache.Cache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Repository;
@@ -17,6 +19,8 @@ import static java.util.Optional.ofNullable;
@Profile("!cluster")
public class InMemoryDeliveryRepository implements DeliveryRepository {
+ private static final Logger log = LoggerFactory.getLogger(InMemoryDeliveryRepository.class);
+
private final Cache<String, DeliveryRequestType> requestRepository;
private final Cache<String, MsgResponse> responseRepository;
private final Cache<String, byte[]> binaryResponseRepository;
@@ -31,33 +35,38 @@ public class InMemoryDeliveryRepository implements DeliveryRepository {
@Override
public void store(DeliveryRequestType request) {
var key = request.getMetaData().getAppDeliveryID();
+ log.trace("Store DeliveryRequest by key={}", key);
requestRepository.put(key, request);
}
@Override
public Optional<DeliveryRequestType> retrieveDeliveryRequest(String appDeliveryID) {
+ log.trace("Retrieve DeliveryRequest by key={}", appDeliveryID);
return ofNullable(requestRepository.getIfPresent(appDeliveryID));
}
@Override
public void store(MsgResponse response) {
String key = response.getResponseID();
+ log.trace("Store MsgResponse by key={}", key);
responseRepository.put(key, response);
}
@Override
public Optional<MsgResponse> retrieveResponse(String responseID) {
+ log.trace("Retrieve MsgResponse by key={}", responseID);
return ofNullable(responseRepository.getIfPresent(responseID));
}
@Override
- public void store(String id, byte[] data) {
- binaryResponseRepository.put(id, data);
-
+ public void store(String responseID, byte[] data) {
+ log.trace("Store Binary MsgResponse by key={}", responseID);
+ binaryResponseRepository.put(responseID, data);
}
@Override
public Optional<byte[]> retrieveBinaryResponse(String responseID) {
+ log.trace("Retrieve Binary MsgResponse by key={}", responseID);
return ofNullable(binaryResponseRepository.getIfPresent(responseID));
}