From 5baa1ed97c1d2b98952a025c3bc76f60587e9670 Mon Sep 17 00:00:00 2001 From: Jozsef Csongvai Date: Mon, 13 Jun 2022 08:53:19 -0400 Subject: Enable long-running processes in ControllerExecutionBB Instead of blocking a thread while waiting for controller response, ControllerExecutionBB is now using camunda receive task to support long running processes without increasing the camunda job timeout. A new property was added to configure the gRPC client's keep alive ping mechanism, which will identify connection issues and prevent the process getting stuck when the controller crashes. Issue-ID: SO-3953 Signed-off-by: Jozsef Csongvai Change-Id: Iaf6438dba76e715dba846bf45ef47b6a91239c4a --- .../impl/buildingblock/ControllerExecutionBB.java | 19 +++++++++++++ .../buildingblock/ControllerExecutionBBTest.java | 32 ++++++++++++++++++++++ .../cds/PnfConfigCdsControllerDETest.java | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) (limited to 'bpmn/so-bpmn-tasks/src') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java index 92be824691..c5536106fe 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java @@ -26,11 +26,13 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable; import org.onap.so.bpmn.infrastructure.decisionpoint.impl.AbstractControllerExecution; +import org.onap.so.client.cds.PayloadConstants; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; /** @@ -52,8 +54,11 @@ public class ControllerExecutionBB extends AbstractControllerExecution controllerContext = buildControllerContext(execution); controllerExecute(controllerContext); } @@ -151,4 +156,18 @@ public class ControllerExecutionBB extends AbstractControllerExecution errMsgCaptor = ArgumentCaptor.forClass(String.class); + verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), anyInt(), + errMsgCaptor.capture(), any()); + + assertTrue(errMsgCaptor.getValue().contains("timeout")); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java index d8f607f6d9..3c3dc839c8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java @@ -50,7 +50,7 @@ public class PnfConfigCdsControllerDETest { @MockBean private ControllerPreparable preparable; - @Mock + @MockBean private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils; @Test -- cgit 1.2.3-korg