From 563ba59d9fb967681216eda454b0be9a3f13607d Mon Sep 17 00:00:00 2001 From: ramverma Date: Tue, 2 Apr 2019 18:22:41 +0000 Subject: Adding pdpHeartbeatIntervalMs to PdpUpdate message Adding pdpHeartbeatIntervalMs to PdpUpdate message. The value of which can be used by Pdp to override its own interval for sending PdpStatus message as heartbeat to PAP. Change-Id: I720713b9b569cf09bf393ac797da29e7f330f8bf Issue-ID: POLICY-1443 Signed-off-by: ramverma --- .../main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java | 2 ++ .../java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java index 80d4e94bd..200515cc4 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java @@ -43,6 +43,7 @@ public class PdpUpdate extends PdpMessage { private String description; private String pdpGroup; private String pdpSubgroup; + private long pdpHeartbeatIntervalMs; private List policies; /** @@ -65,6 +66,7 @@ public class PdpUpdate extends PdpMessage { this.description = source.description; this.pdpGroup = source.pdpGroup; this.pdpSubgroup = source.pdpSubgroup; + this.pdpHeartbeatIntervalMs = source.pdpHeartbeatIntervalMs; this.policies = (source.policies == null ? null : source.policies.stream().map(ToscaPolicy::new).collect(Collectors.toList())); } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java index 3d4359a7a..d2b571f34 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java @@ -42,14 +42,15 @@ public class TestPdpUpdate { PdpUpdate orig = new PdpUpdate(); // verify with null values - assertEquals("PdpUpdate(name=null, description=null, pdpGroup=null, " - + "pdpSubgroup=null, policies=null)", new PdpUpdate(orig).toString()); + assertEquals("PdpUpdate(name=null, description=null, pdpGroup=null, pdpSubgroup=null, " + + "pdpHeartbeatIntervalMs=0, policies=null)", new PdpUpdate(orig).toString()); // verify with all values orig.setDescription("my-description"); orig.setName("my-name"); orig.setPdpGroup("my-group"); orig.setPdpSubgroup("my-subgroup"); + orig.setPdpHeartbeatIntervalMs(30000); ToscaPolicy policy1 = new ToscaPolicy(); policy1.setName("policy-a"); @@ -65,7 +66,7 @@ public class TestPdpUpdate { PdpUpdate other = new PdpUpdate(orig); assertEquals("PdpUpdate(name=my-name, description=my-description, " - + "pdpGroup=my-group, pdpSubgroup=my-subgroup, policies=[" + + "pdpGroup=my-group, pdpSubgroup=my-subgroup, pdpHeartbeatIntervalMs=30000, policies=[" + "ToscaPolicy(super=ToscaEntity(name=policy-a, version=1.2.3, derivedFrom=null, " + "metadata=null, description=null), type=null, typeVersion=null, properties=null), " + "ToscaPolicy(super=ToscaEntity(name=policy-b, version=4.5.6, derivedFrom=null, " -- cgit 1.2.3-korg