aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/preprocess
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/main/java/at/gv/egiz/moazs/preprocess
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/main/java/at/gv/egiz/moazs/preprocess')
-rw-r--r--src/main/java/at/gv/egiz/moazs/preprocess/ConfigProfileGenerator.java19
-rw-r--r--src/main/java/at/gv/egiz/moazs/preprocess/MzsDeliveryRequestValidator.java4
2 files changed, 8 insertions, 15 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/preprocess/ConfigProfileGenerator.java b/src/main/java/at/gv/egiz/moazs/preprocess/ConfigProfileGenerator.java
index 3191d92..8e2c5e5 100644
--- a/src/main/java/at/gv/egiz/moazs/preprocess/ConfigProfileGenerator.java
+++ b/src/main/java/at/gv/egiz/moazs/preprocess/ConfigProfileGenerator.java
@@ -54,12 +54,13 @@ public class ConfigProfileGenerator {
"mzs:DeliveryRequest/Config needs to be configured completely *for each delivery request* in order to guarantee " +
"availability.";
+ public static final String DEFAULT_CONFIG_KEY = "default";
+
private final SpringPropertiesFacade properties;
private final ConfigUtil util;
private final MzsDeliveryRequestValidator validator;
private final boolean verifyCompletenessOfDefaultConfiguration;
private final String profilePrefix;
- private final String defaultConfigKey;
public static ConfigProfileGeneratorBuilder configProfileGeneratorBuilder() {
return new ConfigProfileGeneratorBuilder();
@@ -70,14 +71,12 @@ public class ConfigProfileGenerator {
ConfigUtil util,
MzsDeliveryRequestValidator validator,
boolean verifyCompletenessOfDefaultConfiguration,
- String profilePrefix,
- String defaultConfigKey) {
+ String profilePrefix) {
this.util = util;
this.properties = properties;
this.validator = validator;
this.verifyCompletenessOfDefaultConfiguration = verifyCompletenessOfDefaultConfiguration;
this.profilePrefix = profilePrefix;
- this.defaultConfigKey = defaultConfigKey;
}
/**
@@ -96,7 +95,7 @@ public class ConfigProfileGenerator {
var profiles = groupedKeys.entrySet().stream()
.collect(toUnmodifiableMap(Entry::getKey, this::createConfigFromEnv));
- var defaultProfile = profiles.get(defaultConfigKey);
+ var defaultProfile = profiles.get(DEFAULT_CONFIG_KEY);
try {
validator.isConfigProfileComplete(defaultProfile);
@@ -145,7 +144,6 @@ public class ConfigProfileGenerator {
private MzsDeliveryRequestValidator validator;
private boolean verify = true;
private String profilePrefix = "delivery-request-configuration-profiles";
- private String defaultConfigKey = "default";
public ConfigProfileGeneratorBuilder withProperties(SpringPropertiesFacade properties) {
this.properties = properties;
@@ -173,16 +171,11 @@ public class ConfigProfileGenerator {
return this;
}
- public ConfigProfileGeneratorBuilder withDefaultConfigKey(String defaultConfigKey) {
- this.defaultConfigKey = defaultConfigKey;
- return this;
- }
-
public ConfigProfileGenerator build() {
- if (properties == null || util == null || profilePrefix == null || defaultConfigKey == null || validator == null)
+ if (properties == null || util == null || profilePrefix == null || validator == null)
throw new IllegalArgumentException("Cannot build ConfigProfileGenerator: " +
"One or more arguments are null.");
- return new ConfigProfileGenerator(properties, util, validator, verify, profilePrefix, defaultConfigKey);
+ return new ConfigProfileGenerator(properties, util, validator, verify, profilePrefix);
}
}
}
diff --git a/src/main/java/at/gv/egiz/moazs/preprocess/MzsDeliveryRequestValidator.java b/src/main/java/at/gv/egiz/moazs/preprocess/MzsDeliveryRequestValidator.java
index af8b34c..4693536 100644
--- a/src/main/java/at/gv/egiz/moazs/preprocess/MzsDeliveryRequestValidator.java
+++ b/src/main/java/at/gv/egiz/moazs/preprocess/MzsDeliveryRequestValidator.java
@@ -169,8 +169,8 @@ public class MzsDeliveryRequestValidator {
if (!isConfigured) throw mzse("TrustStore");
}
- private void areSinksConfigured(@Nullable MsgResponseSinksType sinks) {
- var isConfigured = sinks != null && sinks.isLogResponse() != null;
+ public void areSinksConfigured(@Nullable MsgResponseSinksType sinks) {
+ var isConfigured = (sinks != null && sinks.isLogResponse() != null);
if (!isConfigured) throw mzse("MsgResponseSinks");
isSaveResponseToFileConfigured(sinks.getSaveResponseToFile());