aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-11-29 14:54:28 +0100
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-11-29 14:54:28 +0100
commita5b8668c0c7916a8fe2b84122d537a3e0bd67002 (patch)
treef0fd571ff0c22ff2f4567f72fc95b14c63cba7d2 /src/test
parent5fffae99208c7a99a5e3e8f196a6004debcc9c81 (diff)
downloadmoa-zs-a5b8668c0c7916a8fe2b84122d537a3e0bd67002.tar.gz
moa-zs-a5b8668c0c7916a8fe2b84122d537a3e0bd67002.tar.bz2
moa-zs-a5b8668c0c7916a8fe2b84122d537a3e0bd67002.zip
Alter Case Handling "Get Notification where AppDeliveryID is unknown"
- Former: Fail with Exception. - Now: Issue a warning and fall back to default configuration profile after verifying that sinks in default configuration profile are correctly configured. - Refactor: Make DEFAULT_CONFIG_KEY static.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java b/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
index 10670ff..1fec8ec 100644
--- a/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
+++ b/src/test/java/at/gv/egiz/moazs/ConfigProfileGeneratorTest.java
@@ -32,6 +32,7 @@ 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.DEFAULT_CONFIG_KEY;
import static at.gv.egiz.moazs.preprocess.ConfigProfileGenerator.configProfileGeneratorBuilder;
import static at.gv.zustellung.app2mzs.xsd.ConfigType.configTypeBuilder;
import static org.mockito.ArgumentMatchers.any;
@@ -46,7 +47,6 @@ import static org.mockito.Mockito.*;
public class ConfigProfileGeneratorTest {
private static final String PREFIX = "prefix";
- private static final String DEFAULT = "default";
@Mock
private ConfigUtil util;
@@ -60,9 +60,9 @@ public class ConfigProfileGeneratorTest {
@Test
public void assembleDefaultProfile() {
var propMap = Map.of(
- PREFIX + "." + DEFAULT + ".property-a", "value-a",
- PREFIX + "." + DEFAULT + ".property-b", "value-b",
- PREFIX + "." + DEFAULT + ".property-c", "value-c");
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-a", "value-a",
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-b", "value-b",
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-c", "value-c");
var generator = setupMocksAndBuilder(propMap).build();
var profiles = generator.generate();
@@ -71,12 +71,12 @@ public class ConfigProfileGeneratorTest {
"property-a", "value-a",
"property-b", "value-b",
"property-c", "value-c"));
- assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT);
+ assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT_CONFIG_KEY);
}
@Test
public void assembleEmptyDefault() {
- var propMap = Map.of(PREFIX + "." + DEFAULT, "");
+ var propMap = Map.of(PREFIX + "." + DEFAULT_CONFIG_KEY, "");
var generator = setupMocksAndBuilder(propMap).build();
var profiles = generator.generate();
@@ -99,8 +99,8 @@ public class ConfigProfileGeneratorTest {
@Test
public void assembleMultipleProfiles() {
var propMap = Map.of(
- PREFIX + "." + DEFAULT+ ".property-a", "value-a",
- PREFIX + "." + DEFAULT+ ".property-b", "value-b",
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-a", "value-a",
+ PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-b", "value-b",
PREFIX + "." + "profile-1.property-c", "value-c",
PREFIX + "." + "profile-2.property-d", "value-d");
@@ -111,12 +111,12 @@ public class ConfigProfileGeneratorTest {
verify(util).convert(Map.of("property-a", "value-a", "property-b", "value-b"));
verify(util).convert(Map.of("property-c", "value-c"));
verify(util).convert(Map.of("property-d", "value-d"));
- assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT, "profile-1", "profile-2");
+ assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT_CONFIG_KEY, "profile-1", "profile-2");
}
@Test(expected = MoaZSException.class)
public void cancelAtIncompleteDefaultProfile() {
- var propMap = Map.of(PREFIX + "." + DEFAULT + ".property-a", "value-a");
+ var propMap = Map.of(PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-a", "value-a");
var generator = setupMocksAndBuilder(propMap).build();
doThrow(moaZSException("Not Complete.")).when(validator).isConfigProfileComplete(any());
@@ -125,7 +125,7 @@ public class ConfigProfileGeneratorTest {
@Test
public void continueAtIncompleteDefaultWhenVerificationDisabled() {
- var propMap = Map.of(PREFIX + "." + DEFAULT + ".property-a", "value-a");
+ var propMap = Map.of(PREFIX + "." + DEFAULT_CONFIG_KEY + ".property-a", "value-a");
doThrow(moaZSException("Not Complete.")).when(validator).isConfigProfileComplete(any());
@@ -136,7 +136,7 @@ public class ConfigProfileGeneratorTest {
var profiles = generator.generate();
verify(util).convert(Map.of("property-a", "value-a"));
- assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT);
+ assertThat(profiles.keySet()).containsExactlyInAnyOrder(DEFAULT_CONFIG_KEY);
}
private ConfigProfileGenerator.ConfigProfileGeneratorBuilder setupMocksAndBuilder(Map<String, String> propMap) {
@@ -148,7 +148,6 @@ public class ConfigProfileGeneratorTest {
return configProfileGeneratorBuilder()
.withProperties(properties)
.withConfigUtil(util)
- .withDefaultConfigKey(DEFAULT)
.withProfilePrefix(PREFIX)
.withValidator(validator)
.withVerifyCompletenessOfDefaultConfiguration(true);