aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
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/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
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/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java')
-rw-r--r--src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java b/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
index f408c3b..c056b2c 100644
--- a/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
+++ b/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
@@ -5,10 +5,12 @@ import at.gv.egiz.moazs.preprocess.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.Map;
+import static at.gv.egiz.moazs.MoaZSException.moaZSException;
import static at.gv.egiz.moazs.preprocess.ConfigProfileGenerator.configProfileGeneratorBuilder;
import static at.gv.zustellung.app2mzs.xsd.ConfigType.configTypeBuilder;
import static org.mockito.ArgumentMatchers.any;
@@ -91,7 +93,7 @@ public class ConfigProfileGeneratorTest {
public void cancelAtIncompleteDefaultProfile() {
var propMap = Map.of(PREFIX + "." + DEFAULT + ".property-a", "value-a");
var generator = setupMocksAndBuilder(propMap).build();
- when(validator.isConfigProfileComplete(any())).thenReturn(false);
+ doThrow(moaZSException("Not Complete.")).when(validator).isConfigProfileComplete(any());
generator.generate();
}
@@ -100,7 +102,7 @@ public class ConfigProfileGeneratorTest {
public void continueAtIncompleteDefaultWhenVerificationDisabled() {
var propMap = Map.of(PREFIX + "." + DEFAULT + ".property-a", "value-a");
- when(validator.isConfigProfileComplete(any())).thenReturn(false);
+ doThrow(moaZSException("Not Complete.")).when(validator).isConfigProfileComplete(any());
var generator = setupMocksAndBuilder(propMap)
.withVerifyCompletenessOfDefaultConfiguration(false)
@@ -117,7 +119,6 @@ public class ConfigProfileGeneratorTest {
when(properties.getProperty(any())).thenAnswer(i -> propMap.get(i.getArgument(0)));
when(util.merge(any(), any())).thenAnswer(i -> i.getArgument(0));
when(util.convert(any())).thenReturn(configTypeBuilder().build());
- when(validator.isConfigProfileComplete(any())).thenReturn(true);
return configProfileGeneratorBuilder()
.withProperties(properties)