From e129e37a3c2ad3fdbc8b14cd54155fecfd174f33 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 11 Feb 2019 15:08:59 -0500 Subject: made max retries configurable via mso config fixed an error with the wrong variable being printed made max retries configurable via mso config Change-Id: Iec6d209ec2868200ec5956e269b6a048d7619307 Issue-ID: SO-1495 Signed-off-by: Benjamin, Max (mb388a) --- .../tasks/ExecuteBuildingBlockRainyDay.java | 10 +++++++++- .../tasks/ExecuteBuildlingBlockRainyDayTest.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'bpmn/MSOCommonBPMN/src') 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 b210b5ed2f..ee7999f995 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 @@ -55,6 +55,7 @@ public class ExecuteBuildingBlockRainyDay { private Environment environment; protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier"; protected String defaultCode = "mso.rainyDay.defaultCode"; + protected String maxRetries = "mso.rainyDay.maxRetries"; public void setRetryTimer(DelegateExecution execution) { try { @@ -172,10 +173,17 @@ public class ExecuteBuildingBlockRainyDay { msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { - msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = Abort", e); String code = this.environment.getProperty(defaultCode); + msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = "+ code, e); execution.setVariable(HANDLING_CODE, code); } + try{ + int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries)); + execution.setVariable("maxRetries", envMaxRetries); + } catch (Exception ex) { + msoLogger.error("Could not read maxRetries from config file. Setting max to 5 retries"); + execution.setVariable("maxRetries", 5); + } } public void setHandlingStatusSuccess(DelegateExecution execution) { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index 868aabf6a9..6344a3f1a6 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -131,6 +131,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true); assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); + assertEquals(5,delegateExecution.getVariable("maxRetries")); } @Test -- cgit 1.2.3-korg