summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2021-08-03 18:03:10 -0400
committerRam Krishna Verma <ram_krishna.verma@bell.ca>2021-08-03 18:03:16 -0400
commit4861d87bfd949eae259f069c762e2ea24d058eb6 (patch)
tree8a84be21b7adc4bbdf698bfb09f05368a00d2248 /main
parent5636d8592b4c2b2190928ab7907463b099d55a7b (diff)
Update query params in audit api's
Updating query params in audit api's to keep them in sync with statistics api's. Issue-ID: POLICY-3527 Change-Id: I096436930450c263835ff8852edd40655de4fb0d Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PolicyAuditControllerV1.java64
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/e2e/PolicyAuditTest.java6
2 files changed, 35 insertions, 35 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PolicyAuditControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/PolicyAuditControllerV1.java
index ccbc9468..a76afc2b 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PolicyAuditControllerV1.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PolicyAuditControllerV1.java
@@ -59,8 +59,8 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
*
* @param requestId request ID used in ONAP logging
* @param recordCount number of records to fetch
- * @param fromDate the starting date for the query in epoch timestamp
- * @param toDate the ending date for the query in epoch timestamp
+ * @param startTime the starting time for the query in epoch timestamp
+ * @param endTime the ending time for the query in epoch timestamp
* @return a response
*/
// @formatter:off
@@ -99,16 +99,16 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) final UUID requestId,
@ApiParam(value = "Record count between 1-100",
required = false) @QueryParam("recordCount") final int recordCount,
- @ApiParam(value = "From date in epoch timestamp",
- required = false) @QueryParam("fromDate") final Long fromDate,
- @ApiParam(value = "To date in epoch timestamp",
- required = false) @QueryParam("toDate") final Long toDate) {
+ @ApiParam(value = "Start time in epoch timestamp",
+ required = false) @QueryParam("startTime") final Long startTime,
+ @ApiParam(value = "End time in epoch timestamp",
+ required = false) @QueryParam("endTime") final Long endTime) {
try {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(provider.getAuditRecords(AuditFilter.builder().recordNum(recordCount)
- .fromDate(convertEpochtoInstant(fromDate))
- .toDate(convertEpochtoInstant(toDate)).build()))
+ .fromDate(convertEpochtoInstant(startTime))
+ .toDate(convertEpochtoInstant(endTime)).build()))
.build();
} catch (PfModelException | PfModelRuntimeException exp) {
@@ -124,8 +124,8 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
*
* @param requestId request ID used in ONAP logging
* @param recordCount number of records to fetch
- * @param fromDate the starting date for the query in epoch timestamp
- * @param toDate the ending date for the query in epoch timestamp
+ * @param startTime the starting time for the query in epoch timestamp
+ * @param endTime the ending time for the query in epoch timestamp
* @param pdpGroupName the pdp group name for the query
* @return a response
*/
@@ -165,18 +165,18 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) final UUID requestId,
@ApiParam(value = "Record count between 1-100",
required = false) @QueryParam("recordCount") final int recordCount,
- @ApiParam(value = "From date in epoch timestamp",
- required = false) @QueryParam("fromDate") final Long fromDate,
- @ApiParam(value = "To date in epoch timestamp",
- required = false) @QueryParam("toDate") final Long toDate,
+ @ApiParam(value = "Start time in epoch timestamp",
+ required = false) @QueryParam("startTime") final Long startTime,
+ @ApiParam(value = "End time in epoch timestamp",
+ required = false) @QueryParam("endTime") final Long endTime,
@ApiParam(value = "PDP Group Name",
required = true) @PathParam("pdpGroupName") String pdpGroupName) {
try {
return makeOkOrNotFoundResponse(requestId,
provider.getAuditRecords(AuditFilter.builder().recordNum(recordCount)
- .fromDate((convertEpochtoInstant(fromDate)))
- .toDate(convertEpochtoInstant(toDate)).pdpGroup(pdpGroupName).build()));
+ .fromDate((convertEpochtoInstant(startTime)))
+ .toDate(convertEpochtoInstant(endTime)).pdpGroup(pdpGroupName).build()));
} catch (PfModelException | PfModelRuntimeException exp) {
logger.warn(GET_AUDIT_RECORD_FAILED, exp);
@@ -191,8 +191,8 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
*
* @param requestId request ID used in ONAP logging
* @param recordCount number of records to fetch
- * @param fromDate the starting date for the query in epoch timestamp
- * @param toDate the ending date for the query in epoch timestamp
+ * @param startTime the starting time for the query in epoch timestamp
+ * @param endTime the ending time for the query in epoch timestamp
* @param pdpGroupName the pdp group name for the query
* @param policyName name of the Policy
* @param policyVersion version of the Policy
@@ -234,10 +234,10 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) final UUID requestId,
@ApiParam(value = "Record count between 1-100",
required = false) @QueryParam("recordCount") final int recordCount,
- @ApiParam(value = "From date in epoch timestamp",
- required = false) @QueryParam("fromDate") final Long fromDate,
- @ApiParam(value = "To date in epoch timestamp",
- required = false) @QueryParam("toDate") final Long toDate,
+ @ApiParam(value = "Start time in epoch timestamp",
+ required = false) @QueryParam("startTime") final Long startTime,
+ @ApiParam(value = "End time in epoch timestamp",
+ required = false) @QueryParam("endTime") final Long endTime,
@ApiParam(value = "PDP Group Name", required = true) @PathParam("pdpGroupName") String pdpGroupName,
@ApiParam(value = "Policy Name", required = true) @PathParam("policyName") String policyName,
@ApiParam(value = "Policy Version",
@@ -246,8 +246,8 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
try {
return makeOkOrNotFoundResponse(requestId,
provider.getAuditRecords(AuditFilter.builder().recordNum(recordCount)
- .fromDate(convertEpochtoInstant(fromDate))
- .toDate(convertEpochtoInstant(toDate)).pdpGroup(pdpGroupName)
+ .fromDate(convertEpochtoInstant(startTime))
+ .toDate(convertEpochtoInstant(endTime)).pdpGroup(pdpGroupName)
.name(policyName).version(policyVersion).build()));
} catch (PfModelException | PfModelRuntimeException exp) {
@@ -263,8 +263,8 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
*
* @param requestId request ID used in ONAP logging
* @param recordCount number of records to fetch
- * @param fromDate the starting date for the query in epoch timestamp
- * @param toDate the ending date for the query in epoch timestamp
+ * @param startTime the starting time for the query in epoch timestamp
+ * @param endTime the ending time for the query in epoch timestamp
* @param policyName name of the Policy
* @param policyVersion version of the Policy
* @return a response
@@ -305,18 +305,18 @@ public class PolicyAuditControllerV1 extends PapRestControllerV1 {
@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) final UUID requestId,
@ApiParam(value = "Record count between 1-100",
required = false) @QueryParam("recordCount") final int recordCount,
- @ApiParam(value = "From date in epoch timestamp",
- required = false) @QueryParam("fromDate") final Long fromDate,
- @ApiParam(value = "To date in epoch timestamp",
- required = false) @QueryParam("toDate") final Long toDate,
+ @ApiParam(value = "Start time in epoch timestamp",
+ required = false) @QueryParam("startTime") final Long startTime,
+ @ApiParam(value = "End time in epoch timestamp",
+ required = false) @QueryParam("endTime") final Long endTime,
@ApiParam(value = "Policy Name", required = true) @PathParam("policyName") String policyName,
@ApiParam(value = "Policy Version",
required = true) @PathParam("policyVersion") String policyVersion) {
try {
return makeOkOrNotFoundResponse(requestId, provider.getAuditRecords(AuditFilter.builder()
- .recordNum(recordCount).fromDate(convertEpochtoInstant(fromDate))
- .toDate(convertEpochtoInstant(toDate)).name(policyName).version(policyVersion).build()));
+ .recordNum(recordCount).fromDate(convertEpochtoInstant(startTime))
+ .toDate(convertEpochtoInstant(endTime)).name(policyName).version(policyVersion).build()));
} catch (PfModelException | PfModelRuntimeException exp) {
logger.warn(GET_AUDIT_RECORD_FAILED, exp);
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PolicyAuditTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PolicyAuditTest.java
index e1211f34..d010f1db 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PolicyAuditTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PolicyAuditTest.java
@@ -47,9 +47,9 @@ public class PolicyAuditTest extends End2EndBase {
private static final String DEFAULT_USER = "TEST";
private static final String POLICY_AUDIT_ENDPOINT = "policies/audit";
private static final String URI_SEPERATOR = "/";
- private static final String QUERY_PARAMS_INVALID = "?recordCount=5&fromDate=2021-07-25T01:25:15";
- private static final String QUERY_PARAMS_CORRECT = "?recordCount=5&fromDate=1627219515&toDate=1627478715";
- private static final String QUERY_PARAMS_INCORRECT = "?recordCount=5&fromDate=1627478715&toDate=1627565115";
+ private static final String QUERY_PARAMS_INVALID = "?recordCount=5&startTime=2021-07-25T01:25:15";
+ private static final String QUERY_PARAMS_CORRECT = "?recordCount=5&startTime=1627219515&endTime=1627478715";
+ private static final String QUERY_PARAMS_INCORRECT = "?recordCount=5&startTime=1627478715&endTime=1627565115";
@Override
@Before