From eee110cb38b47745cadc65ca7cbb5c64a1965418 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Sun, 5 May 2019 07:51:49 -0400 Subject: Fix deployment of workflows on start Fix deployment of workflows on start Change-Id: Iaa5cb96020da20c96bedb81e0829f73c7461b67f Issue-ID: SO-1837 Signed-off-by: Kuleshov, Elena --- .../MSOInfrastructureApplication.java | 58 ++++++++++++---------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'bpmn/mso-infrastructure-bpmn') diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index c61808ebb1..8168d2a4b8 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -24,14 +24,14 @@ package org.onap.so.bpmn.infrastructure; import java.util.List; import java.util.concurrent.Executor; -import org.camunda.bpm.application.PostDeploy; +import javax.annotation.PostConstruct; import org.camunda.bpm.application.PreUndeploy; import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.engine.repository.DeploymentBuilder; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; import org.onap.so.db.catalog.beans.Workflow; -import org.onap.so.db.catalog.data.repository.WorkflowRepository; +import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,13 +39,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.Primary; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -56,17 +54,17 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @SpringBootApplication @EnableAsync -@EnableJpaRepositories("org.onap.so.db.catalog.data.repository") -@EntityScan({"org.onap.so.db.catalog.beans"}) @ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class MSOInfrastructureApplication { private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class); + @Autowired + private ProcessEngine processEngine; @Autowired - private WorkflowRepository workflowRepository; + private CatalogDbClient catalogDbClient; @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -79,6 +77,7 @@ public class MSOInfrastructureApplication { private static final String LOGS_DIR = "logs_dir"; private static final String BPMN_SUFFIX = ".bpmn"; + private static final String SDC_SOURCE = "sdc"; private static void setLogsDir() { @@ -93,10 +92,14 @@ public class MSOInfrastructureApplication { setLogsDir(); } - @PostDeploy - public void postDeploy(ProcessEngine processEngineInstance) { - DeploymentBuilder deploymentBuilder = processEngineInstance.getRepositoryService().createDeployment(); - deployCustomWorkflows(deploymentBuilder); + @PostConstruct + public void postConstruct() { + try { + DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment(); + deployCustomWorkflows(deploymentBuilder); + } catch (Exception e) { + logger.warn("Unable to invoke deploymentBuilder: " + e.getMessage()); + } } @PreUndeploy @@ -117,23 +120,26 @@ public class MSOInfrastructureApplication { } public void deployCustomWorkflows(DeploymentBuilder deploymentBuilder) { - if (workflowRepository == null) { - return; - } - List workflows = workflowRepository.findAll(); - if (workflows != null && workflows.size() != 0) { - for (Workflow workflow : workflows) { - String workflowName = workflow.getName(); - String workflowBody = workflow.getBody(); - if (!workflowName.endsWith(BPMN_SUFFIX)) { - workflowName += BPMN_SUFFIX; - } - if (workflowBody != null) { - logger.info("{} {}", "Deploying custom workflow", workflowName); - deploymentBuilder.addString(workflowName, workflowBody); + logger.debug("Attempting to deploy custom workflows"); + try { + List workflows = catalogDbClient.findWorkflowBySource(SDC_SOURCE); + if (workflows != null && workflows.size() != 0) { + for (Workflow workflow : workflows) { + String workflowName = workflow.getName(); + String workflowBody = workflow.getBody(); + if (!workflowName.endsWith(BPMN_SUFFIX)) { + workflowName += BPMN_SUFFIX; + } + if (workflowBody != null) { + logger.info("{} {}", "Deploying custom workflow", workflowName); + deploymentBuilder.addString(workflowName, workflowBody); + } } + deploymentBuilder.enableDuplicateFiltering(true); + deploymentBuilder.deploy(); } - deploymentBuilder.deploy(); + } catch (Exception e) { + logger.warn("Unable to deploy custom workflows, " + e.getMessage()); } } } -- cgit 1.2.3-korg From b87ccbbf96a0eac4261f5a2d51c03e18b4243ddb Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Wed, 22 May 2019 21:11:42 -0400 Subject: Handle case of null requestInfo Handle case of null requestInfo Issue-ID: SO-1918 Signed-off-by: Kuleshov, Elena Change-Id: Ie8a0dd9e27734d96442eceaa378e5d1e64667b06 --- .../servicedecomposition/tasks/BBInputSetupMapperLayer.java | 4 +++- bpmn/mso-infrastructure-bpmn/pom.xml | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'bpmn/mso-infrastructure-bpmn') diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index b90ae19ca6..6f3710835c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -335,7 +335,9 @@ public class BBInputSetupMapperLayer { public RequestContext mapRequestContext(RequestDetails requestDetails) { RequestContext context = new RequestContext(); - modelMapper.map(requestDetails.getRequestInfo(), context); + if (null != requestDetails.getRequestInfo()) { + modelMapper.map(requestDetails.getRequestInfo(), context); + } org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters(); if (null != requestParameters) { context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 4dd7a467ea..e9ed15aa0f 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -152,12 +152,12 @@ org.camunda.bpm.springboot camunda-bpm-spring-boot-starter-rest ${camunda.springboot.version} - - - org.camunda.bpmn - camunda-engine-rest-core - - + + + org.camunda.bpmn + camunda-engine-rest-core + + org.camunda.bpm.springboot -- cgit 1.2.3-korg From b802b088c9a46ba34ae1cdfe7c70ba8a8a51cbb5 Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat (vb8416)" Date: Mon, 3 Jun 2019 15:36:31 -0400 Subject: Add SO Turn off OpenStack heat stack audit UPDATE these files so/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml so/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml should have mso: infra: auditInventory: false Issue-ID: SO-1974 Signed-off-by: Bonkur, Venkat (vb8416) Change-Id: I57bb396604e9eb2787122199cdf8a2d1ce54048a --- bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml | 4 ++-- .../mso-api-handler-infra/src/main/resources/application.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'bpmn/mso-infrastructure-bpmn') diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml index a91cb9d88d..e364981a66 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -4,7 +4,7 @@ server: max-threads: 50 mso: infra: - auditInventory: true + auditInventory: false spring: datasource: driver-class-name: org.mariadb.jdbc.Driver @@ -36,4 +36,4 @@ management: export: prometheus: enabled: true # Whether exporting of metrics to Prometheus is enabled. - step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file + step: 1m # Step size (i.e. reporting frequency) to use. diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml index e709758223..03934edf20 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml @@ -7,7 +7,7 @@ server: mso: infra: - auditInventory: true + auditInventory: false default: versions: apiMinorVersion: 0 @@ -70,4 +70,4 @@ org: so: adapters: network: - encryptionKey: aa3871669d893c7fb8abbcda31b88b4f \ No newline at end of file + encryptionKey: aa3871669d893c7fb8abbcda31b88b4f -- cgit 1.2.3-korg