10/31: merge casablanca to master 47/71547/2
authorRob Daugherty <rd472p@att.com>
Wed, 31 Oct 2018 14:21:22 +0000 (10:21 -0400)
committerRob Daugherty <rd472p@att.com>
Wed, 31 Oct 2018 14:38:00 +0000 (10:38 -0400)
Commit: 649c4e85cc991ffe9c13fd3fab4cc3a303faa656
Subject: Fix Error, Check that vimID is present
Issue: SO-1156
https://gerrit.onap.org/r/#/c/71247/

Commit: 959493d3274d2f2749586248cf31ee12b730e2af
Subject: Bug fixes October 26th
Issue: SO-1169
https://gerrit.onap.org/r/#/c/71343/

Commit: 373c057bfa82583f615ea46814ad3cdf9ea8d669
Subject: Resolve vf_module_id setting bug
Issue: SO-1165
https://gerrit.onap.org/r/#/c/71270/

Commit: 6c2c8a66fade016f74b51bdfea3ba04494530b97
Issue: SO-1102
Subject: Pnf Spring Environment correction
https://gerrit.onap.org/r/#/c/71137/

Change-Id: I22b4566050f627e1f1428aacdb52ec4d4fe75733
Issue-ID: SO-1173
Signed-off-by: Rob Daugherty <rd472p@att.com>
51 files changed:
adapters/mso-adapter-utils/pom.xml
adapters/mso-adapters-rest-interface/pom.xml
adapters/mso-catalog-db-adapter/pom.xml
adapters/mso-openstack-adapters/pom.xml
adapters/mso-requests-db-adapter/pom.xml
adapters/mso-sdnc-adapter/pom.xml
adapters/mso-vfc-adapter/pom.xml
adapters/pom.xml
asdc-controller/pom.xml
bpmn/MSOCommonBPMN/pom.xml
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
bpmn/MSOCoreBPMN/pom.xml
bpmn/MSORESTClient/pom.xml
bpmn/mso-infrastructure-bpmn/pom.xml
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
bpmn/pom.xml
bpmn/so-bpmn-building-blocks/pom.xml
bpmn/so-bpmn-infrastructure-common/pom.xml
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java [deleted file]
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java [deleted file]
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
bpmn/so-bpmn-infrastructure-flows/pom.xml
bpmn/so-bpmn-tasks/pom.xml
cloudify-client/pom.xml
cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java
common/pom.xml
cxf-logging/pom.xml
deployment-configs/pom.xml
docs/release_notes/release-notes.rst
mso-api-handlers/mso-api-handler-common/pom.xml
mso-api-handlers/mso-api-handler-infra/pom.xml
mso-api-handlers/mso-requests-db-repositories/pom.xml
mso-api-handlers/mso-requests-db/pom.xml
mso-api-handlers/pom.xml
mso-catalog-db/pom.xml
packages/docker/pom.xml
packages/pom.xml
pom.xml
so-monitoring/pom.xml
so-monitoring/so-monitoring-handler/pom.xml
so-monitoring/so-monitoring-service/pom.xml
so-monitoring/so-monitoring-ui/pom.xml
version.properties

index b0687ed..f94d5d6 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>adapters</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
        <groupId>org.onap.so.adapters</groupId>
        <artifactId>mso-adapter-utils</artifactId>
index 7e341f0..a23cb62 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>adapters</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
        <groupId>org.onap.so.adapters</groupId>
        <artifactId>mso-adapters-rest-interface</artifactId>
index e8db6be..2e58bef 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>adapters</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <groupId>org.onap.so.adapters</groupId>
                        <version>1.0.5</version>
                </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
index db25f5c..4191b52 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>adapters</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
        <artifactId>mso-openstack-adapters</artifactId>
        <packaging>jar</packaging>
index 9dff66b..19cfc59 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>adapters</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <groupId>org.onap.so.adapters</groupId>
index 7723ffa..cd7bf6d 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>adapters</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
        <artifactId>mso-sdnc-adapter</artifactId>
        <properties>
                        <version>${project.version}</version>
                </dependency>
        </dependencies>
-</project>
\ No newline at end of file
+</project>
index 4d1c612..3698284 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>adapters</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
        <groupId>org.onap.so.adapters</groupId>
        <artifactId>mso-vfc-adapter</artifactId>
index cb14a48..634a161 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>so</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <artifactId>adapters</artifactId>
@@ -37,4 +37,4 @@
                        <version>1.2.4.RELEASE</version>
                </dependency>
        </dependencies>
-</project>
\ No newline at end of file
+</project>
index 9ea3977..68be57f 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>so</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>                  
 
        <groupId>org.onap.so</groupId>
