Change to fix issues in overridden validations of ParameterGroups 55/92355/2
authora.sreekumar <ajith.sreekumar@est.tech>
Wed, 31 Jul 2019 13:25:29 +0000 (13:25 +0000)
committera.sreekumar <ajith.sreekumar@est.tech>
Wed, 31 Jul 2019 13:25:29 +0000 (13:25 +0000)
Currently, for validation of nested ParameterGroup classes, a new
GroupValidationResult is directly created instead of calling the
validate method of nested classes. Thus any overridden validate methods
won't work. This is fixed.

Change-Id: I8ee9265b295cb68d67926128b5b68c217f341034
Issue-ID: POLICY-1744
Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java

index ad2eb69..fd68045 100644 (file)
@@ -109,7 +109,12 @@ public class GroupValidationResult extends CommonGroupValidationResult {
 
         // Nested parameter groups are allowed
         if (ParameterGroup.class.isAssignableFrom(fieldType)) {
-            return new GroupValidationResult((ParameterGroup) fieldObject);
+            if (null != fieldObject) {
+                return ((ParameterGroup) fieldObject).validate();
+            }
+            else {
+                return new GroupValidationResult((ParameterGroup) fieldObject);
+            }
         }
 
         // Nested maps of parameter groups are allowed