diff options
author | jhh <jorge.hernandez-herrero@att.com> | 2019-04-16 23:09:49 -0500 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2019-04-16 23:10:46 -0500 |
commit | a2e7d569974b018235e821d7bc0bb7a43d75aa2c (patch) | |
tree | e9d669efdc6af9796e0865d95b1b263a1f9edfb1 /feature-lifecycle/src/test/java/org | |
parent | fde980c4377e237eec08be75bdb7d6ae8fa33b78 (diff) |
Add response section to PAP status message
Change-Id: I26bf9f515c8639c030e8beb9e8b37a6a632da686
Issue-ID: POLICY-1655
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'feature-lifecycle/src/test/java/org')
4 files changed, 26 insertions, 12 deletions
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/ControllerSupport.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/ControllerSupport.java index d5ac423a..c22a0d88 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/ControllerSupport.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/ControllerSupport.java @@ -58,6 +58,12 @@ public class ControllerSupport { * Create controller. */ public PolicyController createController() throws IOException { + try { + getController(); + } catch (IllegalArgumentException e) { + ; + } + ReleaseId coordinates = KieUtils.installArtifact(Paths.get(JUNIT_KMODULE_PATH).toFile(), Paths.get(JUNIT_KMODULE_POM_PATH).toFile(), diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java index 554f2ef0..d28ab14c 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java @@ -195,22 +195,16 @@ public class LifecycleStateActiveTest extends LifecycleStateRunningTest { PdpUpdate update = new PdpUpdate(); update.setName(NetworkUtil.getHostname()); - update.setPdpGroup("Z"); - update.setPdpSubgroup("z"); + update.setPdpGroup("W"); + update.setPdpSubgroup("w"); update.setPolicies(Collections.emptyList()); - long originalInterval = fsm.getStatusTimerSeconds(); - long interval = 10 * originalInterval; - update.setPdpHeartbeatIntervalMs(interval * 1000L); - fsm.start(controllerSupport.getController()); - assertTrue(fsm.update(update)); assertEquals(PdpState.ACTIVE, fsm.state()); - assertEquals(interval, fsm.getStatusTimerSeconds()); - assertEquals("Z", fsm.getGroup()); - assertEquals("z", fsm.getSubgroup()); + assertEquals("W", fsm.getGroup()); + assertEquals("w", fsm.getSubgroup()); String restartV1 = new String(Files.readAllBytes(Paths.get("src/test/resources/tosca-policy-operational-restart.json"))); @@ -316,6 +310,15 @@ public class LifecycleStateActiveTest extends LifecycleStateRunningTest { assertTrue(factPolicies.stream().anyMatch((ff) -> Objects.equals(toscaPolicyFirewall, ff))); assertEquals(2, fsm.policiesMap.size()); + long originalInterval = fsm.getStatusTimerSeconds(); + long interval = 10 * originalInterval; + update.setPdpHeartbeatIntervalMs(interval * 1000L); + + assertTrue(fsm.update(update)); + + assertEquals(PdpState.ACTIVE, fsm.state()); + assertEquals(interval, fsm.getStatusTimerSeconds()); + fsm.shutdown(); } } diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java index 775dc8b0..b96779aa 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java @@ -180,6 +180,12 @@ public class LifecycleStatePassiveTest extends LifecycleStateRunningTest { assertTrue(fsm.update(update)); + int qlength = fsm.client.getSink().getRecentEvents().length; + PdpStatus lastStatus = new StandardCoder() + .decode(fsm.client.getSink().getRecentEvents()[qlength - 1], PdpStatus.class); + assertEquals(update.getRequestId(), lastStatus.getRequestId()); + assertEquals(update.getRequestId(), lastStatus.getResponse().getResponseTo()); + assertEquals(PdpState.PASSIVE, fsm.state()); assertEquals(interval, fsm.getStatusTimerSeconds()); assertEquals("Z", fsm.getGroup()); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java index 6da9dc12..25cce3a9 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java @@ -42,7 +42,7 @@ public abstract class LifecycleStateRunningTest { LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "INFO"); LoggerUtil.setLevel("org.onap.policy.common.endpoints", "WARN"); LoggerUtil.setLevel("org.onap.policy.drools", "INFO"); - SystemPersistence.manager.setConfigurationDir("src/test/resources"); + SystemPersistence.manager.setConfigurationDir("target/test-classes"); controllerSupport.createController(); } @@ -51,7 +51,6 @@ public abstract class LifecycleStateRunningTest { */ @AfterClass public static void tearDown() { - controllerSupport.destroyController(); try { Files.deleteIfExists(Paths.get(SystemPersistence.manager.getConfigurationPath().toString(), CONTROLLER_NAME + "-controller.properties.bak")); |