From e47a29578a2287a96ae13d1867925feab53a6526 Mon Sep 17 00:00:00 2001 From: sebdet Date: Fri, 3 Apr 2020 11:54:33 +0200 Subject: Fix the pdp payload THe pdp payload was not good in some particular cases, when the pdp group was containing different subgroups Issue-ID: CLAMP-813 Signed-off-by: sebdet Change-Id: Ie3e53f42827ed90689ed83b4945151cb13f38c9c --- src/test/java/org/onap/clamp/loop/PolicyComponentTest.java | 6 ++++++ src/test/resources/tosca/pdp-group-policy-payload.json | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'src/test') diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java index 1c9b1018..432de606 100644 --- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java +++ b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java @@ -263,6 +263,10 @@ public class PolicyComponentTest { new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null, "pdpGroup1", "pdpSubgroup1"); loopTest.addMicroServicePolicy(microServicePolicy); + MicroServicePolicy microServicePolicy2 = new MicroServicePolicy("configPolicyTest2", policyModel1, true, + new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null, "pdpGroup2", "pdpSubgroup1"); + loopTest.addMicroServicePolicy(microServicePolicy2); + PolicyModel policyModel2 = new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0"); OperationalPolicy opPolicy = new OperationalPolicy("opPolicy", new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), @@ -280,5 +284,7 @@ public class PolicyComponentTest { String expectedRes = ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json"); assertThat(payload).isEqualTo(expectedRes); + + assertThat(PolicyComponent.listPolicyNamesPdpGroup(loopTest)).containsExactlyInAnyOrder("opPolicy","configPolicyTest","configPolicyTest2"); } } diff --git a/src/test/resources/tosca/pdp-group-policy-payload.json b/src/test/resources/tosca/pdp-group-policy-payload.json index 4ea746de..c81440e7 100644 --- a/src/test/resources/tosca/pdp-group-policy-payload.json +++ b/src/test/resources/tosca/pdp-group-policy-payload.json @@ -27,6 +27,16 @@ "version": "1.0.0" } ] + }, + { + "pdpType": "pdpSubgroup1", + "action": "POST", + "policies": [ + { + "name": "configPolicyTest2", + "version": "1.0.0" + } + ] } ] } -- cgit 1.2.3-korg