summaryrefslogtreecommitdiffstats
path: root/common-parameters/src
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@ericsson.com>2018-08-09 12:26:28 +0100
committerramverma <ram.krishna.verma@ericsson.com>2018-08-09 12:26:56 +0100
commit240a767aee998ae4b56c569757796013b5b45b3a (patch)
tree2eadd3e0188b103284578ff071a49e9c0b93d46d /common-parameters/src
parentfb3c2a56b46a95c188ec4eec9c98c7bd0b881097 (diff)
Fix bug in common-paramter validation service
In GroupValidationResult & GroupMapValidationResult, the setResult method was not setting the actual status that it has recieved from the nested group rather it was setting its own status again. Due to which the validation status of overall ParameterGroup was coming as CLEAN even if a nested child has reported it as INVALID. Changed the expected validation result texts for TestValidation accordingly. Change-Id: I5943decce39574089ca74f9bbccbfbe66d8d542c Issue-ID: POLICY-1035 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'common-parameters/src')
-rw-r--r--common-parameters/src/main/java/org/onap/policy/common/parameters/GroupMapValidationResult.java2
-rw-r--r--common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java4
-rw-r--r--common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt9
-rw-r--r--common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt7
-rw-r--r--common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt9
-rw-r--r--common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt16
-rw-r--r--common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt14
-rw-r--r--common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt16
8 files changed, 70 insertions, 7 deletions
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupMapValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupMapValidationResult.java
index 09cdc1de..e607ff98 100644
--- a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupMapValidationResult.java
+++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupMapValidationResult.java
@@ -122,7 +122,7 @@ public class GroupMapValidationResult implements ValidationResult {
// Set the status of the parameter group and replace the field result
validationResultMap.put(entryName, mapEntryValidationResult);
- this.setResult(status);
+ this.setResult(mapEntryValidationResult.getStatus());
}
/**
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
index 703de927..ac9dc7ba 100644
--- a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
+++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
@@ -255,7 +255,7 @@ public class GroupValidationResult implements ValidationResult {
// Set the status of the parameter group and replace the field result
validationResultMap.put(parameterName, nestedValidationResult);
- this.setResult(status);
+ this.setResult(nestedValidationResult.getStatus());
}
/**
@@ -280,7 +280,7 @@ public class GroupValidationResult implements ValidationResult {
// Set the status of the parameter group and the field
groupMapValidationResult.setResult(key, nestedMapValidationResult);
- this.setResult(status);
+ this.setResult(nestedMapValidationResult.getStatus());
}
/**
diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt
index cec8f208..0dec4a61 100644
--- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt
+++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt
@@ -6,4 +6,11 @@ parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclass
field "l10StringField" type "java.lang.String" value "" INVALID, l10StringField must be a non-blank string
parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
- field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string \ No newline at end of file
+ field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string
+ parameter group map "l00LGenericNestedMap" INVALID, parameter group has status INVALID
+ parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
+ field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
+ field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string
+ parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
+ field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
+ field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string \ No newline at end of file
diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt
index 45402033..e0e78ccb 100644
--- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt
+++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt
@@ -7,3 +7,10 @@ parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclass
parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
+ parameter group map "l00LGenericNestedMap" OBSERVATION, parameter group has status OBSERVATION
+ parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
+ field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
+ field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
+ parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
+ field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
+ field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt
index 33d1d16a..d03ecdf5 100644
--- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt
+++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt
@@ -6,4 +6,11 @@ parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclass
field "l10StringField" type "java.lang.String" value "l10StringField" WARNING, using the field name for the parameter value is dangerous
parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
- field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous \ No newline at end of file
+ field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
+ parameter group map "l00LGenericNestedMap" WARNING, parameter group has status WARNING
+ parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
+ field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
+ field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
+ parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
+ field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
+ field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous \ No newline at end of file
diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt
index fecfe70d..762ef46c 100644
--- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt
+++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt
@@ -10,6 +10,20 @@ parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclass
parameter group "l10LGenericNested1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string
+ parameter group map "l10LGenericNestedMap" INVALID, parameter group has status INVALID
+ parameter group "l10LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
+ field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
+ field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string
+ parameter group "l10LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
+ field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
+ field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string
parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
- field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string \ No newline at end of file
+ field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string
+ parameter group map "l00LGenericNestedMap" INVALID, parameter group has status INVALID
+ parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
+ field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
+ field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string
+ parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID
+ field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer
+ field "lgenericStringField" type "java.lang.String" value "" INVALID, lgenericStringField must be a non-blank string \ No newline at end of file
diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt
index 00fe6627..da943135 100644
--- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt
+++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt
@@ -10,6 +10,20 @@ parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclass
parameter group "l10LGenericNested1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
+ parameter group map "l10LGenericNestedMap" OBSERVATION, parameter group has status OBSERVATION
+ parameter group "l10LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
+ field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
+ field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
+ parameter group "l10LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
+ field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
+ field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
+ parameter group map "l00LGenericNestedMap" OBSERVATION, parameter group has status OBSERVATION
+ parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
+ field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
+ field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
+ parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION
+ field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2
+ field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful
diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt
index 6c1c639d..67a0932e 100644
--- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt
+++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt
@@ -10,6 +10,20 @@ parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclass
parameter group "l10LGenericNested1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
+ parameter group map "l10LGenericNestedMap" WARNING, parameter group has status WARNING
+ parameter group "l10LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
+ field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
+ field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
+ parameter group "l10LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
+ field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
+ field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
- field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous \ No newline at end of file
+ field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
+ parameter group map "l00LGenericNestedMap" WARNING, parameter group has status WARNING
+ parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
+ field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
+ field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
+ parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING
+ field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended
+ field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous \ No newline at end of file