aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2019-07-31 13:40:17 +0000
committerandre.schmid <andre.schmid@est.tech>2019-07-31 13:40:17 +0000
commit527fe8bdac1f1c7c59738c598996dc8c842a22e3 (patch)
tree815745b7dea0a0ffba8eccc2ef9dca7deb9b914e /src/main/java/org/onap
parentd0d5690f13b9c794044bfe6bd7ac87557dd3dcea (diff)
Validation to ThreadsLocalHolder instead stdoutHEADmasterelalto
Fix one validation error that was going to stdout instead of normal handling through ThreadsLocalHolder singleton. Issue-ID: SDC-2344 Change-Id: I34827aa1314f2b65eff7b92fce7890eeddbca0e6 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java5
-rw-r--r--src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java20
2 files changed, 24 insertions, 1 deletions
diff --git a/src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java b/src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java
index 2160527..efc6948 100644
--- a/src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java
+++ b/src/main/java/org/onap/sdc/toscaparser/api/TopologyTemplate.java
@@ -119,7 +119,10 @@ public class TopologyTemplate {
}
if ((parsedParams != null && parsedParams.get(input.getName()) == null || parsedParams == null)
&& input.isRequired() && input.getDefault() == null) {
- System.out.format("Log warning: The required parameter \"%s\" is not provided\n", input.getName());
+ ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue("JE003",
+ String.format("MissingRequiredFieldError: The required input \"%s\" was not provided"
+ , input.getName()))
+ );
}
alInputs.add(input);
}
diff --git a/src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java b/src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java
index 19c9583..cd5cbc5 100644
--- a/src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java
+++ b/src/main/java/org/onap/sdc/toscaparser/api/common/JToscaValidationIssue.java
@@ -20,6 +20,8 @@
package org.onap.sdc.toscaparser.api.common;
+import java.util.Objects;
+
public class JToscaValidationIssue {
private String code;
@@ -52,4 +54,22 @@ public class JToscaValidationIssue {
public String toString() {
return "JToscaError [code=" + code + ", message=" + message + "]";
}
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final JToscaValidationIssue that = (JToscaValidationIssue) o;
+ return Objects.equals(code, that.code) &&
+ Objects.equals(message, that.message);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(code, message);
+ }
}