index 456b8ae..2637988 100644 (file)
@@ -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>
index 3bbc4bd..d4777e2 100644 (file)
@@ -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 (file)
index 0000000..999a12c
--- /dev/null
@@ -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)
+    }
+
+}
index 3a2673c..19638f4 100644 (file)
@@ -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)
-    }
 }
index fc686e5..554deba 100644 (file)
@@ -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>
index ee5bdff..a56afb0 100644 (file)
@@ -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>
index 77e2fa2..b410a2d 100644 (file)
@@ -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>
index f274850..02164cc 100644 (file)
@@ -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
index 0e9e142..8ceb1c1 100644 (file)
@@ -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;
index ae9cec9..96a11d2 100644 (file)
@@ -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
index 9ed36e5..014b06d 100644 (file)
@@ -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;
-       }
-       
-       
-       
 
 }
index 9ea9725..5afd7e0 100644 (file)
@@ -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;
-       }
 }
index 4e36b77..290e509 100644 (file)
@@ -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>
index a523c1e..675ceb5 100644 (file)
@@ -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>
index 55d5d92..d485c8a 100644 (file)
@@ -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>
index b49c421..8e57121 100644 (file)
@@ -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());
         }
     }
index 164f51f..94fb6a8 100644 (file)
@@ -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 (file)
index 32ecff1..0000000
+++ /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 (file)
index e5fc87d..0000000
+++ /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());
-        }
-    }
-
-}
index 2e8fb4b..1f3ecce 100644 (file)
@@ -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();
@@ -68,6 +78,16 @@ public class PnfCheckInputsTest {
         assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
     }
 
+    @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
@@ -78,4 +98,4 @@ public class PnfCheckInputsTest {
         // then
         verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(DEFAULT_TIMEOUT));
     }
-}
\ No newline at end of file
+}
index 7d7b89c..7a00d12 100644 (file)
@@ -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>
index d46f134..c80d683 100644 (file)
@@ -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>
index 38aff4c..44242e9 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>so</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <groupId>org.onap.so</groupId>
@@ -46,4 +46,4 @@
                        <version>2.6</version>
                </dependency>
        </dependencies>
-</project>
\ No newline at end of file
+</project>
index 9a05602..b631dab 100644 (file)
@@ -28,6 +28,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
 import org.apache.http.ProtocolException;
 import org.apache.http.client.methods.HttpDelete;
 import org.apache.http.client.methods.HttpGet;
@@ -87,6 +88,23 @@ public class HttpClientRedirectStrategyTest {
         assertThat(httpUriRequest.getURI()).isEqualTo(expectedUri);
     }
 
