diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java | 8 | ||||
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java index 27e3d7ac..93632659 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/StatisticsRestProvider.java @@ -31,6 +31,7 @@ import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.pdp.concepts.PdpStatistics; +import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters; import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.pap.main.PapConstants; import org.onap.policy.pap.main.PolicyModelsProviderFactoryWrapper; @@ -46,7 +47,6 @@ import org.slf4j.LoggerFactory; public class StatisticsRestProvider { private static final Logger LOGGER = LoggerFactory.getLogger(StatisticsRestProvider.class); private static final String GET_STATISTICS_ERR_MSG = "fetch database failed"; - private static final String DESC_ORDER = "DESC"; /** * Returns the current statistics of pap component. @@ -92,8 +92,10 @@ public class StatisticsRestProvider { if (groupName == null) { pdpStatisticsMap = generatePdpStatistics(databaseProvider.getPdpStatistics(pdpName, startTime)); } else { - pdpStatisticsMap = generatePdpStatistics(databaseProvider.getFilteredPdpStatistics(pdpName, groupName, - subType, startTime, endTime, DESC_ORDER, recordCount)); + pdpStatisticsMap = generatePdpStatistics(databaseProvider.getFilteredPdpStatistics( + PdpFilterParameters.builder().name(pdpName).group(groupName) + .subGroup(subType).startTime(startTime).endTime(endTime) + .recordNum(recordCount).build())); } } catch (final PfModelException exp) { String errorMessage = GET_STATISTICS_ERR_MSG + "groupName:" + groupName + "subType:" + subType + "pdpName:" diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java index 1ecea074..0f668bef 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java @@ -39,6 +39,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroups; import org.onap.policy.models.pdp.concepts.PdpPolicyStatus; import org.onap.policy.models.pdp.concepts.PdpStatistics; +import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters; import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.pap.main.PolicyModelsProviderFactoryWrapper; @@ -182,7 +183,8 @@ public class End2EndBase extends CommonPapRestServer { */ public static List<PdpStatistics> fetchPdpStatistics(final String instanceId, final String groupName, final String subGroupName) throws PfModelException { - return dbConn.getFilteredPdpStatistics(instanceId, groupName, subGroupName, null, null, null, 0); + return dbConn.getFilteredPdpStatistics( + PdpFilterParameters.builder().name(instanceId).group(groupName).subGroup(subGroupName).build()); } /** |