diff options
Diffstat (limited to 'model/engine-model')
2 files changed, 16 insertions, 19 deletions
diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java index d01da460b..db6209af0 100644 --- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java +++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java @@ -35,6 +35,8 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import lombok.Getter; + import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; @@ -43,13 +45,11 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; import org.onap.policy.common.utils.validation.Assertions; -import lombok.Getter; /** - * This class is a java bean that is used to record statistics on Apex engines as they execute. - * Statistics on the number of events, the amount of time taken to execute the last policy, the - * average policy execution time, the up time of the engine, and the time stamp of the last engine - * start are recorded. + * This class is a java bean that is used to record statistics on Apex engines as they execute. Statistics on the number + * of events, the amount of time taken to execute the last policy, the average policy execution time, the up time of the + * engine, and the time stamp of the last engine start are recorded. */ @Entity @@ -58,7 +58,7 @@ import lombok.Getter; @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexEngineStats", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxEngineStats", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = {"key", "timeStamp", - "eventCount", "lastExecutionTime", "averageExecutionTime", "upTime", "lastStart"}) + "eventCount", "lastExecutionTime", "averageExecutionTime", "upTime", "lastStart"}) public class AxEngineStats extends AxConcept { private static final long serialVersionUID = -6981129081962785368L; private static final int HASH_CODE_PRIME = 32; @@ -96,8 +96,7 @@ public class AxEngineStats extends AxConcept { private long lastStart; /** - * The Default Constructor creates an engine statistics instance with a null key and with all - * values cleared. + * The Default Constructor creates an engine statistics instance with a null key and with all values cleared. */ public AxEngineStats() { this(new AxReferenceKey()); @@ -120,8 +119,7 @@ public class AxEngineStats extends AxConcept { } /** - * The Keyed Constructor creates an engine statistics instance with the given key and all values - * cleared. + * The Keyed Constructor creates an engine statistics instance with the given key and all values cleared. * * @param key the key */ @@ -314,8 +312,7 @@ public class AxEngineStats extends AxConcept { } /** - * Updates the statistics when called, used by the Apex engine when it starts executing a - * policy. + * Updates the statistics when called, used by the Apex engine when it starts executing a policy. * * @param eventkey the key of the event that is being executed */ @@ -330,8 +327,7 @@ public class AxEngineStats extends AxConcept { } /** - * Updates the statistics when called, used by the Apex engine when it completes executing a - * policy. + * Updates the statistics when called, used by the Apex engine when it completes executing a policy. */ public synchronized void executionExit() { final long now = System.currentTimeMillis(); diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java index c6fde1cdf..b35d40570 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; /** - * Test engine statistics. + * Test the engine statistics. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class EngineStatsTest { @@ -61,7 +62,7 @@ public class EngineStatsTest { assertEquals("EngineKey:0.0.1:NULL:EngineStats", stats.getKeys().get(0).getId()); stats.setAverageExecutionTime(123.45); - assertEquals(new Double(123.45), new Double(stats.getAverageExecutionTime())); + assertEquals(Double.valueOf(123.45), Double.valueOf(stats.getAverageExecutionTime())); stats.setEventCount(987); assertEquals(987, stats.getEventCount()); @@ -100,7 +101,7 @@ public class EngineStatsTest { stats.engineStart(); stats.setEventCount(4); stats.executionEnter(new AxArtifactKey()); - + synchronized (WAIT_LOCK) { try { WAIT_LOCK.wait(10); @@ -141,7 +142,7 @@ public class EngineStatsTest { assertTrue(stats.equals(stats)); assertTrue(stats.equals(clonedStats)); assertFalse(stats.equals(null)); - assertFalse(stats.equals((Object)"Hello")); + assertFalse(stats.equals("Hello")); assertFalse(stats.equals(new AxEngineStats(new AxReferenceKey()))); assertEquals(0, stats.compareTo(stats)); |