diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-11-10 11:58:39 -0500 |
---|---|---|
committer | Rob Daugherty <rd472p@att.com> | 2018-11-14 20:55:02 +0000 |
commit | be24ada950e9f41a6034b472fc5502b285a510d5 (patch) | |
tree | 76c71f33776386eecf04230882b89a81f904f3fa /bpmn/so-bpmn-tasks | |
parent | 78e9c0c84da529b26f25ab66c4d2e596fd180282 (diff) |
separate error status from progression status
Re-ordered statuses, capitalized, and added delimiters
added retrystatusmessage to to string in infrarequests
Added retryStatusMessage to OrchestrationRequests
removed the word min from retry status message string
added retry status message to infra active requests
Began adding retryStatusMessage
Added rollback status and flow status to status message
added flow status table to separate errors from status
Change-Id: If756fa4523955e4e4b6bfd10aad730b715892b62
Issue-ID: SO-1205
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks')
7 files changed, 111 insertions, 7 deletions
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()); } } |