Use distribution json for workflow install

Use distribution json for workflow install

Change-Id: I2eec3700d0ba92794b6ca11bd43683d91fb480ee
Issue-ID: SO-1726
Signed-off-by: Kuleshov, Elena <evn@att.com>
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index ec53649..9fa2055 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -66,6 +66,7 @@
     db:
       spring:
         endpoint: "http://localhost:"
+  camundaURL: http://localhost:${wiremock.server.port}/        
   db:
     auth: Basic YnBlbDptc28tZGItMTUwNyE=
   site-name: siteName
diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn
new file mode 100644
index 0000000..f3a5c7c
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="customWorkflowtest1" name="TestBpmnFromSDC" isExecutable="true">
+    <bpmn2:extensionElements>
+      <camunda:inputOutput />
+    </bpmn2:extensionElements>
+    <bpmn2:startEvent id="StartEvent_0wtabee">
+      <bpmn2:outgoing>SequenceFlow_1v7ptqz</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:serviceTask id="Task_1kxbei4" name="VNFSetInMaintFlagActivity" implementation="activity:VNFSetInMaintFlagActivity" camunda:expression="${ExecuteActivity.execute(execution)}">
+      <bpmn2:extensionElements>
+        <camunda:inputOutput />
+      </bpmn2:extensionElements>
+      <bpmn2:incoming>SequenceFlow_1v7ptqz</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_16i7mid</bpmn2:outgoing>
+    </bpmn2:serviceTask>
+    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0tgyvzw">
+      <bpmn2:incoming>SequenceFlow_16i7mid</bpmn2:incoming>
+    </bpmn2:intermediateThrowEvent>
+    <bpmn2:sequenceFlow id="SequenceFlow_16i7mid" sourceRef="Task_1kxbei4" targetRef="IntermediateThrowEvent_0tgyvzw" />
+    <bpmn2:sequenceFlow id="SequenceFlow_1v7ptqz" sourceRef="StartEvent_0wtabee" targetRef="Task_1kxbei4" />
+  </bpmn2:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="customWorkflowtest1">
+      <bpmndi:BPMNShape id="StartEvent_0wtabee_di" bpmnElement="StartEvent_0wtabee">
+        <dc:Bounds x="256" y="134" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_1cgg6ym_di" bpmnElement="Task_1kxbei4" bioc:fill="white">
+        <dc:Bounds x="386" y="112" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0tgyvzw_di" bpmnElement="IntermediateThrowEvent_0tgyvzw">
+        <dc:Bounds x="536" y="134" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_16i7mid_di" bpmnElement="SequenceFlow_16i7mid">
+        <di:waypoint x="486" y="152" />
+        <di:waypoint x="536" y="152" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1v7ptqz_di" bpmnElement="SequenceFlow_1v7ptqz">
+        <di:waypoint x="292" y="152" />
+        <di:waypoint x="386" y="152" />
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn
new file mode 100644
index 0000000..11378cf
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="testwf2" name="TestWF2" isExecutable="true">
+    <bpmn2:extensionElements>
+      <camunda:inputOutput />
+    </bpmn2:extensionElements>
+    <bpmn2:endEvent id="EndEvent_1naezi3" />
+  </bpmn2:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf2">
+      <bpmndi:BPMNShape id="EndEvent_1naezi3_di" bpmnElement="EndEvent_1naezi3">
+        <dc:Bounds x="219" y="285" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn
new file mode 100644
index 0000000..4e21a47
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="testwf" name="TestWF" isExecutable="true">
+    <bpmn2:extensionElements>
+      <camunda:inputOutput />
+    </bpmn2:extensionElements>
+    <bpmn2:startEvent id="StartEvent_1loupvi" />
+  </bpmn2:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf">
+      <bpmndi:BPMNShape id="StartEvent_1loupvi_di" bpmnElement="StartEvent_1loupvi">
+        <dc:Bounds x="274" y="212" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn
new file mode 100644
index 0000000..e54d79a
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="testwf" name="TestWF" isExecutable="true">
+    <bpmn2:extensionElements>
+      <camunda:inputOutput />
+    </bpmn2:extensionElements>
+    <bpmn2:startEvent id="StartEvent_1loupvi" />
+    <bpmn2:startEvent id="StartEvent_0z42dnp" />
+  </bpmn2:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf">
+      <bpmndi:BPMNShape id="StartEvent_1loupvi_di" bpmnElement="StartEvent_1loupvi">
+        <dc:Bounds x="274" y="212" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="StartEvent_0z42dnp_di" bpmnElement="StartEvent_0z42dnp">
+        <dc:Bounds x="454" y="364" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn
new file mode 100644
index 0000000..11378cf
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="testwf2" name="TestWF2" isExecutable="true">
+    <bpmn2:extensionElements>
+      <camunda:inputOutput />
+    </bpmn2:extensionElements>
+    <bpmn2:endEvent id="EndEvent_1naezi3" />
+  </bpmn2:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf2">
+      <bpmndi:BPMNShape id="EndEvent_1naezi3_di" bpmnElement="EndEvent_1naezi3">
+        <dc:Bounds x="219" y="285" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar
new file mode 100644
index 0000000..fe99318
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json
new file mode 100644
index 0000000..9f49be5
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json
@@ -0,0 +1,76 @@
+{
+  "distributionID": "48cc0f04-1d42-4fb4-a5ab-9fa62f8d64c1",
+  "serviceName": "TestParentService",
+  "serviceVersion": "1.0",
+  "serviceUUID": "2f55da47-c58a-453e-909f-172c94765fba",
+  "serviceDescription": "TestParentService",
+  "serviceInvariantUUID": "13b817ae-6388-40cf-9261-1619b607f1de",
+  "resources": [
+    {
+      "resourceInstanceName": "TestVF 0",
+      "resourceName": "TestVF",
+      "resourceVersion": "1.0",
+      "resoucreType": "VF",
+      "resourceUUID": "5185253e-4bef-4eb4-bbf9-8c328c787ebd",
+      "resourceInvariantUUID": "ea8264db-3e24-4324-87cc-12c6903ed43d",
+      "resourceCustomizationUUID": "a959a3cb-4988-435c-9cb7-5a40ef2ef2ac",
+      "category": "Allotted Resource",
+      "subcategory": "Contrail Route",
+      "artifacts": [
+        {
+          "artifactName": "TestWF2-1_0.bpmn",
+          "artifactType": "WORKFLOW",
+          "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn",
+          "artifactChecksum": "ZjUzNjg1NDMyMTc4MWJmZjFlNDcyOGQ0Zjc1YWQwYzQ\u003d",
+          "artifactDescription": "Workflow Artifact Description",
+          "artifactTimeout": 120,
+          "artifactUUID": "a90f8eaa-7c20-422f-8c81-aacbca6fb9e7",
+          "artifactVersion": "1"
+        },
+        {
+          "artifactName": "TestWF-1_0.bpmn",
+          "artifactType": "WORKFLOW",
+          "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn",
+          "artifactChecksum": "YzA4NDY3M2E3Njk3Y2FjMmViZjRlODIzNTY1NDY3MDY\u003d",
+          "artifactDescription": "Workflow Artifact Description",
+          "artifactTimeout": 120,
+          "artifactUUID": "f27066a1-c3a7-4672-b02e-1251b74b7b71",
+          "artifactVersion": "1"
+        },
+        {
+          "artifactName": "TestWF-2_0.bpmn",
+          "artifactType": "WORKFLOW",
+          "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn",
+          "artifactChecksum": "MTE0MDA2ZGNjZmY3YWEyNzNlNjUwZDQ2OGU4YTM5ZjU\u003d",
+          "artifactDescription": "Workflow Artifact Description",
+          "artifactTimeout": 120,
+          "artifactUUID": "f51d2203-d1f5-43f1-9492-e59d12facb8f",
+          "artifactVersion": "1"
+        }
+      ]
+    }
+  ],
+  "serviceArtifacts": [
+    {
+      "artifactName": "service-Testparentservice-template.yml",
+      "artifactType": "TOSCA_TEMPLATE",
+      "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/artifacts/service-Testparentservice-template.yml",
+      "artifactChecksum": "YWZlYWMwMjNkODBlYTI2MzZlNjg3YzEzODZiNzNkNTg\u003d",
+      "artifactDescription": "TOSCA representation of the asset",
+      "artifactTimeout": 0,
+      "artifactUUID": "8ec96c3f-d527-48bd-8dc5-1e7682bda676",
+      "artifactVersion": "1"
+    },
+    {
+      "artifactName": "service-Testparentservice-csar.csar",
+      "artifactType": "TOSCA_CSAR",
+      "artifactURL": "service-Testparentservice-csar.csar",
+      "artifactChecksum": "MTc4OWU0MGRhOTE4OGZiM2JiMjM3YmI3NzI2YWZjNjI\u003d",
+      "artifactDescription": "TOSCA definition package of the asset",
+      "artifactTimeout": 0,
+      "artifactUUID": "8dac522d-8e00-4794-819e-88e559ebc170",
+      "artifactVersion": "1"
+    }
+  ],
+  "workloadContext": "Production"
+}
\ No newline at end of file