aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java18
-rw-r--r--main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java33
-rw-r--r--main/src/main/java/org/onap/policy/api/main/startstop/Main.java2
-rw-r--r--main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java31
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java23
-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.java4
-rw-r--r--main/src/test/resources/parameters/ApiConfigParameters.json22
-rw-r--r--main/src/test/resources/parameters/ApiConfigParameters_Https.json22
-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.json5
-rw-r--r--main/src/test/resources/parameters/NoParameters.json3
-rw-r--r--packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json22
-rw-r--r--packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json22
-rw-r--r--pom.xml4
18 files changed, 168 insertions, 58 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 baa0040d..17f3f1ab 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
@@ -20,6 +20,8 @@
package org.onap.policy.api.main.parameters;
+import java.util.ArrayList;
+import java.util.List;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterGroup;
@@ -36,17 +38,22 @@ public class ApiParameterGroup implements ParameterGroup {
private String name;
private RestServerParameters restServerParameters;
private PolicyModelsProviderParameters databaseProviderParameters;
+ private List<String> preloadPolicyTypes;
/**
* Create the api parameter group.
*
* @param name the parameter group name
+ * @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
*/
public ApiParameterGroup(final String name, final RestServerParameters restServerParameters,
- final PolicyModelsProviderParameters databaseProviderParameters) {
+ final PolicyModelsProviderParameters databaseProviderParameters, final List<String> preloadPolicyTypes) {
this.name = name;
this.restServerParameters = restServerParameters;
this.databaseProviderParameters = databaseProviderParameters;
+ this.preloadPolicyTypes = preloadPolicyTypes;
}
/**
@@ -88,6 +95,15 @@ public class ApiParameterGroup implements ParameterGroup {
}
/**
+ * Return the preloadPolicyTypes of this parameter group instance.
+ *
+ * @return the preloadPolicyTypes
+ */
+ public List<String> getPreloadPolicyTypes() {
+ return preloadPolicyTypes;
+ }
+
+ /**
* Validate the parameter group.
*
* @return the result of the validation
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 e6c2bb2b..6ac2f0fc 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
@@ -25,13 +25,13 @@ package org.onap.policy.api.main.startstop;
import java.util.LinkedHashMap;
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.resources.ResourceUtils;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderFactory;
-import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
@@ -50,29 +50,6 @@ public class ApiDatabaseInitializer {
private StandardCoder standardCoder;
private PolicyModelsProviderFactory factory;
- // @formatter:off
- private static final String[] PRELOAD_POLICYTYPES = {
- "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml",
- "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml",
- "policytypes/onap.policies.Optimization.yaml",
- "policytypes/onap.policies.optimization.AffinityPolicy.yaml",
- "policytypes/onap.policies.optimization.DistancePolicy.yaml",
- "policytypes/onap.policies.optimization.HpaPolicy.yaml",
- "policytypes/onap.policies.optimization.OptimizationPolicy.yaml",
- "policytypes/onap.policies.optimization.PciPolicy.yaml",
- "policytypes/onap.policies.optimization.QueryPolicy.yaml",
- "policytypes/onap.policies.optimization.SubscriberPolicy.yaml",
- "policytypes/onap.policies.optimization.Vim_fit.yaml",
- "policytypes/onap.policies.optimization.VnfPolicy.yaml",
- "policytypes/onap.policies.controlloop.guard.Blacklist.yaml",
- "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml",
- "policytypes/onap.policies.controlloop.guard.MinMax.yaml",
- "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml",
- "policytypes/onap.policies.controlloop.Operational.yaml",
- "policytypes/onap.policies.Naming.yaml"
- };
- // @formatter:on
-
/**
* Constructs the object.
*/
@@ -84,18 +61,18 @@ public class ApiDatabaseInitializer {
/**
* Initializes database by preloading policy types.
*
- * @param policyModelsProviderParameters the database parameters
+ * @param apiParameterGroup the apiParameterGroup parameters
* @throws PolicyApiException in case of errors.
*/
- public void initializeApiDatabase(final PolicyModelsProviderParameters policyModelsProviderParameters)
+ public void initializeApiDatabase(final ApiParameterGroup apiParameterGroup)
throws PolicyApiException {
try (PolicyModelsProvider databaseProvider =
- factory.createPolicyModelsProvider(policyModelsProviderParameters)) {
+ factory.createPolicyModelsProvider(apiParameterGroup.getDatabaseProviderParameters())) {
ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
serviceTemplate.setPolicyTypes(new LinkedHashMap<String, ToscaPolicyType>());
serviceTemplate.setToscaDefinitionsVersion("tosca_simple_yaml_1_0_0");
- for (String pt : PRELOAD_POLICYTYPES) {
+ for (String pt : apiParameterGroup.getPreloadPolicyTypes()) {
String policyTypeAsStringYaml = ResourceUtils.getResourceAsString(pt);
if (policyTypeAsStringYaml == null) {
throw new PolicyApiException("Preloading policy type cannot be found: " + pt);
diff --git a/main/src/main/java/org/onap/policy/api/main/startstop/Main.java b/main/src/main/java/org/onap/policy/api/main/startstop/Main.java
index 4a0fead1..23dcd269 100644
--- a/main/src/main/java/org/onap/policy/api/main/startstop/Main.java
+++ b/main/src/main/java/org/onap/policy/api/main/startstop/Main.java
@@ -80,7 +80,7 @@ public class Main {
// Initialize database
try {
- new ApiDatabaseInitializer().initializeApiDatabase(parameterGroup.getDatabaseProviderParameters());
+ new ApiDatabaseInitializer().initializeApiDatabase(parameterGroup);
} catch (final PolicyApiException e) {
LOGGER.error("Preloading policy types into DB failed", e);
return;
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 c12847a7..d2209e73 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
@@ -27,6 +27,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.util.Collections;
+
import org.junit.Test;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.parameters.GroupValidationResult;
@@ -45,8 +47,8 @@ public class TestApiParameterGroup {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT);
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
- final ApiParameterGroup apiParameters = new ApiParameterGroup(
- CommonTestData.API_GROUP_NAME, restServerParameters, databaseProviderParameters);
+ final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
+ restServerParameters, databaseProviderParameters, Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertTrue(validationResult.isValid());
assertEquals(restServerParameters.getHost(), apiParameters.getRestServerParameters().getHost());
@@ -58,6 +60,7 @@ public class TestApiParameterGroup {
assertEquals(restServerParameters.isHttps(), apiParameters.getRestServerParameters().isHttps());
assertEquals(restServerParameters.isAaf(), apiParameters.getRestServerParameters().isAaf());
assertEquals(CommonTestData.API_GROUP_NAME, apiParameters.getName());
+ assertTrue(apiParameters.getPreloadPolicyTypes().isEmpty());
}
@Test
@@ -66,7 +69,7 @@ public class TestApiParameterGroup {
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
final ApiParameterGroup apiParameters = new ApiParameterGroup(null,
- restServerParameters, databaseProviderParameters);
+ restServerParameters, databaseProviderParameters, Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertEquals(null, apiParameters.getName());
@@ -81,7 +84,7 @@ public class TestApiParameterGroup {
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
final ApiParameterGroup apiParameters = new ApiParameterGroup("",
- restServerParameters, databaseProviderParameters);
+ restServerParameters, databaseProviderParameters, Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertEquals("", apiParameters.getName());
@@ -94,8 +97,8 @@ public class TestApiParameterGroup {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(true, PORT);
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
- final ApiParameterGroup apiParameters = new ApiParameterGroup(
- CommonTestData.API_GROUP_NAME, restServerParameters, databaseProviderParameters);
+ final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
+ restServerParameters, databaseProviderParameters, Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -108,8 +111,8 @@ public class TestApiParameterGroup {
final RestServerParameters restServerParameters = null;
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(false);
- final ApiParameterGroup apiParameters = new ApiParameterGroup(
- CommonTestData.API_GROUP_NAME, restServerParameters, databaseProviderParameters);
+ final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
+ restServerParameters, databaseProviderParameters, Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -122,8 +125,8 @@ public class TestApiParameterGroup {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT);
final PolicyModelsProviderParameters databaseProviderParameters =
commonTestData.getDatabaseProviderParameters(true);
- final ApiParameterGroup apiParameters = new ApiParameterGroup(
- CommonTestData.API_GROUP_NAME, restServerParameters, databaseProviderParameters);
+ final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
+ restServerParameters, databaseProviderParameters, Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -135,8 +138,8 @@ public class TestApiParameterGroup {
public void testApiParameterGroup_NullDatabaseProviderParameters() {
final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT);
final PolicyModelsProviderParameters databaseProviderParameters = null;
- final ApiParameterGroup apiParameters = new ApiParameterGroup(
- CommonTestData.API_GROUP_NAME, restServerParameters, databaseProviderParameters);
+ final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
+ restServerParameters, databaseProviderParameters, Collections.emptyList());
final GroupValidationResult validationResult = apiParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -145,8 +148,8 @@ public class TestApiParameterGroup {
@Test
public void testApiParameterGroup_SetName() {
- final ApiParameterGroup apiParameters = new ApiParameterGroup(
- CommonTestData.API_GROUP_NAME, null, null);
+ final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME,
+ null, null, 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 6e51e369..359533ff 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
@@ -33,6 +33,7 @@ import java.lang.reflect.Modifier;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.Base64;
+import java.util.Collections;
import java.util.Properties;
import javax.net.ssl.SSLContext;
@@ -228,7 +229,7 @@ public class TestApiRestServer {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams);
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList());
ParameterService.register(apiParamGroup, true);
policyTypeProvider = new PolicyTypeProvider();
policyProvider = new PolicyProvider();
@@ -697,6 +698,26 @@ public class TestApiRestServer {
}
@Test
+ public void testReadPreloadPolicyTypesPersistentJson() throws Exception {
+ setupParameters();
+ main = startApiService(true);
+ Response rawResponse = readResource(POLICYTYPES, true, APP_JSON);
+ assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
+ ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class);
+ assertEquals(21, response.getPolicyTypes().size());
+ }
+
+ @Test
+ public void testReadPreloadPolicyTypesPersistentYaml() throws Exception {
+ setupParameters();
+ main = startApiService(true);
+ Response rawResponse = readResource(POLICYTYPES, true, APP_YAML);
+ assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
+ ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class);
+ assertEquals(21, response.getPolicyTypes().size());
+ }
+
+ @Test
public void testReadPolicyTypesPersistentJson() {
testReadPolicyTypesPersistent(APP_JSON);
}
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 f83acce7..3104a100 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
@@ -33,6 +33,7 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -103,7 +104,7 @@ public class TestLegacyGuardPolicyProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams);
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, 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 f80b1195..31e22e3f 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
@@ -33,6 +33,7 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.Collections;
import java.util.List;
import org.junit.After;
@@ -98,7 +99,7 @@ public class TestLegacyOperationalPolicyProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams);
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, 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 2e431704..5d0b4128 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
@@ -32,6 +32,7 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.Collections;
import java.util.List;
import org.junit.After;
@@ -105,7 +106,7 @@ public class TestPolicyProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams);
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, 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 582b7d4d..a17a7c9a 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
@@ -28,6 +28,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertFalse;
import java.util.Base64;
+import java.util.Collections;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -70,7 +72,7 @@ public class TestPolicyTypeProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams);
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList());
ParameterService.register(apiParamGroup, true);
policyTypeProvider = new PolicyTypeProvider();
policyProvider = new PolicyProvider();
diff --git a/main/src/test/resources/parameters/ApiConfigParameters.json b/main/src/test/resources/parameters/ApiConfigParameters.json
index be9f5811..91e304fe 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters.json
@@ -14,5 +14,25 @@
"databaseUser": "policy",
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
- }
+ },
+ "preloadPolicyTypes": [
+ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml",
+ "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml",
+ "policytypes/onap.policies.Optimization.yaml",
+ "policytypes/onap.policies.optimization.AffinityPolicy.yaml",
+ "policytypes/onap.policies.optimization.DistancePolicy.yaml",
+ "policytypes/onap.policies.optimization.HpaPolicy.yaml",
+ "policytypes/onap.policies.optimization.OptimizationPolicy.yaml",
+ "policytypes/onap.policies.optimization.PciPolicy.yaml",
+ "policytypes/onap.policies.optimization.QueryPolicy.yaml",
+ "policytypes/onap.policies.optimization.SubscriberPolicy.yaml",
+ "policytypes/onap.policies.optimization.Vim_fit.yaml",
+ "policytypes/onap.policies.optimization.VnfPolicy.yaml",
+ "policytypes/onap.policies.controlloop.guard.Blacklist.yaml",
+ "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml",
+ "policytypes/onap.policies.controlloop.guard.MinMax.yaml",
+ "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml",
+ "policytypes/onap.policies.controlloop.Operational.yaml",
+ "policytypes/onap.policies.Naming.yaml"
+ ]
}
diff --git a/main/src/test/resources/parameters/ApiConfigParameters_Https.json b/main/src/test/resources/parameters/ApiConfigParameters_Https.json
index d7774fcd..e4b2b6d6 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters_Https.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters_Https.json
@@ -15,5 +15,25 @@
"databaseUser": "policy",
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
- }
+ },
+ "preloadPolicyTypes": [
+ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml",
+ "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml",
+ "policytypes/onap.policies.Optimization.yaml",
+ "policytypes/onap.policies.optimization.AffinityPolicy.yaml",
+ "policytypes/onap.policies.optimization.DistancePolicy.yaml",
+ "policytypes/onap.policies.optimization.HpaPolicy.yaml",
+ "policytypes/onap.policies.optimization.OptimizationPolicy.yaml",
+ "policytypes/onap.policies.optimization.PciPolicy.yaml",
+ "policytypes/onap.policies.optimization.QueryPolicy.yaml",
+ "policytypes/onap.policies.optimization.SubscriberPolicy.yaml",
+ "policytypes/onap.policies.optimization.Vim_fit.yaml",
+ "policytypes/onap.policies.optimization.VnfPolicy.yaml",
+ "policytypes/onap.policies.controlloop.guard.Blacklist.yaml",
+ "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml",
+ "policytypes/onap.policies.controlloop.guard.MinMax.yaml",
+ "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml",
+ "policytypes/onap.policies.controlloop.Operational.yaml",
+ "policytypes/onap.policies.Naming.yaml"
+ ]
}
diff --git a/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json b/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json
index 24cc69f3..1a539cf6 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json
@@ -13,5 +13,6 @@
"databaseUser": "policy",
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
- }
+ },
+ "preloadPolicyTypes": []
}
diff --git a/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json b/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json
index 339c20b6..daf9c749 100644
--- a/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json
+++ b/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json
@@ -14,5 +14,6 @@
"databaseUser": "policy",
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
- }
+ },
+ "preloadPolicyTypes": []
}
diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json
index 8ac10805..4b2db7af 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -14,5 +14,6 @@
"databaseUser": "policy",
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
- }
-}
+ },
+ "preloadPolicyTypes": []
+} \ 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 6f933890..091900c9 100644
--- a/main/src/test/resources/parameters/NoParameters.json
+++ b/main/src/test/resources/parameters/NoParameters.json
@@ -13,5 +13,6 @@
"databaseUser": "policy",
"databasePassword": "UDAxaWNZ",
"persistenceUnit": "ToscaConceptTest"
- }
+ },
+ "preloadPolicyTypes": []
} \ No newline at end of file
diff --git a/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json b/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json
index 9c7c92f0..8cca7cda 100644
--- a/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json
+++ b/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json
@@ -16,5 +16,25 @@
"databaseUser": "policy_user",
"databasePassword": "cG9saWN5X3VzZXI=",
"persistenceUnit": "PolicyMariaDb"
- }
+ },
+ "preloadPolicyTypes": [
+ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml",
+ "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml",
+ "policytypes/onap.policies.Optimization.yaml",
+ "policytypes/onap.policies.optimization.AffinityPolicy.yaml",
+ "policytypes/onap.policies.optimization.DistancePolicy.yaml",
+ "policytypes/onap.policies.optimization.HpaPolicy.yaml",
+ "policytypes/onap.policies.optimization.OptimizationPolicy.yaml",
+ "policytypes/onap.policies.optimization.PciPolicy.yaml",
+ "policytypes/onap.policies.optimization.QueryPolicy.yaml",
+ "policytypes/onap.policies.optimization.SubscriberPolicy.yaml",
+ "policytypes/onap.policies.optimization.Vim_fit.yaml",
+ "policytypes/onap.policies.optimization.VnfPolicy.yaml",
+ "policytypes/onap.policies.controlloop.guard.Blacklist.yaml",
+ "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml",
+ "policytypes/onap.policies.controlloop.guard.MinMax.yaml",
+ "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml",
+ "policytypes/onap.policies.controlloop.Operational.yaml",
+ "policytypes/onap.policies.Naming.yaml"
+ ]
}
diff --git a/packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json b/packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json
index 6ee3c728..7c6da000 100644
--- a/packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json
+++ b/packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json
@@ -16,5 +16,25 @@
"databaseUser": "policy_user",
"databasePassword": "cG9saWN5X3VzZXI=",
"persistenceUnit": "PolicyMariaDb"
- }
+ },
+ "preloadPolicyTypes": [
+ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml",
+ "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml",
+ "policytypes/onap.policies.Optimization.yaml",
+ "policytypes/onap.policies.optimization.AffinityPolicy.yaml",
+ "policytypes/onap.policies.optimization.DistancePolicy.yaml",
+ "policytypes/onap.policies.optimization.HpaPolicy.yaml",
+ "policytypes/onap.policies.optimization.OptimizationPolicy.yaml",
+ "policytypes/onap.policies.optimization.PciPolicy.yaml",
+ "policytypes/onap.policies.optimization.QueryPolicy.yaml",
+ "policytypes/onap.policies.optimization.SubscriberPolicy.yaml",
+ "policytypes/onap.policies.optimization.Vim_fit.yaml",
+ "policytypes/onap.policies.optimization.VnfPolicy.yaml",
+ "policytypes/onap.policies.controlloop.guard.Blacklist.yaml",
+ "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml",
+ "policytypes/onap.policies.controlloop.guard.MinMax.yaml",
+ "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml",
+ "policytypes/onap.policies.controlloop.Operational.yaml",
+ "policytypes/onap.policies.Naming.yaml"
+ ]
} \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index a2aa1469..6cbefdff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,6 +59,10 @@
<dependencies>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>