diff options
author | 2022-02-14 14:11:41 +0000 | |
---|---|---|
committer | 2022-02-14 14:11:41 +0000 | |
commit | b1f5a9439f285e16c055e50ce12c65a6623f21a0 (patch) | |
tree | e9f7d0e95c5583aa1229e9aa49ec0730e12880c8 /main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java | |
parent | 0fdbdd8200b8a16243ce96a2a039dbc3922d3171 (diff) | |
parent | f5fda6421dad76d369774c59e89a448a6c4e8c07 (diff) |
Merge "Add yaml support to pap api's"
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.java | 20 |
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()); |