aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java15
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java22
9 files changed, 128 insertions, 8 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 32540eb996..ba9426d88a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -31,6 +31,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
@@ -44,6 +46,8 @@ public class ExecuteBuildingBlockRainyDay {
@Autowired
private CatalogDbClient catalogDbClient;
+ @Autowired
+ private RequestsDbClient requestDbclient;
private static final String ASTERISK = "*";
@Autowired
@@ -68,6 +72,7 @@ public class ExecuteBuildingBlockRainyDay {
ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
String bbName = ebb.getBuildingBlock().getBpmnFlowName();
GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput");
+ String requestId = (String) execution.getVariable("mso-request-id");
Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap");
String serviceType = ASTERISK;
boolean aLaCarte = (boolean) execution.getVariable("aLaCarte");
@@ -122,6 +127,16 @@ public class ExecuteBuildingBlockRainyDay {
handlingCode = rainyDayHandlerStatus.getSecondaryPolicy();
}
}
+ if(!primaryPolicy){
+ try{
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ request.setRetryStatusMessage("Retries have been exhausted.");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch(Exception ex){
+ msoLogger.debug(ex.toString());
+ msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status");
+ }
+ }
if(handlingCode.equals("RollbackToAssigned")&&!aLaCarte){
handlingCode = "Rollback";
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 2c134a9f59..07460a468d 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -20,6 +20,7 @@
<camunda:in source="aLaCarte" target="aLaCarte" />
<camunda:in source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" />
<camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" />
+ <camunda:out source="RetryDuration" target="RetryDuration" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 612051f903..55f898742c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2018 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) Copyright (C) 2018 Bell Canada.
+ * ================================================================================
* 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.onap.so.bpmn.buildingblock;
import java.util.Map;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 505c61da6b..66e2694db6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -109,7 +109,7 @@ public class WorkflowActionBBTasks {
String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
- request.setStatusMessage(statusMessage);
+ request.setFlowStatus(statusMessage);
request.setProgress(percentProgress);
request.setLastModifiedBy("CamundaBPMN");
return request;
@@ -203,9 +203,18 @@ public class WorkflowActionBBTasks {
public void checkRetryStatus(DelegateExecution execution) {
String handlingCode = (String) execution.getVariable("handlingCode");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
if (handlingCode.equals("Retry")){
updateRequestErrorStatusMessage(execution);
+ try{
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ request.setRetryStatusMessage("Retry " + retryCount+1 + "/5 will be started in " + retryDuration);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch(Exception ex){
+ logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex);
+ }
if(retryCount<5){
int currSequence = (int) execution.getVariable("gCurrentSequence");
execution.setVariable("gCurrentSequence", currSequence-1);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java
index 8a57d5d43a..23fcddfe8a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/AllIntegrationTestSuites.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so;
import org.junit.runner.RunWith;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java
index ab999a9889..0eddeb1649 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/IntegrationTestSuite.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so;
import org.junit.runner.RunWith;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java
index 5ac9f229f6..82ad6582c5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/UnitTestSuite.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index b0a80ebc72..fc269cd7cc 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -25,6 +25,7 @@ import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
@@ -42,6 +43,7 @@ import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.request.beans.InfraActiveRequests;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
@@ -258,19 +260,27 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
@Test
public void checkRetryStatusTest(){
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
doNothing().when(workflowActionBBTasks).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
execution.setVariable("handlingCode","Retry");
execution.setVariable("retryCount", 1);
execution.setVariable("gCurrentSequence",1);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
workflowActionBBTasks.checkRetryStatus(execution);
assertEquals(0,execution.getVariable("gCurrentSequence"));
}
@Test
public void checkRetryStatusNoRetryTest(){
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
execution.setVariable("retryCount", 3);
execution.setVariable("handlingCode","Success");
execution.setVariable("gCurrentSequence",1);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
workflowActionBBTasks.checkRetryStatus(execution);
assertEquals(0,execution.getVariable("retryCount"));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
index 1e2558b580..0f106ad913 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
@@ -68,7 +88,7 @@ public class WorkflowActionBBTasksUpdateReqDbTest extends BaseTaskTest{
InfraActiveRequests mockedRequest = new InfraActiveRequests();
doReturn(mockedRequest).when(requestsDbClient).getInfraActiveRequestbyRequestId(isA(String.class));
InfraActiveRequests actual = workflowActionBBTasks.getUpdatedRequest(execution, currentSequence);
- assertEquals(expectedStatusMessage, actual.getStatusMessage());
+ assertEquals(expectedStatusMessage, actual.getFlowStatus());
assertEquals(expectedLong, actual.getProgress());
}
}