PDP Group support

Add support to push all policies to pdp group + log

Issue-ID: CLAMP-303
Change-Id: Ie53b1dfd11ef8db9c2b5ccca0511e6f6343fb70a
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
index 0e03e1b..dcad1a5 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -29,15 +29,18 @@
 import com.google.gson.Gson;
 import com.google.gson.JsonObject;
 
+import java.io.IOException;
 import java.util.HashSet;
 import java.util.Random;
 
 import org.junit.Test;
 import org.onap.clamp.clds.util.JsonUtils;
+import org.onap.clamp.clds.util.ResourceFileUtil;
 import org.onap.clamp.loop.log.LogType;
 import org.onap.clamp.loop.log.LoopLog;
 import org.onap.clamp.policy.microservice.MicroServicePolicy;
 import org.onap.clamp.policy.operational.OperationalPolicy;
+import org.skyscreamer.jsonassert.JSONAssert;
 
 public class LoopToJsonTest {
 
@@ -74,10 +77,11 @@
     }
 
     @Test
-    public void LoopGsonTest() {
+    public void LoopGsonTest() throws IOException {
         Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
             "123456789", "https://dcaetest.org", "UUID-blueprint");
-        OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest");
+        OperationalPolicy opPolicy = this.getOperationalPolicy(
+            ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
         loopTest.addOperationalPolicy(opPolicy);
         MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "",
             "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
@@ -103,4 +107,20 @@
         assertThat((LoopLog) loopTestDeserialized.getLoopLogs().toArray()[0]).isEqualToIgnoringGivenFields(loopLog,
             "loop");
     }
+
+    @Test
+    public void createPoliciesPayloadPdpGroupTest() throws IOException {
+        Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
+            "123456789", "https://dcaetest.org", "UUID-blueprint");
+        OperationalPolicy opPolicy = this.getOperationalPolicy(
+            ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
+        loopTest.addOperationalPolicy(opPolicy);
+        MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "",
+            "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
+            "{\"param1\":\"value1\"}", true);
+        loopTest.addMicroServicePolicy(microServicePolicy);
+
+        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json"),
+            loopTest.createPoliciesPayloadPdpGroup(), false);
+    }
 }
diff --git a/src/test/resources/tosca/pdp-group-policy-payload.json b/src/test/resources/tosca/pdp-group-policy-payload.json
new file mode 100644
index 0000000..bf941e5
--- /dev/null
+++ b/src/test/resources/tosca/pdp-group-policy-payload.json
@@ -0,0 +1,16 @@
+{
+  "policies": [
+    {
+      "policy-id": "GuardOpPolicyTest"
+    },
+    {
+      "policy-id": "guard2"
+    },
+    {
+      "policy-id": "guard1"
+    },
+    {
+      "policy-id": "configPolicyTest"
+    }
+  ]
+}
\ No newline at end of file