diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-07-30 10:22:27 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-07-31 16:06:47 +0100 |
commit | 73ba8039930ba56f6a64a7acc4126dc50b77070d (patch) | |
tree | bb46330718aa99e9753a69715c0ea54e990aca4d /common-parameters/src/test/resources/expectedValidationResults | |
parent | c36939ee0e648f4ac28b9cdc538991ced0c603bd (diff) |
Improve validation, add hierarchical validation
Parameter validaiton updated to generically support nested groups of
parameters, and nested maps of parameters.
Unit test showing JSON parameter input added.
Unit test showing YAML parameter inout added.
Test parameter group classes moved into subdirectory
This allows parameters to be unmarshaled seamlessly from JSON and YAML
files.
Change-Id: I768e11f31ee7f62299c4d5d95ab68a005d1aff16
Issue-ID: POLICY-922
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'common-parameters/src/test/resources/expectedValidationResults')
11 files changed, 159 insertions, 0 deletions
diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt b/common-parameters/src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt new file mode 100644 index 00000000..103321ff --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt @@ -0,0 +1,39 @@ +parameter group "l00NameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l00NameFromFile" CLEAN, parameter has status CLEAN + field "l00IntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "l00StringField" type "java.lang.String" value "l00 string field value from file" CLEAN, parameter has status CLEAN + parameter group "l00L10NestedNameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l00L10NestedNameFromFile" CLEAN, parameter has status CLEAN + field "l10IntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "l10StringField" type "java.lang.String" value "l00 L10 nested string field value from file" CLEAN, parameter has status CLEAN + parameter group "l10LGenericNested0NameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l10LGenericNested0NameFromFile" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "l10 generic nested 0 string field value from file" CLEAN, parameter has status CLEAN + parameter group "l10LGenericNested1NameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l10LGenericNested1NameFromFile" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "l10 generic nested 1 string field value from file" CLEAN, parameter has status CLEAN + parameter group map "l10LGenericNestedMap" CLEAN, parameter group map has status CLEAN + parameter group "L10Entry0Name" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "L10Entry0Name" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "L10Entry0 value from file" CLEAN, parameter has status CLEAN + parameter group "L10Entry1Name" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "L10Entry1Name" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "L10Entry1 value from file" CLEAN, parameter has status CLEAN + parameter group "l00GenericNestedNameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l00GenericNestedNameFromFile" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "l00 generic nested string field value from file" CLEAN, parameter has status CLEAN + parameter group map "l00LGenericNestedMap" CLEAN, parameter group map has status CLEAN + parameter group "L00Entry0Name" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "L00Entry0Name" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "L00Entry0 value from file" CLEAN, parameter has status CLEAN + parameter group "L00Entry1Name" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "L00Entry1Name" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "L00Entry1 value from file" CLEAN, parameter has status CLEAN + diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_0_OK.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_0_OK.txt new file mode 100644 index 00000000..7f6d298c --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_0_OK.txt @@ -0,0 +1,39 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l0Parameters" CLEAN, parameter has status CLEAN + field "l00IntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "l00StringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersL00" CLEAN, parameter has status CLEAN + parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l00L10Nested" CLEAN, parameter has status CLEAN + field "l10IntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "l10StringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersL10" CLEAN, parameter has status CLEAN + parameter group "l10LGenericNested0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l10LGenericNested0" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN + parameter group "l10LGenericNested1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l10LGenericNested1" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN + parameter group map "l10LGenericNestedMap" CLEAN, parameter group map has status CLEAN + parameter group "l10LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l10LGenericNestedMapVal0" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN + parameter group "l10LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l10LGenericNestedMapVal1" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN + parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l00LGenericNested" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN + parameter group map "l00LGenericNestedMap" CLEAN, parameter group map has status CLEAN + parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l00LGenericNestedMapVal0" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN + parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN + field "name" type "java.lang.String" value "l00LGenericNestedMapVal1" CLEAN, parameter has status CLEAN + field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN + field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN + diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Invalid.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Invalid.txt new file mode 100644 index 00000000..dcc3cee3 --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Invalid.txt @@ -0,0 +1,3 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" INVALID, parameter group has status INVALID + field "l00IntField" type "int" value "-1" INVALID, l00IntField must be a positive integer + field "l00StringField" type "java.lang.String" value "" INVALID, l00StringField must be a non-blank string diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Observation.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Observation.txt new file mode 100644 index 00000000..ae627926 --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Observation.txt @@ -0,0 +1,3 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" OBSERVATION, parameter group has status OBSERVATION + field "l00IntField" type "int" value "2" OBSERVATION, this field has been set to 2 + field "l00StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Warning.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Warning.txt new file mode 100644 index 00000000..14a65aa8 --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Warning.txt @@ -0,0 +1,3 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" WARNING, parameter group has status WARNING + field "l00IntField" type "int" value "3" WARNING, values greater than 2 are not recommended + field "l00StringField" type "java.lang.String" value "l00StringField" WARNING, using the field name for the parameter value is dangerous diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt new file mode 100644 index 00000000..cec8f208 --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt @@ -0,0 +1,9 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" INVALID, parameter group has status INVALID + field "l00IntField" type "int" value "-1" INVALID, l00IntField must be a positive integer + field "l00StringField" type "java.lang.String" value "" INVALID, l00StringField must be a non-blank string + parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" INVALID, parameter group has status INVALID + field "l10IntField" type "int" value "-1" INVALID, l10IntField must be a positive integer + 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 diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt new file mode 100644 index 00000000..45402033 --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt @@ -0,0 +1,9 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" OBSERVATION, parameter group has status OBSERVATION + field "l00IntField" type "int" value "2" OBSERVATION, this field has been set to 2 + field "l00StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful + parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" OBSERVATION, parameter group has status OBSERVATION + field "l10IntField" type "int" value "2" OBSERVATION, this field has been set to 2 + field "l10StringField" 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 diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt new file mode 100644 index 00000000..33d1d16a --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt @@ -0,0 +1,9 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" WARNING, parameter group has status WARNING + field "l00IntField" type "int" value "3" WARNING, values greater than 2 are not recommended + field "l00StringField" type "java.lang.String" value "l00StringField" WARNING, using the field name for the parameter value is dangerous + parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" WARNING, parameter group has status WARNING + field "l10IntField" type "int" value "3" WARNING, values greater than 2 are not recommended + 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 diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt new file mode 100644 index 00000000..fecfe70d --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt @@ -0,0 +1,15 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" INVALID, parameter group has status INVALID + field "l00IntField" type "int" value "-1" INVALID, l00IntField must be a positive integer + field "l00StringField" type "java.lang.String" value "" INVALID, l00StringField must be a non-blank string + parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" INVALID, parameter group has status INVALID + field "l10IntField" type "int" value "-1" INVALID, l10IntField must be a positive integer + field "l10StringField" type "java.lang.String" value "" INVALID, l10StringField must be a non-blank string + parameter group "l10LGenericNested0" 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 "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 "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 diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt new file mode 100644 index 00000000..00fe6627 --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt @@ -0,0 +1,15 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" OBSERVATION, parameter group has status OBSERVATION + field "l00IntField" type "int" value "2" OBSERVATION, this field has been set to 2 + field "l00StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful + parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" OBSERVATION, parameter group has status OBSERVATION + field "l10IntField" type "int" value "2" OBSERVATION, this field has been set to 2 + field "l10StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful + parameter group "l10LGenericNested0" 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 "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 "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 diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt new file mode 100644 index 00000000..6c1c639d --- /dev/null +++ b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt @@ -0,0 +1,15 @@ +parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" WARNING, parameter group has status WARNING + field "l00IntField" type "int" value "3" WARNING, values greater than 2 are not recommended + field "l00StringField" type "java.lang.String" value "l00StringField" WARNING, using the field name for the parameter value is dangerous + parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" WARNING, parameter group has status WARNING + field "l10IntField" type "int" value "3" WARNING, values greater than 2 are not recommended + field "l10StringField" type "java.lang.String" value "l10StringField" WARNING, using the field name for the parameter value is dangerous + parameter group "l10LGenericNested0" 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 "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 "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 |