From 73ba8039930ba56f6a64a7acc4126dc50b77070d Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 30 Jul 2018 10:22:27 +0100 Subject: 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 --- .../test/resources/parameters/TestParameters.json | 49 ++++++++++++++++++++++ .../test/resources/parameters/TestParameters.yaml | 37 ++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 common-parameters/src/test/resources/parameters/TestParameters.json create mode 100644 common-parameters/src/test/resources/parameters/TestParameters.yaml (limited to 'common-parameters/src/test/resources/parameters') diff --git a/common-parameters/src/test/resources/parameters/TestParameters.json b/common-parameters/src/test/resources/parameters/TestParameters.json new file mode 100644 index 00000000..8e312166 --- /dev/null +++ b/common-parameters/src/test/resources/parameters/TestParameters.json @@ -0,0 +1,49 @@ +{ + "name" : "l00NameFromFile", + "l00IntField" : 1, + "l00StringField" : "l00 string field value from file", + "l00L10Nested" : { + "name" : "l00L10NestedNameFromFile", + "l10IntField" : 1, + "l10StringField" : "l00 L10 nested string field value from file", + "l10LGenericNested0" : { + "name" : "l10LGenericNested0NameFromFile", + "lgenericIntField" : 1, + "lgenericStringField" : "l10 generic nested 0 string field value from file" + }, + "l10LGenericNested1" : { + "name" : "l10LGenericNested1NameFromFile", + "lgenericIntField" : 1, + "lgenericStringField" : "l10 generic nested 1 string field value from file" + }, + "l10LGenericNestedMap": { + "L10Entry0": { + "name" : "L10Entry0Name", + "lgenericIntField" : 1, + "lgenericStringField" : "L10Entry0 value from file" + }, + "L10Entry1": { + "name" : "L10Entry1Name", + "lgenericIntField" : 1, + "lgenericStringField" : "L10Entry1 value from file" + } + } + }, + "l00LGenericNested" : { + "name" : "l00GenericNestedNameFromFile", + "lgenericIntField" : 1, + "lgenericStringField" : "l00 generic nested string field value from file" + }, + "l00LGenericNestedMap": { + "L00Entry0": { + "name" : "L00Entry0Name", + "lgenericIntField" : 1, + "lgenericStringField" : "L00Entry0 value from file" + }, + "L00Entry1": { + "name" : "L00Entry1Name", + "lgenericIntField" : 1, + "lgenericStringField" : "L00Entry1 value from file" + } + } +} \ No newline at end of file diff --git a/common-parameters/src/test/resources/parameters/TestParameters.yaml b/common-parameters/src/test/resources/parameters/TestParameters.yaml new file mode 100644 index 00000000..c7e17f6a --- /dev/null +++ b/common-parameters/src/test/resources/parameters/TestParameters.yaml @@ -0,0 +1,37 @@ +name: l00NameFromFile +l00IntField: 1 +l00StringField: l00 string field value from file +l00L10Nested: + name: l00L10NestedNameFromFile + l10IntField: 1 + l10StringField: l00 L10 nested string field value from file + l10LGenericNested0: + name: l10LGenericNested0NameFromFile + lgenericIntField: 1 + lgenericStringField: l10 generic nested 0 string field value from file + l10LGenericNested1: + name: l10LGenericNested1NameFromFile + lgenericIntField: 1 + lgenericStringField: l10 generic nested 1 string field value from file + l10LGenericNestedMap: + l10Entry0: + name: L10Entry0Name + lgenericIntField: 1 + lgenericStringField: L10Entry0 value from file + L10Entry1: + name: L10Entry1Name + lgenericIntField: 1 + lgenericStringField: L10Entry1 value from file +l00LGenericNested: + name: l00GenericNestedNameFromFile + lgenericIntField: 1 + lgenericStringField: l00 generic nested string field value from file +l00LGenericNestedMap: + L00Entry0: + name: L00Entry0Name + lgenericIntField: 1 + lgenericStringField: L00Entry0 value from file + L00Entry1: + name: L00Entry1Name + lgenericIntField: 1 + lgenericStringField: L00Entry1 value from file -- cgit 1.2.3-korg