diff options
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
5 files changed, 69 insertions, 27 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java index 194ce58fe9..9fd3bc596f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java @@ -36,6 +36,7 @@ import javax.xml.bind.annotation.XmlType; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="cloudOwner" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * <element name="msoRequest" type="{http://org.onap.so/vnfNotify}msoRequest" minOccurs="0"/> * <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> * <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> @@ -52,6 +53,7 @@ import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "vnfRollback", propOrder = { "cloudSiteId", + "cloudOwner", "msoRequest", "tenantCreated", "tenantId", @@ -61,6 +63,7 @@ import javax.xml.bind.annotation.XmlType; public class VnfRollback { protected String cloudSiteId; + protected String cloudOwner; protected MsoRequest msoRequest; protected boolean tenantCreated; protected String tenantId; @@ -92,6 +95,30 @@ public class VnfRollback { } /** + * Gets the value of the cloudOwner property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCloudOwner() { + return cloudOwner; + } + + /** + * Sets the value of the cloudOwner property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCloudOwner(String value) { + this.cloudOwner = value; + } + + /** * Gets the value of the msoRequest property. * * @return @@ -201,6 +228,7 @@ public class VnfRollback { return "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' + + "<cloudOwner>"+cloudOwner+"</cloudOwner>" + '\n' + msoRequestElement + "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' + "<tenantId>"+tenantId+"</tenantId>" + '\n' + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index f795bcc40e..3eed14bc30 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -53,7 +53,6 @@ import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl; import org.camunda.bpm.model.bpmn.instance.EndEvent; import org.camunda.bpm.model.bpmn.instance.FlowNode; import org.camunda.bpm.model.bpmn.instance.StartEvent; -import org.onap.so.bpmn.core.BPMNLogger; import org.slf4j.Logger; @@ -71,11 +70,11 @@ import org.springframework.stereotype.Component; * Plugin for MSO logging and URN mapping. */ @Component -public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { - +public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { + @Autowired private LoggingParseListener loggingParseListener; - + @Override public void preInit( ProcessEngineConfigurationImpl processEngineConfiguration) { @@ -87,14 +86,14 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { } preParseListeners.add(loggingParseListener); } - + /** * Called when a process flow is parsed so we can inject listeners. */ @Component - public class LoggingParseListener extends AbstractBpmnParseListener { - - + public class LoggingParseListener extends AbstractBpmnParseListener { + + private void injectLogExecutionListener(ActivityImpl activity) { activity.addListener( ExecutionListener.EVENTNAME_END, @@ -115,7 +114,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { @Override public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) { - // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events + // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events injectLogExecutionListener(startEventActivity); } @@ -275,15 +274,15 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { injectLogExecutionListener(messageActivity); } } - + /** * Logs details about the current activity. - */ + */ public class LoggingExecutionListener implements ExecutionListener { private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class); private String event; - + public LoggingExecutionListener() { this.event = ""; } @@ -291,31 +290,31 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { public LoggingExecutionListener(String event) { this.event = event; } - + public String getEvent() { return event; } @Override - public void notify(DelegateExecution execution) throws Exception { + public void notify(DelegateExecution execution) throws Exception { //required for legacy groovy processing in camunda execution.setVariable("isDebugLogEnabled", "true"); if (!isBlank(execution.getCurrentActivityName())) { try { - + String id = execution.getId(); - if (id != null ) { + if (id != null ) { RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService(); String processName = repositoryService.createProcessDefinitionQuery() .processDefinitionId(execution.getProcessDefinitionId()) .singleResult() - .getName(); + .getName(); + - String requestId = (String) execution.getVariable("mso-request-id"); String svcid = (String) execution.getVariable("mso-service-instance-id"); } - } catch(Exception e) { + } catch(Exception e) { logger.error("Exception occurred", e); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java index 9b8f6cd5cc..8bc0055343 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -40,9 +42,10 @@ import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; import org.camunda.bpm.engine.impl.util.xml.Element; -import org.onap.so.bpmn.core.BPMNLogger; import org.onap.so.bpmn.core.WorkflowException; import org.springframework.stereotype.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This plugin does the following: @@ -60,7 +63,8 @@ import org.springframework.stereotype.Component; */ @Component public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { - + private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class); + @Override public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { List<BpmnParseListener> preParseListeners = @@ -73,7 +77,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { preParseListeners.add(new WorkflowExceptionParseListener()); } - + public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener { @Override public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) { @@ -131,7 +135,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { } } } - + /** * If there is a WorkflowException object in the execution, this method * removes it (saving a copy of it in a different variable). @@ -147,8 +151,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { saveName = "SavedWorkflowException" + (++index); } - BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), - "WorkflowExceptionResetTask is moving WorkflowException to " + saveName); + logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName); execution.setVariable(saveName, workflowException); execution.setVariable("WorkflowException", null); @@ -163,8 +166,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { public static class WorkflowExceptionTriggerTask implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), - "WorkflowExceptionTriggerTask is generating a MSOWorkflowException event"); + logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event"); throw new BpmnError("MSOWorkflowException"); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java index ad08f8b2bb..1ef864b543 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java @@ -59,6 +59,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { private final String CREATE_VF_MODULE_REQUEST = "<createVfModuleRequest>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleName>vfModuleName</vfModuleName>" + EOL + @@ -94,6 +95,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { private final String UPDATE_VF_MODULE_REQUEST = "<updateVfModuleRequest>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleName>vfModuleName</vfModuleName>" + EOL + @@ -130,6 +132,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { private final String DELETE_VF_MODULE_REQUEST = "<deleteVfModuleRequest>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + @@ -150,6 +153,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { " <skipAAI>true</skipAAI>" + EOL + " <vfModuleRollback>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + @@ -186,6 +190,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL + " <vfModuleCreated>true</vfModuleCreated>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 117d3b213a..eed2978bc7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -1100,6 +1100,10 @@ public abstract class WorkflowTest { "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()"); rollback.setCloudSiteId(cloudSiteId); + String cloudOwner = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()"); + rollback.setCloudOwner(cloudOwner); + String requestId = xpathTool.evaluate( "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); String serviceInstanceId = xpathTool.evaluate( @@ -1276,6 +1280,10 @@ public abstract class WorkflowTest { "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()"); rollback.setCloudSiteId(cloudSiteId); + String cloudOwner = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()"); + rollback.setCloudOwner(cloudOwner); + String requestId = xpathTool.evaluate( "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); String serviceInstanceId = xpathTool.evaluate( |