Add junit test for empty statistics filter 27/122927/2
authorJim Hahn <jrh3@att.com>
Wed, 28 Jul 2021 13:48:00 +0000 (09:48 -0400)
committerJim Hahn <jrh3@att.com>
Wed, 28 Jul 2021 14:19:25 +0000 (10:19 -0400)
Also removed the version field from the filter, as it is not applicable
to the PDP instance name.

Issue-ID: POLICY-3511
Change-Id: I17e8d2d6646a27736a827b9e9e17881d6b0a3795
Signed-off-by: Jim Hahn <jrh3@att.com>
models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParameters.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java

index 775c154..991e823 100644 (file)
@@ -30,8 +30,9 @@ import org.onap.policy.models.dao.PfFilterParametersIntfc;
 @Getter
 @Builder
 public class PdpFilterParameters implements PfFilterParametersIntfc {
+    // PDP instance ID
     private String name;
-    private String version;
+
     private Instant startTime;
     private Instant endTime;
 
@@ -63,4 +64,10 @@ public class PdpFilterParameters implements PfFilterParametersIntfc {
             return filterMap;
         }
     }
+
+    @Override
+    public String getVersion() {
+        // version is not used
+        return null;
+    }
 }
index 57f3643..90b85b5 100644 (file)
@@ -195,6 +195,11 @@ public class PdpStatisticsProviderTest {
 
         List<PdpStatistics> getPdpStatisticsList;
 
+        // empty filter - should return everything
+        getPdpStatisticsList = new PdpStatisticsProvider().getFilteredPdpStatistics(pfDao, PdpFilterParameters
+                        .builder().build());
+        verifyEquals(getPdpStatisticsList, List.of(pdpStatistics11, pdpStatistics12, pdpStatistics22, pdpStatistics31));
+
         // match on name - returns multiple records
         getPdpStatisticsList = new PdpStatisticsProvider().getFilteredPdpStatistics(pfDao, PdpFilterParameters
                         .builder().name(NAME).group(GROUP).startTime(TIMESTAMP1).endTime(TIMESTAMP2).build());