Create submit route

Create required components for Submit route in camel + unit tests +
Policy payload generation + emulator feature for new policy api

Issue-ID: CLAMP-303
Change-Id: If9033cfa3f4e346e2cbd7f891baff1f2c04a40a2
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
index 93d7166..e86fb27 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
@@ -163,7 +163,7 @@
 
     @Test
     public void fallBackToOneMicroServiceTCATest() {
-        MicroService tcaMS = new MicroService(BlueprintParser.TCA, "onap.policy.monitoring.cdap.tca.hi.lo.ap", "", "",
+        MicroService tcaMS = new MicroService(BlueprintParser.TCA, "onap.policy.monitoring.cdap.tca.hi.lo.app", "", "",
             "");
 
         List<MicroService> expected = Collections.singletonList(tcaMS);
@@ -174,8 +174,8 @@
 
     @Test
     public void fallBackToOneMicroServiceHolmesTest() {
-        MicroService holmesMS = new MicroService(BlueprintParser.HOLMES, "onap.policy.monitoring.cdap.tca.hi.lo.ap", "",
-            "", "");
+        MicroService holmesMS = new MicroService(BlueprintParser.HOLMES, "onap.policy.monitoring.cdap.tca.hi.lo.app",
+            "", "", "");
 
         List<MicroService> expected = Collections.singletonList(holmesMS);
         List<MicroService> actual = new BlueprintParser()
diff --git a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
index 1f57422..739708c 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
@@ -29,7 +29,7 @@
 import com.google.gson.JsonObject;
 
 import java.io.IOException;
-import java.util.List;
+import java.util.Map;
 
 import org.junit.Test;
 import org.onap.clamp.clds.util.ResourceFileUtil;
@@ -53,12 +53,12 @@
             ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
         OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig);
 
-        List<String> guardsList = policy.createGuardPolicyPayloads();
+        Map<String, String> guardsList = policy.createGuardPolicyPayloads();
 
         JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/guard1-policy-payload.json"),
-            guardsList.get(0), false);
+            guardsList.get("guard1"), false);
 
         JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/guard2-policy-payload.json"),
-            guardsList.get(1), false);
+            guardsList.get("guard2"), false);
     }
 }
diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca.yaml
index b165907..b2bf8bb 100644
--- a/src/test/resources/example/sdc/blueprint-dcae/tca.yaml
+++ b/src/test/resources/example/sdc/blueprint-dcae/tca.yaml
@@ -17,7 +17,7 @@
     properties:
       policy_id: 
         get_input: policy_id
-        policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.ap
+        policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.app
   cdap_host_host:
     type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure
     properties:
diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml
index 5590136..fb04257 100644
--- a/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml
+++ b/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml
@@ -166,5 +166,5 @@
     properties:
       policy_id:
            get_input: policy_id
-           policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.ap
+           policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.app
 
diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml
index b165907..b2bf8bb 100644
--- a/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml
+++ b/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml
@@ -17,7 +17,7 @@
     properties:
       policy_id: 
         get_input: policy_id
-        policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.ap
+        policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.app
   cdap_host_host:
     type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure
     properties:
diff --git a/src/test/resources/http-cache/third_party_proxy.py b/src/test/resources/http-cache/third_party_proxy.py
index 30f5107..f19aa0d 100755
--- a/src/test/resources/http-cache/third_party_proxy.py
+++ b/src/test/resources/http-cache/third_party_proxy.py
@@ -171,7 +171,7 @@
             with open(cached_file_content, 'w') as f:
                 f.write(jsonGenerated)
         return True
-     elif (self.path.startswith("/pdp/api/") and http_type == "PUT" or http_type == "DELETE") or (self.path.startswith("/pdp/api/policyEngineImport") and http_type == "POST"):
+     elif (self.path.startswith("/pdp/api/") and (http_type == "PUT" or http_type == "DELETE")) or (self.path.startswith("/pdp/api/policyEngineImport") and http_type == "POST"):
         print "self.path start with /pdp/api/, copying body to response ..."
         if not os.path.exists(cached_file_folder):
             os.makedirs(cached_file_folder, 0777)
@@ -180,6 +180,25 @@
         with open(cached_file_content, 'w+') as f:
             f.write(self.data_string)
         return True
+     elif self.path.startswith("/policy/api/v1/policyTypes/") and http_type == "POST":
+        print "self.path start with POST new policy API /pdp/api/, copying body to response ..."
+        if not os.path.exists(cached_file_folder):
+            os.makedirs(cached_file_folder, 0777)
+        with open(cached_file_header, 'w+') as f:
+            f.write("{\"Content-Length\": \"" + str(len(self.data_string)) + "\", \"Content-Type\": \""+str(self.headers['Content-Type'])+"\"}")
+        with open(cached_file_content, 'w+') as f:
+            f.write(self.data_string)
+        return True
+     elif self.path.startswith("/policy/api/v1/policyTypes/") and http_type == "DELETE":
+        print "self.path start with DELETE new policy API /policy/api/v1/policyTypes/ ..."
+        if not os.path.exists(cached_file_folder):
+            os.makedirs(cached_file_folder, 0777)
+    
+        with open(cached_file_header, 'w+') as f:
+                f.write("{\"Content-Length\": \"" + str(len("")) + "\", \"Content-Type\": \""+str("")+"\"}")
+        with open(cached_file_content, 'w+') as f:
+                f.write(self.data_string)
+        return True
      else:
         return False
 
@@ -337,7 +356,10 @@
         cached_file_header=""
         print("\n\n\nGot a DELETE for %s " % self.path)
         self.check_credentials()
-        self.data_string = self.rfile.read(int(self.headers['Content-Length']))
+        if self.headers.get('Content-Length') is not None:
+            self.data_string = self.rfile.read(int(self.headers['Content-Length']))
+        else:
+            self.data_string = "empty generated"
         print("self.headers:\n %s" % self.headers)
 
         is_special = self._execute_content_generated_cases("DELETE")