aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-01-21 20:42:51 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-21 20:42:51 +0000
commit244b9781a51c6172797f2ec8193399d1233778cc (patch)
tree69342e891b8fc7dab956722a7fc69c1e4c45ba77 /bpmn/MSOCommonBPMN/src
parente05094129320f3ffb1ec01fb4af1b601b4282f81 (diff)
parent63bee11f255fcd2cc39a3d87c208aa6e517a8f85 (diff)
Merge "Bug fixes from AT&T January 20th"
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml1
5 files changed, 25 insertions, 24 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 9e71313e09..57af763ed5 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -20,8 +20,6 @@
package org.onap.so.bpmn.common.scripts;
-import groovy.json.JsonSlurper
-
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.camunda.bpm.engine.variable.VariableMap
@@ -30,11 +28,13 @@ import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats
import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder
-import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIResourcesClient
import org.springframework.web.util.UriUtils
+import groovy.json.JsonSlurper
+
public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor {
public MsoUtils utils = new MsoUtils()
@@ -767,4 +767,4 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
public AAIResourcesClient getAAIClient(){
return new AAIResourcesClient();
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index 9fd16340b6..f96e3bea0e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -174,7 +174,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId')
String newPersonaModelVersion = execution.getVariable('UAAIGenVnf_personaModelVersion')
- String personaModelVersionEntry = ""
+ String personaModelVersionEntry = null
if (newPersonaModelId != null || newPersonaModelVersion != null) {
if (newPersonaModelId != genericVnf.getModelInvariantId()) {
def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values'
@@ -188,7 +188,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Handle ipv4-oam-address
String ipv4OamAddress = execution.getVariable('UAAIGenVnf_ipv4OamAddress')
- String ipv4OamAddressEntry = ""
+ String ipv4OamAddressEntry = null
if (ipv4OamAddress != null) {
// Construct payload
ipv4OamAddressEntry = updateGenericVnfNode(origRequest, 'ipv4-oam-address')
@@ -196,7 +196,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Handle management-v6-address
String managementV6Address = execution.getVariable('UAAIGenVnf_managementV6Address')
- String managementV6AddressEntry = ""
+ String managementV6AddressEntry = null
if (managementV6Address != null) {
// Construct payload
managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address')
@@ -204,21 +204,19 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Handle orchestration-status
String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus')
- String orchestrationStatusEntry = ""
+ String orchestrationStatusEntry = null
if (orchestrationStatus != null) {
// Construct payload
orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status')
}
-
- String payload = """
- { ${personaModelVersionEntry}
- ${ipv4OamAddressEntry}
- ${managementV6AddressEntry}
- ${orchestrationStatusEntry}
- "vnf-id": "${vnfId}"
- }
- """
-
+
+ org.onap.aai.domain.yang.GenericVnf payload = new org.onap.aai.domain.yang.GenericVnf();
+ payload.setVnfId(vnfId)
+ payload.setPersonaModelVersion(personaModelVersionEntry)
+ payload.setIpv4OamAddress(ipv4OamAddressEntry)
+ payload.setManagementV6Address(managementV6AddressEntry)
+ payload.setOrchestrationStatus(orchestrationStatusEntry)
+
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
try {
@@ -246,16 +244,16 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
public String updateGenericVnfNode(String origRequest, String elementName) {
if (!utils.nodeExists(origRequest, elementName)) {
- return ""
+ return null
}
def elementValue = utils.getNodeText(origRequest, elementName)
if (elementValue == 'DELETE') {
- // Set the element being deleted to null
- return """"${elementName}": null,"""
+ // Set the element being deleted to empty string
+ return ""
}
else {
- return """"${elementName}": "${elementValue}","""
+ return elementValue
}
}
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 6c2df13c61..d2e0b07dd1 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
@@ -53,6 +53,7 @@ public class ExecuteBuildingBlockRainyDay {
@Autowired
private Environment environment;
protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier";
+ protected String defaultCode = "mso.rainyDay.defaultCode";
public void setRetryTimer(DelegateExecution execution) {
try {
@@ -149,7 +150,8 @@ public class ExecuteBuildingBlockRainyDay {
execution.setVariable(HANDLING_CODE, handlingCode);
} catch (Exception e) {
msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = Abort");
- execution.setVariable(HANDLING_CODE, "Abort");
+ String code = this.environment.getProperty(defaultCode);
+ execution.setVariable(HANDLING_CODE, code);
}
}
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 9af9b2f2c9..cb5683dcc8 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
@@ -21,7 +21,7 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
index 1651f4f1fc..18f94f3b88 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
@@ -110,6 +110,7 @@ mso:
rollback: 'true'
rainyDay:
retryDurationMultiplier: '2'
+ defaultCode: Abort
site-name: localDevEnv
workflow:
default: