diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2022-02-10 14:35:12 -0500 |
---|---|---|
committer | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2022-02-10 14:35:17 -0500 |
commit | f5fda6421dad76d369774c59e89a448a6c4e8c07 (patch) | |
tree | d0636eee32fb0fcd383ada1488ae6cba2bcefac1 /main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java | |
parent | 873803eca00830dc3ecb61e610d90710f64a8242 (diff) |
Add yaml support to pap api's
Adding yaml support to pap rest api's.
Along with related unit tests.
Issue-ID: POLICY-3864
Change-Id: I43bdbbd4151bcae5dcf4752a9385b115efa947d3
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
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()); |