diff options
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
4 files changed, 14 insertions, 13 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 0df49c103a..9c9a7f9257 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -342,6 +342,10 @@ <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> </exclusion> + <exclusion> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </exclusion> </exclusions> </dependency> </dependencies> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java index fd7498f468..58d0c6d374 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java @@ -52,6 +52,7 @@ public class AutoProcessInstanceMigrationService { } protected List<ProcessDefinition> getProcessDefinitions() { + List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>(); processDefinitionKeys = env.getProperty("migration.processDefinitionKeys", List.class, new ArrayList<String>()); for (String key : processDefinitionKeys) { diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java index 4fb63651eb..2d41eb4e26 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.core.env.Environment; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -68,6 +69,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); long workflowPollInterval = 1000; + private static final String ASYNC_WAIT_TIME = "mso.workflow.async.waitTime"; @Autowired private WorkflowProcessor processor; @@ -75,6 +77,9 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { @Autowired private WorkflowContextHolder workflowContext; + @Autowired + private Environment env; + public void setProcessor(WorkflowProcessor processor) { this.processor = processor; } @@ -119,7 +124,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { protected WorkflowResponse waitForResponse(Map<String, Object> inputVariables) throws Exception { String requestId = getRequestId(inputVariables); long currentWaitTime = 0; - long waitTime = getWaitTime(inputVariables); + long waitTime = getWaitTime(); logger.debug("WorkflowAsyncResource.waitForResponse using timeout: " + waitTime); while (waitTime > currentWaitTime) { Thread.sleep(workflowPollInterval); @@ -185,18 +190,8 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { * @param inputVariables * @return */ - private long getWaitTime(Map<String, Object> inputVariables) { - String timeout = inputVariables.get("mso-service-request-timeout") == null ? null - : inputVariables.get("mso-service-request-timeout").toString(); - - if (timeout != null) { - try { - return Long.parseLong(timeout) * 1000; - } catch (NumberFormatException nex) { - logger.debug("Invalid input for mso-service-request-timeout"); - } - } - return DEFAULT_WAIT_TIME; + private long getWaitTime() { + return env.getProperty(ASYNC_WAIT_TIME, Long.class, new Long(DEFAULT_WAIT_TIME)); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java index 77b3535ce1..36e828448d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java @@ -83,6 +83,7 @@ public class AutoProcessInstanceMigrationServiceTest { defList.add(newDef); defList.add(suspendedDef); + doReturn(query).when(repositoryService).createProcessDefinitionQuery(); doReturn(query).when(query).processDefinitionKey("test"); doReturn(defList).when(query).list(); |