summaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java1
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/startstop/PapDatabaseInitializer.java7
-rw-r--r--main/src/main/resources/PapDb.json12
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java3
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/startstop/TestMain.java2
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java2
6 files changed, 22 insertions, 5 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java b/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java
index 8f3583e1..1b7281ca 100644
--- a/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java
+++ b/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java
@@ -174,6 +174,7 @@ public class PapActivator extends ServiceManagerContainer {
addAction("PDP modification requests",
() -> Registry.register(PapConstants.REG_PDP_MODIFY_MAP, new PdpModifyRequestMap(
new PdpModifyRequestMapParams()
+ .setDaoFactory(daoFactory.get())
.setModifyLock(pdpUpdateLock)
.setParams(pdpParams)
.setPublisher(pdpPub.get())
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": []
}
]
}
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java b/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java
index 32eb3b2c..e7b412dc 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java
@@ -42,6 +42,7 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -95,6 +96,8 @@ public class CommonPapRestServer {
makeConfigFile();
+ HttpServletServer.factory.destroy();
+
startMain();
}
diff --git a/main/src/test/java/org/onap/policy/pap/main/startstop/TestMain.java b/main/src/test/java/org/onap/policy/pap/main/startstop/TestMain.java
index 650e8243..5ed94a36 100644
--- a/main/src/test/java/org/onap/policy/pap/main/startstop/TestMain.java
+++ b/main/src/test/java/org/onap/policy/pap/main/startstop/TestMain.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.pap.main.PapConstants;
import org.onap.policy.pap.main.PolicyPapException;
@@ -47,6 +48,7 @@ public class TestMain {
@Before
public void setUp() {
Registry.newRegistry();
+ HttpServletServer.factory.destroy();
}
/**
diff --git a/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java b/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java
index 6c9e092e..f369488a 100644
--- a/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java
+++ b/main/src/test/java/org/onap/policy/pap/main/startstop/TestPapActivator.java
@@ -33,6 +33,7 @@ import java.util.Properties;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.pap.main.PapConstants;
import org.onap.policy.pap.main.PolicyPapException;
@@ -60,6 +61,7 @@ public class TestPapActivator {
@Before
public void setUp() throws Exception {
Registry.newRegistry();
+ HttpServletServer.factory.destroy();
final String[] papConfigParameters =
{"-c", "parameters/PapConfigParameters.json", "-p", "parameters/topic.properties"};