diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2021-07-05 14:59:40 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2021-07-07 13:07:40 +0100 |
commit | 43ed6b71f24a06834ee9fd6f7ceb28eda2c351ba (patch) | |
tree | a5418aee5608702ad02f900f33442ebb624abe7d /models-pdp | |
parent | d6d78efe6a355805ad384ded50e2a25e31e7345a (diff) |
Update pdp statistics to count deploy/undeploy separately.
Issue-ID: POLICY-3383
Change-Id: I41e2668bdebd732149db0ccbe160b67b9952a8d9
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'models-pdp')
4 files changed, 46 insertions, 11 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatistics.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatistics.java index c9c4cda0e..13b3bdc33 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatistics.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatistics.java @@ -43,12 +43,15 @@ public class PdpStatistics { private Long generatedId; private String pdpGroupName; private String pdpSubGroupName; - private long policyDeployCount; - private long policyDeploySuccessCount; - private long policyDeployFailCount; private long policyExecutedCount; private long policyExecutedSuccessCount; private long policyExecutedFailCount; + private long policyDeployCount; + private long policyDeploySuccessCount; + private long policyDeployFailCount; + private long policyUndeployCount; + private long policyUndeploySuccessCount; + private long policyUndeployFailCount; private List<PdpEngineWorkerStatistics> engineStats; /** @@ -62,12 +65,15 @@ public class PdpStatistics { this.generatedId = source.generatedId; this.pdpGroupName = source.pdpGroupName; this.pdpSubGroupName = source.pdpSubGroupName; - this.policyDeployCount = source.policyDeployCount; - this.policyDeployFailCount = source.policyDeployFailCount; - this.policyDeploySuccessCount = source.policyDeploySuccessCount; this.policyExecutedCount = source.policyExecutedCount; this.policyExecutedFailCount = source.policyExecutedFailCount; this.policyExecutedSuccessCount = source.policyExecutedSuccessCount; + this.policyDeployCount = source.policyDeployCount; + this.policyDeployFailCount = source.policyDeployFailCount; + this.policyDeploySuccessCount = source.policyDeploySuccessCount; + this.policyUndeployCount = source.policyUndeployCount; + this.policyUndeployFailCount = source.policyUndeployFailCount; + this.policyUndeploySuccessCount = source.policyUndeploySuccessCount; this.engineStats = PfUtils.mapList(source.engineStats, PdpEngineWorkerStatistics::new, null); } } diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java index a62eaa304..0ff60b90f 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java @@ -66,7 +66,6 @@ import org.onap.policy.models.pdp.concepts.PdpStatistics; @EqualsAndHashCode(callSuper = false) public class JpaPdpStatistics extends PfConcept implements PfAuthorative<PdpStatistics>, Serializable { private static final long serialVersionUID = -7312974966820980659L; - private static final String NULL_NAME = "NULL"; @EmbeddedId @VerifyKey @@ -101,6 +100,15 @@ public class JpaPdpStatistics extends PfConcept implements PfAuthorative<PdpStat @Column private long policyExecutedFailCount; + @Column + private long policyUndeployCount; + + @Column + private long policyUndeploySuccessCount; + + @Column + private long policyUndeployFailCount; + @ElementCollection private List<PdpEngineWorkerStatistics> engineStats; @@ -117,7 +125,7 @@ public class JpaPdpStatistics extends PfConcept implements PfAuthorative<PdpStat * @param key the key */ public JpaPdpStatistics(@NonNull final PfGeneratedIdKey key) { - this(key, null, NULL_NAME, NULL_NAME, 0L, 0L, 0L, 0L, 0L, 0L, null); + this.key = new PfGeneratedIdKey(key); } /** @@ -134,6 +142,9 @@ public class JpaPdpStatistics extends PfConcept implements PfAuthorative<PdpStat this.policyDeployCount = copyConcept.policyDeployCount; this.policyDeploySuccessCount = copyConcept.policyDeploySuccessCount; this.policyDeployFailCount = copyConcept.policyDeployFailCount; + this.policyUndeployCount = copyConcept.policyUndeployCount; + this.policyUndeploySuccessCount = copyConcept.policyUndeploySuccessCount; + this.policyUndeployFailCount = copyConcept.policyUndeployFailCount; this.policyExecutedCount = copyConcept.policyExecutedCount; this.policyExecutedSuccessCount = copyConcept.policyExecutedSuccessCount; this.policyExecutedFailCount = copyConcept.policyExecutedFailCount; @@ -170,6 +181,9 @@ public class JpaPdpStatistics extends PfConcept implements PfAuthorative<PdpStat .append(this.policyDeployCount, other.policyDeployCount) .append(this.policyDeployFailCount, other.policyDeployFailCount) .append(this.policyDeploySuccessCount, other.policyDeploySuccessCount) + .append(this.policyUndeployCount, other.policyUndeployCount) + .append(this.policyUndeployFailCount, other.policyUndeployFailCount) + .append(this.policyUndeploySuccessCount, other.policyUndeploySuccessCount) .append(this.policyExecutedCount, other.policyExecutedCount) .append(this.policyExecutedFailCount, other.policyExecutedFailCount) .append(this.policyExecutedSuccessCount, other.policyExecutedSuccessCount).toComparison(); @@ -186,6 +200,9 @@ public class JpaPdpStatistics extends PfConcept implements PfAuthorative<PdpStat pdpStatistics.setPolicyDeployCount(policyDeployCount); pdpStatistics.setPolicyDeployFailCount(policyDeployFailCount); pdpStatistics.setPolicyDeploySuccessCount(policyDeploySuccessCount); + pdpStatistics.setPolicyUndeployCount(policyUndeployCount); + pdpStatistics.setPolicyUndeployFailCount(policyUndeployFailCount); + pdpStatistics.setPolicyUndeploySuccessCount(policyUndeploySuccessCount); pdpStatistics.setPolicyExecutedCount(policyExecutedCount); pdpStatistics.setPolicyExecutedFailCount(policyExecutedFailCount); pdpStatistics.setPolicyExecutedSuccessCount(policyExecutedSuccessCount); @@ -212,6 +229,9 @@ public class JpaPdpStatistics extends PfConcept implements PfAuthorative<PdpStat this.setPolicyDeployCount(pdpStatistics.getPolicyDeployCount()); this.setPolicyDeployFailCount(pdpStatistics.getPolicyDeployFailCount()); this.setPolicyDeploySuccessCount(pdpStatistics.getPolicyDeploySuccessCount()); + this.setPolicyUndeployCount(pdpStatistics.getPolicyUndeployCount()); + this.setPolicyUndeployFailCount(pdpStatistics.getPolicyUndeployFailCount()); + this.setPolicyUndeploySuccessCount(pdpStatistics.getPolicyUndeploySuccessCount()); this.setPolicyExecutedCount(pdpStatistics.getPolicyExecutedCount()); this.setPolicyExecutedFailCount(pdpStatistics.getPolicyExecutedFailCount()); this.setPolicyExecutedSuccessCount(pdpStatistics.getPolicyExecutedSuccessCount()); diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatisticsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatisticsTest.java index 4c099e6b5..001c80b7f 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatisticsTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatisticsTest.java @@ -45,12 +45,15 @@ public class PdpStatisticsTest { pdpStat.setPdpGroupName("PDPGroup0"); pdpStat.setPdpSubGroupName("PDPSubGroup0"); pdpStat.setTimeStamp(Instant.EPOCH); - pdpStat.setPolicyDeployCount(3); - pdpStat.setPolicyDeploySuccessCount(1); - pdpStat.setPolicyDeployFailCount(2); pdpStat.setPolicyExecutedCount(9); pdpStat.setPolicyExecutedSuccessCount(4); pdpStat.setPolicyExecutedFailCount(5); + pdpStat.setPolicyDeployCount(3); + pdpStat.setPolicyDeploySuccessCount(1); + pdpStat.setPolicyDeployFailCount(2); + pdpStat.setPolicyUndeployCount(4); + pdpStat.setPolicyUndeploySuccessCount(3); + pdpStat.setPolicyUndeployFailCount(1); pdpStat.setEngineStats(new ArrayList<>()); return pdpStat; } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java index 819c3b6e7..7c0522ff9 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java @@ -118,6 +118,9 @@ public class JpaPdpStatisticsTest { assertEquals(pdpStat.getPolicyDeployCount(), jpaPdpStat.getPolicyDeployCount()); assertEquals(pdpStat.getPolicyDeploySuccessCount(), jpaPdpStat.getPolicyDeploySuccessCount()); assertEquals(pdpStat.getPolicyDeployFailCount(), jpaPdpStat.getPolicyDeployFailCount()); + assertEquals(pdpStat.getPolicyUndeployCount(), jpaPdpStat.getPolicyUndeployCount()); + assertEquals(pdpStat.getPolicyUndeploySuccessCount(), jpaPdpStat.getPolicyUndeploySuccessCount()); + assertEquals(pdpStat.getPolicyUndeployFailCount(), jpaPdpStat.getPolicyUndeployFailCount()); assertEquals(pdpStat.getPolicyExecutedCount(), jpaPdpStat.getPolicyExecutedCount()); assertEquals(pdpStat.getPolicyExecutedSuccessCount(), jpaPdpStat.getPolicyExecutedSuccessCount()); assertEquals(pdpStat.getPolicyExecutedFailCount(), jpaPdpStat.getPolicyExecutedFailCount()); @@ -133,6 +136,9 @@ public class JpaPdpStatisticsTest { pdpStat.setPolicyDeployCount(3); pdpStat.setPolicyDeploySuccessCount(1); pdpStat.setPolicyDeployFailCount(2); + pdpStat.setPolicyUndeployCount(5); + pdpStat.setPolicyUndeploySuccessCount(2); + pdpStat.setPolicyUndeployFailCount(3); pdpStat.setPolicyExecutedCount(9); pdpStat.setPolicyExecutedSuccessCount(4); pdpStat.setPolicyExecutedFailCount(5); |