+    @Test
+    public void getRedirect_shouldReturnHttpGetUri_byDefault() throws URISyntaxException, ProtocolException {
+        // GIVEN
+        HttpRequest request = mock(HttpRequest.class, RETURNS_DEEP_STUBS);
+        given(request.getRequestLine().getMethod()).willReturn(HttpPost.METHOD_NAME);
+        HttpResponse response = mock(HttpResponse.class, RETURNS_DEEP_STUBS);
+        given(response.getStatusLine().getStatusCode()).willReturn(HttpStatus.SC_ACCEPTED);
+        URI expectedUri = new URI("http://localhost/host");
+        HttpContext context = null;
+        // WHEN
+        HttpUriRequest httpUriRequest = new TestableHttpClientRedirectStrategy(expectedUri)
+            .getRedirect(request, response, context);
+        // THEN
+        assertThat(httpUriRequest).isInstanceOf(HttpGet.class);
+        assertThat(httpUriRequest.getURI()).isEqualTo(expectedUri);
+    }
+
     private static class TestableHttpClientRedirectStrategy extends HttpClientRedirectStrategy {
 
         private final URI expectedUri;
index 4427b37..735b132 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
         <groupId>org.onap.so</groupId>
         <artifactId>so</artifactId>
-        <version>1.3.0-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
        </parent>
        <artifactId>common</artifactId>
        <name>MSO Common classes</name>
index 42e5308..3f4c99e 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
         <groupId>org.onap.so</groupId>
         <artifactId>so</artifactId>
-        <version>1.3.0-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
        </parent>
        <name>CXFLogging</name>
        <description>Common CXF Logging Classes</description>
index 7a2e5b8..704ca4e 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.onap.so</groupId>
     <artifactId>so</artifactId>
-    <version>1.3.0-SNAPSHOT</version>
+    <version>1.4.0-SNAPSHOT</version>
   </parent>
   <artifactId>deployment-configs</artifactId>
   <name>deployment-configs</name>
index f9c7002..8e4d699 100644 (file)
@@ -47,7 +47,7 @@ The Beijing release is the second release of the Service Orchestrator (SO) proje
 
 **Known Issues**
 
-       SO docker image is still on ecmop and not onap in the repository. 
+       SO docker image is still on ECOMP and not onap in the repository. 
        This will be addressed in the next release.
 
 **Security Notes**
index b20d64c..eb9b394 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>mso-api-handlers</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
 
index aaa9b41..2b2bec9 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>mso-api-handlers</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
 
index a46111b..954b9ee 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>mso-api-handlers</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <artifactId>mso-requests-db-repositories</artifactId>
@@ -52,4 +52,4 @@
        <build>
                <finalName>${project.artifactId}</finalName>            
        </build>
-</project>
\ No newline at end of file
+</project>
index 5ef683b..82bf6af 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>mso-api-handlers</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <artifactId>mso-requests-db</artifactId>
@@ -36,4 +36,4 @@
        <build>
                <finalName>${project.artifactId}</finalName>            
        </build>
-</project>
\ No newline at end of file
+</project>
index 078971e..3ed6ab7 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>so</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <artifactId>mso-api-handlers</artifactId>
@@ -34,4 +34,4 @@
                        <scope>test</scope>
                </dependency>
        </dependencies>
-</project>
\ No newline at end of file
+</project>
index 7f86cba..364ac96 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>so</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <artifactId>mso-catalog-db</artifactId>
index c2e6fe3..11b7de6 100644 (file)
@@ -6,7 +6,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>packages</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <packaging>pom</packaging>
index 79b8485..da068c3 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.onap.so</groupId>
                <artifactId>so</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>1.4.0-SNAPSHOT</version>
        </parent>
 
        <artifactId>packages</artifactId>
diff --git a/pom.xml b/pom.xml
index df6c19f..486ce5c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
        <groupId>org.onap.so</groupId>
        <artifactId>so</artifactId>
        <packaging>pom</packaging>
-       <version>1.3.0-SNAPSHOT</version>
+       <version>1.4.0-SNAPSHOT</version>
        <name>so</name>
        <description>This Maven project is responsible to build and package all child projects - contributions in the MSO project.
        This build can be configured to run Functional tests and to start/stop a jboss server + Mysql DB.
@@ -47,6 +47,7 @@
                <sonar.cpd.exclusions>**/*</sonar.cpd.exclusions>
                <jacoco.version>0.7.5.201505241946</jacoco.version>
                <org.apache.maven.user-settings/>
+               <!-- TODO: update to version 1.4.0 for Dublin -->
                <openstack.version>1.3.0</openstack.version>
                <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
                <springboot.version>1.5.13.RELEASE</springboot.version> 
@@ -66,7 +67,7 @@
                <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath>
                <publicNexusPath>content/repositories/public/</publicNexusPath>
                <siteNexusPath>content/sites/site/org/onap/so/${project.version}/</siteNexusPath>
-               <cxf.version>3.2.5</cxf.version>
+               <cxf.version>3.2.6</cxf.version>
                <jax.ws.rs>2.1</jax.ws.rs>
        </properties>
        <distributionManagement>
index 4ff1f3b..47ef60b 100644 (file)
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.onap.so</groupId>
         <artifactId>so</artifactId>
-        <version>1.3.0-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
 
     <groupId>org.onap.so.monitoring</groupId>
@@ -63,4 +63,4 @@
         <module>so-monitoring-handler</module>
         <module>so-monitoring-service</module>
     </modules>
-</project>
\ No newline at end of file
+</project>
index ae900ba..c045dd0 100644 (file)
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.onap.so.monitoring</groupId>
         <artifactId>so-monitoring</artifactId>
-        <version>1.3.0-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
     <artifactId>so-monitoring-handler</artifactId>
     <name>${project.artifactId}</name>
index 9992c51..fd46d09 100644 (file)
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.onap.so.monitoring</groupId>
         <artifactId>so-monitoring</artifactId>
-        <version>1.3.0-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
     <artifactId>so-monitoring-service</artifactId>
     <name>${project.artifactId}</name>
         </plugins>
     </build>
 
-</project>
\ No newline at end of file
+</project>
index bfef7df..cd5ad8b 100644 (file)
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.onap.so.monitoring</groupId>
         <artifactId>so-monitoring</artifactId>
-        <version>1.3.0-SNAPSHOT</version>
+        <version>1.4.0-SNAPSHOT</version>
     </parent>
     <artifactId>so-monitoring-ui</artifactId>
 
@@ -88,4 +88,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
index fb21064..668657e 100644 (file)
@@ -3,8 +3,8 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 major=1
-minor=3
-patch=1
+minor=4
+patch=0
 
 base_version=${major}.${minor}.${patch}