diff options
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/startstop/PapDatabaseInitializer.java | 7 | ||||
-rw-r--r-- | main/src/main/resources/PapDb.json | 12 |
2 files changed, 14 insertions, 5 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/startstop/PapDatabaseInitializer.java b/main/src/main/java/org/onap/policy/pap/main/startstop/PapDatabaseInitializer.java index 7c1e2e8f..affe1e9f 100644 --- a/main/src/main/java/org/onap/policy/pap/main/startstop/PapDatabaseInitializer.java +++ b/main/src/main/java/org/onap/policy/pap/main/startstop/PapDatabaseInitializer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ package org.onap.policy.pap.main.startstop; import java.util.List; - +import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; @@ -71,6 +72,10 @@ public class PapDatabaseInitializer { final List<PdpGroup> pdpGroupsFromDb = databaseProvider.getPdpGroups( pdpGroupsToCreate.getGroups().get(0).getName()); if (pdpGroupsFromDb.isEmpty()) { + ValidationResult result = pdpGroupsToCreate.validatePapRest(); + if (!result.isValid()) { + throw new PolicyPapException(result.getResult()); + } databaseProvider.createPdpGroups(pdpGroupsToCreate.getGroups()); LOGGER.debug("Created initial pdpGroup in DB - {}", pdpGroupsToCreate); } else { diff --git a/main/src/main/resources/PapDb.json b/main/src/main/resources/PapDb.json index c6452cc1..6df3fc9f 100644 --- a/main/src/main/resources/PapDb.json +++ b/main/src/main/resources/PapDb.json @@ -15,7 +15,8 @@ } ], "currentInstanceCount": 0, - "desiredInstanceCount": 1 + "desiredInstanceCount": 1, + "policies": [] }, { "pdpType": "drools", @@ -26,7 +27,8 @@ } ], "currentInstanceCount": 0, - "desiredInstanceCount": 1 + "desiredInstanceCount": 1, + "policies": [] }, { "pdpType": "apex", @@ -37,7 +39,8 @@ } ], "currentInstanceCount": 0, - "desiredInstanceCount": 1 + "desiredInstanceCount": 1, + "policies": [] } ] }, @@ -56,7 +59,8 @@ } ], "currentInstanceCount": 0, - "desiredInstanceCount": 1 + "desiredInstanceCount": 1, + "policies": [] } ] } |