summaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2021-05-27 14:41:11 -0500
committerjhh <jorge.hernandez-herrero@att.com>2021-05-27 17:19:46 -0500
commit9e627229dad4b56fd626f0b2813eb5b63e9a27a2 (patch)
tree08e862ce8132d4cf2aa1ef1519711b2448a24aa7 /main/src/test/java/org
parent47c4b4bf0940aa56bbf43b1ff7edc018b538019e (diff)
support external configuration of pdp groups
- modify policy-pap.sh to optionally provision a custom group if such a file is present. Issue-ID: POLICY-3331 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: Ib53bc14ee6b9471ab48f5a792b4283db3ed53b93 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'main/src/test/java/org')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/startstop/TestMain.java37
1 files changed, 30 insertions, 7 deletions
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 e49982bf..12f740b4 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
@@ -35,7 +35,6 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInst
import org.onap.policy.common.utils.resources.MessageConstants;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.pap.main.PapConstants;
-import org.onap.policy.pap.main.PolicyPapException;
import org.onap.policy.pap.main.PolicyPapRuntimeException;
import org.onap.policy.pap.main.parameters.CommonTestData;
@@ -59,10 +58,9 @@ public class TestMain {
/**
* Shuts "main" down.
*
- * @throws Exception if an error occurs
*/
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
// shut down activator
PapActivator activator = Registry.getOrDefault(PapConstants.REG_PAP_ACTIVATOR, PapActivator.class, null);
if (activator != null && activator.isAlive()) {
@@ -70,20 +68,45 @@ public class TestMain {
}
}
- @Test
- public void testMain() throws PolicyPapException {
- final String[] papConfigParameters = {"-c", "parameters/PapConfigParameters.json"};
+ private void testMainBody(String[] papConfigParameters) {
main = new Main(papConfigParameters);
assertTrue(main.getParameters().isValid());
assertEquals(CommonTestData.PAP_GROUP_NAME, main.getParameters().getName());
// ensure items were added to the registry
assertNotNull(Registry.get(PapConstants.REG_PAP_ACTIVATOR, PapActivator.class));
-
main.shutdown();
}
@Test
+ public void testMain() {
+ final String[] papConfigParameters = {"-c", "parameters/PapConfigParameters.json"};
+ testMainBody(papConfigParameters);
+ }
+
+ @Test
+ public void testMainCustomGroup() {
+ final String[] papConfigParameters = {
+ "-c",
+ "parameters/PapConfigParameters.json",
+ "-g",
+ "parameters/PapDbGroup1.json"
+ };
+ testMainBody(papConfigParameters);
+ }
+
+ @Test
+ public void testMainPapDb() {
+ final String[] papConfigParameters = {
+ "-c",
+ "parameters/PapConfigParameters.json",
+ "-g",
+ "PapDb.json"
+ };
+ testMainBody(papConfigParameters);
+ }
+
+ @Test
public void testMain_NoArguments() {
final String[] papConfigParameters = {};
assertThatThrownBy(() -> new Main(papConfigParameters)).isInstanceOf(PolicyPapRuntimeException.class)