aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorChenfei Gao <cgao@research.att.com>2020-02-21 17:07:49 -0500
committerChenfei Gao <cgao@research.att.com>2020-02-25 13:09:05 -0500
commitf0d03b320e772df782a968411f269dc089d1f897 (patch)
tree31a40aa1f238fc063b9d43786361556addbcf0c5 /main
parenta8765f7d8a9be082c281d46592307f5056f32fcd (diff)
Preload default policies
Issue-ID: POLICY-2317 Change-Id: I5794e617ea4fb99caf6e7a974a4886e72605979c Signed-off-by: Chenfei Gao <cgao@research.att.com>
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java63
-rw-r--r--main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java85
-rw-r--r--main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java20
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java32
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java3
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java3
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java3
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java3
-rw-r--r--main/src/test/resources/parameters/ApiConfigParameters_Https.json3
-rw-r--r--main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json3
-rw-r--r--main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json3
-rw-r--r--main/src/test/resources/parameters/MinimumParameters.json3
-rw-r--r--main/src/test/resources/parameters/NoParameters.json3
13 files changed, 109 insertions, 118 deletions
diff --git a/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java b/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java
index aa8ad973..c063d60e 100644
--- a/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java
+++ b/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java
@@ -21,6 +21,8 @@
package org.onap.policy.api.main.parameters;
import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterGroup;
@@ -32,12 +34,15 @@ import org.onap.policy.models.provider.PolicyModelsProviderParameters;
* Class to hold all parameters needed for Api component.
*
*/
+@Getter
public class ApiParameterGroup implements ParameterGroup {
+ @Setter
private String name;
- private RestServerParameters restServerParameters;
- private PolicyModelsProviderParameters databaseProviderParameters;
- private List<String> preloadPolicyTypes;
+ private final RestServerParameters restServerParameters;
+ private final PolicyModelsProviderParameters databaseProviderParameters;
+ private final List<String> preloadPolicyTypes;
+ private final List<String> preloadPolicies;
/**
* Create the api parameter group.
@@ -46,60 +51,16 @@ public class ApiParameterGroup implements ParameterGroup {
* @param restServerParameters the parameters for instantiating API rest server
* @param databaseProviderParameters the parameters for instantiating database provider
* @param preloadPolicyTypes the list of preloaded policy types
+ * @param preloadPolicies the list of preloaded policies
*/
public ApiParameterGroup(final String name, final RestServerParameters restServerParameters,
- final PolicyModelsProviderParameters databaseProviderParameters, final List<String> preloadPolicyTypes) {
+ final PolicyModelsProviderParameters databaseProviderParameters, final List<String> preloadPolicyTypes,
+ final List<String> preloadPolicies) {
this.name = name;
this.restServerParameters = restServerParameters;
this.databaseProviderParameters = databaseProviderParameters;
this.preloadPolicyTypes = preloadPolicyTypes;
- }
-
- /**
- * Return the name of this parameter group instance.
- *
- * @return name the parameter group name
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Set the name of this parameter group instance.
- *
- * @param name the parameter group name
- */
- @Override
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Return the restServerParameters of this parameter group instance.
- *
- * @return the restServerParameters
- */
- public RestServerParameters getRestServerParameters() {
- return restServerParameters;
- }
-
- /**
- * Return the databaseProviderParameters of this parameter group instance.
- *
- * @return the databaseProviderParameters
- */
- public PolicyModelsProviderParameters getDatabaseProviderParameters() {
- return databaseProviderParameters;
- }
-
- /**
- * Return the preloadPolicyTypes of this parameter group instance.
- *
- * @return the preloadPolicyTypes
- */
- public List<String> getPreloadPolicyTypes() {
- return preloadPolicyTypes;
+ this.preloadPolicies = preloadPolicies;
}
/**
diff --git a/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java b/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java
index aee28303..7e3765d2 100644
--- a/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java
+++ b/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java
@@ -24,11 +24,12 @@
package org.onap.policy.api.main.startstop;
import java.util.LinkedHashMap;
-
+import java.util.LinkedList;
+import java.util.List;
import org.onap.policy.api.main.exception.PolicyApiException;
import org.onap.policy.api.main.parameters.ApiParameterGroup;
import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.coder.StandardYamlCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.provider.PolicyModelsProvider;
@@ -36,9 +37,9 @@ import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.Yaml;
/**
* This class creates initial policy types in the database.
@@ -49,7 +50,7 @@ public class ApiDatabaseInitializer {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiDatabaseInitializer.class);
- private StandardCoder standardCoder;
+ private static final StandardYamlCoder coder = new StandardYamlCoder();
private PolicyModelsProviderFactory factory;
/**
@@ -57,11 +58,10 @@ public class ApiDatabaseInitializer {
*/
public ApiDatabaseInitializer() {
factory = new PolicyModelsProviderFactory();
- standardCoder = new StandardCoder();
}
/**
- * Initializes database by preloading policy types.
+ * Initializes database by preloading policy types and policies.
*
* @param apiParameterGroup the apiParameterGroup parameters
* @throws PolicyApiException in case of errors.
@@ -74,34 +74,57 @@ public class ApiDatabaseInitializer {
serviceTemplate.setDataTypes(new LinkedHashMap<String, ToscaDataType>());
serviceTemplate.setPolicyTypes(new LinkedHashMap<String, ToscaPolicyType>());
serviceTemplate.setToscaDefinitionsVersion("tosca_simple_yaml_1_0_0");
- for (String pt : apiParameterGroup.getPreloadPolicyTypes()) {
- String policyTypeAsStringYaml = ResourceUtils.getResourceAsString(pt);
- if (policyTypeAsStringYaml == null) {
- throw new PolicyApiException("Preloading policy type cannot be found: " + pt);
- }
- Object yamlObject = new Yaml().load(policyTypeAsStringYaml);
- String policyTypeAsString = new StandardCoder().encode(yamlObject);
+ ToscaServiceTemplate createdPolicyTypes = preloadServiceTemplate(serviceTemplate,
+ apiParameterGroup.getPreloadPolicyTypes(), databaseProvider::createPolicyTypes);
+ preloadServiceTemplate(createdPolicyTypes,
+ apiParameterGroup.getPreloadPolicies(), databaseProvider::createPolicies);
+ } catch (final PolicyApiException | PfModelException | CoderException exp) {
+ throw new PolicyApiException(exp);
+ }
+ }
- ToscaServiceTemplate singlePolicyType =
- standardCoder.decode(policyTypeAsString, ToscaServiceTemplate.class);
- if (singlePolicyType == null) {
- throw new PolicyApiException("Error deserializing policy type from file: " + pt);
- }
- // Consolidate data types and policy types
- if (singlePolicyType.getDataTypes() != null) {
- serviceTemplate.getDataTypes().putAll(singlePolicyType.getDataTypes());
- }
- serviceTemplate.getPolicyTypes().putAll(singlePolicyType.getPolicyTypes());
+ private ToscaServiceTemplate preloadServiceTemplate(ToscaServiceTemplate serviceTemplate,
+ List<String> entities, FunctionWithEx<ToscaServiceTemplate, ToscaServiceTemplate> getter)
+ throws PolicyApiException, CoderException, PfModelException {
+
+ for (String entity : entities) {
+ String entityAsStringYaml = ResourceUtils.getResourceAsString(entity);
+ if (entityAsStringYaml == null) {
+ throw new PolicyApiException("Preloading entity cannot be found: " + entity);
}
- ToscaServiceTemplate createdPolicyTypes = databaseProvider.createPolicyTypes(serviceTemplate);
- if (createdPolicyTypes == null) {
- throw new PolicyApiException("Error preloading policy types: " + serviceTemplate);
- } else {
- LOGGER.debug("Created initial policy types in DB - {}", createdPolicyTypes);
+
+ ToscaServiceTemplate singleEntity =
+ coder.decode(entityAsStringYaml, ToscaServiceTemplate.class);
+ if (singleEntity == null) {
+ throw new PolicyApiException("Error deserializaing entity from file: " + entity);
+ }
+
+ // Consolidate data types and policy types
+ if (singleEntity.getDataTypes() != null) {
+ serviceTemplate.getDataTypes().putAll(singleEntity.getDataTypes());
+ }
+ if (singleEntity.getPolicyTypes() != null) {
+ serviceTemplate.getPolicyTypes().putAll(singleEntity.getPolicyTypes());
+ }
+
+ // Consolidate policies
+ ToscaTopologyTemplate topologyTemplate = singleEntity.getToscaTopologyTemplate();
+ if (topologyTemplate != null && topologyTemplate.getPolicies() != null) {
+ serviceTemplate.setToscaTopologyTemplate(new ToscaTopologyTemplate());
+ serviceTemplate.getToscaTopologyTemplate().setPolicies(new LinkedList<>());
+ serviceTemplate.getToscaTopologyTemplate().getPolicies()
+ .addAll(singleEntity.getToscaTopologyTemplate().getPolicies());
}
- } catch (final PfModelException | CoderException exp) {
- throw new PolicyApiException(exp);
}
+ // Preload the specified entities
+ ToscaServiceTemplate createdServiceTemplate = getter.apply(serviceTemplate);
+ LOGGER.debug("Created initial tosca service template in DB - {}", createdServiceTemplate);
+ return createdServiceTemplate;
+ }
+
+ @FunctionalInterface
+ protected interface FunctionWithEx<T, R> {
+ public R apply(T value) throws PfModelException;
}
-}
+} \ No newline at end of file
diff --git a/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java b/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java
index d2209e73..45653883 100644
--- a/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java
@@ -48,7 +48,7 @@ public class TestApiParameterGroup {
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
- restServerParameters, databaseProviderParameters, Collections.emptyList());
+ restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertTrue(validationResult.isValid());
assertEquals(restServerParameters.getHost(), apiParameters.getRestServerParameters().getHost());
@@ -68,8 +68,8 @@ public class TestApiParameterGroup {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT);
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
- final ApiParameterGroup apiParameters = new ApiParameterGroup(null,
- restServerParameters, databaseProviderParameters, Collections.emptyList());
+ final ApiParameterGroup apiParameters = new ApiParameterGroup(null, restServerParameters,
+ databaseProviderParameters, Collections.emptyList(), Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertEquals(null, apiParameters.getName());
@@ -83,8 +83,8 @@ public class TestApiParameterGroup {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT);
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
- final ApiParameterGroup apiParameters = new ApiParameterGroup("",
- restServerParameters, databaseProviderParameters, Collections.emptyList());
+ final ApiParameterGroup apiParameters = new ApiParameterGroup("", restServerParameters,
+ databaseProviderParameters, Collections.emptyList(), Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertEquals("", apiParameters.getName());
@@ -98,7 +98,7 @@ public class TestApiParameterGroup {
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
- restServerParameters, databaseProviderParameters, Collections.emptyList());
+ restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -112,7 +112,7 @@ public class TestApiParameterGroup {
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
- restServerParameters, databaseProviderParameters, Collections.emptyList());
+ restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -126,7 +126,7 @@ public class TestApiParameterGroup {
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(true);
final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
- restServerParameters, databaseProviderParameters, Collections.emptyList());
+ restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -139,7 +139,7 @@ public class TestApiParameterGroup {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT);
final PolicyModelsProviderParameters databaseProviderParameters = null;
final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
- restServerParameters, databaseProviderParameters, Collections.emptyList());
+ restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -149,7 +149,7 @@ public class TestApiParameterGroup {
@Test
public void testApiParameterGroup_SetName() {
final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
- null, null, Collections.emptyList());
+ null, null, Collections.emptyList(), Collections.emptyList());
assertEquals(CommonTestData.API_GROUP_NAME, apiParameters.getName());
apiParameters.setName("SampleName");
assertEquals("SampleName", apiParameters.getName());
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
index 4af601a2..7780ea7d 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
@@ -110,6 +110,9 @@ public class TestApiRestServer {
private static final String POLICYTYPES_DROOLS_VERSION = POLICYTYPES_DROOLS + "/versions/1.0.0";
private static final String POLICYTYPES_DROOLS_VERSION_LATEST = POLICYTYPES_DROOLS + "/versions/latest";
+ private static final String POLICYTYPES_NAMING_VERSION =
+ POLICYTYPES + "/onap.policies.Naming/versions/1.0.0";
+
private static final String POLICYTYPES_TCA_POLICIES =
"policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies";
private static final String POLICYTYPES_TCA_POLICIES_VCPE =
@@ -252,7 +255,8 @@ public class TestApiRestServer {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList());
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams,
+ Collections.emptyList(), Collections.emptyList());
ParameterService.register(apiParamGroup, true);
policyTypeProvider = new PolicyTypeProvider();
@@ -542,6 +546,9 @@ public class TestApiRestServer {
rawResponse = readResource(POLICYTYPES_DROOLS_VERSION_LATEST, mediaType);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
+
+ rawResponse = readResource(POLICYTYPES_NAMING_VERSION, mediaType);
+ assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
}
@Test
@@ -611,12 +618,9 @@ public class TestApiRestServer {
@Test
public void testNamingPolicyGet() throws Exception {
- Response rawResponse = createResource("policies", "policies/sdnc.policy.naming.input.tosca.yaml");
- assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
- rawResponse = readResource("policytypes/"
- + "onap.policies.Naming/versions/1.0.0/policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/1.0.0",
- APP_JSON);
+ Response rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
+ + "policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
ToscaServiceTemplate namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -624,9 +628,8 @@ public class TestApiRestServer {
assertEquals(1, namingServiceTemplate.getPolicyTypesAsMap().size());
assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
- rawResponse = readResource("policytypes/"
- + "onap.policies.Naming/versions/1.0.0/policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/latest",
- APP_JSON);
+ rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
+ + "policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/latest", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -634,20 +637,13 @@ public class TestApiRestServer {
assertEquals(1, namingServiceTemplate.getPolicyTypesAsMap().size());
assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
- rawResponse = readResource(
- "policytypes/" + "onap.policies.Naming/versions/1.0.0/policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP",
- APP_JSON);
+ rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/policies", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
assertEquals(1, namingServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap().size());
assertEquals(1, namingServiceTemplate.getPolicyTypesAsMap().size());
assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
-
- rawResponse = deleteResource("policytypes/"
- + "onap.policies.Naming/versions/1.0.0/policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/1.0.0",
- APP_JSON);
- assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
}
@Test
@@ -664,7 +660,7 @@ public class TestApiRestServer {
Response rawResponse = deleteResource(POLICYTYPES_TCA_POLICIES_VCPE_VERSION1, mediaType);
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus());
ErrorResponse error = rawResponse.readEntity(ErrorResponse.class);
- assertEquals("no policies found", error.getErrorMessage());
+ assertEquals("policy onap.restart.tca:1.0.0 not found", error.getErrorMessage());
}
@Test
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
index 342d17b1..dfe29cfc 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
@@ -105,7 +105,8 @@ public class TestLegacyGuardPolicyProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList());
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams,
+ Collections.emptyList(), Collections.emptyList());
ParameterService.register(apiParamGroup, true);
guardPolicyProvider = new LegacyGuardPolicyProvider();
policyTypeProvider = new PolicyTypeProvider();
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
index c0084956..74ad4a9d 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
@@ -100,7 +100,8 @@ public class TestLegacyOperationalPolicyProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList());
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams,
+ Collections.emptyList(), Collections.emptyList());
ParameterService.register(apiParamGroup, true);
operationalPolicyProvider = new LegacyOperationalPolicyProvider();
policyTypeProvider = new PolicyTypeProvider();
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
index d9b01fdb..be9b5838 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
@@ -107,7 +107,8 @@ public class TestPolicyProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList());
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams,
+ Collections.emptyList(), Collections.emptyList());
ParameterService.register(apiParamGroup, true);
policyTypeProvider = new PolicyTypeProvider();
policyProvider = new PolicyProvider();
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
index 58576abc..58d4230c 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
@@ -91,7 +91,8 @@ public class TestPolicyTypeProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList());
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams,
+ Collections.emptyList(), Collections.emptyList());
ParameterService.register(apiParamGroup, true);
policyTypeProvider = new PolicyTypeProvider();
policyProvider = new PolicyProvider();
diff --git a/main/src/test/resources/parameters/ApiConfigParameters_Https.json b/main/src/test/resources/parameters/ApiConfigParameters_Https.json
index 29745fb8..5f0bc8af 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters_Https.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters_Https.json
@@ -44,5 +44,8 @@
"policytypes/onap.policies.controlloop.operational.Common.yaml",
"policytypes/onap.policies.controlloop.operational.common.Apex.yaml",
"policytypes/onap.policies.controlloop.operational.common.Drools.yaml"
+ ],
+ "preloadPolicies" : [
+ "policies/sdnc.policy.naming.input.tosca.yaml"
]
}
diff --git a/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json b/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json
index 1a539cf6..f8a286f9 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json
@@ -14,5 +14,6 @@
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
},
- "preloadPolicyTypes": []
+ "preloadPolicyTypes": [],
+ "preloadPolicies": []
}
diff --git a/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json b/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json
index daf9c749..4e9083ec 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json
@@ -15,5 +15,6 @@
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
},
- "preloadPolicyTypes": []
+ "preloadPolicyTypes": [],
+ "preloadPolicies": []
}
diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json
index 4b2db7af..129d9ca3 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -15,5 +15,6 @@
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
},
- "preloadPolicyTypes": []
+ "preloadPolicyTypes": [],
+ "preloadPolicies": []
} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/NoParameters.json b/main/src/test/resources/parameters/NoParameters.json
index 091900c9..d71e7bbe 100644
--- a/main/src/test/resources/parameters/NoParameters.json
+++ b/main/src/test/resources/parameters/NoParameters.json
@@ -14,5 +14,6 @@
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
},
- "preloadPolicyTypes": []
+ "preloadPolicyTypes": [],
+ "preloadPolicies": []
} \ No newline at end of file