aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy34
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy205
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy95
-rw-r--r--bpmn/MSOCoreBPMN/pom.xml2
-rw-r--r--bpmn/MSORESTClient/pom.xml2
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java75
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java30
-rw-r--r--bpmn/pom.xml2
-rw-r--r--bpmn/so-bpmn-building-blocks/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java48
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java50
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java22
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml2
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml2
22 files changed, 260 insertions, 349 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index 456b8ae074..26379882f2 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>MSOCommonBPMN</artifactId>
<name>MSOCommonBPMN</name>
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
index 3bbc4bd110..d4777e234c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.RollbackData
-import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
@@ -29,7 +28,6 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
-import org.springframework.web.util.UriUtils
public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModule.class);
@@ -163,7 +161,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
String aaiNamespace = aaiUriUtil.getNamespace()
msoLogger.debug('AAI namespace is: ' + aaiNamespace)
- execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}")
+ execution.setVariable("CAAIVfMod_aaiNamespace",aaiNamespace)
}
@@ -212,8 +210,6 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// process the result from queryAAIForGenericVnf()
// note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
public void processAAIGenericVnfQuery(DelegateExecution execution) {
- def result = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
-
if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
msoLogger.debug("New Generic VNF requested and it does not already exist")
@@ -310,7 +306,6 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
moduleIndex = aaiUtil.getLowestUnusedVfModuleIndexFromAAIVnfResponse(execution, aaiVnfResponse,
fieldToCheck, personaModelId)
}
- def moduleIndexString = String.valueOf(moduleIndex)
// if we get to this point, we may be about to create the Vf Module,
// add rollback information about the Generic VNF for this base/add-on module
@@ -366,7 +361,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
String responseOut = ""
String isVidRequest = execution.getVariable("isVidRequest")
-
+ def moduleIndexString = String.valueOf(moduleIndex)
if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) {
responseOut = """<CreateAAIVfModuleResponse>
@@ -411,20 +406,18 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
for (String qryModuleName : qryModuleNameList) {
if (newModuleName.equals(qryModuleName)) {
// a module with the requested name already exists - failure
- msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_moduleExists", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ "VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
break
}
}
}
if (execution.getVariable("CAAIVfMod_moduleExists") == false) {
- msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + newModuleName + " does not exist for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ "VF Module " + newModuleName + " does not exist for Generic VNF " + vnfNameFromAAI)
}
}
@@ -445,11 +438,10 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
for (String qryModuleName : qryModuleNameList) {
if (newModuleName.equals(qryModuleName)) {
// a module with the requested name already exists - failure
- msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_baseModuleConflict", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ "VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
break
}
}
@@ -460,21 +452,19 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
for (String baseValue : isBaseVfModuleList) {
if (baseValue.equals("true")) {
// a base module already exists in this VNF - failure
- msoLogger.debug("Base VF Module already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ msoLogger.debug("Base VF Module already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_baseModuleConflict", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
- "Base VF Module already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ "Base VF Module already exists for Generic VNF " + vnfNameFromAAI)
break
}
}
}
- if (execution.getVariable("CAAIVfMod_moduleExists") == false && execution.getVariable("CAAIVfMod_baseModuleConflict") == false) {
+ if (execution.getVariable("CAAIVfMod_baseModuleConflict") == false) {
msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + newModuleName + " does not exist for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ "VF Module " + newModuleName + " does not exist for Generic VNF " + vnfNameFromAAI)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy
new file mode 100644
index 0000000000..999a12c869
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy
@@ -0,0 +1,205 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2018 Nokia.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.scripts
+
+import joptsimple.internal.Strings
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake
+import org.junit.Before
+import org.junit.Test
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.springframework.core.env.Environment
+
+import static org.assertj.core.api.Assertions.assertThat
+import static org.mockito.Mockito.mock
+import static org.mockito.Mockito.when
+
+class CreateAAIVfModuleTest {
+
+ private static final String VNF_ID = "vnfIdTest"
+ private static final String VNF_TYPE = "vnfTypeTest"
+ private static final String VNF_NAME = "testVnf"
+ private static final String SERVICE_ID = "123"
+ private static final String PERSONAL_MODEL_ID = "modelTest"
+ private static final String PERSONAL_MODEL_VERSION = "12"
+ private static final String MODEL_CUST_ID = "modelCustIdTest"
+ private static final String VNF_PERSONAL_MODEL_ID = "perModIdTest"
+ private static final String VNF_PERSONAL_MODEL_VER = "14"
+ private static final String VF_MODULE_NAME = "modTestName"
+ private static final String VF_MODULE_MODEL_NAME = "modModelNameTest"
+ private static final String DEFAULT_AAI_VERSION = "9"
+ private static final String DEFAULT_AAI_NAMESPACE = "defaultTestNamespace"
+
+ private CreateAAIVfModule testedObject
+ private DelegateExecutionFake executionFake
+
+ @Before
+ void setupTest() {
+ testedObject = new CreateAAIVfModule()
+ executionFake = new DelegateExecutionFake()
+ }
+
+ @Test
+ void preProcessRequest_successful() {
+ //given
+ prepareUrnPropertiesReader()
+ executionFake.setVariable("vnfId", VNF_ID)
+ executionFake.setVariable("vnfType", VNF_TYPE)
+ executionFake.setVariable("vnfName", VNF_NAME)
+ executionFake.setVariable("serviceId", SERVICE_ID)
+ executionFake.setVariable("personaModelId", PERSONAL_MODEL_ID)
+ executionFake.setVariable("personaModelVersion", PERSONAL_MODEL_VERSION)
+ executionFake.setVariable("modelCustomizationId", MODEL_CUST_ID)
+ executionFake.setVariable("vnfPersonaModelId", VNF_PERSONAL_MODEL_ID)
+ executionFake.setVariable("vnfPersonaModelVersion", VNF_PERSONAL_MODEL_VER)
+ executionFake.setVariable("isBaseVfModule", "true")
+ executionFake.setVariable("vfModuleName", VF_MODULE_NAME)
+ executionFake.setVariable("vfModuleModelName", VF_MODULE_MODEL_NAME)
+ //when
+ testedObject.preProcessRequest(executionFake)
+ //then
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfId")).isEqualTo(VNF_ID)
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfName")).isEqualTo(VNF_NAME)
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfType")).isEqualTo(VNF_TYPE)
+ assertThat(executionFake.getVariable("CAAIVfMod_serviceId")).isEqualTo(SERVICE_ID)
+ assertThat(executionFake.getVariable("CAAIVfMod_personaId")).isEqualTo(PERSONAL_MODEL_ID)
+ assertThat(executionFake.getVariable("CAAIVfMod_personaVer")).isEqualTo(PERSONAL_MODEL_VERSION)
+ assertThat(executionFake.getVariable("CAAIVfMod_modelCustomizationId")).isEqualTo(MODEL_CUST_ID)
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfPersonaId")).isEqualTo(VNF_PERSONAL_MODEL_ID)
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfPersonaVer")).isEqualTo(VNF_PERSONAL_MODEL_VER)
+ assertThat(executionFake.getVariable("CAAIVfMod_isBaseVfModule")).isEqualTo(true)
+ assertThat(executionFake.getVariable("CAAIVfMod_moduleName")).isEqualTo(VF_MODULE_NAME)
+ assertThat(executionFake.getVariable("CAAIVfMod_moduleModelName")).isEqualTo(VF_MODULE_MODEL_NAME)
+ assertThat(executionFake.getVariable("CAAIVfMod_aaiNamespace"))
+ .isEqualTo(DEFAULT_AAI_NAMESPACE + "v" + DEFAULT_AAI_VERSION)
+ }
+
+ @Test
+ void processAAIGenericVnfQuery_setVnfResponse() {
+ executionFake.setVariable("CAAIVfMod_queryGenericVnfResponseCode", 200)
+ executionFake.setVariable("CAAIVfMod_vnfId", Strings.EMPTY)
+ executionFake.setVariable("CAAIVfMod_vnfName", VNF_NAME)
+
+ testedObject.processAAIGenericVnfQuery(executionFake)
+
+ assertThat(executionFake.getVariable("CAAIVfMod_queryGenericVnfResponse"))
+ .isEqualTo("Invalid request for new Generic VNF which already exists, Vnf Name=" + VNF_NAME)
+ }
+
+ @Test
+ void processAAIGenericVnfQuery_setVfModuleResponse() {
+ executionFake.setVariable("CAAIVfMod_queryGenericVnfResponseCode", 500)
+ executionFake.setVariable("CAAIVfMod_vnfId", VNF_ID)
+
+ testedObject.processAAIGenericVnfQuery(executionFake)
+
+ assertThat(executionFake.getVariable("CAAIVfMod_createVfModuleResponse"))
+ .isEqualTo("Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" + VNF_ID)
+ }
+
+ @Test
+ void parseForAddOnModule_moduleNameFound() {
+ String xml = "<CAAIVfMod_queryGenericVnfResponse><vnf-name>" + VNF_NAME + "</vnf-name>" +
+ "<vf-module-name>" + VF_MODULE_NAME + "</vf-module-name></CAAIVfMod_queryGenericVnfResponse>"
+ executionFake.setVariable("CAAIVfMod_queryGenericVnfResponse", xml)
+ executionFake.setVariable("CAAIVfMod_moduleName", VF_MODULE_NAME)
+
+ testedObject.parseForAddOnModule(executionFake)
+
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfNameFromAAI")).isEqualTo(VNF_NAME)
+ assertThat(executionFake.getVariable("CAAIVfMod_moduleExists")).isEqualTo(true)
+ assertThat(executionFake.getVariable("CAAIVfMod_parseModuleResponse"))
+ .isEqualTo("VF Module " + VF_MODULE_NAME + " already exists for Generic VNF " + VNF_NAME)
+ }
+
+ @Test
+ void parseForAddOnModule_moduleNameNotFound() {
+ String xml = "<CAAIVfMod_queryGenericVnfResponse><vnf-name>" + VNF_NAME + "</vnf-name>" +
+ "</CAAIVfMod_queryGenericVnfResponse>"
+ executionFake.setVariable("CAAIVfMod_queryGenericVnfResponse", xml)
+ executionFake.setVariable("CAAIVfMod_moduleName", VF_MODULE_NAME)
+ executionFake.setVariable("CAAIVfMod_moduleExists", false)
+
+ testedObject.parseForAddOnModule(executionFake)
+
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfNameFromAAI")).isEqualTo(VNF_NAME)
+ assertThat(executionFake.getVariable("CAAIVfMod_moduleExists")).isEqualTo(false)
+ assertThat(executionFake.getVariable("CAAIVfMod_parseModuleResponse"))
+ .isEqualTo("VF Module " + VF_MODULE_NAME + " does not exist for Generic VNF " + VNF_NAME)
+ }
+
+ @Test
+ void parseForBaseModule_moduleNameFound() {
+ String xml = "<CAAIVfMod_queryGenericVnfResponse><vnf-name>" + VNF_NAME + "</vnf-name>" +
+ "<vf-module-name>" + VF_MODULE_NAME + "</vf-module-name></CAAIVfMod_queryGenericVnfResponse>"
+ executionFake.setVariable("CAAIVfMod_queryGenericVnfResponse", xml)
+ executionFake.setVariable("CAAIVfMod_moduleName", VF_MODULE_NAME)
+
+ testedObject.parseForBaseModule(executionFake)
+
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfNameFromAAI")).isEqualTo(VNF_NAME)
+ assertThat(executionFake.getVariable("CAAIVfMod_moduleExists")).isEqualTo(false)
+ assertThat(executionFake.getVariable("CAAIVfMod_baseModuleConflict")).isEqualTo(true)
+ assertThat(executionFake.getVariable("CAAIVfMod_parseModuleResponse"))
+ .isEqualTo("VF Module " + VF_MODULE_NAME + " already exists for Generic VNF " + VNF_NAME)
+ }
+
+ @Test
+ void parseForBaseModule_isBaseVfModule() {
+ String xml = "<CAAIVfMod_queryGenericVnfResponse><vnf-name>" + VNF_NAME + "</vnf-name>" +
+ "<is-base-vf-module>true</is-base-vf-module></CAAIVfMod_queryGenericVnfResponse>"
+ executionFake.setVariable("CAAIVfMod_queryGenericVnfResponse", xml)
+ executionFake.setVariable("CAAIVfMod_baseModuleConflict", false)
+
+ testedObject.parseForBaseModule(executionFake)
+
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfNameFromAAI")).isEqualTo(VNF_NAME)
+ assertThat(executionFake.getVariable("CAAIVfMod_moduleExists")).isEqualTo(false)
+ assertThat(executionFake.getVariable("CAAIVfMod_baseModuleConflict")).isEqualTo(true)
+ assertThat(executionFake.getVariable("CAAIVfMod_parseModuleResponse"))
+ .isEqualTo("Base VF Module already exists for Generic VNF " + VNF_NAME)
+ }
+
+ @Test
+ void parseForBaseModule_baseModuleConflictIsFalse() {
+ String xml = "<CAAIVfMod_queryGenericVnfResponse><vnf-name>" + VNF_NAME + "</vnf-name></CAAIVfMod_queryGenericVnfResponse>"
+ executionFake.setVariable("CAAIVfMod_queryGenericVnfResponse", xml)
+ executionFake.setVariable("CAAIVfMod_baseModuleConflict", false)
+ executionFake.setVariable("CAAIVfMod_moduleName", VF_MODULE_NAME)
+
+ testedObject.parseForBaseModule(executionFake)
+
+ assertThat(executionFake.getVariable("CAAIVfMod_vnfNameFromAAI")).isEqualTo(VNF_NAME)
+ assertThat(executionFake.getVariable("CAAIVfMod_moduleExists")).isEqualTo(false)
+ assertThat(executionFake.getVariable("CAAIVfMod_parseModuleResponse"))
+ .isEqualTo("VF Module " + VF_MODULE_NAME + " does not exist for Generic VNF " + VNF_NAME)
+ }
+
+ private void prepareUrnPropertiesReader() {
+ Environment mockEnvironment = mock(Environment.class)
+ when(mockEnvironment.getProperty("mso.workflow.global.default.aai.version")).thenReturn(DEFAULT_AAI_VERSION)
+ when(mockEnvironment.getProperty("mso.workflow.global.default.aai.namespace")).thenReturn(DEFAULT_AAI_NAMESPACE)
+ UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader()
+ urnPropertiesReader.setEnvironment(mockEnvironment)
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
index 3a2673c9ee..19638f42da 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common.scripts
@@ -30,29 +30,15 @@ import org.junit.Rule
import org.junit.rules.ExpectedException
import org.junit.runner.RunWith
import org.mockito.runners.MockitoJUnitRunner
-import org.onap.aai.domain.yang.GenericVnf
-import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.client.aai.AAIObjectPlurals
-import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
-import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.client.graphinventory.entities.uri.Depth
-import org.onap.so.constants.Defaults
@RunWith(MockitoJUnitRunner.class)
abstract class MsoGroovyTest {
-
+
@Rule
public ExpectedException thrown = ExpectedException.none()
-
protected ExecutionEntity mockExecution
protected AAIResourcesClient client
- protected AllottedResourceUtils allottedResourceUtils_MOCK
- protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA =
- FileUtil.readResourceFile("__files/aai/searchResults.json")
- protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString();
protected void init(String procName){
mockExecution = setupMock(procName)
@@ -63,91 +49,14 @@ abstract class MsoGroovyTest {
protected ExecutionEntity setupMock(String procName) {
ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
when(mockProcessDefinition.getKey()).thenReturn(procName)
-
RepositoryService mockRepositoryService = mock(RepositoryService.class)
when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName)
when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
-
ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
-
ExecutionEntity mockExecution = mock(ExecutionEntity.class)
when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
-
return mockExecution
}
-
- protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) {
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-
- when(mockExecution.getVariable("prefix")).thenReturn(prefix)
-
- ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class)
- RepositoryService repositoryService = mock(RepositoryService.class)
- ProcessDefinition processDefinition = mock(ProcessDefinition.class)
-
- when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices)
- when(processEngineServices.getRepositoryService()).thenReturn(repositoryService)
- when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition)
- when(processDefinition.getKey()).thenReturn(procName)
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- return mockExecution
- }
-
- protected <T> Optional<T> getAAIObjectFromJson(Class<T> clazz , String file){
- String json = FileUtil.readResourceFile(file)
- AAIResultWrapper resultWrapper = new AAIResultWrapper(json)
- return resultWrapper.asBean(clazz)
- }
-
- protected Optional<GenericVnf> mockAAIGenericVnf(String vnfId){
- return mockAAIGenericVnf(vnfId,"__files/aai/GenericVnf.json")
- }
-
- protected Optional<GenericVnf> mockAAIGenericVnf(String vnfId,String file){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
- Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,file);
- when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf)
- when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf)
- return genericVnf
- }
-
- protected Optional<GenericVnf> mockAAIGenericVnfByName(String vnfName){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
- Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnf.json");
- when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf)
- when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf)
- return genericVnf
- }
-
- protected void mockAAIGenericVnfNotFound(String vnfId){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
- when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty())
- when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty())
- }
-
- protected void mockAAIGenericVnfByNameNotFound(String vnfName){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
- when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty())
- when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty())
- }
-
- protected AAIResultWrapper mockVolumeGroupWrapper(String region, String volumeGroupId, String file){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, region,volumeGroupId)
- String json = FileUtil.readResourceFile(file)
- AAIResultWrapper resultWrapper = new AAIResultWrapper(json)
- when(client.get(resourceUri)).thenReturn(resultWrapper)
- return resultWrapper
- }
-
- void initAR(String procName){
- init(procName)
- allottedResourceUtils_MOCK = spy(new AllottedResourceUtils(mock(AbstractServiceTaskProcessor.class)))
- when(allottedResourceUtils_MOCK.getAAIClient()).thenReturn(client)
- }
}
diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml
index fc686e503c..554debad3f 100644
--- a/bpmn/MSOCoreBPMN/pom.xml
+++ b/bpmn/MSOCoreBPMN/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>MSOCoreBPMN</artifactId>
diff --git a/bpmn/MSORESTClient/pom.xml b/bpmn/MSORESTClient/pom.xml
index ee5bdff485..a56afb0c0c 100644
--- a/bpmn/MSORESTClient/pom.xml
+++ b/bpmn/MSORESTClient/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>MSORESTClient</artifactId>
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index 77e2fa27d3..b410a2d405 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mso-infrastructure-bpmn</artifactId>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
index f274850b8d..02164ccec1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
@@ -35,7 +35,6 @@ import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
/**
@@ -130,11 +129,9 @@ public class CallbackHandlerService {
* @param variables variables to inject into the process
* @param logMarker a marker for debug logging
* @return true if a process could be found, false if not
- * @throws Exception for correlation errors
*/
protected boolean correlate(String messageEventName, String correlationVariable,
- String correlationValue, Map<String, Object> variables, String logMarker)
- throws Exception {
+ String correlationValue, Map<String, Object> variables, String logMarker) {
try{
LOGGER.debug(logMarker + " Attempting to find process waiting"
+ " for " + messageEventName + " with " + correlationVariable
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
index 0e9e1425a6..8ceb1c1277 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
@@ -23,8 +23,6 @@ package org.onap.so.bpmn.common.workflow.service;
import java.util.Optional;
-import javax.ws.rs.ext.Provider;
-
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.ProcessEngines;
import org.springframework.stereotype.Service;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index ae9cec9476..96a11d21a7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -49,8 +49,6 @@ import org.springframework.stereotype.Service;
@Service
public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterNotifyServiceImpl.class);
-
private final String logMarker = "[VNF-NOTIFY]";
@Autowired
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 9ed36e5ba9..014b06deff 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
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.common.workflow.service;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
-import java.util.Optional;
import java.util.UUID;
import javax.ws.rs.Consumes;
@@ -67,10 +66,7 @@ import io.swagger.annotations.ApiOperation;
public class WorkflowAsyncResource extends ProcessEngineAwareService {
private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
-
-
- protected Optional<ProcessEngineServices> pes4junit = Optional.empty();
-
+
long workflowPollInterval=1000;
@Autowired
@@ -79,12 +75,6 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
@Autowired
private WorkflowContextHolder workflowContext;
- public WorkflowProcessor getProcessor() {
- return processor;
- }
-
-
-
public void setProcessor(WorkflowProcessor processor) {
this.processor = processor;
}
@@ -138,14 +128,6 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
throw new Exception("TimeOutOccured");
}
- private WorkflowResponse buildTimeoutResponse(String requestId) {
- WorkflowResponse response = new WorkflowResponse();
- response.setMessage("Fail");
- response.setResponse("Request timedout, request id:" + requestId);
- response.setMessageCode(500);
- return response;
- }
-
private WorkflowResponse buildUnkownError(String requestId,String error) {
WorkflowResponse response = new WorkflowResponse();
response.setMessage(error);
@@ -166,46 +148,11 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
}
return value;
}
-
- // Note: the business key is used to identify the process in unit tests
- protected static String getBusinessKey(Map<String, Object> inputVariables) {
- return getOrCreate(inputVariables, "mso-business-key");
- }
protected static String getRequestId(Map<String, Object> inputVariables) {
return getOrCreate(inputVariables, "mso-request-id");
}
-
-
- protected void recordEvents(String processKey, WorkflowResponse response,
- long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- response.getMessage() + "for processKey: " + processKey + " with response: " + response.getResponse());
-
- }
-
- protected static void setLogContext(String processKey,
- Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"serviceInstanceId"));
- }
- }
-
- protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- if (inputVariables == null) {
- return "";
- }
-
- return Objects.toString(inputVariables.get(key), "N/A");
- }
-
protected boolean isProcessEnded(String processInstanceId) {
ProcessEngineServices pes = getProcessEngineServices();
return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
@@ -224,25 +171,5 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
}
return inputVariables;
}
-
-
- protected long getWaitTime(Map<String, Object> inputVariables)
- {
-
- String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null);
-
- if (timeout != null) {
- try {
- return Long.parseLong(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
-
- return DEFAULT_WAIT_TIME;
- }
-
-
-
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index 9ea97258ef..5afd7e00e8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -38,12 +38,10 @@ import org.springframework.stereotype.Service;
public class WorkflowProcessor extends ProcessEngineAwareService {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowProcessor.class);
-
protected static final String logMarker = "[WRKFLOW-RESOURCE]";
- protected static final long DEFAULT_WAIT_TIME = 30000; //default wait time
@Async
- public void startProcess( String processKey, VariableMapImpl variableMap) throws InterruptedException
+ public void startProcess( String processKey, VariableMapImpl variableMap)
{
long startTime = System.currentTimeMillis();
@@ -80,23 +78,12 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
throw new WorkflowProcessorException(workflowResponse);
}
}
-
- protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- if (inputVariables == null) {
- return "";
- }
- return Objects.toString(inputVariables.get(key), "N/A");
- }
-
// Note: the business key is used to identify the process in unit tests
protected static String getBusinessKey(Map<String, Object> inputVariables) {
return getOrCreate(inputVariables, "mso-business-key");
}
- protected static String getRequestId(Map<String, Object> inputVariables) {
- return getOrCreate(inputVariables, "mso-request-id");
- }
protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
Map<String, Object> inputVariables = new HashMap<>();
@@ -120,20 +107,5 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
}
return value;
}
-
- protected long getWaitTime(Map<String, Object> inputVariables)
- {
-
- String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null);
- if (timeout != null) {
- try {
- return Long.parseLong(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
-
- return DEFAULT_WAIT_TIME;
- }
}
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index 4e36b775f5..290e5099a2 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>bpmn</artifactId>
diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml
index a523c1e676..675ceb55b8 100644
--- a/bpmn/so-bpmn-building-blocks/pom.xml
+++ b/bpmn/so-bpmn-building-blocks/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-building-blocks</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 55d5d9244e..d485c8a32d 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-common</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
index b49c4211b1..8e57121876 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
@@ -24,13 +24,11 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
import java.io.IOException;
+
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -41,14 +39,11 @@ import org.springframework.stereotype.Component;
* - correlationId - String
*
* Outputs:
- * - AAI_CONTAINS_INFO_ABOUT_PNF - local Boolean
- * - aaiContainsInfoAboutIp - local Boolean
+ * - aaiContainsInfoAboutPnf - local Boolean
*/
@Component
public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, CheckAaiForCorrelationIdDelegate.class);
- private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation();
private AaiConnection aaiConnection;
@Autowired
@@ -57,18 +52,15 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
}
@Override
- public void execute(DelegateExecution execution) throws Exception {
+ public void execute(DelegateExecution execution) {
String correlationId = (String) execution.getVariable(CORRELATION_ID);
if (correlationId == null) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
}
-
try {
- AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection);
-
- execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf());
+ boolean isEntry = aaiConnection.getEntryFor(correlationId).isPresent();
+ execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
} catch (IOException e) {
- LOGGER.error("IOException",e);
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
index 164f51f579..94fb6a8674 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
+import com.google.common.base.Strings;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
@@ -46,11 +47,11 @@ public class PnfCheckInputs implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
String correlationId = (String) execution.getVariable(CORRELATION_ID);
- if (correlationId == null) {
+ if (Strings.isNullOrEmpty(correlationId)) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined");
}
String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION);
- if (timeout == null) {
+ if (Strings.isNullOrEmpty(timeout)) {
LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default");
if (defaultTimeout == null) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java
deleted file mode 100644
index 32ecff102f..0000000000
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.infrastructure.pnf.implementation;
-
-import java.util.Optional;
-import javax.annotation.Nullable;
-import javax.validation.constraints.NotNull;
-
-public enum AaiResponse {
- NO_ENTRY(false, false),
- ENTRY_NO_IP(true, false),
- ENTRY_WITH_IP(true, true);
-
- private boolean containsInfoAboutPnf;
- private boolean containsInfoAboutIp;
-
- AaiResponse(boolean containsInfoAboutPnf, boolean containsInfoAboutIp) {
- this.containsInfoAboutPnf = containsInfoAboutPnf;
- this.containsInfoAboutIp = containsInfoAboutIp;
- }
-
- public boolean getContainsInfoAboutPnf() {
- return containsInfoAboutPnf;
- }
-
- public boolean getContainsInfoAboutIp() {
- return containsInfoAboutIp;
- }
-
-}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java
deleted file mode 100644
index e5fc87db91..0000000000
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.infrastructure.pnf.implementation;
-
-import java.io.IOException;
-import java.util.Optional;
-import org.onap.aai.domain.yang.Pnf;
-
-public class CheckAaiForCorrelationIdImplementation {
-
- public AaiResponse check(String correlationId, AaiConnection aaiConnection) throws IOException {
- Optional<Pnf> pnf = aaiConnection.getEntryFor(correlationId);
- if (!pnf.isPresent()) {
- return AaiResponse.NO_ENTRY;
- }
-
- if(extractIp(pnf.get()).isPresent()) {
- return AaiResponse.ENTRY_WITH_IP;
- } else {
- return AaiResponse.ENTRY_NO_IP;
- }
- }
-
- private Optional<String> extractIp(Pnf pnf) {
- if (pnf.getIpaddressV4Oam() != null) {
- return Optional.of(pnf.getIpaddressV4Oam());
- } else {
- return Optional.ofNullable(pnf.getIpaddressV6Oam());
- }
- }
-
-}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
index 2e8fb4be78..1f3ecce341 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
@@ -52,6 +52,16 @@ public class PnfCheckInputsTest {
assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
}
+ @Test
+ public void shouldThrowException_whenPnfIdIsEmptyString() throws Exception {
+ // given
+ PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ DelegateExecution delegateExecution = mockDelegateExecution();
+ when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("");
+ // when, then
+ assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
+ }
+
private DelegateExecution mockDelegateExecutionWithCorrelationId() {
new PnfCheckInputs(DEFAULT_TIMEOUT);
DelegateExecution delegateExecution = mockDelegateExecution();
@@ -69,6 +79,16 @@ public class PnfCheckInputsTest {
}
@Test
+ public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() throws Exception {
+ // given
+ PnfCheckInputs testedObject = new PnfCheckInputs(null);
+ DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
+ when(delegateExecution.getVariable(TIMEOUT_FOR_NOTIFICATION)).thenReturn("");
+ // when, then
+ assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
+ }
+
+ @Test
public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() {
// given
PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
@@ -78,4 +98,4 @@ public class PnfCheckInputsTest {
// then
verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(DEFAULT_TIMEOUT));
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index 7d7b89c8fb..7a00d1281c 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-flows</artifactId>
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index d46f13434f..c80d683fa8 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-tasks</artifactId>