Add Holmes to the Backend

Add support for Holmes boxes defined in GUI, Holmes model has been added
and also policy calls.

Change-Id: I2bbef0030b5174075792b459b7ced74aa2e8aad2
Issue-Id: CLAMP-27
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
diff --git a/src/test/java/org/onap/clamp/clds/transform/XslTransformerTest.java b/src/test/java/org/onap/clamp/clds/transform/XslTransformerTest.java
new file mode 100644
index 0000000..8ee60e7
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/transform/XslTransformerTest.java
@@ -0,0 +1,34 @@
+package org.onap.clamp.clds.transform;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import javax.xml.transform.TransformerException;
+
+import org.junit.Test;
+import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+public class XslTransformerTest {
+
+    /**
+     * This test validates the XSLT to convert BPMN xml to BPMN JSON.
+     * 
+     * @throws TransformerException
+     *             In case of issues
+     * @throws IOException
+     *             In case of issues
+     */
+    @Test
+    public void xslTransformTest() throws TransformerException, IOException {
+        XslTransformer xslTransformer = new XslTransformer();
+        xslTransformer.setXslResourceName("xsl/clds-bpmn-transformer.xsl");
+
+        String bpmnJson = xslTransformer
+                .doXslTransformToString(ResourceFileUtil.getResourceAsString("example/xsl-validation/modelBpmn.xml"));
+        assertNotNull(bpmnJson);
+        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("example/xsl-validation/modelBpmnForVerif.json"),
+                bpmnJson, true);
+    }
+}
diff --git a/src/test/resources/example/modelBpmn.xml b/src/test/resources/example/modelBpmn.xml
deleted file mode 100644
index d84f790..0000000
--- a/src/test/resources/example/modelBpmn.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-  ONAP CLAMP
-  ================================================================================
-  Copyright (C) 2017 AT&T Intellectual Property. All rights
-                              reserved.
-  ================================================================================
-  Licensed under the Apache License, Version 2.0 (the "License"); 
-  you may not use this file except in compliance with the License. 
-  You may obtain a copy of the License at
-  
-  http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing, software 
-  distributed under the License is distributed on an "AS IS" BASIS, 
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-  See the License for the specific language governing permissions and 
-  limitations under the License.
-  ============LICENSE_END============================================
-  ===================================================================
-  ECOMP is a trademark and service mark of AT&T Intellectual Property.
-  -->
-
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
-  <bpmn:process id="Process_1" isExecutable="false">
-    <bpmn:startEvent id="StartEvent_1">
-      <bpmn:outgoing>SequenceFlow_0ex3w2w</bpmn:outgoing>
-    </bpmn:startEvent>
-    <bpmn:collector id="Collector_">
-      <bpmn:incoming>SequenceFlow_0ex3w2w</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_185iyma</bpmn:outgoing>
-    </bpmn:collector>
-    <bpmn:stringMatch id="StringMatch_">
-      <bpmn:incoming>SequenceFlow_185iyma</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_092429t</bpmn:outgoing>
-    </bpmn:stringMatch>
-    <bpmn:policy id="Policy_">
-      <bpmn:incoming>SequenceFlow_092429t</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0hghw7g</bpmn:outgoing>
-    </bpmn:policy>
-    <bpmn:tCA id="TCA_">
-      <bpmn:incoming>SequenceFlow_08j3fsl</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0hghw7g</bpmn:outgoing>
-    </bpmn:tCA>
-    <bpmn:endEvent id="EndEvent_0lg612k">
-      <bpmn:incoming>SequenceFlow_0hghw7g</bpmn:incoming>
-    </bpmn:endEvent>
-    <bpmn:sequenceFlow id="SequenceFlow_0ex3w2w" sourceRef="StartEvent_1" targetRef="Collector_" />
-    <bpmn:sequenceFlow id="SequenceFlow_185iyma" sourceRef="Collector_" targetRef="StringMatch_" />
-    <bpmn:sequenceFlow id="SequenceFlow_092429t" sourceRef="StringMatch_" targetRef="Policy_" />
-    <bpmn:sequenceFlow id="SequenceFlow_0hghw7g" sourceRef="Policy_" targetRef="EndEvent_0lg612k" />
-  </bpmn:process>
-  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
-    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="60" y="25" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="33" y="61" width="90" height="20" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Collector__di" bpmnElement="Collector_">
-        <dc:Bounds x="169" y="140" width="120" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="StringMatch__di" bpmnElement="StringMatch_">
-        <dc:Bounds x="578" y="140" width="120" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Policy__di" bpmnElement="Policy_">
-        <dc:Bounds x="768" y="140" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_0lg612k_di" bpmnElement="EndEvent_0lg612k">
-        <dc:Bounds x="949" y="162" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="922" y="198" width="90" height="20" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ex3w2w_di" bpmnElement="SequenceFlow_0ex3w2w">
-        <di:waypoint xsi:type="dc:Point" x="96" y="43" />
-        <di:waypoint xsi:type="dc:Point" x="128" y="43" />
-        <di:waypoint xsi:type="dc:Point" x="128" y="180" />
-        <di:waypoint xsi:type="dc:Point" x="169" y="180" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="83" y="101.5" width="90" height="20" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_185iyma_di" bpmnElement="SequenceFlow_185iyma">
-        <di:waypoint xsi:type="dc:Point" x="500" y="180" />
-        <di:waypoint xsi:type="dc:Point" x="578" y="180" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="494" y="170" width="90" height="20" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_092429t_di" bpmnElement="SequenceFlow_092429t">
-        <di:waypoint xsi:type="dc:Point" x="698" y="180" />
-        <di:waypoint xsi:type="dc:Point" x="768" y="180" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="688" y="170" width="90" height="20" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0hghw7g_di" bpmnElement="SequenceFlow_0hghw7g">
-        <di:waypoint xsi:type="dc:Point" x="868" y="180" />
-        <di:waypoint xsi:type="dc:Point" x="907" y="180" />
-        <di:waypoint xsi:type="dc:Point" x="907" y="180" />
-        <di:waypoint xsi:type="dc:Point" x="949" y="180" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="862" y="170" width="90" height="20" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-    </bpmndi:BPMNPlane>
-  </bpmndi:BPMNDiagram>
-</bpmn:definitions>
diff --git a/src/test/resources/example/xsl-validation/modelBpmn.xml b/src/test/resources/example/xsl-validation/modelBpmn.xml
new file mode 100644
index 0000000..3021902
--- /dev/null
+++ b/src/test/resources/example/xsl-validation/modelBpmn.xml
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
+	xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+	xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
+	<bpmn:process id="Process_1" isExecutable="false">
+		<bpmn:startEvent id="StartEvent_1">
+			<bpmn:outgoing>SequenceFlow_1nvvr00</bpmn:outgoing>
+		</bpmn:startEvent>
+		<bpmn:stringMatch id="StringMatch_0tw2y4f">
+			<bpmn:incoming>SequenceFlow_0qf2552</bpmn:incoming>
+			<bpmn:outgoing>SequenceFlow_1a2oxpd</bpmn:outgoing>
+		</bpmn:stringMatch>
+		<bpmn:vesCollector id="VesCollector_1kxjxy6" name="AAAAA">
+			<bpmn:incoming>SequenceFlow_0jeu0gv</bpmn:incoming>
+			<bpmn:outgoing>SequenceFlow_15gkgs5</bpmn:outgoing>
+		</bpmn:vesCollector>
+		<bpmn:collector id="Collector_">
+			<bpmn:incoming>SequenceFlow_1nvvr00</bpmn:incoming>
+			<bpmn:outgoing>SequenceFlow_0qf2552</bpmn:outgoing>
+		</bpmn:collector>
+		<bpmn:tCA id="TCA_09hcdsx">
+			<bpmn:incoming>SequenceFlow_15gkgs5</bpmn:incoming>
+			<bpmn:outgoing>SequenceFlow_0ev75ss</bpmn:outgoing>
+		</bpmn:tCA>
+		<bpmn:policy id="Policy_">
+			<bpmn:incoming>SequenceFlow_0ev75ss</bpmn:incoming>
+			<bpmn:outgoing>SequenceFlow_103hvmr</bpmn:outgoing>
+		</bpmn:policy>
+		<bpmn:endEvent id="EndEvent_0zjiuu5">
+			<bpmn:incoming>SequenceFlow_103hvmr</bpmn:incoming>
+		</bpmn:endEvent>
+		<bpmn:holmes id="Holmes_1fzdqp9">
+			<bpmn:incoming>SequenceFlow_1a2oxpd</bpmn:incoming>
+			<bpmn:outgoing>SequenceFlow_0jeu0gv</bpmn:outgoing>
+		</bpmn:holmes>
+		<bpmn:sequenceFlow id="SequenceFlow_1nvvr00"
+			sourceRef="StartEvent_1" targetRef="Collector_" />
+		<bpmn:sequenceFlow id="SequenceFlow_0qf2552"
+			sourceRef="Collector_" targetRef="StringMatch_0tw2y4f" />
+		<bpmn:sequenceFlow id="SequenceFlow_1a2oxpd"
+			sourceRef="StringMatch_0tw2y4f" targetRef="Holmes_1fzdqp9" />
+		<bpmn:sequenceFlow id="SequenceFlow_0jeu0gv"
+			sourceRef="Holmes_1fzdqp9" targetRef="VesCollector_1kxjxy6" />
+		<bpmn:sequenceFlow id="SequenceFlow_15gkgs5"
+			sourceRef="VesCollector_1kxjxy6" targetRef="TCA_09hcdsx" />
+		<bpmn:sequenceFlow id="SequenceFlow_0ev75ss"
+			sourceRef="TCA_09hcdsx" targetRef="Policy_" />
+		<bpmn:sequenceFlow id="SequenceFlow_103hvmr"
+			sourceRef="Policy_" targetRef="EndEvent_0zjiuu5" />
+	</bpmn:process>
+	<bpmndi:BPMNDiagram id="BPMNDiagram_1">
+		<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
+			<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2"
+				bpmnElement="StartEvent_1">
+				<dc:Bounds x="50" y="162" width="36" height="36" />
+			</bpmndi:BPMNShape>
+			<bpmndi:BPMNShape id="StringMatch_0tw2y4f_di"
+				bpmnElement="StringMatch_0tw2y4f">
+				<dc:Bounds x="324" y="192" width="120" height="80" />
+			</bpmndi:BPMNShape>
+			<bpmndi:BPMNShape id="VesCollector_1kxjxy6_di"
+				bpmnElement="VesCollector_1kxjxy6">
+				<dc:Bounds x="492" y="192" width="120" height="80" />
+			</bpmndi:BPMNShape>
+			<bpmndi:BPMNShape id="Collector__di" bpmnElement="Collector_">
+				<dc:Bounds x="159" y="206" width="120" height="80" />
+			</bpmndi:BPMNShape>
+			<bpmndi:BPMNShape id="TCA_09hcdsx_di" bpmnElement="TCA_09hcdsx">
+				<dc:Bounds x="651" y="192" width="120" height="80" />
+			</bpmndi:BPMNShape>
+			<bpmndi:BPMNShape id="Policy__di" bpmnElement="Policy_">
+				<dc:Bounds x="844" y="206" width="120" height="80" />
+			</bpmndi:BPMNShape>
+			<bpmndi:BPMNShape id="EndEvent_0zjiuu5_di"
+				bpmnElement="EndEvent_0zjiuu5">
+				<dc:Bounds x="703" y="396" width="36" height="36" />
+				<bpmndi:BPMNLabel>
+					<dc:Bounds x="676" y="432" width="90" height="20" />
+				</bpmndi:BPMNLabel>
+			</bpmndi:BPMNShape>
+			<bpmndi:BPMNShape id="Holmes_1fzdqp9_di"
+				bpmnElement="Holmes_1fzdqp9">
+				<dc:Bounds x="358" y="74" width="120" height="80" />
+			</bpmndi:BPMNShape>
+			<bpmndi:BPMNEdge id="SequenceFlow_1nvvr00_di"
+				bpmnElement="SequenceFlow_1nvvr00">
+				<di:waypoint xsi:type="dc:Point" x="86" y="180" />
+				<di:waypoint xsi:type="dc:Point" x="123" y="180" />
+				<di:waypoint xsi:type="dc:Point" x="123" y="246" />
+				<di:waypoint xsi:type="dc:Point" x="159" y="246" />
+				<bpmndi:BPMNLabel>
+					<dc:Bounds x="78" y="203" width="90" height="20" />
+				</bpmndi:BPMNLabel>
+			</bpmndi:BPMNEdge>
+			<bpmndi:BPMNEdge id="SequenceFlow_0qf2552_di"
+				bpmnElement="SequenceFlow_0qf2552">
+				<di:waypoint xsi:type="dc:Point" x="279" y="246" />
+				<di:waypoint xsi:type="dc:Point" x="302" y="246" />
+				<di:waypoint xsi:type="dc:Point" x="302" y="232" />
+				<di:waypoint xsi:type="dc:Point" x="324" y="232" />
+				<bpmndi:BPMNLabel>
+					<dc:Bounds x="257" y="229" width="90" height="20" />
+				</bpmndi:BPMNLabel>
+			</bpmndi:BPMNEdge>
+			<bpmndi:BPMNEdge id="SequenceFlow_1a2oxpd_di"
+				bpmnElement="SequenceFlow_1a2oxpd">
+				<di:waypoint xsi:type="dc:Point" x="384" y="192" />
+				<di:waypoint xsi:type="dc:Point" x="384" y="173" />
+				<di:waypoint xsi:type="dc:Point" x="418" y="173" />
+				<di:waypoint xsi:type="dc:Point" x="418" y="154" />
+				<bpmndi:BPMNLabel>
+					<dc:Bounds x="356" y="163" width="90" height="20" />
+				</bpmndi:BPMNLabel>
+			</bpmndi:BPMNEdge>
+			<bpmndi:BPMNEdge id="SequenceFlow_0jeu0gv_di"
+				bpmnElement="SequenceFlow_0jeu0gv">
+				<di:waypoint xsi:type="dc:Point" x="418" y="154" />
+				<di:waypoint xsi:type="dc:Point" x="418" y="173" />
+				<di:waypoint xsi:type="dc:Point" x="552" y="173" />
+				<di:waypoint xsi:type="dc:Point" x="552" y="192" />
+				<bpmndi:BPMNLabel>
+					<dc:Bounds x="440" y="163" width="90" height="20" />
+				</bpmndi:BPMNLabel>
+			</bpmndi:BPMNEdge>
+			<bpmndi:BPMNEdge id="SequenceFlow_15gkgs5_di"
+				bpmnElement="SequenceFlow_15gkgs5">
+				<di:waypoint xsi:type="dc:Point" x="612" y="232" />
+				<di:waypoint xsi:type="dc:Point" x="651" y="232" />
+				<bpmndi:BPMNLabel>
+					<dc:Bounds x="586.5" y="222" width="90" height="20" />
+				</bpmndi:BPMNLabel>
+			</bpmndi:BPMNEdge>
+			<bpmndi:BPMNEdge id="SequenceFlow_0ev75ss_di"
+				bpmnElement="SequenceFlow_0ev75ss">
+				<di:waypoint xsi:type="dc:Point" x="771" y="232" />
+				<di:waypoint xsi:type="dc:Point" x="808" y="232" />
+				<di:waypoint xsi:type="dc:Point" x="808" y="246" />
+				<di:waypoint xsi:type="dc:Point" x="844" y="246" />
+				<bpmndi:BPMNLabel>
+					<dc:Bounds x="763" y="229" width="90" height="20" />
+				</bpmndi:BPMNLabel>
+			</bpmndi:BPMNEdge>
+			<bpmndi:BPMNEdge id="SequenceFlow_103hvmr_di"
+				bpmnElement="SequenceFlow_103hvmr">
+				<di:waypoint xsi:type="dc:Point" x="844" y="246" />
+				<di:waypoint xsi:type="dc:Point" x="792" y="246" />
+				<di:waypoint xsi:type="dc:Point" x="792" y="414" />
+				<di:waypoint xsi:type="dc:Point" x="739" y="414" />
+				<bpmndi:BPMNLabel>
+					<dc:Bounds x="747" y="320" width="90" height="20" />
+				</bpmndi:BPMNLabel>
+			</bpmndi:BPMNEdge>
+		</bpmndi:BPMNPlane>
+	</bpmndi:BPMNDiagram>
+</bpmn:definitions>
\ No newline at end of file
diff --git a/src/test/resources/example/xsl-validation/modelBpmnForVerif.json b/src/test/resources/example/xsl-validation/modelBpmnForVerif.json
new file mode 100644
index 0000000..1bef49a
--- /dev/null
+++ b/src/test/resources/example/xsl-validation/modelBpmnForVerif.json
@@ -0,0 +1,38 @@
+{
+	"collector": [
+		{
+			"id": "Collector_",
+			"from": "StartEvent_1"
+		}
+	],
+	"stringMatch": [
+		{
+			"id": "StringMatch_0tw2y4f",
+			"from": "Collector_"
+		}
+	],
+	"policy": [
+		{
+			"id": "Policy_",
+			"from": "TCA_09hcdsx"
+		}
+	],
+	"tca": [
+		{
+			"id": "TCA_09hcdsx",
+			"from": "VesCollector_1kxjxy6"
+		}
+	],
+	"vesCollector": [
+		{
+			"id": "VesCollector_1kxjxy6",
+			"from": "Holmes_1fzdqp9"
+		}
+	],
+	"holmes": [
+		{
+			"id": "Holmes_1fzdqp9",
+			"from": "StringMatch_0tw2y4f"
+		}
+	]
+}
\ No newline at end of file