aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java33
1 files changed, 12 insertions, 21 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java
index aa2c59ea..75aafba6 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP PAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -71,43 +71,28 @@ public class StatisticsTest extends End2EndBase {
@Test
public void testDb() throws Exception {
- setupEnv();
- Invocation.Builder invocationBuilder = sendRequest("pdps/statistics");
- Response testResponse = invocationBuilder.get();
- verifyResponse(testResponse);
+ verifyResponse("pdps/statistics");
}
@Test
public void testDbWithGroup() throws Exception {
- setupEnv();
- Invocation.Builder invocationBuilder = sendRequest("pdps/statistics/defaultGroup");
- Response testResponse = invocationBuilder.get();
- verifyResponse(testResponse);
+ verifyResponse("pdps/statistics/defaultGroup");
}
@Test
public void testDbWithSubGroup() throws Exception {
- setupEnv();
- Invocation.Builder invocationBuilder = sendRequest("pdps/statistics/defaultGroup/apex");
- Response testResponse = invocationBuilder.get();
- verifyResponse(testResponse);
+ verifyResponse("pdps/statistics/defaultGroup/apex");
}
@Test
public void testDbWithPdp() throws Exception {
- setupEnv();
- Invocation.Builder invocationBuilder = sendRequest("pdps/statistics/defaultGroup/apex/pdp1");
- Response testResponse = invocationBuilder.get();
- verifyResponse(testResponse);
+ verifyResponse("pdps/statistics/defaultGroup/apex/pdp1");
}
@Test
public void testDbWithPdpLatest() throws Exception {
- setupEnv();
- Invocation.Builder invocationBuilder = sendRequest("pdps/statistics/defaultGroup/apex/pdp1?recordCount=5");
- Response testResponse = invocationBuilder.get();
- verifyResponse(testResponse);
+ verifyResponse("pdps/statistics/defaultGroup/apex/pdp1?recordCount=5");
}
private void updateDistributionStatistics() {
@@ -146,6 +131,12 @@ public class StatisticsTest extends End2EndBase {
}
}
+ private void verifyResponse(String endpoint) throws Exception {
+ setupEnv();
+ Invocation.Builder invocationBuilder = sendRequest(endpoint);
+ verifyResponse(invocationBuilder.get());
+ }
+
private void verifyResponse(Response testResponse) {
assertEquals(Response.Status.OK.getStatusCode(), testResponse.getStatus());
Map<String, Map<String, List<PdpStatistics>>> map =