summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN
diff options
context:
space:
mode:
authorbiniek <lukasz.biniek@nokia.com>2018-04-10 10:48:54 +0200
committerbiniek <lukasz.biniek@nokia.com>2018-04-10 11:39:12 +0200
commit402e5e2cad8320dcfe7bd49cc9724d3071a4224d (patch)
tree2d8f9cbe47251555f938adf93511ba28fc8d91f1 /bpmn/MSOInfrastructureBPMN
parentf115334f0e8711e36dd43bc79335f2c98c77723f (diff)
Added informing dmaap client in pnf-ready workflow
Change-Id: I0d7b610e24da56aad32a9b02b987f98f932456f6 Issue-ID: SO-506 Signed-off-by: biniek <lukasz.biniek@nokia.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java45
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java26
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn139
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml5
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java42
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java94
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java11
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml6
8 files changed, 307 insertions, 61 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
new file mode 100644
index 0000000000..5a8d741a05
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class InformDmaapClient implements JavaDelegate {
+
+ private DmaapClient dmaapClient;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID);
+ dmaapClient.registerForUpdate(correlationId, () -> execution.getProcessEngineServices().getRuntimeService()
+ .createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey(execution.getProcessBusinessKey())
+ .correlateWithResult());
+ }
+
+ @Autowired
+ public void setDmaapClient(DmaapClient dmaapClient) {
+ this.dmaapClient = dmaapClient;
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java
new file mode 100644
index 0000000000..07e8ada21e
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.implementation;
+
+public interface DmaapClient {
+
+ void registerForUpdate(String correlationId, Runnable informConsumer);
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn
index 262e08689d..7d8863892d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn
@@ -8,6 +8,7 @@
<bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForCorrelationId" targetRef="Participant_0atuyq0" />
<bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForCorrelationId" />
<bpmn:messageFlow id="MessageFlow_1vrcp2d" sourceRef="Participant_19w87ws" targetRef="WaitForDmaapPnfReadyNotification" />
+ <bpmn:messageFlow id="MessageFlow_0tg4hw9" sourceRef="InformDmaapClient" targetRef="Participant_19w87ws" />
</bpmn:collaboration>
<bpmn:process id="CreateAndActivatePnfResource" name="CreateAndActivatePnfResource" isExecutable="true">
<bpmn:sequenceFlow id="SequenceFlow_1ls8pua" name="No" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryExists">
@@ -34,9 +35,10 @@
<bpmn:startEvent id="CreateAndActivatePnf_StartEvent">
<bpmn:outgoing>SequenceFlow_0j5ksz1</bpmn:outgoing>
</bpmn:startEvent>
- <bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="WaitForDmaapPnfReadyNotification" />
+ <bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" />
<bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="ThrowTimeoutException" />
<bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" />
+ <bpmn:sequenceFlow id="SequenceFlow_1o8od8e" sourceRef="InformDmaapClient" targetRef="WaitForDmaapPnfReadyNotification" />
<bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}">
<bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing>
@@ -61,7 +63,7 @@
<bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing>
</bpmn:intermediateThrowEvent>
<bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo">
- <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1o8od8e</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing>
</bpmn:receiveTask>
<bpmn:boundaryEvent id="WaitForDmaapTimeout" name="Timeout" attachedToRef="WaitForDmaapPnfReadyNotification">
@@ -74,6 +76,10 @@
<bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming>
<bpmn:errorEventDefinition errorRef="Error_1" />
</bpmn:endEvent>
+ <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${informDmaapClient}">
+ <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing>
+ </bpmn:serviceTask>
<bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" />
<bpmn:textAnnotation id="TextAnnotation_1eyzes8">
<bpmn:text><![CDATA[Inputs:
@@ -90,15 +96,15 @@
<dc:Bounds x="0" y="0" width="1482" height="353" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1cttgdo_di" bpmnElement="DoesAaiContainInfoAboutPnf" isMarkerVisible="true">
- <dc:Bounds x="408" y="230" width="50" height="50" />
+ <dc:Bounds x="354" y="230" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="388" y="283" width="85" height="20" />
+ <dc:Bounds x="334" y="283" width="85" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0yamdfm_di" bpmnElement="DoesAaiContainInfoAboutIp" isMarkerVisible="true">
- <dc:Bounds x="786" y="41" width="50" height="50" />
+ <dc:Bounds x="678" y="41" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="767" y="5" width="87" height="30" />
+ <dc:Bounds x="659" y="5" width="87" height="30" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated">
@@ -114,92 +120,92 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForCorrelationId">
- <dc:Bounds x="194" y="215" width="100" height="80" />
+ <dc:Bounds x="167" y="215" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreateAndActivatePnf_CreateAaiEntry">
- <dc:Bounds x="572" y="215" width="100" height="80" />
+ <dc:Bounds x="491" y="215" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt">
- <di:waypoint xsi:type="dc:Point" x="294" y="255" />
- <di:waypoint xsi:type="dc:Point" x="408" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="267" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="354" y="255" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="306" y="235" width="90" height="10" />
+ <dc:Bounds x="265.5" y="235" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak">
- <di:waypoint xsi:type="dc:Point" x="433" y="230" />
- <di:waypoint xsi:type="dc:Point" x="433" y="66" />
- <di:waypoint xsi:type="dc:Point" x="786" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="379" y="230" />
+ <di:waypoint xsi:type="dc:Point" x="379" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="678" y="66" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="438" y="206" width="19" height="10" />
+ <dc:Bounds x="384" y="206" width="19" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe">
- <di:waypoint xsi:type="dc:Point" x="458" y="255" />
- <di:waypoint xsi:type="dc:Point" x="572" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="404" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="491" y="255" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="471.6714285714286" y="237" width="15" height="10" />
+ <dc:Bounds x="412.9078947368421" y="237" width="15" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1h6yz62_di" bpmnElement="SequenceFlow_1h6yz62">
- <di:waypoint xsi:type="dc:Point" x="836" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="728" y="66" />
<di:waypoint xsi:type="dc:Point" x="1312" y="66" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="842.76953125" y="51" width="19" height="10" />
+ <dc:Bounds x="738.7436974789916" y="51" width="19" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ls8pua_di" bpmnElement="SequenceFlow_1ls8pua">
- <di:waypoint xsi:type="dc:Point" x="811" y="91" />
- <di:waypoint xsi:type="dc:Point" x="811" y="237" />
+ <di:waypoint xsi:type="dc:Point" x="703" y="91" />
+ <di:waypoint xsi:type="dc:Point" x="703" y="237" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="821" y="119.69863013698631" width="15" height="10" />
+ <dc:Bounds x="713" y="124.1917808219178" width="15" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf">
- <di:waypoint xsi:type="dc:Point" x="672" y="255" />
- <di:waypoint xsi:type="dc:Point" x="793" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="685" y="255" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="687.5" y="235" width="90" height="10" />
+ <dc:Bounds x="593" y="235" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0j5ksz1_di" bpmnElement="SequenceFlow_0j5ksz1">
<di:waypoint xsi:type="dc:Point" x="85" y="255" />
- <di:waypoint xsi:type="dc:Point" x="194" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="167" y="255" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="94.5" y="235" width="90" height="10" />
+ <dc:Bounds x="81" y="235" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Participant_0i9ban2_di" bpmnElement="Participant_0atuyq0">
- <dc:Bounds x="123" y="538" width="1222" height="60" />
+ <dc:Bounds x="123" y="415" width="502" height="60" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="MessageFlow_1h3xu88_di" bpmnElement="MessageFlow_1h3xu88">
- <di:waypoint xsi:type="dc:Point" x="622" y="295" />
- <di:waypoint xsi:type="dc:Point" x="622" y="538" />
+ <di:waypoint xsi:type="dc:Point" x="541" y="295" />
+ <di:waypoint xsi:type="dc:Point" x="541" y="415" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="592" y="411.5" width="90" height="10" />
+ <dc:Bounds x="511" y="350" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_09ibv5a_di" bpmnElement="MessageFlow_09ibv5a">
- <di:waypoint xsi:type="dc:Point" x="225" y="295" />
- <di:waypoint xsi:type="dc:Point" x="225" y="538" />
+ <di:waypoint xsi:type="dc:Point" x="198" y="295" />
+ <di:waypoint xsi:type="dc:Point" x="198" y="415" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="195" y="411.5" width="90" height="10" />
+ <dc:Bounds x="168" y="350" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_0vjul4t_di" bpmnElement="MessageFlow_0vjul4t">
- <di:waypoint xsi:type="dc:Point" x="264" y="538" />
- <di:waypoint xsi:type="dc:Point" x="264" y="295" />
+ <di:waypoint xsi:type="dc:Point" x="237" y="415" />
+ <di:waypoint xsi:type="dc:Point" x="237" y="295" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="234" y="411.5" width="90" height="10" />
+ <dc:Bounds x="207" y="350" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Participant_0vmrrhf_di" bpmnElement="Participant_19w87ws">
- <dc:Bounds x="767" y="414" width="300" height="62" />
+ <dc:Bounds x="804" y="415" width="300" height="62" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0wbx6tt_di" bpmnElement="ThrowTimeoutException">
- <dc:Bounds x="1164" y="135" width="36" height="36" />
+ <dc:Bounds x="1189" y="135" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1157" y="172" width="70" height="20" />
+ <dc:Bounds x="1182" y="172" width="70" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_00cy7r0_di" bpmnElement="AaiEntryAlreadyUpToDate">
@@ -209,9 +215,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateThrowEvent_0fjcdy4_di" bpmnElement="AaiEntryExists">
- <dc:Bounds x="793" y="237" width="36" height="36" />
+ <dc:Bounds x="685" y="237" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="771" y="283" width="80" height="20" />
+ <dc:Bounds x="663" y="283" width="80" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8">
@@ -222,43 +228,60 @@
<di:waypoint xsi:type="dc:Point" x="67" y="124" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d">
- <di:waypoint xsi:type="dc:Point" x="1002" y="414" />
- <di:waypoint xsi:type="dc:Point" x="1002" y="295" />
+ <di:waypoint xsi:type="dc:Point" x="1054" y="415" />
+ <di:waypoint xsi:type="dc:Point" x="1054" y="295" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="972" y="349.5" width="90" height="10" />
+ <dc:Bounds x="1024" y="350" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025">
- <di:waypoint xsi:type="dc:Point" x="829" y="255" />
- <di:waypoint xsi:type="dc:Point" x="950" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="721" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="815" y="255" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="844.5" y="235" width="90" height="10" />
+ <dc:Bounds x="723" y="235" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="BoundaryEvent_15eo1k9_di" bpmnElement="WaitForDmaapTimeout">
- <dc:Bounds x="1004" y="197" width="36" height="36" />
+ <dc:Bounds x="1056" y="197" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1035" y="192" width="40" height="10" />
+ <dc:Bounds x="1087" y="192" width="40" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc">
- <di:waypoint xsi:type="dc:Point" x="1022" y="197" />
- <di:waypoint xsi:type="dc:Point" x="1022" y="153" />
- <di:waypoint xsi:type="dc:Point" x="1164" y="153" />
+ <di:waypoint xsi:type="dc:Point" x="1074" y="197" />
+ <di:waypoint xsi:type="dc:Point" x="1074" y="153" />
+ <di:waypoint xsi:type="dc:Point" x="1189" y="153" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="992" y="170" width="90" height="10" />
+ <dc:Bounds x="1044" y="170" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ReceiveTask_1sfysua_di" bpmnElement="WaitForDmaapPnfReadyNotification">
- <dc:Bounds x="950" y="215" width="100" height="80" />
+ <dc:Bounds x="1002" y="215" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm">
- <di:waypoint xsi:type="dc:Point" x="1050" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="1102" y="255" />
<di:waypoint xsi:type="dc:Point" x="1312" y="255" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1181" y="235" width="0" height="10" />
+ <dc:Bounds x="1162" y="235" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1o8od8e_di" bpmnElement="SequenceFlow_1o8od8e">
+ <di:waypoint xsi:type="dc:Point" x="915" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="1002" y="255" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="913.5" y="235" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="MessageFlow_0tg4hw9_di" bpmnElement="MessageFlow_0tg4hw9">
+ <di:waypoint xsi:type="dc:Point" x="865" y="295" />
+ <di:waypoint xsi:type="dc:Point" x="865" y="415" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="835" y="350" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1iax11n_di" bpmnElement="InformDmaapClient">
+ <dc:Bounds x="815" y="215" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
index f46cd065ed..ed1556b05d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
@@ -14,6 +14,11 @@
<property name="aaiConnection" ref="aaiConnection"/>
</bean>
+ <bean id="informDmaapClient" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.InformDmaapClient">
+ <!--TODO: uncommend line below after DmaapClient is pushed to master-->
+ <!--<property name="dmaapClient" ref="dmaapClient"/>-->
+ </bean>
+
<bean id="pnfEventReadyConsumer" class="org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.PnfEventReadyConsumer">
<property name="dmaapHost" value="${dmaapHost}" />
<property name="dmaapPort" value="${dmaapPort}"/>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
new file mode 100644
index 0000000000..1103597157
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient;
+
+public class DmaapClientTestImpl implements DmaapClient {
+ private String correlationId;
+ private Runnable informConsumer;
+
+ @Override
+ public void registerForUpdate(String correlationId, Runnable informConsumer) {
+ this.correlationId = correlationId;
+ this.informConsumer = informConsumer;
+ }
+
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ public Runnable getInformConsumer() {
+ return informConsumer;
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
new file mode 100644
index 0000000000..2bfae461be
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InOrder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {InformDmaapClient.class, DmaapClientTestImpl.class})
+public class InformDmaapClientTest {
+
+ @Autowired
+ private InformDmaapClient informDmaapClient;
+
+ @Autowired
+ private DmaapClientTestImpl dmaapClientTest;
+
+ private DelegateExecution delegateExecution;
+
+ private MessageCorrelationBuilder messageCorrelationBuilder;
+
+ @Test
+ public void shouldSendListenerToDmaapClient() throws Exception {
+ // given
+ mockDelegateExecution();
+ // when
+ informDmaapClient.execute(delegateExecution);
+ // then
+ assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ assertThat(dmaapClientTest.getInformConsumer()).isNotNull();
+ verifyZeroInteractions(messageCorrelationBuilder);
+ }
+
+ @Test
+ public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception {
+ // given
+ mockDelegateExecution();
+ // when
+ informDmaapClient.execute(delegateExecution);
+ dmaapClientTest.getInformConsumer().run();
+ // then
+ assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ InOrder inOrder = inOrder(messageCorrelationBuilder);
+ inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey");
+ inOrder.verify(messageCorrelationBuilder).correlateWithResult();
+ }
+
+ private void mockDelegateExecution() {
+ delegateExecution = mock(DelegateExecution.class);
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+ when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
+ ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
+ when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
+ RuntimeService runtimeService = mock(RuntimeService.class);
+ when(processEngineServices.getRuntimeService()).thenReturn(runtimeService);
+ messageCorrelationBuilder = mock(MessageCorrelationBuilder.class);
+ when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder);
+ when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder);
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
index 88e7d2f4b3..cceb271778 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
@@ -75,7 +75,8 @@ public class CreateAndActivatePnfResourceTest {
"CreateAndActivatePnf_StartEvent",
"CheckAiiForCorrelationId",
"DoesAaiContainInfoAboutPnf",
- "DoesAaiContainInfoAboutIp"
+ "DoesAaiContainInfoAboutIp",
+ "AaiEntryAlreadyUpToDate"
);
}
@@ -102,7 +103,9 @@ public class CreateAndActivatePnfResourceTest {
"DoesAaiContainInfoAboutPnf",
"DoesAaiContainInfoAboutIp",
"AaiEntryExists",
- "WaitForDmaapPnfReadyNotification"
+ "InformDmaapClient",
+ "WaitForDmaapPnfReadyNotification",
+ "AaiEntryUpdated"
);
}
@@ -129,7 +132,9 @@ public class CreateAndActivatePnfResourceTest {
"DoesAaiContainInfoAboutPnf",
"CreateAndActivatePnf_CreateAaiEntry",
"AaiEntryExists",
- "WaitForDmaapPnfReadyNotification"
+ "InformDmaapClient",
+ "WaitForDmaapPnfReadyNotification",
+ "AaiEntryUpdated"
);
assertThat(aaiConnection.getCreated()).containsExactly(ID_WITHOUT_ENTRY);
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml
index b222383c82..6dc3bbf880 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml
@@ -56,4 +56,10 @@
<bean id="createAaiEntryWithPnfIdDelegate" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.CreateAaiEntryWithPnfIdDelegate">
<property name="aaiConnection" ref="aaiConnection"/>
</bean>
+
+ <bean id="informDmaapClient" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.InformDmaapClient">
+ <property name="dmaapClient" ref="dmaapClient"/>
+ </bean>
+
+ <bean id="dmaapClient" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl"/>
</beans>