summaryrefslogtreecommitdiffstats
path: root/model/engine-model/src
diff options
context:
space:
mode:
Diffstat (limited to 'model/engine-model/src')
-rw-r--r--model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java10
-rw-r--r--model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java4
2 files changed, 7 insertions, 7 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 b7593e751..b35492356 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
@@ -530,16 +530,14 @@ public class AxEngineStats extends AxConcept {
if (lastExecutionTime != other.lastExecutionTime) {
return (int) (lastExecutionTime - other.lastExecutionTime);
}
- if (averageExecutionTime != other.averageExecutionTime) {
- return (int) (averageExecutionTime - other.averageExecutionTime);
+ final int result = Double.compare(averageExecutionTime, other.averageExecutionTime);
+ if (result != 0) {
+ return result;
}
if (upTime != other.upTime) {
return (int) (upTime - other.upTime);
}
- if (getLastStart() != other.getLastStart()) {
- return (int) (getLastStart() - other.getLastStart());
- }
- return 0;
+ return Long.compare(lastStart, other.lastStart);
}
}
diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java
index f5fdcbb1f..2d20964f5 100644
--- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java
+++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java
@@ -104,7 +104,6 @@ public class TestEngineStats {
}
stats.executionExit();
final double avExecutionTime = stats.getAverageExecutionTime();
- System.err.println(avExecutionTime);
assertTrue(avExecutionTime >= 2.0 && avExecutionTime < 3.0);
stats.engineStop();
@@ -179,6 +178,8 @@ public class TestEngineStats {
assertTrue(stats.equals(new AxEngineStats(statsKey)));
assertEquals(0, stats.compareTo(new AxEngineStats(statsKey)));
+ assertEquals(-1, stats.compareTo(new AxEngineStats(statsKey, 0, 0, 0, 0.0, 0, 1)));
+
stats.engineStart();
assertFalse(stats.equals(new AxEngineStats(statsKey)));
final AxEngineStats newStats = new AxEngineStats(statsKey);
@@ -190,4 +191,5 @@ public class TestEngineStats {
assertTrue(stats.equals(new AxEngineStats(statsKey)));
assertEquals(0, stats.compareTo(new AxEngineStats(statsKey)));
}
+
}