aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java
index 3f763863..650dd41a 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java
@@ -77,18 +77,30 @@ public class PdpGroupCreateOrUpdateTest extends End2EndBase {
}
@Test
- public void testCreateGroups() throws Exception {
+ public void testCreateGroupsJson() throws Exception {
+ createPdpGroups("createGroups.json", MediaType.APPLICATION_JSON);
+ }
+
+ @Test
+ public void testCreateGroupsYaml() throws Exception {
+
+ createPdpGroups("createGroups.yaml", "application/yaml");
+ }
+
+ private void createPdpGroups(String fileName, String mediaType) throws Exception, InterruptedException {
context.addPdp("pdpAA_1", CREATE_SUBGROUP);
context.addPdp("pdpAA_2", CREATE_SUBGROUP);
context.addPdp("pdpAB_1", "pdpTypeB");
context.startThreads();
- Invocation.Builder invocationBuilder = sendRequest(CREATEORUPDATE_GROUPS_ENDPOINT);
+ Invocation.Builder invocationBuilder = sendRequest(CREATEORUPDATE_GROUPS_ENDPOINT, mediaType);
- PdpGroups groups = loadJsonFile("createGroups.json", PdpGroups.class);
- Entity<PdpGroups> entity = Entity.entity(groups, MediaType.APPLICATION_JSON);
+ PdpGroups groups = (mediaType.equalsIgnoreCase(MediaType.APPLICATION_JSON)
+ ? loadJsonFile(fileName, PdpGroups.class)
+ : loadYamlFile(fileName, PdpGroups.class));
+ Entity<PdpGroups> entity = Entity.entity(groups, mediaType);
Response rawresp = invocationBuilder.post(entity);
PdpGroupUpdateResponse resp = rawresp.readEntity(PdpGroupUpdateResponse.class);
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());