Merge "Iterate over the entrySet instead of keySet"
authorSeshu Kumar M <seshu.kumar.m@huawei.com>
Fri, 27 Oct 2017 08:32:36 +0000 (08:32 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 27 Oct 2017 08:32:36 +0000 (08:32 +0000)
155 files changed:
LICENSE.txt
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java
adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java
adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java
adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java
adapters/mso-vfc-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml
adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VimLocation.java [moved from bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java with 59% similarity]
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
asdc-controller/src/main/resources/resource-examples/service_Rg511NfmService.csar
asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar
bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java
bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd
bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java
bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateNetworkInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVFCNetworkServiceInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties
bpmn/MSOMockServer/.gitignore [new file with mode: 0644]
bpmn/MSOMockServer/WebContent/META-INF/MANIFEST.MF [new file with mode: 0644]
bpmn/MSOMockServer/WebContent/WEB-INF/jboss-deployment-structure.xml [new file with mode: 0644]
bpmn/MSOMockServer/WebContent/WEB-INF/web.xml [new file with mode: 0644]
bpmn/MSOMockServer/pom.xml [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java [new file with mode: 0644]
bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml [new file with mode: 0644]
bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml [new file with mode: 0644]
bpmn/MSOURN-plugin/build.properties [deleted file]
bpmn/MSOURN-plugin/build.xml [deleted file]
bpmn/MSOURN-plugin/pom.xml [deleted file]
bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java [deleted file]
bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java [deleted file]
bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java [deleted file]
bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java [deleted file]
bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java [deleted file]
bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java [deleted file]
bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin [deleted file]
bpmn/MSOURN-plugin/src/main/resources/mappings.xml [deleted file]
bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml [deleted file]
bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/dashboard.html [deleted file]
bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/plugin.js [deleted file]
bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/info.txt [deleted file]
bpmn/pom.xml
common/src/main/java/org/openecomp/mso/logger/MsoLogger.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcResp.java [moved from bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java with 53% similarity]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java [moved from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestParameters.java with 51% similarity]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java [moved from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java with 59% similarity]
mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java
mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java
mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml
mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml
mso-catalog-db/src/main/resources/HeatFiles.hbm.xml
mso-catalog-db/src/main/resources/NetworkResource.hbm.xml
packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json
packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg511NfmService.csar
packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar
packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
packages/docker/src/main/docker/docker-files/wait-for.sh [new file with mode: 0755]
packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/default/create_mso_db-default.sql
readme.md

index cf1d4b6..bb235ff 100644 (file)
@@ -1,22 +1,39 @@
 /*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright © 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
\ No newline at end of file
+* ============LICENSE_START==========================================
+* ===================================================================
+* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+* ===================================================================
+*
+* Unless otherwise specified, all software contained herein is licensed
+* under the Apache License, Version 2.0 (the “License”);
+* you may not use this software 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.
+*
+*
+*
+* Unless otherwise specified, all documentation contained herein is licensed
+* under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+* you may not use this documentation except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*             https://creativecommons.org/licenses/by/4.0/
+*
+* Unless required by applicable law or agreed to in writing, documentation
+* 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============================================
+*
+* ECOMP is a trademark and service mark of AT&T Intellectual Property.
+*
+*/
index 0777c60..052f09a 100644 (file)
@@ -22,17 +22,15 @@ package org.openecomp.mso.cloud;
 import java.io.IOException;\r
 \r
 import org.codehaus.jackson.JsonGenerator;\r
-import org.codehaus.jackson.JsonProcessingException;\r
 import org.codehaus.jackson.map.JsonSerializer;\r
 import org.codehaus.jackson.map.SerializerProvider;\r
-import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType;\r
 \r
 \r
 public class IdentityAuthenticationTypeJsonSerializer extends JsonSerializer<IdentityAuthenticationTypeAbstract> {\r
 \r
        @Override\r
        public void serialize(IdentityAuthenticationTypeAbstract tmpObj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)\r
-                       throws IOException, JsonProcessingException {\r
+                       throws IOException {\r
                jsonGenerator.writeObject(tmpObj.toString());\r
        }\r
 }\r
index ff1cd43..b8a7a55 100644 (file)
@@ -61,6 +61,6 @@ public abstract class MsoException extends Exception
                if (this.context == null)
                        return getMessage();
                else
-                       return ("[" + context + "] " + getMessage());
+                       return "[" + context + "] " + getMessage();
        }
 }
index a62339d..8aa8d3f 100644 (file)
@@ -71,7 +71,13 @@ public class MsoOpenstackException extends MsoException
        
        @Override
        public String toString () {
-               String error = "" + statusCode + " " + statusMessage + ": " + errorDetail;
-               return error;
+               StringBuilder error = new StringBuilder();
+               error.append("");
+               error.append(statusCode);
+               error.append(" ");
+               error.append(statusMessage);
+               error.append(": ");
+               error.append(errorDetail);
+               return error.toString();
        }
 }
index cd5879c..e47dea6 100644 (file)
@@ -21,7 +21,6 @@
 package org.openecomp.mso.openstack.utils;
 
 
-import java.lang.StackTraceElement;
 import org.openecomp.mso.logger.MsoAlarmLogger;
 import org.openecomp.mso.logger.MsoLogger;
 import org.openecomp.mso.logger.MessageEnum;
@@ -41,7 +40,7 @@ import com.woorea.openstack.quantum.model.NeutronError;
 
 public class MsoCommonUtils {
 
-       private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+       private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
        protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
        
        protected static String retryDelayProp = "ecomp.mso.adapters.po.retryDelay";
@@ -111,18 +110,18 @@ public class MsoCommonUtils {
                        boolean retry = false;
                        if (retryCodes != null ) {
                                int code = e.getStatus();
-                               LOGGER.debug ("Config values RetryDelay:" + retryDelay + " RetryCount:" + retryCount + " RetryCodes:" + retryCodes + " ResponseCode:" + code);
+                    logger.debug ("Config values RetryDelay:" + retryDelay + " RetryCount:" + retryCount + " RetryCodes:" + retryCodes + " ResponseCode:" + code);
                                for (String rCode : retryCodes.split (",")) {
                                        try {
                                                if (retryCount > 0 && code == Integer.parseInt (rCode))
                                                {
                                                        retryCount--;
                                                        retry = true;
-                                                       LOGGER.debug ("OpenStackResponseException ResponseCode:" + code +  " at:" + parentServiceMethodName + " request:" + requestType +  " Retry indicated. Attempts remaining:" + retryCount);
+                                logger.debug ("OpenStackResponseException ResponseCode:" + code +  " at:" + parentServiceMethodName + " request:" + requestType +  " Retry indicated. Attempts remaining:" + retryCount);
                                                        break;
                                                }
                                        } catch (NumberFormatException e1) {
-                                               LOGGER.error (MessageEnum.RA_CONFIG_EXC, "No retries. Exception in parsing retry code in config:" + rCode, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in parsing retry code in config");
+                            logger.error (MessageEnum.RA_CONFIG_EXC, "No retries. Exception in parsing retry code in config:" + rCode, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in parsing retry code in config");
                                                throw e;
                                        }
                                }
@@ -132,7 +131,7 @@ public class MsoCommonUtils {
                                try {
                                        Thread.sleep (retryDelay * 1000L);
                                } catch (InterruptedException e1) {
-                                       LOGGER.debug ("Thread interrupted while sleeping", e1);
+                        logger.debug ("Thread interrupted while sleeping", e1);
                                }
                        }
                        else
@@ -143,11 +142,11 @@ public class MsoCommonUtils {
                        if (retryCount > 0)
                        {
                                retryCount--;
-                               LOGGER.debug ("OpenstackConnectException at:" + parentServiceMethodName + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount);
+                    logger.debug ("OpenstackConnectException at:" + parentServiceMethodName + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount);
                                try {
                                        Thread.sleep (retryDelay * 1000L);
                                } catch (InterruptedException e1) {
-                                       LOGGER.debug ("Thread interrupted while sleeping", e1);
+                        logger.debug ("Thread interrupted while sleeping", e1);
                                }
                        }
                        else
@@ -170,11 +169,11 @@ public class MsoCommonUtils {
             try {
                 // Failed Keystone calls return an Error entity body.
                 Error error = re.getResponse ().getErrorEntity (Error.class);
-                LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Keystone Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone Error on " + context);
+                logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Keystone Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone Error on " + context);
                                me = new MsoOpenstackException (error.getCode (), error.getTitle (), error.getMessage ());
             } catch (Exception e2) {
                 // Can't parse the body as an "Error". Report the HTTP error
-               LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "HTTP Error on " + context + ": " + re.getStatus() + "," + re.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "HTTP Error on " + context, e2);
+                logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "HTTP Error on " + context + ": " + re.getStatus() + "," + re.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "HTTP Error on " + context, e2);
                                me = new MsoOpenstackException (re.getStatus (), re.getMessage (), "");
             }
 
@@ -192,7 +191,7 @@ public class MsoCommonUtils {
             me.addContext (context);
 
             // Generate an alarm for all connection errors.
-            LOGGER.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "Openstack Keystone connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone connection error on " + context);
+            logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "Openstack Keystone connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone connection error on " + context);
                        alarmLogger.sendAlarm ("KeystoneIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
         }
 
@@ -212,16 +211,16 @@ public class MsoCommonUtils {
             try {
                 // Failed Heat calls return an Explanation entity body.
                 Explanation explanation = re.getResponse ().getErrorEntity (Explanation.class);
-                LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error on " + context + ": " + explanation.toString(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Openstack Error on " + context);
+                logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error on " + context + ": " + explanation.toString(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Openstack Error on " + context);
                 String fullError = explanation.getExplanation() + ", error.type=" + explanation.getError().getType() + ", error.message=" + explanation.getError().getMessage();
-                LOGGER.debug(fullError);
+                logger.debug(fullError);
                                me = new MsoOpenstackException (explanation.getCode (),
                                                 explanation.getTitle (),
                                                 //explanation.getExplanation ());
                                                 fullError);
             } catch (Exception e2) {
                 // Couldn't parse the body as an "Explanation". Report the original HTTP error.
-               LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - HTTP Error on " + context, e2);
+                logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - HTTP Error on " + context, e2);
                                me = new MsoOpenstackException (re.getStatus (), re.getMessage (), "");
             }
 
@@ -240,7 +239,7 @@ public class MsoCommonUtils {
 
             // Generate an alarm for all connection errors.
             alarmLogger.sendAlarm ("HeatIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
-            LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Heat connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Heat connection error on " + context);
+            logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Heat connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Heat connection error on " + context);
        }
 
         return me;
@@ -259,11 +258,11 @@ public class MsoCommonUtils {
             try {
                 // Failed Neutron calls return an NeutronError entity body
                 NeutronError error = re.getResponse ().getErrorEntity (NeutronError.class);
-                LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Error on " + context);
+                logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Error on " + context);
                                me = new MsoOpenstackException (re.getStatus (), error.getType (), error.getMessage ());
             } catch (Exception e2) {
                 // Couldn't parse body as a NeutronError. Report the HTTP error.
-               LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack HTTP Error on " + context, e2);
+                logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack HTTP Error on " + context, e2);
                                me = new MsoOpenstackException (re.getStatus (), re.getMessage (), null);
             }
 
@@ -282,7 +281,7 @@ public class MsoCommonUtils {
 
             // Generate an alarm for all connection errors.
             alarmLogger.sendAlarm ("NeutronIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
-            LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Connection error on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Connection error on "+ context);
+            logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Connection error on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Connection error on "+ context);
        }
 
         return me;
@@ -300,7 +299,7 @@ public class MsoCommonUtils {
         me.setCategory (MsoExceptionCategory.INTERNAL);
 
         // Always generate an alarm for internal exceptions
-        LOGGER.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on  "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on  "+ context);
+        logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on  "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on  "+ context);
                alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
 
         return me;
index 31e2fca..a2e605f 100644 (file)
@@ -56,10 +56,18 @@ public class MsoHeatEnvironmentResource {
        public void setValue(String value) {
                this.value = value;
        }
+
+       @Override
        public String toString() {
-               return "\"" + this.name + "\": " + this.value;
+               StringBuilder str = new StringBuilder();
+               str.append("\"");
+               str.append(this.name);
+               str.append("\": ");
+               str.append(this.value);
+               return str.toString();
        }
-       
+
+       @Override
        public boolean equals(Object o) {       
                if (!(o instanceof MsoHeatEnvironmentResource)) {
                        return false;
@@ -74,7 +82,8 @@ public class MsoHeatEnvironmentResource {
                }
                return false;
        }
-       
+
+       @Override
        public int hashCode() {
                int result = 0;
                try {
index bceb749..be49cd9 100644 (file)
@@ -33,11 +33,12 @@ import java.lang.reflect.InvocationTargetException;
 public class MsoTenantUtilsFactory {
 
        private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
-       private CloudConfigFactory cloudConfigFactory= new CloudConfigFactory(); 
+
+       private CloudConfigFactory cloudConfigFactory= new CloudConfigFactory();
        protected CloudConfig cloudConfig;
        protected MsoJavaProperties msoProps = null;
        private String msoPropID;
-       
+
        public MsoTenantUtilsFactory (String msoPropID) {
                this.msoPropID = msoPropID;
        }
@@ -45,7 +46,7 @@ public class MsoTenantUtilsFactory {
        //based on Cloud IdentityServerType returns ORM or KEYSTONE Utils
        public MsoTenantUtils getTenantUtils(String cloudSiteId) {
 
-               // Obtain the cloud site information 
+               // Obtain the cloud site information
                cloudConfig = cloudConfigFactory.getCloudConfig();
                CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
 
@@ -54,7 +55,7 @@ public class MsoTenantUtilsFactory {
 
        public MsoTenantUtils getTenantUtilsByServerType(String serverType) {
 
-               MsoTenantUtils tenantU = null;
+               MsoTenantUtils tenantU;
                if (CloudIdentity.IdentityServerType.KEYSTONE.toString().equals(serverType)) {
                        tenantU = new MsoKeystoneUtils (msoPropID);
                } else {
index bd649e8..c227d72 100644 (file)
@@ -32,7 +32,6 @@ import java.util.Set;
 import java.util.Map.Entry;
 import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
 import org.codehaus.jackson.map.ObjectMapper;
-import java.util.LinkedHashMap;
 
 import org.yaml.snakeyaml.Yaml;
 
@@ -63,7 +62,7 @@ public class MsoYamlEditorWithEnvt {
        public synchronized Set <MsoHeatEnvironmentParameter> getParameterListFromEnvt() {
        // In an environment entry, the parameters section can only contain the name:value - 
        // not other attributes.
-       Set <MsoHeatEnvironmentParameter> paramSet = new HashSet<MsoHeatEnvironmentParameter>();
+       Set <MsoHeatEnvironmentParameter> paramSet = new HashSet<>();
        Map<String, Object> resourceMap = null;
        try {
                resourceMap = (Map<String,Object>) yml.get("parameters");
@@ -79,13 +78,9 @@ public class MsoYamlEditorWithEnvt {
        while (it.hasNext()) {
                MsoHeatEnvironmentParameter hep = new MsoHeatEnvironmentParameter();
                Map.Entry <String, Object> pair = it.next();
-               //Map<String, String> resourceEntry = (Map <String, String>) pair.getValue();
-               //String value = null;
-               String value = null;
+               String value;
                Object obj = pair.getValue();
                if (obj instanceof java.lang.String) {
-                       //value = (String) pair.getValue();
-                       // handle block scalar - literals and folded:
                        value = yaml.dump(obj);
                        // but this adds an extra '\n' at the end - which won't hurt - but we don't need it
                        value = value.substring(0, value.length() - 1);
index f3f252d..2395495 100644 (file)
@@ -30,7 +30,6 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.codehaus.jackson.map.ObjectMapper;
 import org.jboss.resteasy.annotations.providers.NoJackson;
-import org.openecomp.mso.logger.MsoLogger;
 import org.openecomp.mso.openstack.beans.VnfStatus;
 
 @XmlRootElement(name = "queryVfModuleResponse")
index 6c571f3..f51b272 100644 (file)
@@ -241,9 +241,6 @@ public class BpelRestClient {
                LOGGER.debug("Sending to BPEL server: "+bpelUrl);
                LOGGER.debug("Content is: "+toBpelStr);
 
-               //Client 4.3+
-               CloseableHttpClient client = null;
-
                //POST
                HttpPost post = new HttpPost(bpelUrl);
                if (credentials != null && !credentials.isEmpty())
@@ -263,8 +260,7 @@ public class BpelRestClient {
 
         //Client 4.3+
                //Execute & GetResponse
-               try {
-                   client = HttpClients.createDefault();
+               try (CloseableHttpClient client = HttpClients.createDefault()) {
                        CloseableHttpResponse response = client.execute(post);
                        if (response != null) {
                                lastResponseCode = response.getStatusLine().getStatusCode();
@@ -279,14 +275,6 @@ public class BpelRestClient {
                        LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception sending Bpel notification", e);
                        lastResponseCode = 900;
                        lastResponse = "";
-               } finally {
-                       if(client != null){
-                               try {
-                                       client.close();
-                               } catch (IOException e) {
-                                       LOGGER.debug("Exception while closing client", e);
-                               }
-                       }
                }
                LOGGER.debug("Response code from BPEL server: "+lastResponseCode);
                LOGGER.debug("Response body is: "+lastResponse);
index 43273df..877012c 100644 (file)
@@ -27,6 +27,7 @@ import javax.xml.bind.annotation.XmlElement;
 
 import org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbException;
 import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.ResourceOperationStatus;
 
 /**
  * MSO Request DB Adapter Web Service
@@ -59,6 +60,7 @@ public interface MsoRequestsDbAdapter {
     @WebMethod
     public void updateServiceOperationStatus (@WebParam(name = "serviceId") @XmlElement(required = true) String serviceId,
                                     @WebParam(name = "operationId") @XmlElement(required = false) String operationId,
+                                    @WebParam(name = "serviceName") @XmlElement(required = false) String serviceName,
                                     @WebParam(name = "operationType") @XmlElement(required = false) String operationType,
                                     @WebParam(name = "userId") @XmlElement(required = false) String userId,
                                     @WebParam(name = "result") @XmlElement(required = false) String result,
@@ -71,5 +73,21 @@ public interface MsoRequestsDbAdapter {
                                     @WebParam(name = "operationId") @XmlElement(required = true) String operationId,
                                     @WebParam(name = "operationType") @XmlElement(required = true) String operationType,
                                     @WebParam(name = "resourceTemplateUUIDs") @XmlElement(required = true) String resourceTemplateUUIDs) throws MsoRequestsDbException;
+    
+    @WebMethod
+    public ResourceOperationStatus getResourceOperationStatus (@WebParam(name="serviceId") @XmlElement(required = true) String serviceId,
+                                    @WebParam(name = "operationId") @XmlElement(required = true) String operationId,
+                                    @WebParam(name = "resourceTemplateUUID") @XmlElement(required = true) String resourceTemplateUUID) throws MsoRequestsDbException;
+    @WebMethod
+    public void updateResourceOperationStatus (@WebParam(name = "serviceId") @XmlElement(required = true) String serviceId,
+                                    @WebParam(name = "operationId") @XmlElement(required = true) String operationId,
+                                    @WebParam(name = "resourceTemplateUUID") @XmlElement(required = true) String resourceTemplateUUID,
+                                    @WebParam(name = "operType") @XmlElement(required = false) String operType,
+                                    @WebParam(name = "resourceInstanceID") @XmlElement(required = false) String resourceInstanceID,
+                                    @WebParam(name = "jobId") @XmlElement(required = false) String jobId,
+                                    @WebParam(name = "status") @XmlElement(required = false) String status,
+                                    @WebParam(name = "progress") @XmlElement(required = false) String progress,
+                                    @WebParam(name = "errorCode") @XmlElement(required = false) String errorCode,
+                                    @WebParam(name = "statusDescription") @XmlElement(required = false) String statusDescription) throws MsoRequestsDbException;
 
 }
index 87be2e1..0bdead4 100644 (file)
@@ -22,7 +22,6 @@ package org.openecomp.mso.adapters.requestsdb;
 
 import java.sql.Timestamp;
 
-import javax.jws.WebMethod;
 import javax.jws.WebService;
 
 import org.hibernate.HibernateException;
@@ -283,11 +282,13 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
      * @since   ONAP Amsterdam Release
      */
     @Override
-    public void updateServiceOperationStatus(String serviceId, String operationId, String operationType, String userId,
+    public void updateServiceOperationStatus(String serviceId, String operationId, String serviceName,String operationType, String userId,
             String result, String operationContent, String progress, String reason) throws MsoRequestsDbException {
         OperationStatus operStatus = new OperationStatus();
+        operStatus.setResult(RequestsDbConstant.Status.PROCESSING);
         operStatus.setServiceId(serviceId);
         operStatus.setOperationId(operationId);
+        operStatus.setServiceName(serviceName);
         operStatus.setUserId(userId);
         operStatus.setOperation(operationType);
         operStatus.setReason(reason);
@@ -322,5 +323,56 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
             RequestsDatabase.getInstance().updateResOperStatus(resourceStatus);
         }     
     }
-
+    
+    /**
+     * get resource operation status
+     * <br>
+     * 
+     * @param serviceId
+     * @param operationId
+     * @param resourceUUID
+     * @return
+     * @throws MsoRequestsDbException
+     * @since   ONAP Amsterdam Release
+     */
+    @Override
+    public ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID)
+            throws MsoRequestsDbException {
+        return RequestsDatabase.getInstance().getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
+    }
+    
+    /**
+     * update resource operation status
+     * <br>
+     * 
+     * @param serviceId
+     * @param operationId
+     * @param resourceUUID
+     * @param operationType
+     * @param resourceInstanceID
+     * @param jobId
+     * @param status
+     * @param progress
+     * @param errorCode
+     * @param statusDescription
+     * @throws MsoRequestsDbException
+     * @since   ONAP Amsterdam Release
+     */
+    @Override
+    public void updateResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID,
+            String operType, String resourceInstanceID, String jobId, String status, String progress,
+            String errorCode, String statusDescription) throws MsoRequestsDbException {
+         ResourceOperationStatus resStatus = new ResourceOperationStatus();
+         resStatus.setServiceId(serviceId);
+         resStatus.setOperationId(operationId);
+         resStatus.setResourceTemplateUUID(resourceTemplateUUID);
+         resStatus.setOperType(operType);
+         resStatus.setResourceInstanceID(resourceInstanceID);
+         resStatus.setJobId(jobId);
+         resStatus.setStatus(status);
+         resStatus.setProgress(progress);
+         resStatus.setErrorCode(errorCode);
+         resStatus.setStatusDescription(statusDescription);
+         RequestsDatabase.getInstance().updateResOperStatus(resStatus);
+    }
 }
index d412914..a4d9f27 100644 (file)
@@ -41,7 +41,6 @@ import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFactory;
-import javax.ejb.EJB;
 
 import org.openecomp.mso.utils.UUIDChecker;
 import org.w3c.dom.Document;
index e7bc08a..fb26891 100644 (file)
@@ -1,17 +1,21 @@
 <jboss-deployment-structure>\r
        <deployment>\r
-               <!-- Exclusions allow you to prevent the server from automatically adding \r
-                       some dependencies -->\r
+               <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->\r
                <exclusions>\r
                        <module name="org.apache.log4j" />\r
                        <module name="org.slf4j" />\r
                        <module name="org.slf4j.impl" />\r
+                       <module name="org.jboss.resteasy.resteasy-jackson-provider" />\r
+                       <module name="org.jboss.resteasy.resteasy-jettison-provider" />\r
                </exclusions>\r
                <dependencies>\r
-                       <module name="org.jboss.jandex" slot="main" />\r
-                       <module name="org.javassist" slot="main" />\r
-                       <module name="org.antlr" slot="main" />\r
-                       <module name="org.dom4j" slot="main" />\r
+                           <module name="org.jboss.jandex" slot="main" />\r
+                <module name="org.javassist" slot="main" />\r
+                <module name="org.antlr" slot="main" />\r
+                <module name="org.dom4j" slot="main" />\r
+                <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />\r
+                <!-- This module contain the ProviderBase class: -->\r
+                <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" export="true" />\r
                </dependencies>\r
        </deployment>\r
-</jboss-deployment-structure>
\ No newline at end of file
+</jboss-deployment-structure>\r
index 0c198de..cd97471 100644 (file)
        </servlet>
        <servlet-mapping>
                <servlet-name>Resteasy</servlet-name>
-               <url-pattern>/vfcadapter/*</url-pattern>
+               <url-pattern>/rest/*</url-pattern>
        </servlet-mapping>
-       <security-constraint>
-               <web-resource-collection>
-                       <web-resource-name>SoapRequests</web-resource-name>
-                       <description>Soap Ingress Requests</description>
-                       <url-pattern>/VfcAdapter</url-pattern>
-                       <url-pattern>/VfcAdapterAsync</url-pattern>
-                       <http-method>POST</http-method>
-               </web-resource-collection>
-               <auth-constraint>
-                       <role-name>BPEL-Client</role-name>
-               </auth-constraint>
-       </security-constraint>
        <security-constraint>
                <web-resource-collection>
                        <web-resource-name>SiteStatus</web-resource-name>
@@ -70,7 +58,7 @@
                <web-resource-collection>
                        <web-resource-name>RestRequests</web-resource-name>
                        <description>Rest Ingress Requests</description>
-                       <url-pattern>/rest/v1/vfc/*</url-pattern>
+                       <url-pattern>/rest/v1/vfcadapter/*</url-pattern>
                        <http-method>DELETE</http-method>
                        <http-method>GET</http-method>
                        <http-method>POST</http-method>
index 6c2ab4d..ef3c1b7 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.openecomp.mso.adapters.vfc;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.POST;
@@ -29,14 +28,12 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
 
 import org.openecomp.mso.adapters.vfc.exceptions.ApplicationException;
 import org.openecomp.mso.adapters.vfc.model.NSResourceInputParameter;
 import org.openecomp.mso.adapters.vfc.model.NsOperationKey;
 import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
 import org.openecomp.mso.adapters.vfc.util.JsonUtil;
-import org.openecomp.mso.adapters.vfc.util.RestfulUtil;
 import org.openecomp.mso.adapters.vfc.util.ValidateUtil;
 import org.openecomp.mso.logger.MsoLogger;
 
@@ -48,164 +45,149 @@ import org.openecomp.mso.logger.MsoLogger;
  * @author
  * @version ONAP Amsterdam Release 2017-08-28
  */
-@Path("/vfcadapter/v1")
+@Path("/v1/vfcadapter")
 public class VfcAdapterRest {
 
-  private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
 
-  private final VfcManager driverMgr = new VfcManager();
+    private final VfcManager driverMgr = new VfcManager();
 
-  public VfcAdapterRest() {
+    public VfcAdapterRest() {
 
-  }
-
-  /**
-   * Create a NS <br>
-   * 
-   * @param servletReq the http request
-   * @return
-   * @since ONAP Amsterdam Release
-   */
-  @POST
-  @Path("/ns")
-  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  public Response createNfvoNs(HttpServletRequest servletReq) {
-    // Step 1: get parameters from request for current node
-    try {
-      String body = RestfulUtil.getRequestBody(servletReq);
-      ValidateUtil.assertObjectNotNull(body);
-      LOGGER.debug("body from request is {}" + body);
-      NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
-      RestfulResponse rsp = driverMgr.createNs(nsInput);
-      return buildResponse(rsp);
-    } catch (ApplicationException e) {
-      LOGGER.debug("ApplicationException: ", e);
-      return e.buildErrorResponse();
     }
-  }
 
-  /**
-   * Delete NS instance<br>
-   *
-   * @param servletReq http request
-   * @return response
-   * @since ONAP Amsterdam Release
-   */
-  @DELETE
-  @Path("/ns/{nsInstanceId}")
-  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  public Response deleteNfvoNs(HttpServletRequest servletReq,
-      @PathParam("nsInstanceId") String nsInstanceId) {
-    try {
-      // Step 1: get parameters from request for current node
-      String body = RestfulUtil.getRequestBody(servletReq);
-      ValidateUtil.assertObjectNotNull(body);
-      LOGGER.debug("body from request is {}" + body);
-      NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
-      RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
-      return buildResponse(rsp);
-    } catch (ApplicationException e) {
-      LOGGER.debug("ApplicationException: ", e);
-      return e.buildErrorResponse();
+    /**
+     * Create a NS <br>
+     * 
+     * @param servletReq the http request
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    @POST
+    @Path("/ns")
+    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    public Response createNfvoNs(String data) {
+        try {
+            ValidateUtil.assertObjectNotNull(data);
+            LOGGER.debug("body from request is {}" + data);
+            NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
+            RestfulResponse rsp = driverMgr.createNs(nsInput);
+            return buildResponse(rsp);
+        } catch(ApplicationException e) {
+            LOGGER.debug("ApplicationException: ", e);
+            return e.buildErrorResponse();
+        }
     }
-  }
 
-  /**
-   * Query Operation job status <br>
-   * 
-   * @param servletReq The Http Request
-   * @param jobId The job id
-   * @return
-   * @since ONAP Amsterdam Release
-   */
-  @POST
-  @Path("/jobs/{jobId}")
-  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  public Response queryNfvoJobStatus(HttpServletRequest servletReq,
-      @PathParam("jobId") String jobId) {
-    try {
-      ValidateUtil.assertObjectNotNull(jobId);
-      String body = RestfulUtil.getRequestBody(servletReq);
-      ValidateUtil.assertObjectNotNull(body);
-      LOGGER.debug("body from request is {}" + body);
-      NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
+    /**
+     * Delete NS instance<br>
+     *
+     * @param servletReq http request
+     * @return response
+     * @since ONAP Amsterdam Release
+     */
+    @DELETE
+    @Path("/ns/{nsInstanceId}")
+    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    public Response deleteNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
+        try {
+
+            ValidateUtil.assertObjectNotNull(data);
+            LOGGER.debug("body from request is {}" + data);
+            NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
+            RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
+            return buildResponse(rsp);
+        } catch(ApplicationException e) {
+            LOGGER.debug("ApplicationException: ", e);
+            return e.buildErrorResponse();
+        }
+    }
 
-      RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
-      return buildResponse(rsp);
-    } catch (ApplicationException e) {
-      LOGGER.debug("ApplicationException: ", e);
-      return e.buildErrorResponse();
+    /**
+     * Query Operation job status <br>
+     * 
+     * @param servletReq The Http Request
+     * @param jobId The job id
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    @POST
+    @Path("/jobs/{jobId}")
+    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    public Response queryNfvoJobStatus(String data, @PathParam("jobId") String jobId) {
+        try {
+            ValidateUtil.assertObjectNotNull(data);
+            LOGGER.debug("body from request is {}" + data);
+            NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
+            RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
+            return buildResponse(rsp);
+        } catch(ApplicationException e) {
+            LOGGER.debug("ApplicationException: ", e);
+            return e.buildErrorResponse();
+        }
     }
-  }
 
-  /**
-   * Instantiate NS instance <br>
-   * 
-   * @param servletReq The http request
-   * @param nsInstanceId The NS instance id
-   * @return
-   * @since ONAP Amsterdam Release
-   */
-  @POST
-  @Path("/ns/{nsInstanceId}/instantiate")
-  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  public Response instantiateNfvoNs(HttpServletRequest servletReq,
-      @PathParam("nsInstanceId") String nsInstanceId) {
-    String body = RestfulUtil.getRequestBody(servletReq);
-    try {
-      ValidateUtil.assertObjectNotNull(body);
-      LOGGER.debug("body from request is {}" + body);
-      NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
-      RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
-      return buildResponse(rsp);
-    } catch (ApplicationException e) {
-      LOGGER.debug("ApplicationException: ", e);
-      return e.buildErrorResponse();
+    /**
+     * Instantiate NS instance <br>
+     * 
+     * @param servletReq The http request
+     * @param nsInstanceId The NS instance id
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    @POST
+    @Path("/ns/{nsInstanceId}/instantiate")
+    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    public Response instantiateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
+        try {
+            ValidateUtil.assertObjectNotNull(data);
+            LOGGER.debug("body from request is {}" + data);
+            NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
+            RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
+            return buildResponse(rsp);
+        } catch(ApplicationException e) {
+            LOGGER.debug("ApplicationException: ", e);
+            return e.buildErrorResponse();
+        }
     }
-  }
 
-  /**
-   * Terminate NS instance <br>
-   * 
-   * @param servletReq The http request
-   * @param nsInstanceId The NS instance id
-   * @return
-   * @since ONAP Amsterdam Release
-   */
-  @POST
-  @Path("/ns/{nsInstanceId}/terminate")
-  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-  public Response terminateNfvoNs(HttpServletRequest servletReq,
-      @PathParam("nsInstanceId") String nsInstanceId) {
-    try {
-      ValidateUtil.assertObjectNotNull(nsInstanceId);
-      String body = RestfulUtil.getRequestBody(servletReq);
-      ValidateUtil.assertObjectNotNull(body);
-      LOGGER.debug("body from request is {}" + body);
-      NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
-      RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
-      return buildResponse(rsp);
-    } catch (ApplicationException e) {
-      LOGGER.debug("ApplicationException: ", e);
-      return e.buildErrorResponse();
+    /**
+     * Terminate NS instance <br>
+     * 
+     * @param servletReq The http request
+     * @param nsInstanceId The NS instance id
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    @POST
+    @Path("/ns/{nsInstanceId}/terminate")
+    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+    public Response terminateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
+        try {
+            ValidateUtil.assertObjectNotNull(data);
+            LOGGER.debug("body from request is {}" + data);
+            NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
+            RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
+            return buildResponse(rsp);
+        } catch(ApplicationException e) {
+            LOGGER.debug("ApplicationException: ", e);
+            return e.buildErrorResponse();
+        }
     }
-  }
 
-  /**
-   * build response from restful response <br>
-   * 
-   * @param rsp general response object
-   * @return
-   * @since ONAP Amsterdam Release
-   */
-  private Response buildResponse(RestfulResponse rsp) {
-    ResponseBuilder rspBuilder = Response.status(rsp.getStatus());
-    rspBuilder.entity(rsp.getResponseContent());
-    return rspBuilder.build();
-  }
+    /**
+     * build response from restful response <br>
+     * 
+     * @param rsp general response object
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    private Response buildResponse(RestfulResponse rsp) {
+        return Response.status(rsp.getStatus()).entity(rsp.getResponseContent()).build();
+    }
 }
index fed6d5e..35c8ead 100644 (file)
@@ -111,22 +111,8 @@ public class VfcManager {
     ValidateUtil.assertObjectNotNull(createRsp);
     LOGGER.info("create ns response status is : {}", createRsp.getStatus());
     LOGGER.info("create ns response content is : {}", createRsp.getResponseContent());
-    @SuppressWarnings("unchecked")
-    Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class);
-    String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID);
-    if (ValidateUtil.isStrEmpty(nsInstanceId)) {
-      LOGGER.error("Invalid instanceId from create operation");
-      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
-          DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION);
-    }
-    LOGGER.info("create ns -> end");
-    LOGGER.info("save segment and operaton info -> begin");
-    // Step 5: add relation between service and NS
-    AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(),
-        segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(),
-        nsInstanceId);
 
-    // Step 6: save resource operation information
+    // Step 5: save resource operation information
     ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance())
         .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
             segInput.getNsOperationKey().getOperationId(),
@@ -142,7 +128,16 @@ public class VfcManager {
       throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
           DriverExceptionID.FAIL_TO_CREATE_NS);
     }
-    LOGGER.info("save segment and operation info -> end");
+    @SuppressWarnings("unchecked")
+    Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class);
+    String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID);
+    if (ValidateUtil.isStrEmpty(nsInstanceId)) {
+      LOGGER.error("Invalid instanceId from create operation");
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION);
+    }
+    LOGGER.info("create ns -> end");
+
     return createRsp;
   }
 
@@ -181,11 +176,6 @@ public class VfcManager {
           DriverExceptionID.FAIL_TO_DELETE_NS);
     }
 
-    // Step3: remove relation info between service and ns
-    AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(),
-        nsOperationKey.getServiceId(), nsInstanceId);
-    LOGGER.info("delete segment information -> end");
-
     // Step4: update service segment operation status
     nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
     nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus()));
@@ -220,18 +210,27 @@ public class VfcManager {
     String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE);
     String methodType = CommonConstant.MethodType.POST;
 
-    RestfulResponse instRsp = RestfulUtil.send(url, methodType, instReq);
+    RestfulResponse instRsp = RestfulUtil.send(url, methodType, instReq);    
+    ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance())
+            .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
+                segInput.getNsOperationKey().getOperationId(),
+                segInput.getNsOperationKey().getNodeTemplateUUID());
     ValidateUtil.assertObjectNotNull(instRsp);
+    if (!HttpCode.isSucess(instRsp.getStatus())) {
+        LOGGER.error("update segment operation status : fail to instantiate ns");
+        nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+        nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
+        nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
+        (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+        throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+            DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+      }
     LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus());
     LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent());
-    ValidateUtil.assertObjectNotNull(instRsp.getResponseContent());
+    ValidateUtil.assertObjectNotNull(instRsp.getResponseContent());    
     @SuppressWarnings("unchecked")
     Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class);
     String jobId = rsp.get(CommonConstant.JOB_ID);
-    ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance())
-        .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
-            segInput.getNsOperationKey().getOperationId(),
-            segInput.getNsOperationKey().getNodeTemplateUUID());
     if (ValidateUtil.isStrEmpty(jobId)) {
       LOGGER.error("Invalid jobId from instantiate operation");
       nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
@@ -242,17 +241,6 @@ public class VfcManager {
           DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION);
     }
     LOGGER.info("instantiate ns -> end");
-
-    if (!HttpCode.isSucess(instRsp.getStatus())) {
-      LOGGER.error("update segment operation status : fail to instantiate ns");
-      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-      nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
-      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
-      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
-          DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
-    }
-
     // Step 3: update segment operation job id
     LOGGER.info("update resource operation status job id -> begin");
     nsOperInfo.setJobId(jobId);
@@ -296,6 +284,17 @@ public class VfcManager {
     ValidateUtil.assertObjectNotNull(terminateRsp);
     LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus());
     LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent());
+    // Step 3: update segment operation
+    if (!HttpCode.isSucess(terminateRsp.getStatus())) {
+      LOGGER.error("fail to instantiate ns");
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.FAIL_TO_TERMINATE_NS);
+    }
     @SuppressWarnings("unchecked")
     Map<String, String> rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class);
     String jobId = rsp.get(CommonConstant.JOB_ID);
@@ -310,17 +309,6 @@ public class VfcManager {
     }
     LOGGER.info("terminate ns -> end");
 
-    // Step 3: update segment operation
-    if (!HttpCode.isSucess(terminateRsp.getStatus())) {
-      LOGGER.error("fail to instantiate ns");
-      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-      nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
-      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
-      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-
-      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
-          DriverExceptionID.FAIL_TO_TERMINATE_NS);
-    }
     LOGGER.info("update segment job id -> begin");
     nsOperInfo.setJobId(jobId);
     (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
@@ -380,7 +368,6 @@ public class VfcManager {
         && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) {
       LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType());
       nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
-      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
 
       if (RequestsDbConstant.OperationType.CREATE.equals(nsOperInfo.getOperType())) {
         nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
index 8b259e9..214451b 100644 (file)
@@ -19,8 +19,6 @@
  */
 package org.openecomp.mso.adapters.vfc.model;
 
-import java.util.Map;
-
 /**
  * <br>
  * <p>
@@ -39,7 +37,7 @@ public class LocationConstraint {
     /**
      * location constraints: vimId
      */
-    private Map<String, String> locationConstraints;
+    private VimLocation locationConstraints;
 
     /**
      * @return Returns the vnfProfileId.
@@ -55,17 +53,19 @@ public class LocationConstraint {
         this.vnfProfileId = vnfProfileId;
     }
 
+    
     /**
      * @return Returns the locationConstraints.
      */
-    public Map<String, String> getLocationConstraints() {
+    public VimLocation getLocationConstraints() {
         return locationConstraints;
     }
 
+    
     /**
      * @param locationConstraints The locationConstraints to set.
      */
-    public void setLocationConstraints(Map<String, String> locationConstraints) {
+    public void setLocationConstraints(VimLocation locationConstraints) {
         this.locationConstraints = locationConstraints;
     }
 
index f88a11d..1f16606 100644 (file)
  */
 package org.openecomp.mso.adapters.vfc.model;
 
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig;
+import org.openecomp.mso.logger.MsoLogger;
+
 /**
  * NS Create Input Parameter For VFC Adapter<br>
  * <p>
@@ -28,6 +37,8 @@ package org.openecomp.mso.adapters.vfc.model;
  */
 public class NSResourceInputParameter {
 
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+    
     private NsOperationKey nsOperationKey;
 
     private String nsServiceName;
@@ -91,5 +102,29 @@ public class NSResourceInputParameter {
     public void setNsOperationKey(NsOperationKey nsOperationKey) {
         this.nsOperationKey = nsOperationKey;
     }
+    public String toJsonString() {
+        String jsonString = null;
+        try {
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+            jsonString = mapper.writeValueAsString(this);
+        } catch (Exception e) {
+            LOGGER.debug("Exception:", e);
+        }
+        return jsonString;
+    }
 
+    public String toXmlString() {
+        try {
+            ByteArrayOutputStream bs = new ByteArrayOutputStream();
+            JAXBContext context = JAXBContext.newInstance(this.getClass());
+            Marshaller marshaller = context.createMarshaller();
+            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML
+            marshaller.marshal(this, bs);
+            return bs.toString();
+        } catch (Exception e) {
+            LOGGER.debug("Exception:", e);
+            return "";
+        }
+    }
 }
index e4d6d66..23bf36f 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.\r
  * ============LICENSE_END=========================================================\r
  */\r
+\r
 package org.openecomp.mso.adapters.vfc.model;\r
 \r
 /**\r
@@ -26,20 +27,20 @@ package org.openecomp.mso.adapters.vfc.model;
  * </p>\r
  * \r
  * @author\r
- * @version     ONAP Amsterdam Release  2017-09-15\r
+ * @version ONAP Amsterdam Release 2017-09-15\r
  */\r
 public class NsOperationKey {\r
-    \r
+\r
     /**\r
      * The subscriber id\r
      */\r
     private String globalSubscriberId;\r
-    \r
+\r
     /**\r
      * The serviceType\r
      */\r
     private String serviceType;\r
-    \r
+\r
     /**\r
      * The service ID\r
      */\r
@@ -49,15 +50,12 @@ public class NsOperationKey {
      * The Operation ID\r
      */\r
     private String operationId;\r
-    \r
+\r
     /**\r
      * the NS template uuid\r
      */\r
     private String nodeTemplateUUID;\r
 \r
-    \r
-    \r
-    \r
     /**\r
      * @return Returns the globalSubscriberId.\r
      */\r
@@ -65,14 +63,13 @@ public class NsOperationKey {
         return globalSubscriberId;\r
     }\r
 \r
-    \r
     /**\r
      * @param globalSubscriberId The globalSubscriberId to set.\r
      */\r
     public void setGlobalSubscriberId(String globalSubscriberId) {\r
         this.globalSubscriberId = globalSubscriberId;\r
     }\r
-    \r
+\r
     /**\r
      * @return Returns the serviceType.\r
      */\r
@@ -80,8 +77,6 @@ public class NsOperationKey {
         return serviceType;\r
     }\r
 \r
-\r
-    \r
     /**\r
      * @param serviceType The serviceType to set.\r
      */\r
@@ -89,9 +84,7 @@ public class NsOperationKey {
         this.serviceType = serviceType;\r
     }\r
 \r
-\r
     /**\r
-     * \r
      * <br>\r
      * \r
      * @return\r
@@ -102,7 +95,6 @@ public class NsOperationKey {
     }\r
 \r
     /**\r
-     *     \r
      * <br>\r
      * \r
      * @param serviceId\r
@@ -113,7 +105,6 @@ public class NsOperationKey {
     }\r
 \r
     /**\r
-     * \r
      * <br>\r
      * \r
      * @return\r
@@ -124,7 +115,6 @@ public class NsOperationKey {
     }\r
 \r
     /**\r
-     * \r
      * <br>\r
      * \r
      * @param operationId\r
@@ -134,7 +124,6 @@ public class NsOperationKey {
         this.operationId = operationId;\r
     }\r
 \r
-    \r
     /**\r
      * @return Returns the nodeTemplateUUID.\r
      */\r
@@ -142,7 +131,6 @@ public class NsOperationKey {
         return nodeTemplateUUID;\r
     }\r
 \r
-    \r
     /**\r
      * @param nodeTemplateUUID The nodeTemplateUUID to set.\r
      */\r
index 79d770b..2a5c305 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.openecomp.mso.adapters.vfc.model;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -34,8 +35,7 @@ public class NsParameters {
 
     private List<LocationConstraint> locationConstraints;
 
-    private Map<String, String> additionalParamForNs;
-
+    private Map<String, Object> additionalParamForNs = new HashMap<String,Object>();
     /**
      * @return Returns the locationConstraints.
      */
@@ -50,18 +50,19 @@ public class NsParameters {
         this.locationConstraints = locationConstraints;
     }
 
+    
     /**
      * @return Returns the additionalParamForNs.
      */
-    public Map<String, String> getAdditionalParamForNs() {
+    public Map<String, Object> getAdditionalParamForNs() {
         return additionalParamForNs;
     }
 
+    
     /**
      * @param additionalParamForNs The additionalParamForNs to set.
      */
-    public void setAdditionalParamForNs(Map<String, String> additionalParamForNs) {
+    public void setAdditionalParamForNs(Map<String, Object> additionalParamForNs) {
         this.additionalParamForNs = additionalParamForNs;
     }
-
 }
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================\r
  * ONAP - SO\r
  * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * limitations under the License.\r
  * ============LICENSE_END=========================================================\r
  */\r
+package org.openecomp.mso.adapters.vfc.model;\r
 \r
-package org.openecomp.camunda.bpmn.plugin.urnmap.db;\r
+/**\r
+ * \r
+ * <br>\r
+ * <p>\r
+ * </p>\r
+ * \r
+ * @author\r
+ * @version     ONAP Amsterdam Release  2017-10-18\r
+ */\r
+public class VimLocation {\r
+    private String vimId;\r
 \r
-public class URNData {\r
+    \r
+    /**\r
+     * @return Returns the vimId.\r
+     */\r
+    public String getVimId() {\r
+        return vimId;\r
+    }\r
 \r
-         private String URNName;\r
-         private String URNValue;\r
-         private String Ver_;\r
-       public String getURNName() {\r
-               return URNName;\r
-       }\r
-       public void setURNName(String uRNName) {\r
-               URNName = uRNName;\r
-       }\r
-       public String getURNValue() {\r
-               return URNValue;\r
-       }\r
-       public void setURNValue(String uRNValue) {\r
-               URNValue = uRNValue;\r
-       }\r
-       public String getVer_() {\r
-               return Ver_;\r
-       }\r
-       public void setVer_(String ver_) {\r
-               Ver_ = ver_;\r
-       }\r
-         \r
+    \r
+    /**\r
+     * @param vimId The vimId to set.\r
+     */\r
+    public void setVimId(String vimId) {\r
+        this.vimId = vimId;\r
+    }\r
+    \r
 }\r
index 85065c0..e8718fa 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.openecomp.mso.adapters.vfc.util;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.SocketTimeoutException;
 
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.config.RequestConfig;
@@ -46,6 +41,8 @@ import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
 import org.openecomp.mso.logger.MessageEnum;
 import org.openecomp.mso.logger.MsoAlarmLogger;
 import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoPropertiesException;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
 
 /**
  * <br>
@@ -58,179 +55,197 @@ import org.openecomp.mso.logger.MsoLogger;
  */
 public class RestfulUtil {
 
-  /**
-   * Log service
-   */
-  private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
-  private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
-
-  private static final int DEFAULT_TIME_OUT = 60;
-
-  private RestfulUtil() {
-
-  }
-
-  public static RestfulResponse send(String url, String methodType, String content) {
-    LOGGER.info(MessageEnum.RA_NS_EXC, url, "VFC", "");
-    LOGGER.debug("VFC Request Body:\n" + content);
-
-    HttpRequestBase method = null;
-    HttpResponse httpResponse = null;
-
-    try {
-      int timeout = DEFAULT_TIME_OUT;
-
-      RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout)
-          .setConnectTimeout(timeout).setConnectionRequestTimeout(timeout).build();
-
-      HttpClient client = HttpClientBuilder.create().build();
-
-      if ("POST".equals(methodType)) {
-        HttpPost httpPost = new HttpPost(url);
-        httpPost.setConfig(requestConfig);
-        httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
-        method = httpPost;
-      } else if ("PUT".equals(methodType)) {
-        HttpPut httpPut = new HttpPut(url);
-        httpPut.setConfig(requestConfig);
-        httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
-        method = httpPut;
-      } else if ("GET".equals(methodType)) {
-        HttpGet httpGet = new HttpGet(url);
-        httpGet.setConfig(requestConfig);
-        method = httpGet;
-      } else if ("DELETE".equals(methodType)) {
-        HttpDelete httpDelete = new HttpDelete(url);
-        httpDelete.setConfig(requestConfig);
-        method = httpDelete;
-      }
-
-      // now VFC have no auth
-      // String userCredentials =
-      // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
-      // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
-      // String authorization = "Basic " +
-      // DatatypeConverter.printBase64Binary(userCredentials.getBytes());
-      // method.setHeader("Authorization", authorization);
-
-      httpResponse = client.execute(method);
-
-      String responseContent = null;
-      if (httpResponse.getEntity() != null) {
-        responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
-      }
-
-      int statusCode = httpResponse.getStatusLine().getStatusCode();
-      String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
-
-      LOGGER.debug("VFC Response: " + statusCode + " " + statusMessage
-          + (responseContent == null ? "" : System.lineSeparator() + responseContent));
-
-      if (httpResponse.getStatusLine().getStatusCode() >= 300) {
-        String errMsg = "VFC returned " + statusCode + " " + statusMessage;
-        logError(errMsg);
-        return createResponse(statusCode, errMsg);
-      }
-
-      httpResponse = null;
-
-      if (null != method) {
-        method.reset();
-      } else {
-        LOGGER.debug("method is NULL:");
-      }
-
-      method = null;
-
-      LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
-      return createResponse(statusCode, responseContent);
-
-    } catch (SocketTimeoutException e) {
-      String errMsg = "Request to SDNC timed out";
-      logError(errMsg, e);
-      return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
-
-    } catch (ConnectTimeoutException e) {
-      String errMsg = "Request to SDNC timed out";
-      logError(errMsg, e);
-      return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
-
-    } catch (Exception e) {
-      String errMsg = "Error processing request to SDNC";
-      logError(errMsg, e);
-      return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
-
-    } finally {
-      if (httpResponse != null) {
-        try {
-          EntityUtils.consume(httpResponse.getEntity());
-        } catch (Exception e) {
-          LOGGER.debug("Exception :", e);
-        }
-      }
+    /**
+     * Log service
+     */
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+
+    private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
 
-      if (method != null) {
+    private static final int DEFAULT_TIME_OUT = 60000;
+
+    private static final MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
+    public static String getMsbHost() {
+        String msbIp = "10.229.32.131";
+        String msbPort = "8090";
         try {
-          method.reset();
-        } catch (Exception e) {
-          LOGGER.debug("Exception :", e);
+            msbIp = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-ip",
+                    "10.229.32.131");
+            msbPort = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-port", "8099");
+
+        } catch(MsoPropertiesException e) {
+            LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
+                    "Get msb properties failed");
+            e.printStackTrace();
         }
-      }
+        return "http://" + msbIp + ":" + msbPort;
+    }
+
+    private RestfulUtil() {
+
     }
-  }
-
-  private static void logError(String errMsg, Throwable t) {
-    LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg,
-        t);
-    ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
-  }
-
-  private static void logError(String errMsg) {
-    LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
-    ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
-  }
-
-  private static RestfulResponse createResponse(int statusCode, String content) {
-    RestfulResponse rsp = new RestfulResponse();
-    rsp.setStatus(statusCode);
-    rsp.setResponseContent(content);
-    return rsp;
-  }
-
-  /**
-   * @param request
-   * @return
-   */
-  public static String getRequestBody(HttpServletRequest request) {
-    String body = null;
-    StringBuilder stringBuilder = new StringBuilder();
-    BufferedReader bufferedReader = null;
-    try {
-      InputStream inputStream = request.getInputStream();
-      if (inputStream != null) {
-        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
-        char[] charBuffer = new char[128];
-        int bytesRead = -1;
-        while ((bytesRead = bufferedReader.read(charBuffer)) > 0)
-          stringBuilder.append(charBuffer, 0, bytesRead);
-      }
-    } catch (IOException ex) {
-      LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
-          "read inputStream buffer catch exception:", ex);
-    } finally {
-      if (bufferedReader != null) {
+
+    public static RestfulResponse send(String url, String methodType, String content) {
+        String msbUrl = getMsbHost() + url;
+        LOGGER.info(MessageEnum.RA_NS_EXC, msbUrl, "VFC", "");
+        LOGGER.debug("VFC Request Body:\n" + content);
+
+        HttpRequestBase method = null;
+        HttpResponse httpResponse = null;
+
         try {
-          bufferedReader.close();
-        } catch (IOException ex) {
-          LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
-              "close buffer catch exception:", ex);
+            int timeout = DEFAULT_TIME_OUT;
+
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
+                    .setConnectionRequestTimeout(timeout).build();
+
+            HttpClient client = HttpClientBuilder.create().build();
+
+            if("POST".equals(methodType.toUpperCase())) {
+                HttpPost httpPost = new HttpPost(msbUrl);
+                httpPost.setConfig(requestConfig);
+                httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+                method = httpPost;
+            } else if("PUT".equals(methodType.toUpperCase())) {
+                HttpPut httpPut = new HttpPut(msbUrl);
+                httpPut.setConfig(requestConfig);
+                httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+                method = httpPut;
+            } else if("GET".equals(methodType.toUpperCase())) {
+                HttpGet httpGet = new HttpGet(msbUrl);
+                httpGet.setConfig(requestConfig);
+                method = httpGet;
+            } else if("DELETE".equals(methodType.toUpperCase())) {
+                HttpDelete httpDelete = new HttpDelete(msbUrl);
+                httpDelete.setConfig(requestConfig);
+                method = httpDelete;
+            }
+
+            // now VFC have no auth
+            // String userCredentials =
+            // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
+            // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
+            // String authorization = "Basic " +
+            // DatatypeConverter.printBase64Binary(userCredentials.getBytes());
+            // method.setHeader("Authorization", authorization);
+
+            httpResponse = client.execute(method);
+
+            String responseContent = null;
+            if(httpResponse.getEntity() != null) {
+                responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+            }
+
+            int statusCode = httpResponse.getStatusLine().getStatusCode();
+            String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
+
+            LOGGER.debug("VFC Response: " + statusCode + " " + statusMessage
+                    + (responseContent == null ? "" : System.lineSeparator() + responseContent));
+
+            if(httpResponse.getStatusLine().getStatusCode() >= 300) {
+                String errMsg = "VFC returned " + statusCode + " " + statusMessage;
+                logError(errMsg);
+                return createResponse(statusCode, errMsg);
+            }
+
+            httpResponse = null;
+
+            if(null != method) {
+                method.reset();
+            } else {
+                LOGGER.debug("method is NULL:");
+            }
+
+            method = null;
+
+            LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "VFC", "");
+            return createResponse(statusCode, responseContent);
+
+        } catch(SocketTimeoutException e) {
+            String errMsg = "Request to VFC timed out";
+            logError(errMsg, e);
+            return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+
+        } catch(ConnectTimeoutException e) {
+            String errMsg = "Request to VFC timed out";
+            logError(errMsg, e);
+            return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+
+        } catch(Exception e) {
+            String errMsg = "Error processing request to VFC";
+            logError(errMsg, e);
+            return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
+
+        } finally {
+            if(httpResponse != null) {
+                try {
+                    EntityUtils.consume(httpResponse.getEntity());
+                } catch(Exception e) {
+                    LOGGER.debug("Exception :", e);
+                }
+            }
+
+            if(method != null) {
+                try {
+                    method.reset();
+                } catch(Exception e) {
+                    LOGGER.debug("Exception :", e);
+                }
+            }
         }
-      }
     }
 
-    body = stringBuilder.toString();
-    return body;
-  }
+    private static void logError(String errMsg, Throwable t) {
+        LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
+        ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
+    }
+
+    private static void logError(String errMsg) {
+        LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
+        ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
+    }
+
+    private static RestfulResponse createResponse(int statusCode, String content) {
+        RestfulResponse rsp = new RestfulResponse();
+        rsp.setStatus(statusCode);
+        rsp.setResponseContent(content);
+        return rsp;
+    }
+
+    /**
+     * @param request
+     * @return
+     */
+    // public static String getRequestBody(HttpServletRequest request) {
+    // String body = null;
+    // StringBuilder stringBuilder = new StringBuilder();
+    // BufferedReader bufferedReader = null;
+    // try {
+    // InputStream inputStream = request.getInputStream();
+    // if (inputStream != null) {
+    // bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+    // char[] charBuffer = new char[128];
+    // int bytesRead = -1;
+    // while ((bytesRead = bufferedReader.read(charBuffer)) > 0)
+    // stringBuilder.append(charBuffer, 0, bytesRead);
+    // }
+    // } catch (IOException ex) {
+    // LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
+    // "read inputStream buffer catch exception:", ex);
+    // } finally {
+    // if (bufferedReader != null) {
+    // try {
+    // bufferedReader.close();
+    // } catch (IOException ex) {
+    // LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
+    // "close buffer catch exception:", ex);
+    // }
+    // }
+    // }
+    //
+    // body = stringBuilder.toString();
+    // return body;
+    // }
 
 }
index 84991d7..95d3bf6 100644 (file)
@@ -24,8 +24,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.commons.io.IOUtils;
 import org.junit.After;
 import org.junit.Assert;
@@ -52,194 +50,191 @@ import mockit.MockUp;
  */
 public class VfcAdapterTest {
 
-  private VfcAdapterRest vfcAdapter = new VfcAdapterRest();
-
-  /**
-   * File path
-   */
-  private static final String FILE_PATH = "src/test/resources/json/";
-
-  /**
-   * Mock the request body form a file <br>
-   * 
-   * @param fileName
-   * @since ONAP Amsterdam Release
-   */
-  private void mockRestfulUtil(String fileName) {
-    new MockUp<RestfulUtil>() {
-
-      /**
-       * mock get request body <br>
-       * 
-       * @param request
-       * @return
-       * @since ONAP Amsterdam Release
-       */
-      @Mock
-      public String getRequestBody(HttpServletRequest request) {
+    private VfcAdapterRest vfcAdapter = new VfcAdapterRest();
+
+    /**
+     * File path
+     */
+    private static final String FILE_PATH = "src/test/resources/json/";
+
+    /**
+     * mock get request body <br>
+     * 
+     * @param request
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    public String getRequestBody(String fileName) {
         return getJsonString(fileName);
-      }
-
-      /**
-       * mock get send method <br>
-       * 
-       * @param url
-       * @param methodType
-       * @param content
-       * @return
-       * @since ONAP Amsterdam Release
-       */
-      @Mock
-      public RestfulResponse send(String url, String methodType, String content) {
-        if (url.equals(CommonConstant.NFVO_CREATE_URL)
-            && methodType.equals(CommonConstant.MethodType.POST)) {
-          return getResponse("createNsRsp.json");
-        } else if (url.contains("instantiate")
-            && methodType.equals(CommonConstant.MethodType.POST)) {
-          return getResponse("instantiateNsRsp.json");
-        } else if (methodType.equals(CommonConstant.MethodType.DELETE)) {
-          return getResponse(null);
-        } else if (url.contains("terminate") && methodType.equals(CommonConstant.MethodType.POST)) {
-          return getResponse("terminateNsRsp.json");
-        } else if (url.contains("/api/nslcm/v1/jobs")
-            && methodType.equals(CommonConstant.MethodType.GET)) {
-          return getResponse("queryJobRsp.json");
-        } else {
-          return null;
-        }
-      }
-    };
-  }
-
-  /**
-   * Mock the request body form a file <br>
-   * 
-   * @param fileName
-   * @since ONAP Amsterdam Release
-   */
-  private void mockRequestDatabase() {
-    new MockUp<RequestsDatabase>() {
-
-      /**
-       * mock get resource operation status <br>
-       * 
-       * @param request
-       * @return
-       * @since ONAP Amsterdam Release
-       */
-      @Mock
-      public ResourceOperationStatus getResourceOperationStatus(String serviceId,
-          String operationId, String resourceTemplateUUID) {
-        ResourceOperationStatus resStatus = new ResourceOperationStatus();
-        resStatus.setServiceId("111");
-        resStatus.setOperationId("111");
-        return resStatus;
-      }
-
-      /**
-       * Mock update Res Oper Status <br>
-       * 
-       * @param operStatus
-       * @since ONAP Amsterdam Release
-       */
-      @Mock
-      public void updateResOperStatus(ResourceOperationStatus operStatus) {
-
-      }
-    };
-  }
-
-  /**
-   * Before executing UT, start mock requst database <br>
-   * 
-   * @since ONAP Amsterdam Release
-   */
-  @Before
-  public void start() {
-    mockRequestDatabase();
-  }
-
-  /**
-   * After executing UT, close session<br/>
-   * 
-   * @since ONAP Amsterdam Release
-   */
-  @After
-  public void stop() {
-
-  }
-
-  @Test
-  public void createTest() {
-    // get request
-    mockRestfulUtil(FILE_PATH + "createNsReq.json");
-    vfcAdapter.createNfvoNs(null);
-  }
-
-  @Test
-  public void deleteTest() {
-    // get request
-    mockRestfulUtil(FILE_PATH + "deleteNsReq.json");
-    vfcAdapter.deleteNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
-  }
-
-  @Test
-  public void instantiateTest() {
-    // get request
-    mockRestfulUtil(FILE_PATH + "instantiateNsReq.json");
-    vfcAdapter.instantiateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
-  }
-
-  @Test
-  public void terminateTest() {
-    mockRestfulUtil(FILE_PATH + "terminateNsReq.json");
-    vfcAdapter.terminateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
-  }
-
-  @Test
-  public void queryJobTest() {
-    mockRestfulUtil(FILE_PATH + "queryJobReq.json");
-    vfcAdapter.queryNfvoJobStatus(null, "1");
-  }
-
-  /**
-   * Get json string from file.<br/>
-   * 
-   * @param file the path of file
-   * @return json string
-   * @throws IOException when fail to read
-   * @since ONAP Amsterdam Release 2017-9-6
-   */
-  @SuppressWarnings("deprecation")
-  private String getJsonString(final String file) {
-    if (ValidateUtil.isStrEmpty(file)) {
-      return "";
     }
 
-    String json = null;
-    try {
-      FileInputStream fileStream = new FileInputStream(new File(file));
-      json = IOUtils.toString(fileStream);
-    } catch (Exception e) {
-      Assert.fail(e.getMessage());
+    /**
+     * Mock the request body form a file <br>
+     * 
+     * @param fileName
+     * @since ONAP Amsterdam Release
+     */
+    private void mockRestfulUtil() {
+        new MockUp<RestfulUtil>() {
+
+            /**
+             * mock get send method <br>
+             * 
+             * @param url
+             * @param methodType
+             * @param content
+             * @return
+             * @since ONAP Amsterdam Release
+             */
+            @Mock
+            public RestfulResponse send(String url, String methodType, String content) {
+                if(url.equals(CommonConstant.NFVO_CREATE_URL) && methodType.equals(CommonConstant.MethodType.POST)) {
+                    return getResponse("createNsRsp.json");
+                } else if(url.contains("instantiate") && methodType.equals(CommonConstant.MethodType.POST)) {
+                    return getResponse("instantiateNsRsp.json");
+                } else if(methodType.equals(CommonConstant.MethodType.DELETE)) {
+                    return getResponse(null);
+                } else if(url.contains("terminate") && methodType.equals(CommonConstant.MethodType.POST)) {
+                    return getResponse("terminateNsRsp.json");
+                } else if(url.contains("/api/nslcm/v1/jobs") && methodType.equals(CommonConstant.MethodType.GET)) {
+                    return getResponse("queryJobRsp.json");
+                } else {
+                    return null;
+                }
+            }
+        };
+    }
+
+    /**
+     * Mock the request body form a file <br>
+     * 
+     * @param fileName
+     * @since ONAP Amsterdam Release
+     */
+    private void mockRequestDatabase() {
+        new MockUp<RequestsDatabase>() {
+
+            /**
+             * mock get resource operation status <br>
+             * 
+             * @param request
+             * @return
+             * @since ONAP Amsterdam Release
+             */
+            @Mock
+            public ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId,
+                    String resourceTemplateUUID) {
+                ResourceOperationStatus resStatus = new ResourceOperationStatus();
+                resStatus.setServiceId("111");
+                resStatus.setOperationId("111");
+                return resStatus;
+            }
+
+            /**
+             * Mock update Res Oper Status <br>
+             * 
+             * @param operStatus
+             * @since ONAP Amsterdam Release
+             */
+            @Mock
+            public void updateResOperStatus(ResourceOperationStatus operStatus) {
+
+            }
+        };
+    }
+
+    /**
+     * Before executing UT, start mock requst database <br>
+     * 
+     * @since ONAP Amsterdam Release
+     */
+    @Before
+    public void start() {
+        mockRequestDatabase();
+        mockRestfulUtil();
+    }
+
+    /**
+     * After executing UT, close session<br/>
+     * 
+     * @since ONAP Amsterdam Release
+     */
+    @After
+    public void stop() {
+
+    }
+
+    @Test
+    public void createTest() {
+        // get request
+        String createReq = getRequestBody(FILE_PATH + "createNsReq.json");
+        vfcAdapter.createNfvoNs(createReq);
+    }
+
+    @Test
+    public void deleteTest() {
+        // get request
+        String req = getRequestBody(FILE_PATH + "deleteNsReq.json");
+        vfcAdapter.deleteNfvoNs(req, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
     }
-    return json;
-  }
-
-  /**
-   * get the response from file <br>
-   * 
-   * @param fileName
-   * @return
-   * @since ONAP Amsterdam Release
-   */
-  private RestfulResponse getResponse(String fileName) {
-    RestfulResponse responseSuccess = new RestfulResponse();
-    responseSuccess.setStatus(HttpCode.RESPOND_OK);
-    if (null != fileName) {
-      String jsonStr = getJsonString(FILE_PATH + fileName);
-      responseSuccess.setResponseContent(jsonStr);
+
+    @Test
+    public void instantiateTest() {
+        // get request
+        String req = getRequestBody(FILE_PATH + "instantiateNsReq.json");
+        vfcAdapter.instantiateNfvoNs(req, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
+    }
+
+    @Test
+    public void terminateTest() {
+        String req = getRequestBody(FILE_PATH + "terminateNsReq.json");
+        vfcAdapter.deleteNfvoNs(req, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
+    }
+
+    @Test
+    public void queryJobTest() {
+        String req = getRequestBody(FILE_PATH + "queryJobReq.json");
+        vfcAdapter.queryNfvoJobStatus(req, "1");
+    }
+
+    /**
+     * Get json string from file.<br/>
+     * 
+     * @param file the path of file
+     * @return json string
+     * @throws IOException when fail to read
+     * @since ONAP Amsterdam Release 2017-9-6
+     */
+    @SuppressWarnings("deprecation")
+    private String getJsonString(final String file) {
+        if(ValidateUtil.isStrEmpty(file)) {
+            return "";
+        }
+
+        String json = null;
+        try {
+            FileInputStream fileStream = new FileInputStream(new File(file));
+            json = IOUtils.toString(fileStream);
+        } catch(Exception e) {
+            Assert.fail(e.getMessage());
+        }
+        return json;
+    }
+
+    /**
+     * get the response from file <br>
+     * 
+     * @param fileName
+     * @return
+     * @since ONAP Amsterdam Release
+     */
+    private RestfulResponse getResponse(String fileName) {
+        RestfulResponse responseSuccess = new RestfulResponse();
+        responseSuccess.setStatus(HttpCode.RESPOND_OK);
+        if(null != fileName) {
+            String jsonStr = getJsonString(FILE_PATH + fileName);
+            responseSuccess.setResponseContent(jsonStr);
+        }
+        return responseSuccess;
     }
-    return responseSuccess;
-  }
 }
index cba378e..a8e03d9 100644 (file)
@@ -86,7 +86,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
        private static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER";
     private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
     private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
-    private static final String LOG_REPLY_NAME = "MSO-VnfAdapter:MSO-BPMN.";
     private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
     private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
     private static final String CHECK_REQD_PARAMS = "org.openecomp.mso.adapters.vnf.checkRequiredParameters";
@@ -433,34 +432,36 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
     }
 
     private Map <String, String> copyStringOutputs (Map <String, Object> stackOutputs) {
-        Map <String, String> stringOutputs = new HashMap <String, String> ();
-        for (String key : stackOutputs.keySet ()) {
-            if (stackOutputs.get (key) instanceof String) {
-                stringOutputs.put (key, (String) stackOutputs.get (key));
-            } else if (stackOutputs.get(key) instanceof Integer)  {
+        Map <String, String> stringOutputs = new HashMap <> ();
+        for (Map.Entry<String,Object> entry : stackOutputs.entrySet ()) {
+            String key = entry.getKey();
+            Object value = entry.getValue();
+            if (value instanceof String) {
+                stringOutputs.put (key, (String) value);
+            } else if (value instanceof Integer)  {
                try {
-                       String str = "" + stackOutputs.get(key);
+                       String str = "" + value;
                        stringOutputs.put(key, str);
                } catch (Exception e) {
                        LOGGER.debug("Unable to add " + key + " to outputs",e);
                }
-            } else if (stackOutputs.get(key) instanceof JsonNode) {
+            } else if (value instanceof JsonNode) {
                try {
-                       String str = this.convertNode((JsonNode) stackOutputs.get(key));
+                       String str = this.convertNode((JsonNode) value);
                        stringOutputs.put(key, str);
                } catch (Exception e) {
                        LOGGER.debug("Unable to add " + key + " to outputs - exception converting JsonNode",e);
                }
-            } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
+            } else if (value instanceof java.util.LinkedHashMap) {
                try {
-                                       String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
+                                       String str = JSON_MAPPER.writeValueAsString(value);
                        stringOutputs.put(key, str);
                } catch (Exception e) {
                        LOGGER.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap",e);
                }
             } else {
                try {
-                       String str = stackOutputs.get(key).toString();
+                       String str = value.toString();
                        stringOutputs.put(key, str);
                } catch (Exception e) {
                        LOGGER.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage(),e);
@@ -471,7 +472,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
     }
 
     private Map <String, Object> copyStringInputs (Map <String, String> stringInputs) {
-        return new HashMap <String, Object> (stringInputs);
+        return new HashMap <> (stringInputs);
     }
 
     /*
@@ -485,7 +486,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         StringBuilder sb = new StringBuilder ();
         try (Scanner scanner = new Scanner (environment)) {
             scanner.useDelimiter ("\n");
-            String line = null;
+            String line;
             Pattern resource = Pattern.compile ("\\s*\"\\w+::\\S+\"\\s*:");
             LOGGER.debug ("regex pattern for finding a resource_registry: \\s*\"\\w+::\\S+\"\\s*:");
             while (scanner.hasNextLine ()) {
@@ -569,7 +570,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                boolean wait = p.waitFor(waitTimeMs, TimeUnit.MILLISECONDS);
 
                LOGGER.debug(" HeatBridgeMain.py returned " + wait + " with code " + p.exitValue());
-               return (wait && p.exitValue()==0);
+               return wait && p.exitValue()==0;
        } catch (IOException e) {
                LOGGER.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
                return false;
@@ -591,10 +592,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
        else if (inputs.size() < 1) {
                sb.append("\tEMPTY");
        } else {
-               for (String str : inputs.keySet()) {
+               for (Map.Entry<String,Object> entry : inputs.entrySet()) {
                        String outputString;
+                       String str = entry.getKey();
+                       Object value = entry.getValue();
                        try {
-                               outputString = inputs.get(str).toString();
+                               outputString = value.toString();
                        } catch (Exception e) {
                                LOGGER.debug("Exception :",e);
                                outputString = "Unable to call toString() on the value for " + str;
@@ -708,7 +711,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         String mcu = modelCustomizationUuid;
         boolean useMCUuid = false;
         if (mcu != null && !mcu.isEmpty()) {
-            if (mcu.equalsIgnoreCase("null")) {
+            if ("null".equalsIgnoreCase(mcu)) {
                 LOGGER.debug("modelCustomizationUuid: passed in as the string 'null' - will ignore: " + modelCustomizationUuid);
                 useMCUuid = false;
                 mcu = "";
@@ -720,25 +723,25 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
        MsoLogger.setLogContext (msoRequest);
        MsoLogger.setServiceName ("CreateVfModule");
        String requestTypeString = "";
-        if (requestType != null && !requestType.equals("")) {
+        if (requestType != null && !"".equals(requestType)) {
                requestTypeString = requestType;
         }
         String nestedStackId = null;
-        if (volumeGroupHeatStackId != null && !volumeGroupHeatStackId.equals("")) {
-               if (!volumeGroupHeatStackId.equalsIgnoreCase("null")) {
+        if (volumeGroupHeatStackId != null && !"".equals(volumeGroupHeatStackId)) {
+               if (!"null".equalsIgnoreCase(volumeGroupHeatStackId)) {
                        nestedStackId = volumeGroupHeatStackId;
                }
         }
         String nestedBaseStackId = null;
-        if (baseVfHeatStackId != null && !baseVfHeatStackId.equals("")) {
-               if (!baseVfHeatStackId.equalsIgnoreCase("null")) {
+        if (baseVfHeatStackId != null && !"".equals(baseVfHeatStackId)) {
+               if (!"null".equalsIgnoreCase(baseVfHeatStackId)) {
                        nestedBaseStackId = baseVfHeatStackId;
                }
         }
 
         if (inputs == null) {
                // Create an empty set of inputs
-               inputs = new HashMap<String,String>();
+               inputs = new HashMap<>();
                LOGGER.debug("inputs == null - setting to empty");
         } else {
                this.sendMapToDebug(inputs);
@@ -774,7 +777,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         vfRollback.setModelCustomizationUuid(mcu);
 
         // Put data into A&AI through Heatstack
-        boolean heatStackCallSuccess = callHeatbridge(baseVfHeatStackId);
+        callHeatbridge(baseVfHeatStackId);
 
         // First, look up to see if the VF already exists.
         MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
@@ -1037,17 +1040,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        minVersionVnf = null;
                        maxVersionVnf = null;
                }
-               if (minVersionVnf != null && minVersionVnf.equals("")) {
+               if (minVersionVnf != null && "".equals(minVersionVnf)) {
                        minVersionVnf = null;
                }
-               if (maxVersionVnf != null && maxVersionVnf.equals("")) {
+               if (maxVersionVnf != null && "".equals(maxVersionVnf)) {
                        maxVersionVnf = null;
                }
             }
                        if (minVersionVnf != null && maxVersionVnf != null) {
                                MavenLikeVersioning aicV = new MavenLikeVersioning();
                                CloudSite cloudSite = null;
-                               String aicVersion = "";
                                if (this.cloudConfig == null) {
                                        this.cloudConfig = this.cloudConfigFactory.getCloudConfig();
                                }
@@ -1133,7 +1135,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        }
                        // By the time we get here - heatTemplateId and heatEnvtId should be populated (or null)
                        HeatTemplate heatTemplate = null;
-                       if (heatTemplateArtifactUuid == null || heatTemplateArtifactUuid.equals("")) {
+                       if (heatTemplateArtifactUuid == null || "".equals(heatTemplateArtifactUuid)) {
                                String error = "Create: No Heat Template ID defined in catalog database for " + vnfType + ", reqType=" + requestTypeString;
                                LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vnfType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create: No Heat Template ID defined in catalog database");
                 LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
@@ -1158,7 +1160,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             HeatEnvironment heatEnvironment = null;
             String heatEnvironmentString = null;
 
-            if (heatEnvironmentArtifactUuid != null && !heatEnvironmentArtifactUuid.equals("")) {
+            if (heatEnvironmentArtifactUuid != null && !"".equals(heatEnvironmentArtifactUuid)) {
                 LOGGER.debug ("about to call getHeatEnvironment with :" + heatEnvironmentArtifactUuid + ":");
                 heatEnvironment = db.getHeatEnvironmentByArtifactUuid(heatEnvironmentArtifactUuid);
                 if (heatEnvironment == null) {
@@ -1184,13 +1186,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             LOGGER.debug ("In MsoVnfAdapterImpl, createVfModule about to call db.getNestedTemplates avec templateId="
                           + heatTemplate.getArtifactUuid());
             Map <String, Object> nestedTemplates = db.getNestedTemplates (heatTemplate.getArtifactUuid());
-            Map <String, Object> nestedTemplatesChecked = new HashMap <String, Object> ();
+            Map <String, Object> nestedTemplatesChecked = new HashMap <> ();
             if (nestedTemplates != null) {
                 // for debugging print them out
                 LOGGER.debug ("Contents of nestedTemplates - to be added to files: on stack:");
-                for (String providerResourceFile : nestedTemplates.keySet ()) {
+                for (Map.Entry<String, Object> entry : nestedTemplates.entrySet ()) {
+                    String providerResourceFile = entry.getKey();
+                    Object value = entry.getValue();
                     String providerResourceFileChecked = providerResourceFile; //this.enforceFilePrefix (providerResourceFile);
-                    String childTemplateBody = (String) nestedTemplates.get (providerResourceFile);
+                    String childTemplateBody = (String) value;
                     LOGGER.debug (providerResourceFileChecked + " -> " + childTemplateBody);
                     nestedTemplatesChecked.put (providerResourceFileChecked, childTemplateBody);
                 }
@@ -1202,7 +1206,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             // 1510 - Also add the files: for any get_files associated with this vnf_resource_id
             // *if* there are any
             Map<String, HeatFiles> heatFiles = null;
-                       Map<String, Object> heatFilesObjects = new HashMap<String, Object>();
+                       Map<String, Object> heatFilesObjects = new HashMap<>();
 
             // Add ability to turn on adding get_files with volume requests (by property).
             boolean addGetFilesOnVolumeReq = false;
@@ -1234,7 +1238,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                        // this will match the nested templates format
                                        LOGGER.debug("Contents of heatFiles - to be added to files: on stack:");
 
-                                       for (String heatFileName : heatFiles.keySet()) {
+                                       for (Map.Entry<String, HeatFiles> entry : heatFiles.entrySet()) {
+                                               String heatFileName = entry.getKey();
+                                               HeatFiles value = entry.getValue();
                                                if (heatFileName.startsWith("_ERROR|")) {
                                                        // This means there was an invalid entry in VF_MODULE_TO_HEAT_FILES table - the heat file it pointed to could not be found.
                                                        String heatFileId = heatFileName.substring(heatFileName.lastIndexOf("|")+1);
@@ -1246,8 +1252,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                                        alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
                                                        throw new VnfException (error, MsoExceptionCategory.INTERNAL);
                                                }
-                                               String heatFileBody = heatFiles.get(heatFileName)
-                                                               .getFileBody();
+                                               String heatFileBody = value.getFileBody();
                                                String heatFileNameChecked = heatFileName;
                                                LOGGER.debug(heatFileNameChecked + " -> "
                                                                + heatFileBody);
@@ -1263,14 +1268,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
             // Check that required parameters have been supplied
             String missingParams = null;
-            List <String> paramList = new ArrayList <String> ();
+            List <String> paramList = new ArrayList <> ();
 
             // New for 1510 - consult the PARAM_ALIAS field to see if we've been
             // supplied an alias. Only check if we don't find it initially.
             // Also new in 1510 - don't flag missing parameters if there's an environment - because they might be there.
             // And also new - add parameter to turn off checking all together if we find we're blocking orders we
             // shouldn't
-            boolean haveEnvironmentParameters = false;
             boolean checkRequiredParameters = true;
             try {
                 String propertyString = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_VNF_ADAPTER)
@@ -1292,7 +1296,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             if (heatEnvironmentString != null && heatEnvironmentString.contains ("parameters:")) {
                 //LOGGER.debug ("Have an Environment argument with a parameters: section - will bypass checking for valid params - but will still check for aliases");
                LOGGER.debug("Enhanced environment checking enabled - 1604");
-                haveEnvironmentParameters = true;
                 StringBuilder sb = new StringBuilder(heatEnvironmentString);
                 //LOGGER.debug("About to create MHEE with " + sb);
                 mhee = new MsoHeatEnvironmentEntry(sb);
@@ -1314,15 +1317,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             HashMap<String, Object> goldenInputs = null;
             
             LOGGER.debug("Now handle the inputs....first convert");
-            ArrayList<String> parameterNames = new ArrayList<String>();
-            HashMap<String, String> aliasToParam = new HashMap<String, String>();
+            ArrayList<String> parameterNames = new ArrayList<>();
+            HashMap<String, String> aliasToParam = new HashMap<>();
             StringBuilder sb = new StringBuilder("\nTemplate Parameters:\n");
             int cntr = 0;
             try { 
                for (HeatTemplateParam htp : heatTemplate.getParameters()) {
                        sb.append("param[" + cntr++ + "]=" + htp.getParamName());
                        parameterNames.add(htp.getParamName());
-                       if (htp.getParamAlias() != null && !htp.getParamAlias().equals("")) {
+                       if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) {
                                aliasToParam.put(htp.getParamAlias(), htp.getParamName());
                                sb.append(" ** (alias=" + htp.getParamAlias() + ")");
                        }
@@ -1534,7 +1537,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                            Holder <VnfRollback> rollback) throws VnfException {
        String vfModuleName = vnfName;
        String vfModuleType = vnfType;
-       String vfVersion = vnfVersion;
        String methodName = "updateVfModule";
        MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ());
        String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName;
@@ -1568,25 +1570,25 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         }
 
        String requestTypeString = "";
-        if (requestType != null && !requestType.equals("")) {
+        if (requestType != null && !"".equals(requestType)) {
                requestTypeString = requestType;
         }
         String nestedStackId = null;
-        if (volumeGroupHeatStackId != null && !volumeGroupHeatStackId.equals("")) {
-               if (!volumeGroupHeatStackId.equalsIgnoreCase("null")) {
+        if (volumeGroupHeatStackId != null && !"".equals(volumeGroupHeatStackId)) {
+               if (!"null".equalsIgnoreCase(volumeGroupHeatStackId)) {
                        nestedStackId = volumeGroupHeatStackId;
                }
         }
         String nestedBaseStackId = null;
-        if (baseVfHeatStackId != null && !baseVfHeatStackId.equals("")) {
-               if (!baseVfHeatStackId.equalsIgnoreCase("null")) {
+        if (baseVfHeatStackId != null && !"".equals(baseVfHeatStackId)) {
+               if (!"null".equalsIgnoreCase(baseVfHeatStackId)) {
                        nestedBaseStackId = baseVfHeatStackId;
                }
         }
 
         if (inputs == null) {
                // Create an empty set of inputs
-               inputs = new HashMap<String,String>();
+               inputs = new HashMap<>();
                LOGGER.debug("inputs == null - setting to empty");
         } else {
                this.sendMapToDebug(inputs);
@@ -1596,7 +1598,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         if (requestTypeString.startsWith("VOLUME")) {
                isVolumeRequest = true;
         }
-        if (vfModuleName == null || vfModuleName.trim().equals("")) {
+        if (vfModuleName == null || "".equals(vfModuleName.trim())) {
                if (vfModuleStackId != null) {
                        vfModuleName = this.getVfModuleNameFromModuleStackId(vfModuleStackId);
                }
@@ -1790,10 +1792,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        minVersionVnf = null;
                        maxVersionVnf = null;
                        }
-               if (minVersionVnf != null && minVersionVnf.equals("")) {
+               if (minVersionVnf != null && "".equals(minVersionVnf)) {
                        minVersionVnf = null;
                }
-               if (maxVersionVnf != null && maxVersionVnf.equals("")) {
+               if (maxVersionVnf != null && "".equals(maxVersionVnf)) {
                        maxVersionVnf = null;
                        }
                }
@@ -1898,13 +1900,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             LOGGER.debug ("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId="
                           + heatTemplate.getArtifactUuid ());
             Map <String, Object> nestedTemplates = db.getNestedTemplates (heatTemplate.getArtifactUuid ());
-            Map <String, Object> nestedTemplatesChecked = new HashMap <String, Object> ();
+            Map <String, Object> nestedTemplatesChecked = new HashMap <> ();
             if (nestedTemplates != null) {
                 // for debugging print them out
                 LOGGER.debug ("Contents of nestedTemplates - to be added to files: on stack:");
-                for (String providerResourceFile : nestedTemplates.keySet ()) {
+                for (Map.Entry<String, Object> entry : nestedTemplates.entrySet ()) {
+                    String providerResourceFile = entry.getKey();
+                    Object value = entry.getValue();
                     String providerResourceFileChecked = providerResourceFile; //this.enforceFilePrefix (providerResourceFile);
-                    String childTemplateBody = (String) nestedTemplates.get (providerResourceFile);
+                    String childTemplateBody = (String) value;
                     nestedTemplatesChecked.put (providerResourceFileChecked, childTemplateBody);
                     LOGGER.debug (providerResourceFileChecked + " -> " + childTemplateBody);
                 }
@@ -1920,7 +1924,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
             Map <String, HeatFiles> heatFiles = null;
 //            Map <String, HeatFiles> heatFiles = db.getHeatFiles (vnf.getId ());
-            Map <String, Object> heatFilesObjects = new HashMap <String, Object> ();
+            Map <String, Object> heatFilesObjects = new HashMap <> ();
 
             // Add ability to turn on adding get_files with volume requests (by property).
             boolean addGetFilesOnVolumeReq = false;
@@ -1944,7 +1948,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                     // this will match the nested templates format
                     LOGGER.debug ("Contents of heatFiles - to be added to files: on stack:");
 
-                    for (String heatFileName : heatFiles.keySet ()) {
+                    for (Map.Entry<String, HeatFiles> entry : heatFiles.entrySet ()) {
+                                               String heatFileName = entry.getKey();
+                                               HeatFiles value = entry.getValue();
                                                if (heatFileName.startsWith("_ERROR|")) {
                                                        // This means there was an invalid entry in VF_MODULE_TO_HEAT_FILES table - the heat file it pointed to could not be found.
                                                        String heatFileId = heatFileName.substring(heatFileName.lastIndexOf("|")+1);
@@ -1956,7 +1962,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                                        alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
                                                        throw new VnfException (error, MsoExceptionCategory.INTERNAL);
                                                }
-                        String heatFileBody = heatFiles.get (heatFileName).getFileBody ();
+                        String heatFileBody = value.getFileBody ();
                         LOGGER.debug (heatFileName + " -> " + heatFileBody);
                         heatFilesObjects.put (heatFileName, heatFileBody);
                     }
@@ -1968,7 +1974,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
             // Check that required parameters have been supplied
             String missingParams = null;
-            List <String> paramList = new ArrayList <String> ();
+            List <String> paramList = new ArrayList <> ();
 
             // New for 1510 - consult the PARAM_ALIAS field to see if we've been
             // supplied an alias. Only check if we don't find it initially.
@@ -2016,7 +2022,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             }
 
             // New for 1607 - support params of json type
-            HashMap<String, JsonNode> jsonParams = new HashMap<String, JsonNode>();
+            HashMap<String, JsonNode> jsonParams = new HashMap<>();
             boolean hasJson = false;
 
             for (HeatTemplateParam parm : heatTemplate.getParameters ()) {
@@ -2027,11 +2033,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                               + parm.getParamAlias ());
                 // handle json
                 String parameterType = parm.getParamType();
-                if (parameterType == null || parameterType.trim().equals("")) {
+                if (parameterType == null || "".equals(parameterType.trim())) {
                        parameterType = "String";
                 }
                 JsonNode jsonNode = null;
-                if (parameterType.equalsIgnoreCase("json") && inputs != null) {
+                if ("json".equalsIgnoreCase(parameterType) && inputs != null) {
                        if (inputs.containsKey(parm.getParamName()) ) {
                                hasJson = true;
                                String jsonString = null;
@@ -2138,7 +2144,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
             // Remove any extraneous parameters (don't throw an error)
             if (inputs != null) {
-                List <String> extraParams = new ArrayList <String> ();
+                List <String> extraParams = new ArrayList <> ();
                 extraParams.addAll (inputs.keySet ());
                 // This is not a valid parameter for this template
                 extraParams.removeAll (paramList);
@@ -2150,12 +2156,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             // 1607 - when we get here - we have clean inputs. Create inputsTwo in case we have json
             Map<String, Object> inputsTwo = null;
             if (hasJson && jsonParams.size() > 0) {
-               inputsTwo = new HashMap<String, Object>();
-               for (String keyParamName : inputs.keySet()) {
+               inputsTwo = new HashMap<>();
+               for (Map.Entry<String, String> entry : inputs.entrySet()) {
+                       String keyParamName = entry.getKey();
+                       String value = entry.getValue();
                        if (jsonParams.containsKey(keyParamName)) {
                                inputsTwo.put(keyParamName, jsonParams.get(keyParamName));
                        } else {
-                               inputsTwo.put(keyParamName, inputs.get(keyParamName));
+                               inputsTwo.put(keyParamName, value);
                        }
                }
             }
index 2686e4b..a383359 100644 (file)
Binary files a/asdc-controller/src/main/resources/resource-examples/service_Rg511NfmService.csar and b/asdc-controller/src/main/resources/resource-examples/service_Rg511NfmService.csar differ
index d2983ce..edbd8d8 100644 (file)
Binary files a/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar and b/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar differ
index dcbb73c..0abab94 100755 (executable)
@@ -1,5 +1,21 @@
 /*\r
- * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
  */\r
 package org.openecomp.mso.bpmn.common.scripts\r
 \r
index cd5ae79..94b4236 100644 (file)
@@ -283,7 +283,7 @@ class MsoUtils {
        def log(logmode,logtxt,isDebugLogEnabled="false"){\r
                MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);\r
                if ("INFO"==logmode) {\r
-                       msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt);\r
+                       msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName());\r
                } else if ("WARN"==logmode) {\r
                        // to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method\r
                        msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);\r
index 72f8810..c3912b4 100644 (file)
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.bpmn.common.adapter.vnf;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlType;\r
-\r
-\r
-/**\r
- * <p>Java class for msoRequest complex type.\r
- * \r
- * <p>The following schema fragment specifies the expected content contained within this class.\r
- * \r
- * <pre>\r
- * &lt;complexType name="msoRequest">\r
- *   &lt;complexContent>\r
- *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">\r
- *       &lt;sequence>\r
- *         &lt;element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>\r
- *         &lt;element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>\r
- *       &lt;/sequence>\r
- *     &lt;/restriction>\r
- *   &lt;/complexContent>\r
- * &lt;/complexType>\r
- * </pre>\r
- * \r
- * \r
- */\r
-@XmlAccessorType(XmlAccessType.FIELD)\r
-@XmlType(name = "msoRequest", propOrder = {\r
-    "requestId",\r
-    "serviceInstanceId"\r
-})\r
-public class MsoRequest {\r
-\r
-    protected String requestId;\r
-    protected String serviceInstanceId;\r
-\r
-    /**\r
-     * Gets the value of the requestId property.\r
-     * \r
-     * @return\r
-     *     possible object is\r
-     *     {@link String }\r
-     *     \r
-     */\r
-    public String getRequestId() {\r
-        return requestId;\r
-    }\r
-\r
-    /**\r
-     * Sets the value of the requestId property.\r
-     * \r
-     * @param value\r
-     *     allowed object is\r
-     *     {@link String }\r
-     *     \r
-     */\r
-    public void setRequestId(String value) {\r
-        this.requestId = value;\r
-    }\r
-\r
-    /**\r
-     * Gets the value of the serviceInstanceId property.\r
-     * \r
-     * @return\r
-     *     possible object is\r
-     *     {@link String }\r
-     *     \r
-     */\r
-    public String getServiceInstanceId() {\r
-        return serviceInstanceId;\r
-    }\r
-\r
-    /**\r
-     * Sets the value of the serviceInstanceId property.\r
-     * \r
-     * @param value\r
-     *     allowed object is\r
-     *     {@link String }\r
-     *     \r
-     */\r
-    public void setServiceInstanceId(String value) {\r
-        this.serviceInstanceId = value;\r
-    }\r
-    \r
-    public String toString() {\r
-       String request = "";\r
-       request =\r
-       "<requestId>"+requestId+"</requestId>" + '\n' +\r
-       "<serviceInstanceId>"+serviceInstanceId+"</serviceInstanceId>";\r
-       return request; \r
-    }\r
-\r
-}\r
+/*-
+ * ============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.openecomp.mso.bpmn.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for msoRequest complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="msoRequest">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         &lt;element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "msoRequest", propOrder = {
+    "requestId",
+    "serviceInstanceId"
+})
+public class MsoRequest {
+
+    protected String requestId;
+    protected String serviceInstanceId;
+
+    /**
+     * Gets the value of the requestId property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getRequestId() {
+        return requestId;
+    }
+
+    /**
+     * Sets the value of the requestId property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setRequestId(String value) {
+        this.requestId = value;
+    }
+
+    /**
+     * Gets the value of the serviceInstanceId property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getServiceInstanceId() {
+        return serviceInstanceId;
+    }
+
+    /**
+     * Sets the value of the serviceInstanceId property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setServiceInstanceId(String value) {
+        this.serviceInstanceId = value;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder request = new StringBuilder();
+        request.append("<requestId>"+requestId+"</requestId>");
+        request.append('\n');
+        request.append("<serviceInstanceId>"+serviceInstanceId+"</serviceInstanceId>");
+        return request.toString();
+    }
+
+}
index e938a25..787453e 100644 (file)
@@ -28,9 +28,9 @@ public class CryptoHandler implements ICryptoHandler {
        private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);\r
 \r
        private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";\r
-       //private static String msoAaiPwd = "mso0206";\r
        private static String msoAaiEncryptedPwd = "C1FC4A39E16419DD41DFC1212843F440";\r
 \r
+        @Override\r
        public String getMsoAaiPassword() {\r
                try {\r
                        return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);\r
@@ -41,6 +41,7 @@ public class CryptoHandler implements ICryptoHandler {
        }\r
 \r
 \r
+       @Override\r
        public String encryptMsoPassword(String plainMsoPwd) {\r
                try {\r
                        return CryptoUtils.encrypt(plainMsoPwd, msoKey);\r
@@ -50,7 +51,7 @@ public class CryptoHandler implements ICryptoHandler {
                }\r
        }\r
 \r
-\r
+       @Override\r
        public String decryptMsoPassword(String encryptedPwd) {\r
                try {\r
                        return CryptoUtils.decrypt(encryptedPwd, msoKey);\r
index b1d1085..c0be899 100644 (file)
@@ -25,9 +25,9 @@ import java.util.HashMap;
 import java.util.List;\r
 import java.util.Map;\r
 \r
-import org.camunda.bpm.BpmPlatform;\r
 import org.camunda.bpm.engine.MismatchingMessageCorrelationException;\r
 import org.camunda.bpm.engine.ProcessEngineServices;\r
+import org.camunda.bpm.engine.ProcessEngines;\r
 import org.camunda.bpm.engine.RuntimeService;\r
 import org.camunda.bpm.engine.runtime.Execution;\r
 import org.camunda.bpm.engine.runtime.MessageCorrelationResult;\r
@@ -371,7 +371,7 @@ public abstract class AbstractCallbackService {
        \r
        protected ProcessEngineServices getProcessEngineServices() {\r
                if (pes4junit == null) {\r
-                       return BpmPlatform.getDefaultProcessEngine();\r
+                       return ProcessEngines.getProcessEngine("infrastructure");\r
                } else {\r
                        return pes4junit;\r
                }\r
@@ -380,4 +380,4 @@ public abstract class AbstractCallbackService {
        public void setProcessEngineServices4junit(ProcessEngineServices pes) {\r
                pes4junit = pes;\r
        }\r
-}
\ No newline at end of file
+}
index 2492839..4534b56 100644 (file)
@@ -27,6 +27,6 @@ import org.camunda.bpm.engine.ProcessEngines;
 public class WorkflowAsyncCommonResource extends WorkflowAsyncResource {\r
 \r
     protected ProcessEngineServices getProcessEngineServices() {\r
-        return pes4junit.orElse(ProcessEngines.getProcessEngine("common"));\r
+        return pes4junit.orElse(ProcessEngines.getProcessEngine("infrastructure"));\r
     }\r
 }\r
index 4f62112..99909b6 100644 (file)
@@ -53,7 +53,7 @@ import org.slf4j.MDC;
  * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process\r
  */\r
 @Path("/async")\r
-public abstract class WorkflowAsyncResource {
+public abstract class WorkflowAsyncResource {\r
 \r
        private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();\r
        protected Optional<ProcessEngineServices> pes4junit = Optional.empty();\r
@@ -261,7 +261,10 @@ public abstract class WorkflowAsyncResource {
        }\r
 \r
        private static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {\r
-               if (inputVariables == null) return "";\r
+               if (inputVariables == null) {\r
+                       return "";\r
+               }\r
+\r
                return Objects.toString(inputVariables.get(key), "N/A");\r
        }\r
 \r
@@ -271,19 +274,21 @@ public abstract class WorkflowAsyncResource {
        }\r
        \r
        \r
-       protected abstract ProcessEngineServices getProcessEngineServices();
+       protected abstract ProcessEngineServices getProcessEngineServices();\r
        \r
        public void setProcessEngineServices4junit(ProcessEngineServices pes) {\r
                pes4junit = Optional.ofNullable(pes);\r
        }\r
 \r
        private static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {\r
-               Map<String, Object> inputVariables = new HashMap<String,Object>();\r
+               Map<String, Object> inputVariables = new HashMap<>();\r
                @SuppressWarnings("unchecked")\r
                Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");\r
-               for (String vName : vMap.keySet()) {\r
+               for (Map.Entry<String, Object> entry : vMap.entrySet()) {\r
+                       String vName = entry.getKey();\r
+                       Object value = entry.getValue();\r
                        @SuppressWarnings("unchecked")\r
-                       Map<String, Object> valueMap = (Map<String,Object>)vMap.get(vName); // value, type\r
+                       Map<String, Object> valueMap = (Map<String,Object>)value; // value, type\r
                        inputVariables.put(vName, valueMap.get("value"));\r
                }\r
                return inputVariables;\r
index 05c0688..731b18d 100644 (file)
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.bpmn.common.workflow.service;\r
-\r
-import java.util.concurrent.DelayQueue;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import javax.ws.rs.core.Response;\r
-\r
-import org.jboss.resteasy.spi.AsynchronousResponse;\r
-import org.slf4j.MDC;\r
-\r
-import org.openecomp.mso.logger.MessageEnum;\r
-import org.openecomp.mso.logger.MsoLogger;\r
-\r
-/**\r
- * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java\r
- * @version 1.0\r
- *\r
- */\r
-public class WorkflowContextHolder {\r
-\r
-       private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);\r
-       private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]";\r
-       private static WorkflowContextHolder instance = null;\r
-\r
-       /**\r
-        * Delay Queue which holds workflow context holder objects\r
-        */\r
-       private final DelayQueue<WorkflowContext> responseQueue = new DelayQueue<WorkflowContext>();\r
-       private final TimeoutThread timeoutThread = new TimeoutThread();\r
-\r
-       private WorkflowContextHolder() {\r
-               timeoutThread.start();\r
-       }\r
-\r
-       /**\r
-        * Singleton holder which eliminates hot lock\r
-        * Since the JVM synchronizes static method there is no synchronization needed for this method\r
-        * @return\r
-        */\r
-       public static synchronized WorkflowContextHolder getInstance() {\r
-               if (instance == null) {\r
-                       instance = new WorkflowContextHolder();\r
-               }\r
-               return instance;\r
-       }\r
-       \r
-       public void put(WorkflowContext context) {\r
-               msoLogger.debug(logMarker + " Adding context to the queue: "\r
-                       + context.getRequestId());\r
-               responseQueue.put(context);\r
-       }\r
-       \r
-       public void remove(WorkflowContext context) {\r
-               msoLogger.debug(logMarker + " Removing context from the queue: "\r
-                       + context.getRequestId());\r
-               responseQueue.remove(context);\r
-       }\r
-       \r
-       public WorkflowContext getWorkflowContext(String requestId) {\r
-               // Note: DelayQueue interator is threadsafe\r
-               for (WorkflowContext context : responseQueue) {\r
-                       if (requestId.equals(context.getRequestId())) {\r
-                               msoLogger.debug("Found context for request id: " + requestId);\r
-                               return context;\r
-                       }\r
-               }\r
-\r
-               msoLogger.debug("Unable to find context for request id: " + requestId);\r
-               return null;\r
-       }\r
-       \r
-       /**\r
-        * Builds the callback response object to respond to client\r
-        * @param processKey\r
-        * @param processInstanceId\r
-        * @param requestId\r
-        * @param callbackResponse\r
-        * @return\r
-        */\r
-       public Response processCallback(String processKey, String processInstanceId,\r
-                       String requestId, WorkflowCallbackResponse callbackResponse) {\r
-               WorkflowResponse workflowResponse = new WorkflowResponse();\r
-               WorkflowContext workflowContext = getWorkflowContext(requestId);\r
-\r
-               if (workflowContext == null) {\r
-                       msoLogger.debug("Unable to correlate workflow context for request id: " + requestId\r
-                               + ":processInstance Id:" + processInstanceId\r
-                               + ":process key:" + processKey);\r
-                       workflowResponse.setMessage("Fail");\r
-                       workflowResponse.setMessageCode(400);\r
-                       workflowResponse.setResponse("Unable to correlate workflow context, bad request. Request Id: " + requestId);\r
-                       return Response.serverError().entity(workflowResponse).build();\r
-               }\r
-\r
-               responseQueue.remove(workflowContext);\r
-\r
-               msoLogger.debug("Using callback response for request id: " + requestId);\r
-               workflowResponse.setResponse(callbackResponse.getResponse());\r
-               workflowResponse.setProcessInstanceID(processInstanceId);\r
-               workflowResponse.setMessageCode(callbackResponse.getStatusCode());\r
-               workflowResponse.setMessage(callbackResponse.getMessage());\r
-               sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse);\r
-               return Response.ok().entity(workflowResponse).build();\r
-       }\r
-       \r
-       /**\r
-        * Send the response to client asynchronously when invoked by the BPMN process\r
-        * @param processKey\r
-        * @param workflowContext\r
-        * @param workflowResponse\r
-        */\r
-       private void sendWorkflowResponseToClient(String processKey, WorkflowContext workflowContext,\r
-                       WorkflowResponse workflowResponse) {\r
-               msoLogger.debug(logMarker + "Sending the response for request id: " + workflowContext.getRequestId());\r
-               recordEvents(processKey, workflowResponse, workflowContext.getStartTime());\r
-               Response response = Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();\r
-               AsynchronousResponse asyncResp = workflowContext.getAsynchronousResponse();\r
-               asyncResp.setResponse(response);\r
-       }\r
-\r
-       /**\r
-        * Timeout thread which monitors the delay queue for expired context and send timeout response\r
-        * to client\r
-        *\r
-        * */\r
-       private class TimeoutThread extends Thread {\r
-               public void run() {\r
-                       while (!isInterrupted()) {\r
-                               try {\r
-                                       WorkflowContext requestObject = responseQueue.take();                                   \r
-                                       msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS));\r
-                                       msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId());\r
-                                       WorkflowResponse response = new WorkflowResponse();\r
-                                       response.setMessage("Fail");\r
-                                       response.setResponse("Request timedout, request id:" + requestObject.getRequestId());\r
-                                       //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId());\r
-                                       recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime());\r
-                                       response.setMessageCode(500);\r
-                                       Response result = Response.status(500).entity(response).build();\r
-                                       requestObject.getAsynchronousResponse().setResponse(result);\r
-                                       msoLogger.debug("Sending timeout response for request id:" + requestObject.getRequestId() + ":response:" + response);\r
-                               } catch (InterruptedException e) {\r
-                                       break;\r
-                               } catch (Exception e) {\r
-                                       msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e);\r
-                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), \r
-                                               MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread");\r
-                               \r
-                               }\r
-                       }\r
-\r
-                       msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting");\r
-               }\r
-       }\r
-       \r
-       private static void recordEvents(String processKey, WorkflowResponse response,\r
-                       long startTime) {\r
-\r
-               msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, \r
-                               logMarker + response.getMessage() + " for processKey: "\r
-                               + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);\r
-               \r
-               msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker \r
-                               + response.getMessage() + " for processKey: " \r
-                               + processKey + " with response: " + response.getResponse());\r
-               \r
-       }\r
-}\r
+/*-
+ * ============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.openecomp.mso.bpmn.common.workflow.service;
+
+import java.util.concurrent.DelayQueue;
+import java.util.concurrent.TimeUnit;
+
+import javax.ws.rs.core.Response;
+
+import org.jboss.resteasy.spi.AsynchronousResponse;
+import org.slf4j.MDC;
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java
+ * @version 1.0
+ *
+ */
+public class WorkflowContextHolder {
+
+       private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+       private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]";
+       private static WorkflowContextHolder instance = null;
+
+       /**
+        * Delay Queue which holds workflow context holder objects
+        */
+       private final DelayQueue<WorkflowContext> responseQueue = new DelayQueue<>();
+       private final TimeoutThread timeoutThread = new TimeoutThread();
+
+       private WorkflowContextHolder() {
+               timeoutThread.start();
+       }
+
+       /**
+        * Singleton holder which eliminates hot lock
+        * Since the JVM synchronizes static method there is no synchronization needed for this method
+        * @return
+        */
+       public static synchronized WorkflowContextHolder getInstance() {
+               if (instance == null) {
+                       instance = new WorkflowContextHolder();
+               }
+               return instance;
+       }
+       
+       public void put(WorkflowContext context) {
+               msoLogger.debug(logMarker + " Adding context to the queue: "
+                       + context.getRequestId());
+               responseQueue.put(context);
+       }
+       
+       public void remove(WorkflowContext context) {
+               msoLogger.debug(logMarker + " Removing context from the queue: "
+                       + context.getRequestId());
+               responseQueue.remove(context);
+       }
+       
+       public WorkflowContext getWorkflowContext(String requestId) {
+               // Note: DelayQueue interator is threadsafe
+               for (WorkflowContext context : responseQueue) {
+                       if (requestId.equals(context.getRequestId())) {
+                               msoLogger.debug("Found context for request id: " + requestId);
+                               return context;
+                       }
+               }
+
+               msoLogger.debug("Unable to find context for request id: " + requestId);
+               return null;
+       }
+       
+       /**
+        * Builds the callback response object to respond to client
+        * @param processKey
+        * @param processInstanceId
+        * @param requestId
+        * @param callbackResponse
+        * @return
+        */
+       public Response processCallback(String processKey, String processInstanceId,
+                       String requestId, WorkflowCallbackResponse callbackResponse) {
+               WorkflowResponse workflowResponse = new WorkflowResponse();
+               WorkflowContext workflowContext = getWorkflowContext(requestId);
+
+               if (workflowContext == null) {
+                       msoLogger.debug("Unable to correlate workflow context for request id: " + requestId
+                               + ":processInstance Id:" + processInstanceId
+                               + ":process key:" + processKey);
+                       workflowResponse.setMessage("Fail");
+                       workflowResponse.setMessageCode(400);
+                       workflowResponse.setResponse("Unable to correlate workflow context, bad request. Request Id: " + requestId);
+                       return Response.serverError().entity(workflowResponse).build();
+               }
+
+               responseQueue.remove(workflowContext);
+
+               msoLogger.debug("Using callback response for request id: " + requestId);
+               workflowResponse.setResponse(callbackResponse.getResponse());
+               workflowResponse.setProcessInstanceID(processInstanceId);
+               workflowResponse.setMessageCode(callbackResponse.getStatusCode());
+               workflowResponse.setMessage(callbackResponse.getMessage());
+               sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse);
+               return Response.ok().entity(workflowResponse).build();
+       }
+       
+       /**
+        * Send the response to client asynchronously when invoked by the BPMN process
+        * @param processKey
+        * @param workflowContext
+        * @param workflowResponse
+        */
+       private void sendWorkflowResponseToClient(String processKey, WorkflowContext workflowContext,
+                       WorkflowResponse workflowResponse) {
+               msoLogger.debug(logMarker + "Sending the response for request id: " + workflowContext.getRequestId());
+               recordEvents(processKey, workflowResponse, workflowContext.getStartTime());
+               Response response = Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
+               AsynchronousResponse asyncResp = workflowContext.getAsynchronousResponse();
+               asyncResp.setResponse(response);
+       }
+
+       /**
+        * Timeout thread which monitors the delay queue for expired context and send timeout response
+        * to client
+        *git review -R
+        * */
+       private class TimeoutThread extends Thread {
+               public void run() {
+                       while (!isInterrupted()) {
+                               try {
+                                       WorkflowContext requestObject = responseQueue.take();
+                                       msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS));
+                                       msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId());
+                                       WorkflowResponse response = new WorkflowResponse();
+                                       response.setMessage("Fail");
+                                       response.setResponse("Request timedout, request id:" + requestObject.getRequestId());
+                                       //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId());
+                                       recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime());
+                                       response.setMessageCode(500);
+                                       Response result = Response.status(500).entity(response).build();
+                                       requestObject.getAsynchronousResponse().setResponse(result);
+                                       msoLogger.debug("Sending timeout response for request id:" + requestObject.getRequestId() + ":response:" + response);
+                               } catch (InterruptedException e) {
+                                       break;
+                               } catch (Exception e) {
+                                       msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e);
+                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), 
+                                               MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread");
+                               
+                               }
+                       }
+
+                       msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting");
+               }
+       }
+       
+       private static void recordEvents(String processKey, WorkflowResponse response,
+                       long startTime) {
+
+               msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, 
+                               logMarker + response.getMessage() + " for processKey: "
+                               + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+               
+               msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker 
+                               + response.getMessage() + " for processKey: " 
+                               + processKey + " with response: " + response.getResponse());
+               
+       }
+}
index 7a53721..0521fb4 100644 (file)
@@ -618,7 +618,7 @@ public class WorkflowResource {
 \r
        private ProcessEngineServices getProcessEngineServices() {\r
                if (pes4junit == null) {\r
-                       return ProcessEngines.getDefaultProcessEngine();\r
+                       return ProcessEngines.getProcessEngine("infrastructure");\r
                } else {\r
                        return pes4junit;\r
                }\r
index 2629ea7..9bfd453 100644 (file)
@@ -50,7 +50,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
             <camunda:inputParameter name="payload"><![CDATA[${execution.getVariable("CMSO_setUpdateDBstatustoSuccessPayload")}]]></camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
index 4ac34f9..4f27e00 100644 (file)
@@ -133,7 +133,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraRespons
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
             <camunda:inputParameter name="method">POST</camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
index e743dc7..a8b5fcc 100644 (file)
@@ -1,11 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
        <!--
-               =========================================================================
-               AT&T Proprietary (Internal Use Only) Not for use or disclosure outside
-               the AT&T companies except under written agreement (c) 2015 AT&T
-               Intellectual Property. All rights reserved. AT&T and the AT&T logo are
-               trademarks of AT&T Intellectual Property.
-               =======================================================================
+               ============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=========================================================
        -->
        <!--
                ================================================================
index ce92a49..dcf52e3 100644 (file)
@@ -1,11 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-               =========================================================================
-               AT&T Proprietary (Internal Use Only) Not for use or disclosure outside
-               the AT&T companies except under written agreement (c) 2015 AT&T
-               Intellectual Property. All rights reserved. AT&T and the AT&T logo are
-               trademarks of AT&T Intellectual Property.
-               =======================================================================
+               ============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=========================================================
        -->
 <!--
                ================================================================
index 7c9247a..8281687 100644 (file)
@@ -40,6 +40,11 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
  */\r
 public class FalloutHandlerTest extends WorkflowTest {\r
        private void setupMocks() {\r
+               stubFor(post(urlEqualTo("/dbadapters/MsoRequestsDbAdapter"))\r
+                               .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBody("<DbTag>Notified</DbTag>")));\r
                stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))\r
                                .willReturn(aResponse()\r
                                .withStatus(200)\r
index ba45f54..5520d18 100644 (file)
@@ -13,8 +13,8 @@ mso.healthcheck.log.debug=false
 \r
 mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess\r
 \r
-mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter\r
-mso.openecomp.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter\r
+mso.adapters.db.endpoint=http://localhost:28090/dbadapters/MsoRequestsDbAdapter\r
+mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter\r
 mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC\r
 \r
 mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter\r
index 75858b1..204d9e4 100644 (file)
@@ -54,7 +54,7 @@ public class HealthCheckHandler  {
 
     private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
     private static final String SITENAME = "mso.sitename";
-    private static final String ADAPTER_ENDPOINT = "mso.adapters.db.endpoint";
+    private static final String ADAPTER_ENDPOINT = "mso.adapters.openecomp.db.endpoint";
     private static final String ADAPTER_NAMESPACE = "mso.adapters.namespace";
     private static final String CONFIG = "mso.bpmn.urn.properties";
     private static final String CREDENTIAL = "mso.adapters.db.auth";
index 18dbbea..450c5b1 100644 (file)
@@ -31,6 +31,7 @@ import org.openecomp.mso.bpmn.core.WorkflowException
 import org.openecomp.mso.bpmn.core.json.JsonUtils
 import org.openecomp.mso.rest.APIResponse
 
+import java.util.List;
 import java.util.UUID;
 
 import org.camunda.bpm.engine.delegate.BpmnError
@@ -54,7 +55,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                execution.setVariable("prefix",Prefix)
                String msg = ""
-               utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)
+               utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled)
 
                try {
 
@@ -63,13 +64,13 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
 
                        String requestId = execution.getVariable("mso-request-id")
                        execution.setVariable("msoRequestId", requestId)
-                       utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled)
+                       utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled)
 
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
                        if (isBlank(serviceInstanceId)) {
                                serviceInstanceId = UUID.randomUUID().toString()
                        }
-                       utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled)
+                       utils.log("INFO", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled)
                        serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
                        execution.setVariable("serviceInstanceId", serviceInstanceId)
 
@@ -90,96 +91,73 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                        if (isBlank(productFamilyId))
                        {
                                msg = "Input productFamilyId is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                               utils.log("INFO", msg, isDebugEnabled)
                                //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        } else {
                                execution.setVariable("productFamilyId", productFamilyId)
                        }
-
+                String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")      
+             utils.log("INFO", "userParams:" + userParams, isDebugEnabled)
+                List<String> paramList = jsonUtil.StringArrayToList(execution, userParams)
+                String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest")
                        //modelInfo
-                       String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
-                       if (isBlank(serviceModelInfo)) {
-                               msg = "Input serviceModelInfo is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                       if (isBlank(uuiRequest)) {
+                               msg = "Input uuiRequest is null"
+                               utils.log("INFO", msg, isDebugEnabled)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        } else
                        {
-                               execution.setVariable("serviceModelInfo", serviceModelInfo)
+                               execution.setVariable("uuiRequest", uuiRequest)
                        }
 
-                       utils.log("DEBUG", "modelInfo" + serviceModelInfo,  isDebugEnabled)
+                       utils.log("INFO", "uuiRequest:\n" + uuiRequest,  isDebugEnabled)
 
                        //requestParameters
-                       String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")
-                       if (isBlank(subscriptionServiceType)) {
-                               msg = "Input subscriptionServiceType is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                       String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.parameters.serviceType")
+                       if (isBlank(serviceType)) {
+                               msg = "Input serviceType is null"
+                               utils.log("INFO", msg, isDebugEnabled)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        } else {
-                               execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+                               execution.setVariable("serviceType", serviceType)
                        }
-
-                       
-                       /*
-                        * Extracting User Parameters from incoming Request and converting into a Map
-                        */
-                       def jsonSlurper = new JsonSlurper()
-                       def jsonOutput = new JsonOutput()
-
-                       Map reqMap = jsonSlurper.parseText(siRequest)
-
-                       //InputParams
-                       def userParams = reqMap.requestDetails?.requestParameters?.userParams
-
-                       Map<String, String> inputMap = [:]
-                       if (userParams) {
-                               userParams.each {
-                                       userParam -> inputMap.put(userParam.name, userParam.value)
-                               }
-                       }
-                       
-                       utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
-                       execution.setVariable("serviceInputParams", inputMap)
-                       
-                       //TODO
-                       //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
-                       //execution.setVariable("failExists", true)
+                       execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
 
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception ex){
                        msg = "Exception in preProcessRequest " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," ***** Exit preProcessRequest *****",  isDebugEnabled)
+               utils.log("INFO"," ***** Exit preProcessRequest *****",  isDebugEnabled)
        }
 
        public void sendSyncResponse (Execution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+               utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled)
 
                try {
-                       String requestId = execution.getVariable("msoRequestId")
+                       String operationId = execution.getVariable("operationId")
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
                        // RESTResponse for API Handler (APIH) Reply Task
-                       String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${requestId}"}}""".trim()
-                       utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestRequest, isDebugEnabled)
+                       String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()
+                       utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + createServiceRestRequest, isDebugEnabled)
                        sendWorkflowResponse(execution, 202, createServiceRestRequest)
                        execution.setVariable("sentSyncResponse", true)
 
                } catch (Exception ex) {
                        String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," ***** Exit sendSyncResopnse *****",  isDebugEnabled)
+               utils.log("INFO"," ***** Exit sendSyncResopnse *****",  isDebugEnabled)
        }
 
 
        public void sendSyncError (Execution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled)
+               utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled)
 
                try {
                        String errorMessage = ""
@@ -200,14 +178,14 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                        sendWorkflowResponse(execution, 500, buildworkflowException)
 
                } catch (Exception ex) {
-                       utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
+                       utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
                }
 
        }
 
        public void prepareCompletionRequest (Execution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled)
+               utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled)
 
                try {
                        String requestId = execution.getVariable("msoRequestId")
@@ -231,23 +209,23 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                        String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
 
                        execution.setVariable("completionRequest", xmlMsoCompletionRequest)
-                       utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
+                       utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
 
                } catch (Exception ex) {
                        String msg = " Exception in prepareCompletion:" + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled)
+               utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled)
        }
 
        public void prepareFalloutRequest(Execution execution){
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled)
+               utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled)
 
                try {
                        WorkflowException wfex = execution.getVariable("WorkflowException")
-                       utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled)
+                       utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled)
                        String requestId = execution.getVariable("msoRequestId")
                        String source = execution.getVariable("source")
                        String requestInfo =
@@ -260,7 +238,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                        String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
                        execution.setVariable("falloutRequest", falloutRequest)
                } catch (Exception ex) {
-                       utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled)
+                       utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled)
                        String errorException = "  Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest,  buildErrorResponse() - " + ex.getMessage()
                        String requestId = execution.getVariable("msoRequestId")
                        String falloutRequest =
@@ -280,7 +258,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
 
                        execution.setVariable("falloutRequest", falloutRequest)
                }
-               utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled)
+               utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled)
        }
        
        /**
@@ -288,25 +266,26 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
         */
        public void prepareInitServiceOperationStatus(Execution execution){
         def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-        utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+        utils.log("INFO", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
         try{
             String serviceId = execution.getVariable("serviceInstanceId")
             String operationId = UUID.randomUUID().toString()
+            String serviceName = execution.getVariable("serviceInstanceName")
             String operationType = "CREATE"
             String userId = ""
             String result = "processing"
             String progress = "0"
             String reason = ""
             String operationContent = "Prepare service creation"
-            utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
+            utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
             serviceId = UriUtils.encode(serviceId,"UTF-8")
             execution.setVariable("serviceInstanceId", serviceId)
             execution.setVariable("operationId", operationId)
             execution.setVariable("operationType", operationType)
 
-            def dbAdapterEndpoint = execution.getVariable("URN_mso_openecomp_adapters_db_endpoint")
+            def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
             execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
-            utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+            utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
 
             String payload =
                 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -316,8 +295,9 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                             <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
                             <serviceId>${serviceId}</serviceId>
                             <operationId>${operationId}</operationId>
+                            <serviceName>${serviceName}</serviceName>
                             <operationType>${operationType}</operationType>
-                            <userId>${userId}</responseBody>
+                            <userId>${userId}</userId>
                             <result>${result}</result>
                             <operationContent>${operationContent}</operationContent>
                             <progress>${progress}</progress>
@@ -328,14 +308,14 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
 
             payload = utils.formatXml(payload)
             execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
-            utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+            utils.log("INFO", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
             utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
 
         }catch(Exception e){
             utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
             execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
         }
-        utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)    
+        utils.log("INFO", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)    
        }
        
-}
\ No newline at end of file
+}
index 9416e68..80d7148 100644 (file)
@@ -37,6 +37,7 @@ import org.camunda.bpm.engine.runtime.Execution
 import org.apache.commons.lang3.*
 import org.apache.commons.codec.binary.Base64;
 import org.springframework.web.util.UriUtils
+import org.json.JSONException;
 
 /**
  * This groovy class supports the <class>CreateGenericALaCarteServiceInstance.bpmn</class> process.
@@ -85,7 +86,12 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
                        execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source"))
                        execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName"))
                        execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback"))
-                       String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")
+                       String productFamilyId = null;
+                       try { 
+                               productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")
+                       } catch (JSONException e) {
+                               productFamilyId = null;
+                       }
                        if (isBlank(productFamilyId))
                        {
                                msg = "Input productFamilyId is null"
index 99c37fb..37ff494 100644 (file)
@@ -408,7 +408,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
                        // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input
                        def vfModuleName = execution.getVariable("CVFMI_vfModuleName")
 
-                       def dbAdapterEndpoint = execution.getVariable("URN_mso_openecomp_adapters_db_endpoint")
+                       def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
                        execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
                        utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
 
index 7a047d4..206e614 100644 (file)
@@ -81,36 +81,17 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                                msg = "Input serviceInstanceId' is null"\r
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
                        }\r
-               \r
-                       //String xmlRequestDetails = vidUtils.getJsonRequestDetailstoXml(siRequest)\r
-                       //execution.setVariable("requestDetails", xmlRequestDetails)\r
-                       \r
-                       //modelInfo\r
-                       String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")\r
-                       if (isBlank(serviceModelInfo)) {\r
-                               msg = "Input serviceModelInfo is null"\r
+                                               \r
+                       String serviceType = execution.getVariable("serviceType")\r
+                       if (isBlank(serviceType)) {\r
+                               msg = "Input serviceType' is null"\r
                                utils.log("DEBUG", msg, isDebugEnabled)\r
-                       } else\r
-                       {\r
-                               execution.setVariable("serviceModelInfo", serviceModelInfo)\r
-                               //utils.log("DEBUG", "modelInfo" + serviceModelInfo,  isDebugEnabled)\r
-                       }\r
-                       \r
-                       //requestInfo\r
-                       String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")\r
-                       if (isBlank(productFamilyId))\r
-                       {\r
-                               msg = "Input productFamilyId is null"\r
-                               utils.log("DEBUG", msg, isDebugEnabled)\r
-                               //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
                        } else {\r
-                               execution.setVariable("productFamilyId", productFamilyId)\r
+                               execution.setVariable("serviceType", serviceType)\r
                        }\r
-                       String source = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")\r
-                       execution.setVariable("source", source)\r
                        \r
                        //subscriberInfo\r
-                       String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId")\r
+                       String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId")\r
                        if (isBlank(globalSubscriberId)) {\r
                                msg = "Input globalSubscriberId' is null"\r
                                utils.log("DEBUG", msg, isDebugEnabled)\r
@@ -118,37 +99,15 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                                execution.setVariable("globalSubscriberId", globalSubscriberId)\r
                        }\r
                        \r
-                       //requestParameters\r
-                       String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")\r
-                       if (isBlank(subscriptionServiceType)) {\r
-                               msg = "Input subscriptionServiceType is null"\r
-                               utils.log("DEBUG", msg, isDebugEnabled)\r
-                               //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
-                       } else {\r
-                               execution.setVariable("subscriptionServiceType", subscriptionServiceType)\r
-                       }\r
+                       //operationId\r
+                       String operationId = jsonUtil.getJsonValue(siRequest, "operationId")\r
+                       if (isBlank(operationId)) {\r
+                               operationId = UUID.randomUUID().toString()\r
+                        }   \r
+                       execution.setVariable("operationId", operationId) \r
                        \r
-                       /*\r
-                        * Extracting User Parameters from incoming Request and converting into a Map\r
-                        */\r
-                       def jsonSlurper = new JsonSlurper()\r
-                       def jsonOutput = new JsonOutput()\r
-\r
-                       Map reqMap = jsonSlurper.parseText(siRequest)\r
-\r
-                       //InputParams\r
-                       def userParams = reqMap.requestDetails?.requestParameters?.userParams\r
-\r
-                       Map<String, String> inputMap = [:]\r
-                       if (userParams) {\r
-                               userParams.each {\r
-                                       userParam -> inputMap.put(userParam.name, userParam.value)\r
-                               }\r
-                       }\r
+                       execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")\r
                        \r
-                       utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)\r
-                       execution.setVariable("serviceInputParams", inputMap)\r
-\r
                } catch (BpmnError e) {\r
                        throw e;\r
                } catch (Exception ex){\r
@@ -164,11 +123,10 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                utils.log("DEBUG", " *** sendSyncResponse  *** ", isDebugEnabled)\r
 \r
                try {\r
-                       String requestId = execution.getVariable("msoRequestId")\r
-                       String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
-\r
-                       // RESTResponse (for API Handler (APIH) Reply Task)\r
-                       String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()\r
+                       String operationId = execution.getVariable("operationId")\r
+                       \r
+                       // RESTResponse (for API Handler (APIH) Reply Task) :  :  \r
+                       String syncResponse = """{"operationId":"${operationId}"}""".trim()\r
                        utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)\r
                        sendWorkflowResponse(execution, 202, syncResponse)\r
 \r
index a2be303..ca67d5d 100644 (file)
@@ -81,31 +81,29 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
        public void preProcessRequest (Execution execution) {
                def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
                String msg = ""
-               utils.log("DEBUG"," ***** preProcessRequest *****",  isDebugEnabled)
+               utils.log("INFO"," ***** preProcessRequest *****",  isDebugEnabled)
 
                try {
-                       String requestId = execution.getVariable("msoRequestId")
                        execution.setVariable("prefix", Prefix)
-                       
                        //Inputs
                        //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
                        String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
-
+                       utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId,  isDebugEnabled)
                        //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
-                       String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
-
+                       String serviceType = execution.getVariable("serviceType")
+                       utils.log("INFO"," ***** serviceType *****" + serviceType,  isDebugEnabled)
                        //requestDetails.requestParameters. for SDNC assignTopology
                        String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
 
                        if (isBlank(globalSubscriberId)) {
                                msg = "Input globalSubscriberId is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                               utils.log("INFO", msg, isDebugEnabled)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
                        
-                       if (isBlank(subscriptionServiceType)) {
-                               msg = "Input subscriptionServiceType is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                       if (isBlank(serviceType)) {
+                               msg = "Input serviceType is null"
+                               utils.log("INFO", msg, isDebugEnabled)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
                        
@@ -116,93 +114,25 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
                        if (isBlank(sdncCallbackUrl)) {
                                msg = "URN_mso_workflow_sdncadapter_callback is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                               utils.log("INFO", msg, isDebugEnabled)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
                        execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
-                       utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
+                       utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
 
-                       //requestDetails.modelInfo.for AAI PUT servieInstanceData & SDNC assignTopology
-                       String modelInvariantUuid = ""
-                       String modelVersion = ""
-                       String modelUuid = ""
-                       String modelName = ""
-                       String serviceInstanceName = "" 
-                       //Generated in parent.for AAI PUT
-                       String serviceInstanceId = ""
-                       String serviceType = ""
-                       String serviceRole = ""
-                       
-                       //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology
-                       serviceInstanceName = execution.getVariable("serviceInstanceName")
-                       serviceInstanceId = execution.getVariable("serviceInstanceId")
-                       
-                       String serviceModelInfo = execution.getVariable("serviceModelInfo")
-                       if (isBlank(serviceModelInfo)) {
-                               msg = "Input serviceModelInfo is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-                       }
-                       modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
-                       modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
-                       modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
-                       modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
-                       //modelCustomizationUuid NA for SI
-       
-                       execution.setVariable("serviceType", serviceType)
-                       execution.setVariable("serviceRole", serviceRole)
-                       
-                       if (serviceInstanceName == null) {
-                               execution.setVariable("serviceInstanceName", "")
-                               serviceInstanceName = ""
-                       }
-                       if (isBlank(serviceInstanceId)){
-                               msg = "Input serviceInstanceId is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-                       }
-                       
-                       if (modelInvariantUuid == null) {
-                               modelInvariantUuid = ""
-                       }
-                       if (modelUuid == null) {
-                               modelUuid = ""
-                       }
-                       if (modelVersion == null) {
-                               modelVersion = ""
-                       }
-                       if (modelName == null) {
-                               modelName = ""
-                       }
+                       //requestDetails.modelInfo.for AAI PUT servieInstanceData                       
+                       //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData 
+                       String serviceInstanceName = execution.getVariable("serviceInstanceName")
+                       String serviceInstanceId = execution.getVariable("serviceInstanceId")
+                       String uuiRequest = execution.getVariable("uuiRequest")
+                       String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
+                       String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
+                       //aai serviceType and Role can be setted as fixed value now.
+                       String aaiServiceType = "voLTE type"
+                       String aaiServiceRole = "voLTE role"
                        
                        execution.setVariable("modelInvariantUuid", modelInvariantUuid)
-                       execution.setVariable("modelVersion", modelVersion)
                        execution.setVariable("modelUuid", modelUuid)
-                       execution.setVariable("modelName", modelName)
-                        
-                       StringBuilder sbParams = new StringBuilder()
-                       Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
-                       if (paramsMap != null)
-                       {
-                               sbParams.append("<service-input-parameters>")
-                               for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
-                                       String paramsXml
-                                       String paramName = entry.getKey()
-                                       String paramValue = entry.getValue()
-                                       paramsXml =
-                                                       """     <param>
-                                                       <name>${paramName}</name>
-                                                       <value>${paramValue}</value>
-                                                       </param>
-                                                       """
-                                       sbParams.append(paramsXml)
-                               }
-                               sbParams.append("</service-input-parameters>")
-                       }
-                       String siParamsXml = sbParams.toString()
-                       if (siParamsXml == null)
-                               siParamsXml = ""
-                       execution.setVariable("siParamsXml", siParamsXml)
 
                        //AAI PUT
                        String oStatus = execution.getVariable("initialStatus") ?: ""
@@ -218,111 +148,39 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
                        String serviceInstanceData =
                                        """<service-instance xmlns=\"${namespace}\">
-                                       <service-instance-name>${serviceInstanceName}</service-instance-name>
-                                       <service-type>${serviceType}</service-type>
-                                       <service-role>${serviceRole}</service-role>
+                               <service-instance-id>${serviceInstanceId}</service-instance-id>
+                               <service-instance-name>${serviceInstanceName}</service-instance-name>
+                                       <service-type>${aaiServiceType}</service-type>
+                                       <service-role>${aaiServiceRole}</service-role>
                                        ${statusLine}
                                    <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
                                    <model-version-id>${modelUuid}</model-version-id>
-                                       </service-instance>""".trim()
-
+                                       </service-instance>""".trim()                                   
                        execution.setVariable("serviceInstanceData", serviceInstanceData)
                        utils.logAudit(serviceInstanceData)
-                       utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
+                       utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)
+                       utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
 
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception ex){
                        msg = "Exception in preProcessRequest " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-               }
-               utils.log("DEBUG"," ***** Exit preProcessRequest *****",  isDebugEnabled)
-       }
-
-       //TODO: Will be able to replace with call to CustomE2EGetService as per the GenericGetService
-       public void getAAICustomerById (Execution execution) {
-               // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId}
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-               String msg = ""
-               try {
-
-                       String globalCustomerId = execution.getVariable("globalSubscriberId") //UUI to AAI name map
-                       utils.log("DEBUG"," ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId, isDebugEnabled)
-
-                       String aai_endpoint = execution.getVariable("URN_aai_endpoint")
-                       AaiUtil aaiUriUtil = new AaiUtil(this)
-                       String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
-                       if (isBlank(aai_endpoint) || isBlank(aai_uri))
-                       {
-                               msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri
-                               utils.log("DEBUG", msg, isDebugEnabled)
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-                       }
-                       String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8")
-
-                       utils.logAudit(getAAICustomerUrl)
-                       utils.log("DEBUG", "getAAICustomerById Url:" + getAAICustomerUrl, isDebugEnabled)
-                       APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl)
-                       String returnCode = response.getStatusCode()
-                       String aaiResponseAsString = response.getResponseBodyAsString()
-
-                       msg = "getAAICustomerById ResponseCode:" + returnCode + " ResponseString:" + aaiResponseAsString
-                       utils.log("DEBUG",msg, isDebugEnabled)
-                       utils.logAudit(msg)
-
-                       if (returnCode=='200') {
-                               // Customer found by ID. FLow to proceed.
-                               utils.log("DEBUG",msg, isDebugEnabled)
-
-                               //TODO Deferred
-                               //we might verify that service-subscription with matching name exists
-                               //and throw error if not. If not checked, we will get exception in subsequent step on Create call
-                               //in 1610 we assume both customer & service subscription were pre-created
-
-                       } else {
-                               if (returnCode=='404') {
-                                       msg = "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI"
-                                       utils.log("DEBUG", msg, isDebugEnabled)
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
-
-                               } else {
-                                       if (aaiResponseAsString.contains("RESTFault")) {
-                                               utils.log("ERROR", aaiResponseAsString)
-                                               WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution)
-                                               execution.setVariable("WorkflowException", workflowException)
-                                               throw new BpmnError("MSOWorkflowException")
-
-                                       } else {
-                                               // aai all errors
-                                               msg = "Error in getAAICustomerById ResponseCode:" + returnCode
-                                               utils.log("DEBUG", msg, isDebugEnabled)
-                                               exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
-                                       }
-                               }
-                       }
-
-               } catch (BpmnError e) {
-                       throw e;
-               } catch (Exception ex) {
-                       msg = "Exception in getAAICustomerById. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," *****Exit getAAICustomerById *****", isDebugEnabled)
-
+               utils.log("INFO"," ***** Exit preProcessRequest *****",  isDebugEnabled)
        }
 
        public void postProcessAAIGET(Execution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled)
+               utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled)
                String msg = ""
 
                try {
                        String serviceInstanceName = execution.getVariable("serviceInstanceName")
                        boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
                        if(succInAAI != true){
-                               utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
+                               utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
                                WorkflowException workflowException = execution.getVariable("WorkflowException")
                                utils.logAudit("workflowException: " + workflowException)
                                if(workflowException != null){
@@ -331,7 +189,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                                else
                                {
                                        msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
-                                       utils.log("DEBUG", msg, isDebugEnabled)
+                                       utils.log("INFO", msg, isDebugEnabled)
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
                                }
                        }
@@ -339,9 +197,9 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        {
                                boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
                                if(foundInAAI == true){
-                                       utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled)
+                                       utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
                                        msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
-                                       utils.log("DEBUG", msg, isDebugEnabled)
+                                       utils.log("INFO", msg, isDebugEnabled)
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
                                }
                        }
@@ -349,21 +207,21 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        throw e;
                } catch (Exception ex) {
                        msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
+               utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
        }
 
        public void postProcessAAIPUT(Execution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** postProcessAAIPUT ***** ", isDebugEnabled)
+               utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled)
                String msg = ""
                try {
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
                        boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
                        if(succInAAI != true){
-                               utils.log("DEBUG","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
+                               utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
                                WorkflowException workflowException = execution.getVariable("WorkflowException")
                                utils.logAudit("workflowException: " + workflowException)
                                if(workflowException != null){
@@ -387,150 +245,22 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        throw e;
                } catch (Exception ex) {
                        msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-               }
-               utils.log("DEBUG"," *** Exit postProcessAAIPUT *** ", isDebugEnabled)
-       }
-
-       public void preProcessSDNCAssignRequest(Execution execution) {
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-               String msg = ""
-               utils.log("DEBUG"," ***** preProcessSDNCAssignRequest *****", isDebugEnabled)
-
-               try {
-                       def serviceInstanceId = execution.getVariable("serviceInstanceId")
-                       def serviceInstanceName = execution.getVariable("serviceInstanceName")
-                       def callbackURL = execution.getVariable("sdncCallbackUrl")
-                       def requestId = execution.getVariable("msoRequestId")
-                       def serviceId = execution.getVariable("productFamilyId")
-                       def subscriptionServiceType = execution.getVariable("subscriptionServiceType")
-                       def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
-                       def serviceType = execution.getVariable("serviceType")
-
-                       def modelInvariantUuid = execution.getVariable("modelInvariantUuid")
-                       def modelVersion = execution.getVariable("modelVersion")
-                       def modelUuid = execution.getVariable("modelUuid")
-                       def modelName = execution.getVariable("modelName")
-                       
-                       def sdncRequestId = UUID.randomUUID().toString()
-                       
-                       def siParamsXml = execution.getVariable("siParamsXml")
-                       
-                       String sdncAssignRequest =
-                                       """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
-                                                                                                       xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
-                                                                                                       xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
-                                  <sdncadapter:RequestHeader>
-                                                       <sdncadapter:RequestId>${sdncRequestId}</sdncadapter:RequestId>
-                                                       <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
-                                                       <sdncadapter:SvcAction>assign</sdncadapter:SvcAction>
-                                                       <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
-                                                       <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
-                                                       <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction>
-                                       </sdncadapter:RequestHeader>
-                               <sdncadapterworkflow:SDNCRequestData>
-                                       <request-information>
-                                               <request-id>${requestId}</request-id>
-                                               <source>MSO</source>
-                                               <notification-url/>
-                                               <order-number/>
-                                               <order-version/>
-                                               <request-action>CreateServiceInstance</request-action>
-                                       </request-information>
-                                       <service-information>
-                                               <service-id>${serviceId}</service-id>
-                                               <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
-                                               <ecomp-model-information>
-                                                <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
-                                                <model-uuid>${modelUuid}</model-uuid>
-                                                <model-version>${modelVersion}</model-version>
-                                                <model-name>${modelName}</model-name>
-                                           </ecomp-model-information>
-                                               <service-instance-id>${serviceInstanceId}</service-instance-id>
-                                               <subscriber-name/>
-                                               <global-customer-id>${globalSubscriberId}</global-customer-id>
-                                       </service-information>
-                                       <service-request-input>
-                                               <service-instance-name>${serviceInstanceName}</service-instance-name>
-                                               ${siParamsXml}
-                                       </service-request-input>
-                               </sdncadapterworkflow:SDNCRequestData>
-                               </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
-
-                       utils.log("DEBUG","sdncAssignRequest:\n" + sdncAssignRequest, isDebugEnabled)
-                       sdncAssignRequest = utils.formatXml(sdncAssignRequest)
-                       execution.setVariable("sdncAssignRequest", sdncAssignRequest)
-                       utils.logAudit("sdncAssignRequest:  " + sdncAssignRequest)
-
-                       def sdncRequestId2 = UUID.randomUUID().toString()
-                       String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
-                       def sdncRequestId3 = UUID.randomUUID().toString()
-                       String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<")
-                       def rollbackData = execution.getVariable("rollbackData")
-                       rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate)
-                       rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete)
-                       execution.setVariable("rollbackData", rollbackData)
-                       
-                       utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled)
-
-               } catch (BpmnError e) {
-                       throw e;
-               } catch(Exception ex) {
-                       msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," *****Exit preProcessSDNCAssignRequest *****", isDebugEnabled)
-       }
-       
-       public void postProcessSDNCAssign (Execution execution) {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** postProcessSDNCAssign ***** ", isDebugEnabled)
-               try {
-                       WorkflowException workflowException = execution.getVariable("WorkflowException")
-                       utils.logAudit("workflowException: " + workflowException)
-
-                       boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
-
-                       String response = execution.getVariable("sdncAdapterResponse")
-                       utils.logAudit("SDNCResponse: " + response)
-
-                       SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
-                       sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
-
-                       if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
-                               utils.log("DEBUG","Good response from SDNC Adapter for service-instance  topology assign: \n" + response, isDebugEnabled)
-
-                               def rollbackData = execution.getVariable("rollbackData")
-                               rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true")
-                               execution.setVariable("rollbackData", rollbackData)
-
-                       }else{
-                               utils.log("DEBUG","Bad Response from SDNC Adapter for service-instance assign", isDebugEnabled)
-                               throw new BpmnError("MSOWorkflowException")
-                       }
-
-               } catch (BpmnError e) {
-                       throw e;
-               } catch(Exception ex) {
-                       msg = "Exception in postProcessSDNCAssign. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-               }
-               utils.log("DEBUG"," *** Exit postProcessSDNCAssign *** ", isDebugEnabled)
+               utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled)
        }
        
        public void postProcessAAIGET2(Execution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** postProcessAAIGET2 ***** ", isDebugEnabled)
+               utils.log("INFO"," ***** postProcessAAIGET2 ***** ", isDebugEnabled)
                String msg = ""
 
                try {
                        String serviceInstanceName = execution.getVariable("serviceInstanceName")
                        boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
                        if(succInAAI != true){
-                               utils.log("DEBUG","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
+                               utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
                                WorkflowException workflowException = execution.getVariable("WorkflowException")
                                utils.logAudit("workflowException: " + workflowException)
                                if(workflowException != null){
@@ -539,7 +269,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                                else
                                {
                                        msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
-                                       utils.log("DEBUG", msg, isDebugEnabled)
+                                       utils.log("INFO", msg, isDebugEnabled)
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
                                }
                        }
@@ -550,7 +280,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                                        String aaiService = execution.getVariable("GENGS_service")
                                        if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
                                                execution.setVariable("serviceInstanceName",  utils.getNodeText1(aaiService, "service-instance-name"))
-                                               utils.log("DEBUG","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)
+                                               utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)
                                        }
                                }
                        }
@@ -558,58 +288,58 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        throw e;
                } catch (Exception ex) {
                        msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled)
+               utils.log("INFO"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled)
        }
 
        public void preProcessRollback (Execution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled)
+               utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled)
                try {
                        
                        Object workflowException = execution.getVariable("WorkflowException");
 
                        if (workflowException instanceof WorkflowException) {
-                               utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
+                               utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
                                execution.setVariable("prevWorkflowException", workflowException);
                                //execution.setVariable("WorkflowException", null);
                        }
                } catch (BpmnError e) {
-                       utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled)
+                       utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled)
                } catch(Exception ex) {
                        String msg = "Exception in preProcessRollback. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                }
-               utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled)
+               utils.log("INFO"," *** Exit preProcessRollback *** ", isDebugEnabled)
        }
 
        public void postProcessRollback (Execution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled)
+               utils.log("INFO"," ***** postProcessRollback ***** ", isDebugEnabled)
                String msg = ""
                try {
                        Object workflowException = execution.getVariable("prevWorkflowException");
                        if (workflowException instanceof WorkflowException) {
-                               utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled)
+                               utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled)
                                execution.setVariable("WorkflowException", workflowException);
                        }
                        execution.setVariable("rollbackData", null)
                } catch (BpmnError b) {
-                       utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled)
+                       utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled)
                        throw b;
                } catch(Exception ex) {
                        msg = "Exception in postProcessRollback. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                }
-               utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled)
+               utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled)
        }
 
        public void preInitResourcesOperStatus(Execution execution){
         def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
 
-        utils.log("DEBUG", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+        utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
         try{
             String serviceId = execution.getVariable("serviceInstanceId")
             String operationId = execution.getVariable("operationId")
@@ -619,26 +349,21 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
             String progress = "0"
             String reason = ""
             String operationContent = "Prepare service creation"
-            utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + oprationType, isDebugEnabled)
+            utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
             serviceId = UriUtils.encode(serviceId,"UTF-8")
             execution.setVariable("serviceInstanceId", serviceId)
             execution.setVariable("operationId", operationId)
             execution.setVariable("operationType", operationType)
-            def jsonSlurper = new JsonSlurper()
-            def jsonOutput = new JsonOutput()
-            String incomingRequest = execution.getVariable("bpmnRequest")
-            Map serviceReq =  jsonSlurper.parseText(incomingRequest)
-            def segmentList = serviceReq.service.parameters.segments
-                    
-            if (segmentList != null) {
-                segmentList.each {
-                    resourceTemplateUUIDs  = resourcesUUIDs + it.resourceUUID + ":"
-                }
-            }            
-
-            def dbAdapterEndpoint = execution.getVariable("URN_mso_openecomp_adapters_db_endpoint")
+            String incomingRequest = execution.getVariable("uuiRequest")
+            String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")  
+            List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)   
+            for(String resource : resourceList){
+                    resourceTemplateUUIDs  = resourceTemplateUUIDs + jsonUtil.getJsonValue(resource, "resourceDefId") + ":"
+            }           
+
+            def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
             execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
-            utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+            utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
 
             String payload =
                 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -656,45 +381,49 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
 
             payload = utils.formatXml(payload)
             execution.setVariable("CVFMI_initResOperStatusRequest", payload)
-            utils.log("DEBUG", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+            utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
             utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
 
         }catch(Exception e){
             utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
             execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
         }
-        utils.log("DEBUG", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)  
+        utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)  
        }
        
        /**
         * prepare resource create request
         */
-       public void preResourceRequest(execution, resourceType){
+       public void preResourceRequest(execution){
+           String resourceType = execution.getVariable("resourceType")
            def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
            String serviceInstanceName = execution.getVariable("serviceInstanceName")
-           String nsServiceName = nsName + "_" + serviceInstanceName
-           String nsServiceDescription = execution.getVariable("serviceInstanceDescription")
+           String nsServiceName = resourceType + "_" + serviceInstanceName
            execution.setVariable("nsServiceName", nsServiceName)
-           utils.log("DEBUG", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled)
-           execution.setVariable("nsServiceDescription", nsServiceDescription)
-           utils.log("DEBUG", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
+           utils.log("INFO", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled)
         String globalSubscriberId = execution.getVariable("globalSubscriberId")
         String serviceType = execution.getVariable("serviceType")
-        String serviceId = execution.getVariable("serviceId")
+        String serviceId = execution.getVariable("serviceInstanceId")
+        execution.setVariable("serviceId", serviceId)
         String operationId = execution.getVariable("operationId")
-        String incomingRequest = execution.getVariable("bpmnRequest")
-        Map serviceReq =  jsonSlurper.parseText(incomingRequest)
-        def segmentList = serviceReq.service.parameters.segments                
-        if (segmentList != null) {
-            segmentList.each {
-                if(StringUtils.containsIgnoreCase(it.resourceName, resourceType)){
-                    String resourceUUID  = it.resourceUUID
-                    String resourceParameters = it.nsParameters
-                    execution.setVariable("resourceType", resourceType)
-                    execution.setVariable("resourceUUID", resourceUUID)
-                    execution.setVariable("resourceParameters", resourceParameters)
-                }                
-            }
-        } 
+        String incomingRequest = execution.getVariable("uuiRequest")
+        String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")  
+        String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")  
+        execution.setVariable("nsServiceDescription", nsServiceDescription)
+        utils.log("INFO", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
+        List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)   
+        for(String resource : resourceList){
+            String resourceName = jsonUtil.getJsonValue(resource, "resourceName")  
+            if(StringUtils.containsIgnoreCase(resourceName, resourceType)){
+                String resourceUUID  = jsonUtil.getJsonValue(resource, "resourceDefId")
+                String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")                
+                execution.setVariable("resourceUUID", resourceUUID)
+                execution.setVariable("resourceParameters", resourceParameters)
+                utils.log("INFO", "Prepare VFC Request resourceType:" + resourceType, isDebugEnabled)
+                utils.log("INFO", "Prepare VFC Request resourceUUID:" + resourceUUID, isDebugEnabled)
+                utils.log("INFO", "Prepare VFC Request resourceParameters:" + resourceParameters, isDebugEnabled)
+            } 
+        }
+           utils.log("INFO", "Prepare VFC Request finished", isDebugEnabled)
        }
 }
index 0eb16a2..18925d3 100644 (file)
@@ -257,6 +257,8 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        }
 
                        String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
+                       String serviceTypeLine = isBlank(serviceType) ? "" : "<service-type>${serviceType}</service-type>"
+                       String serviceRoleLine = isBlank(serviceRole) ? "" : "<service-role>${serviceRole}</service-role>"
                                
                        AaiUtil aaiUriUtil = new AaiUtil(this)
                        String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
@@ -264,8 +266,8 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        String serviceInstanceData =
                                        """<service-instance xmlns=\"${namespace}\">
                                        <service-instance-name>${serviceInstanceName}</service-instance-name>
-                                       <service-type>${serviceType}</service-type>
-                                       <service-role>${serviceRole}</service-role>
+                                       ${serviceTypeLine}
+                                       ${serviceRoleLine}
                                        ${statusLine}
                                    <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
                                    <model-version-id>${modelUuid}</model-version-id>
index 6c0dedf..2e62abd 100644 (file)
@@ -46,16 +46,14 @@ import org.openecomp.mso.rest.APIResponse;
  */\r
 public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {\r
 \r
-    String createUrl = "/vfc/vfcadapters/v1/ns"\r
-            \r
-    String instantiateUrl = "/vfcvfcadatpers/v1/ns/{nsInstanceId}/instantiate"\r
+    String vfcUrl = "/vfc/rest/v1/vfcadapter"\r
     \r
-    String queryJobUrl = "/vfc/vfcadatpers/v1/jobs/{jobId}"\r
+    String host = "http://mso.mso.testlab.openecomp.org:8080"\r
     \r
     ExceptionUtil exceptionUtil = new ExceptionUtil()\r
 \r
     JsonUtils jsonUtil = new JsonUtils()\r
-\r
+    \r
     /**\r
      * Pre Process the BPMN Flow Request\r
      * Inclouds:\r
@@ -65,23 +63,23 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
     public void preProcessRequest (Execution execution) {\r
           def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
        String msg = ""\r
-       utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)\r
+       utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled)\r
        try {\r
            //deal with nsName and Description\r
            String nsServiceName = execution.getVariable("nsServiceName")\r
            String nsServiceDescription = execution.getVariable("nsServiceDescription")\r
-           utils.log("DEBUG", "nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled)\r
+           utils.log("INFO", "nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled)\r
            //deal with operation key\r
            String globalSubscriberId = execution.getVariable("globalSubscriberId")\r
-           utils.log("DEBUG", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)\r
+           utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)\r
            String serviceType = execution.getVariable("serviceType")\r
-           utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled)\r
+           utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)\r
            String serviceId = execution.getVariable("serviceId")\r
-           utils.log("DEBUG", "serviceId:" + serviceId, isDebugEnabled)\r
+           utils.log("INFO", "serviceId:" + serviceId, isDebugEnabled)\r
            String operationId = execution.getVariable("operationId")\r
-           utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled)\r
+           utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)\r
            String nodeTemplateUUID = execution.getVariable("resourceUUID")\r
-           utils.log("DEBUG", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled)\r
+           utils.log("INFO", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled)\r
            /*\r
             * segmentInformation needed as a object of segment\r
             * {\r
@@ -93,11 +91,15 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
             *     }\r
             * }\r
             */\r
-           String nsParameters = execution.getVariable("resourceParamters")\r
-           utils.log("DEBUG", "Input Request:" + siRequest, isDebugEnabled)\r
-           String nsOperationKey = "{\"globalSubscriberId\":\"" + globalSubscriberId + "\",\"serviceType:\""\r
-                 + serviceType + "\",\"serviceId\":\"" + serviceId + "\",\"operationId\":\"" + operationId\r
-                 +"\",\"nodeTemplateUUID\":\"" + nodeTemplateUUID + "\"}";\r
+           String nsParameters = execution.getVariable("resourceParameters")\r
+           utils.log("INFO", "nsParameters:" + nsParameters, isDebugEnabled)\r
+           String nsOperationKey = """{\r
+                   "globalSubscriberId":"${globalSubscriberId}",\r
+                   "serviceType":"${serviceType}",\r
+                   "serviceId":"${serviceId}",\r
+                   "operationId":"${operationId}",\r
+                   "nodeTemplateUUID":"${nodeTemplateUUID}"\r
+                    }"""\r
            execution.setVariable("nsOperationKey", nsOperationKey);\r
            execution.setVariable("nsParameters", nsParameters)\r
            \r
@@ -106,24 +108,29 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
            throw e;\r
        } catch (Exception ex){\r
            msg = "Exception in preProcessRequest " + ex.getMessage()\r
-           utils.log("DEBUG", msg, isDebugEnabled)\r
+           utils.log("INFO", msg, isDebugEnabled)\r
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
        }\r
-       utils.log("DEBUG"," ***** Exit preProcessRequest *****",  isDebugEnabled)\r
+       utils.log("INFO"," ***** Exit preProcessRequest *****",  isDebugEnabled)\r
        }\r
 \r
     /**\r
      * create NS task\r
      */\r
     public void createNetworkService(Execution execution) {\r
-        \r
-        String nsOperationKey = excution.getVariable("nsOperationKey");\r
-        String nsParameters = excution.getVariable("nsParameters");\r
+        def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+        utils.log("INFO"," *****  createNetworkService *****",  isDebugEnabled)\r
+        String nsOperationKey = execution.getVariable("nsOperationKey");\r
+        String nsParameters = execution.getVariable("nsParameters");\r
         String nsServiceName = execution.getVariable("nsServiceName")\r
         String nsServiceDescription = execution.getVariable("nsServiceDescription")\r
-        String reqBody = "{\"nsServiceName\":\"" + nsServiceName + "\",\"nsServiceDescription\":\"" + nsServiceDescription\r
-              +"\",\"nsOperationKey\":" + nsOperationKey + ",\"nsParameters\":" + nsParameters\r
-        APIResponse apiResponse = postRequest(createUrl, reqBody)\r
+        String reqBody ="""{\r
+                "nsServiceName":"${nsServiceName}",\r
+                "nsServiceDescription":"${nsServiceDescription}",\r
+                "nsOperationKey":${nsOperationKey},\r
+                "nsParameters":${nsParameters}\r
+               }"""\r
+        APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody)\r
         String returnCode = apiResponse.getStatusCode()\r
         String aaiResponseAsString = apiResponse.getResponseBodyAsString()\r
         String nsInstanceId = "";\r
@@ -131,83 +138,150 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
             nsInstanceId =  jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId")\r
         }\r
         execution.setVariable("nsInstanceId", nsInstanceId)\r
-        \r
+        utils.log("INFO"," *****Exit  createNetworkService *****",  isDebugEnabled)\r
     }\r
 \r
     /**\r
      * instantiate NS task\r
      */\r
     public void instantiateNetworkService(Execution execution) {\r
-        String nsOperationKey = excution.getVariable("nsOperationKey");\r
-        String nsParameters = excution.getVariable("nsParameters");\r
+        def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+        utils.log("INFO"," *****  instantiateNetworkService *****",  isDebugEnabled)\r
+        String nsOperationKey = execution.getVariable("nsOperationKey");\r
+        String nsParameters = execution.getVariable("nsParameters");\r
         String nsServiceName = execution.getVariable("nsServiceName")\r
         String nsServiceDescription = execution.getVariable("nsServiceDescription")\r
-        String reqBody = "{\"nsServiceName\":\"" + nsServiceName + "\",\"nsServiceDescription\":\"" + nsServiceDescription\r
-              +"\",\"nsOperationKey\":" + nsOperationKey + ",\"nsParameters\":" + nsParameters\r
-        String url = instantiateUrl.replaceAll("{nsInstanceId}", execution.getVariable("nsInstanceId")) \r
-        APIResponse apiResponse = postRequest(url, reqBody)\r
+        String reqBody ="""{\r
+        "nsServiceName":"${nsServiceName}",\r
+        "nsServiceDescription":"${nsServiceDescription}",\r
+        "nsOperationKey":${nsOperationKey},\r
+        "nsParameters":${nsParameters}\r
+       }"""\r
+        String nsInstanceId = execution.getVariable("nsInstanceId")\r
+        String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate"\r
+        APIResponse apiResponse = postRequest(execution, url, reqBody)\r
         String returnCode = apiResponse.getStatusCode()\r
         String aaiResponseAsString = apiResponse.getResponseBodyAsString()\r
         String jobId = "";\r
         if(returnCode== "200"){\r
             jobId =  jsonUtil.getJsonValue(aaiResponseAsString, "jobId")\r
         }\r
-        execution.setVariable("jobId", nsInstanceId)\r
+        execution.setVariable("jobId", jobId)\r
+        utils.log("INFO"," *****Exit  instantiateNetworkService *****",  isDebugEnabled)\r
     }\r
 \r
     /**\r
      * query NS task\r
      */\r
     public void queryNSProgress(Execution execution) {\r
+        def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+        utils.log("INFO"," *****  queryNSProgress *****",  isDebugEnabled)\r
         String jobId = execution.getVariable("jobId")\r
-        String nsOperationKey = excution.getVariable("nsOperationKey");\r
-        String url = queryJobUrl.replaceAll("{jobId}", execution.getVariable("jobId")) \r
-        APIResponse apiResponse = postRequest(url, nsOperationKey)\r
+        String nsOperationKey = execution.getVariable("nsOperationKey");\r
+        String url = host + vfcUrl + "/jobs/" + jobId\r
+        APIResponse apiResponse = postRequest(execution, url, nsOperationKey)\r
         String returnCode = apiResponse.getStatusCode()\r
         String aaiResponseAsString = apiResponse.getResponseBodyAsString()\r
         String operationStatus = "error"\r
         if(returnCode== "200"){\r
             operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status")\r
         }\r
-        exection.setVariable("operationStatus", operationStatus)\r
+        execution.setVariable("operationStatus", operationStatus)\r
+        utils.log("INFO"," *****Exit  queryNSProgress *****",  isDebugEnabled)\r
     }\r
 \r
     /**\r
      * delay 5 sec \r
      */\r
     public void timeDelay(Execution execution) {\r
+        def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
         try {\r
             Thread.sleep(5000);\r
         } catch(InterruptedException e) {           \r
-            taskProcessor.utils.log("ERROR", "Time Delay exception" + e , isDebugEnabled)\r
+            utils.log("ERROR", "Time Delay exception" + e , isDebugEnabled)\r
         }\r
     }\r
 \r
     /**\r
      * finish NS task\r
      */\r
-    public void finishNSCreate(Execution execution) {\r
-        //no need to do anything util now\r
+    public void addNSRelationship(Execution execution) {\r
+        def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+        utils.log("INFO"," ***** addNSRelationship *****",  isDebugEnabled)\r
+        String operationStatus = execution.getVariable("operationStatus")\r
+        if(operationStatus != "finished"){\r
+            utils.log("INFO"," create NS failed, so do not need to add relationship",  isDebugEnabled)\r
+            return\r
+        }\r
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")\r
+        String serviceType = execution.getVariable("serviceType")\r
+        String serviceId = execution.getVariable("serviceId")\r
+        String nsInstanceId = execution.getVariable("nsInstanceId")\r
+        String addRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11">\r
+                                            <related-to>service-instance</related-to>\r
+                                            <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link>\r
+                                            <relationship-data>\r
+                                                <relationship-key>customer.global-customer-id</relationship-key>\r
+                                                <relationship-value>${globalSubscriberId}</relationship-value>\r
+                                            </relationship-data>\r
+                                            <relationship-data>\r
+                                                <relationship-key>service-subscription.service-type</relationship-key>\r
+                                                <relationship-value>${serviceType}</relationship-value>\r
+                                            </relationship-data>\r
+                                           <relationship-data>\r
+                                                <relationship-key>service-instance.service-instance-id</relationship-key>\r
+                                                <relationship-value>${nsInstanceId}</relationship-value>\r
+                                            </relationship-data>           \r
+                                        </relationship>"""\r
+        String endpoint = execution.getVariable("URN_aai_endpoint")  \r
+        String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship"\r
+        executeAAIPutCall(execution, url, addRelationPayload)\r
+        utils.log("INFO"," *****Exit addNSRelationship *****",  isDebugEnabled)\r
     }\r
-\r
+    \r
+    public APIResponse executeAAIPutCall(Execution execution, String url, String payload){\r
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
+        utils.log("INFO", " ======== Started Execute AAI Put Process ======== ",  isDebugEnabled) \r
+        APIResponse apiResponse = null\r
+        try{\r
+            String uuid = utils.getRequestID()\r
+            utils.log("INFO","Generated uuid is: " + uuid,  isDebugEnabled) \r
+            utils.log("INFO","URL to be used is: " + url,  isDebugEnabled) \r
+            String userName = execution.getVariable("URN_aai_auth")\r
+            String password = execution.getVariable("URN_mso_msoKey")\r
+            String basicAuthCred = utils.getBasicAuth(userName,password)\r
+            RESTConfig config = new RESTConfig(url);\r
+            RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml");\r
+            if (basicAuthCred != null && !"".equals(basicAuthCred)) {\r
+                client.addAuthorizationHeader(basicAuthCred)\r
+            }\r
+            apiResponse = client.httpPut(payload)\r
+            utils.log("INFO","======== Completed Execute AAI Put Process ======== ",  isDebugEnabled) \r
+        }catch(Exception e){\r
+            utils.log("ERROR","Exception occured while executing AAI Put Call. Exception is: \n" + e,  isDebugEnabled) \r
+            throw new BpmnError("MSOWorkflowException")\r
+        }\r
+        return apiResponse\r
+    }\r
+    \r
     /**\r
      * post request\r
      * url: the url of the request\r
      * requestBody: the body of the request\r
      */\r
-    private APIResponse postRequest(String url, String requestBody){\r
+    private APIResponse postRequest(Execution execution, String url, String requestBody){\r
         def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
-        taskProcessor.logDebug( " ======== Started Execute VFC adapter Post Process ======== ", isDebugEnabled)\r
-        taskProcessor.logDebug( "url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled)\r
+        utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****",  isDebugEnabled)\r
+        utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody,  isDebugEnabled)\r
         APIResponse apiResponse = null\r
         try{\r
             RESTConfig config = new RESTConfig(url);\r
-            RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/json");\r
+            RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk");\r
             apiResponse = client.httpPost(requestBody)\r
-            taskProcessor.logDebug( "response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled)\r
-            taskProcessor.logDebug( "======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled)\r
+            utils.log("INFO","response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(),  isDebugEnabled)    \r
+            utils.log("INFO","======== Completed Execute VF-C adapter Post Process ======== ",  isDebugEnabled)\r
         }catch(Exception e){\r
-            taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)\r
+            utils.log("ERROR","Exception occured while executing AAI Post Call. Exception is: \n" + e,  isDebugEnabled)\r
             throw new BpmnError("MSOWorkflowException")\r
         }        \r
         return apiResponse\r
index 46b6dd8..0cbcfab 100644 (file)
@@ -1,5 +1,21 @@
 /*\r
- * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
  */\r
 package org.openecomp.mso.bpmn.infrastructure.scripts;\r
 \r
index b7aaef0..cd0fe81 100644 (file)
@@ -58,8 +58,6 @@ import org.xml.sax.InputSource
  * @param - subscriptionServiceType - O
  * @param - serviceInstanceId
  * @param - serviceInstanceName - O
- * @param - serviceModelInfo - O
- * @param - productFamilyId
  * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
  * @param - sdncVersion 
  * @param - failNotFound - TODO
@@ -70,7 +68,7 @@ import org.xml.sax.InputSource
  * 
  * Rollback - Deferred
  */
-public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
+public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
 
        String Prefix="DDELSI_"
        ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -474,7 +472,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
                utils.log("DEBUG"," *** Exit postProcessAAIDEL *** ", isDebugEnabled)
        }
        
-   public void preInitResourcesOperStatus(Execution execution){
+       public void preInitResourcesOperStatus(Execution execution){
         def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
 
         utils.log("DEBUG", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
@@ -552,7 +550,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
         }
         utils.log("DEBUG", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)  
     }
-   
+    
    /**
     * prepare delete parameters
     */
index 87cf6fb..fc6293c 100644 (file)
@@ -156,29 +156,33 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                        execution.setVariable("subscriberInfo", subscriberInfo)\r
                        utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled)\r
 \r
-                 /*
-                 * Extracting User Parameters from incoming Request and converting into a Map
-                 */
-                 def jsonSlurper = new JsonSlurper()
-                 def jsonOutput = new JsonOutput()
+                 /*\r
+                 * Extracting User Parameters from incoming Request and converting into a Map\r
+                 */\r
+                 def jsonSlurper = new JsonSlurper()\r
+                 def jsonOutput = new JsonOutput()\r
+\r
+                 Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest)\r
+\r  
+                 //InputParams\r
+                 def userParams = reqMap.requestDetails?.requestParameters?.userParams\r
   
-                 Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest)
-  
-                 //InputParams
-                 def userParams = reqMap.requestDetails?.requestParameters?.userParams
-  
-                 Map<String, String> inputMap = [:]
-                 if (userParams) {
-                         userParams.each {
-                                 name, value -> inputMap.put(name, value)
-                                       if (name.equals("BRG_WAN_MAC_Address"))
-                                                       execution.setVariable("brgWanMacAddress", value)\r
-                         }
-                 }
-
-                 utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
-                 execution.setVariable("serviceInputParams", inputMap)
-
+                 Map<String, String> inputMap = [:]\r
+\r
+\r
+                 if (userParams) {\r
+                               userParams.each {\r
+                                                               userParam ->\r
+                                                               if("BRG_WAN_MAC_Address".equals(userParam?.name)) {\r
+                                                                                               execution.setVariable("brgWanMacAddress", userParam.value)\r
+                                                                                               inputMap.put("BRG_WAN_MAC_Address", userParam.value)\r
+                                       }\r
+                               }\r
+                 }\r
+\r
+                 utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)\r
+                 execution.setVariable("serviceInputParams", inputMap)\r
+\r
                        utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled)\r
 \r
                        //For Completion Handler & Fallout Handler\r
index 4495e87..c52c3b2 100644 (file)
@@ -43,8 +43,9 @@ import java.util.Map;
 public abstract class AbstractSdncOperationTask extends BaseTask {
 
     private static final String DEFAULT_MSB_IP = "127.0.0.1";
-    private static final int DEFAULT_MSB_Port = 10081;
+    private static final int DEFAULT_MSB_Port = 80;
     private static final String SDCADAPTOR_INPUTS = "resourceParameters";
+    public static final String ONAP_IP = "ONAP_IP";
     private RequestsDatabase requestsDB = RequestsDatabase.getInstance();
 
 
@@ -105,9 +106,15 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
 
     private GenericResourceApi getGenericResourceApiClient(DelegateExecution execution) {
         updateProgress(execution, null, null, "20", "getGenericResourceApiClient begin!");
+        String msbIp = System.getenv().get(ONAP_IP);
+        int msbPort = DEFAULT_MSB_Port;
         Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
-        String msbIp = getString(properties, "msb.address", DEFAULT_MSB_IP);
-        int msbPort = Integer.valueOf(getString(properties, "msb.port", String.valueOf(DEFAULT_MSB_Port)));
+        if (properties != null) {
+            if (StringUtils.isBlank(msbIp)) {
+                msbIp = getString(properties, "msb.address", DEFAULT_MSB_IP);
+            }
+            msbPort = Integer.valueOf(getString(properties, "msb.port", String.valueOf(DEFAULT_MSB_Port)));
+        }
         MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort);
         RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient);
         return restServiceCreater.createService(GenericResourceApi.class);
index 04b47b4..8fc761c 100644 (file)
@@ -29,17 +29,18 @@ ex.processJavaException(execution)]]></bpmn:script>
         <camunda:out source="rollbackData" target="rollbackData" />
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
-        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
         <camunda:in source="productFamilyId" target="productFamilyId" />
         <camunda:in source="disableRollback" target="disableRollback" />
-        <camunda:in source="serviceInputParams" target="serviceInputParams" />
+        <camunda:in source="uuiRequest" target="uuiRequest" />
         <camunda:out source="rolledBack" target="rolledBack" />
         <camunda:out source="serviceInstanceName" target="serviceInstanceName" />
         <camunda:in source="failIfExists" target="failIfExists" />
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
-        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
-        <camunda:in sourceExpression="1610" target="sdncVersion" />
+        <camunda:in source="serviceType" target="serviceType" />
         <camunda:in source="initialStatus" target="initialStatus" />
+        <camunda:in source="operationId" target="operationId" />
+        <camunda:in source="operationType" target="operationType" />
+        <camunda:in source="URN_mso_adapters_openecomp_db_endpoint" target="URN_mso_adapters_openecomp_db_endpoint" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_19eilro</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing>
@@ -152,11 +153,11 @@ csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script>
       <bpmn:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
                 <camunda:entry key="content-type">application/soap+xml</camunda:entry>
-                <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
+                <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
               </camunda:map>
             </camunda:inputParameter>
             <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
index 24a9a6d..0316e26 100644 (file)
@@ -116,7 +116,7 @@ CreateNetworkInstance.prepareDBRequestError(execution)]]></bpmn2:script>
         <bpmn2:extensionElements>
           <camunda:connector>
             <camunda:inputOutput>
-              <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+              <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
               <camunda:inputParameter name="payload">${CRENI_createDBRequest}</camunda:inputParameter>
               <camunda:inputParameter name="headers">
                 <camunda:map>
index 72c2753..84ab417 100644 (file)
@@ -70,7 +70,7 @@ createVfModule.prepareUpdateInfraRequest(execution)]]></bpmn2:script>
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
                 <camunda:entry key="content-type">application/soap+xml</camunda:entry>
index ec4afa4..111b6c7 100644 (file)
@@ -200,7 +200,7 @@ createVfModuleVolumeInfraV1.executeMethod('postProcessResponse', execution, isDe
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
             <camunda:inputParameter name="payload">${CVMVINFRAV1_createDBRequest}</camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
index f24acb4..c6a6d02 100644 (file)
@@ -137,7 +137,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script>
   </bpmn:process>
   <bpmn:error id="Error_1erlsmy" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
-    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteCustomE2EServiceInstance">
       <bpmndi:BPMNShape id="StartEvent_00m8zen_di" bpmnElement="StartEvent_00m8zen">
         <dc:Bounds x="577" y="209" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -148,99 +148,95 @@ csi.sendSyncResponse(execution)]]></bpmn:script>
         <dc:Bounds x="834" y="660" width="394" height="188" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_1vyx9hu_di" bpmnElement="CallActivity_1vyx9hu">
-        <dc:Bounds x="1121" y="187" width="100" height="80" />
+        <dc:Bounds x="1159" y="187" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0db8bs6_di" bpmnElement="EndEvent_0db8bs6">
-        <dc:Bounds x="1646" y="304" width="36" height="36" />
+        <dc:Bounds x="1686" y="304" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1657" y="340" width="19" height="12" />
+          <dc:Bounds x="1696" y="340" width="22" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0a63hms_di" bpmnElement="ScriptTask_0a63hms">
-        <dc:Bounds x="741" y="187" width="100" height="80" />
+        <dc:Bounds x="724" y="187" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1fzpbop_di" bpmnElement="ScriptTask_1fzpbop">
-        <dc:Bounds x="1453" y="187" width="100" height="80" />
+        <dc:Bounds x="1493" y="187" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_1wx4ihe_di" bpmnElement="CallActivity_1wx4ihe">
-        <dc:Bounds x="1614" y="187" width="100" height="80" />
+        <dc:Bounds x="1654" y="187" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="SubProcess_1vbcima_di" bpmnElement="SubProcess_1vbcima" isExpanded="true">
         <dc:Bounds x="736" y="374" width="679" height="194" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1mao77y_di" bpmnElement="ScriptTask_1mao77y">
-        <dc:Bounds x="920" y="187" width="100" height="80" />
+        <dc:Bounds x="936" y="187" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_0vu8gx6_di" bpmnElement="ExclusiveGateway_0vu8gx6" isMarkerVisible="true">
-        <dc:Bounds x="1318" y="202" width="50" height="50" />
+        <dc:Bounds x="1358" y="202" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1318" y="174" width="49" height="12" />
+          <dc:Bounds x="1358" y="174" width="50" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1i1g9s6_di" bpmnElement="EndEvent_1i1g9s6">
-        <dc:Bounds x="1325" y="304" width="36" height="36" />
+        <dc:Bounds x="1365" y="304" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1298" y="340" width="0" height="12" />
+          <dc:Bounds x="1293" y="340" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1wxumid_di" bpmnElement="SequenceFlow_1wxumid">
         <di:waypoint xsi:type="dc:Point" x="613" y="227" />
-        <di:waypoint xsi:type="dc:Point" x="741" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="724" y="227" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="587" y="212" width="90" height="12" />
+          <dc:Bounds x="623.5" y="206" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0zf2qyk_di" bpmnElement="SequenceFlow_0zf2qyk">
-        <di:waypoint xsi:type="dc:Point" x="1020" y="227" />
-        <di:waypoint xsi:type="dc:Point" x="1073" y="227" />
-        <di:waypoint xsi:type="dc:Point" x="1073" y="227" />
-        <di:waypoint xsi:type="dc:Point" x="1121" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="1036" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="1159" y="227" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1043" y="227" width="0" height="12" />
+          <dc:Bounds x="1052.5" y="206" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_07hrbs0_di" bpmnElement="SequenceFlow_07hrbs0">
-        <di:waypoint xsi:type="dc:Point" x="1221" y="227" />
-        <di:waypoint xsi:type="dc:Point" x="1318" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="1259" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="1358" y="227" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1225.5" y="212" width="0" height="12" />
+          <dc:Bounds x="1263.5" y="206" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1ab5l2q_di" bpmnElement="SequenceFlow_1ab5l2q">
-        <di:waypoint xsi:type="dc:Point" x="1664" y="267" />
-        <di:waypoint xsi:type="dc:Point" x="1664" y="304" />
+        <di:waypoint xsi:type="dc:Point" x="1704" y="267" />
+        <di:waypoint xsi:type="dc:Point" x="1704" y="304" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1634" y="279.5" width="90" height="12" />
+          <dc:Bounds x="1674" y="280" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0yowshs_di" bpmnElement="SequenceFlow_0yowshs">
-        <di:waypoint xsi:type="dc:Point" x="841" y="227" />
-        <di:waypoint xsi:type="dc:Point" x="920" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="824" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="936" y="227" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="835.5" y="206" width="90" height="12" />
+          <dc:Bounds x="835" y="206" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_04urx2e_di" bpmnElement="SequenceFlow_04urx2e">
-        <di:waypoint xsi:type="dc:Point" x="1368" y="227" />
-        <di:waypoint xsi:type="dc:Point" x="1453" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="1408" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="1493" y="227" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1370.25" y="203" width="18" height="12" />
+          <dc:Bounds x="1410" y="203" width="20" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1ii935p_di" bpmnElement="SequenceFlow_1ii935p">
-        <di:waypoint xsi:type="dc:Point" x="1553" y="227" />
-        <di:waypoint xsi:type="dc:Point" x="1614" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="1593" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="1654" y="227" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1495" y="212" width="90" height="12" />
+          <dc:Bounds x="1535" y="212" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1t6ekab_di" bpmnElement="SequenceFlow_1t6ekab">
-        <di:waypoint xsi:type="dc:Point" x="1343" y="252" />
-        <di:waypoint xsi:type="dc:Point" x="1343" y="277" />
-        <di:waypoint xsi:type="dc:Point" x="1343" y="277" />
-        <di:waypoint xsi:type="dc:Point" x="1343" y="304" />
+        <di:waypoint xsi:type="dc:Point" x="1383" y="252" />
+        <di:waypoint xsi:type="dc:Point" x="1383" y="304" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1352" y="277" width="12" height="12" />
+          <dc:Bounds x="1391" y="277" width="15" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1c6ogpt_di" bpmnElement="ScriptTask_1c6ogpt">
index 079599d..3b5c629 100644 (file)
@@ -116,7 +116,7 @@ DeleteNetworkInstance.prepareDBRequestError(execution)]]></bpmn2:script>
         <bpmn2:extensionElements>\r
           <camunda:connector>\r
             <camunda:inputOutput>\r
-              <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>\r
+              <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>\r
               <camunda:inputParameter name="payload">${DELNI_deleteDBRequest}</camunda:inputParameter>\r
               <camunda:inputParameter name="headers">\r
                 <camunda:map>\r
index a687d5d..e19ea1b 100644 (file)
@@ -79,7 +79,7 @@ dvfm.completionHandlerPrep(execution, 'DELVfModI_CompletionHandlerRequest')
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
             <camunda:inputParameter name="method">POST</camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
index 21f74a2..c7092ff 100644 (file)
@@ -198,7 +198,7 @@ execution.setVariable("DELVfModVol_TransactionSuccessIndicator", true)]]></bpmn2
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
             <camunda:inputParameter name="payload">${DELVfModVol_updateInfraRequest}</camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
index 7e54b80..a9d81d0 100644 (file)
@@ -116,7 +116,7 @@ UpdateNetworkInstance.prepareDBRequestError(execution)]]></bpmn2:script>
         <bpmn2:extensionElements>
           <camunda:connector>
             <camunda:inputOutput>
-              <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+              <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
               <camunda:inputParameter name="payload">${UPDNI_createDBRequest}</camunda:inputParameter>
               <camunda:inputParameter name="headers">
                 <camunda:map>
index 15b5bc7..7e5f41b 100644 (file)
@@ -21,7 +21,7 @@
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter>
             <camunda:inputParameter name="payload">${UPDVfModVol_updateInfraRequest}</camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
index 109cf69..2fbb898 100644 (file)
@@ -5,14 +5,6 @@
       <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
     </bpmn2:startEvent>
     <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" />
-    <bpmn2:scriptTask id="getAAICustomerById_scriptTask" name="Get AAI Customer By globalCustomerId " scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def dcsi = new DoCreateE2EServiceInstance()
-dcsi.getAAICustomerById(execution)]]></bpmn2:script>
-    </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getAAICustomerById_scriptTask" targetRef="ExclusiveGateway_09wkav2" />
     <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
@@ -22,7 +14,7 @@ dcsi.preProcessRequest(execution)
 ]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="CustomE2EGetService" targetRef="ScriptTask_0i8cqdy" />
-    <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="getAAICustomerById_scriptTask" />
+    <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="CustomE2EGetService" />
     <bpmn2:callActivity id="CustomE2EGetService" name="Call Custom E2E Get Service" calledElement="CustomE2EGetService">
       <bpmn2:extensionElements>
         <camunda:in source="serviceInstanceName" target="GENGS_serviceInstanceName" />
@@ -31,35 +23,26 @@ dcsi.preProcessRequest(execution)
         <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" />
         <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="serviceType" target="GENGS_serviceType" />
       </bpmn2:extensionElements>
-      <bpmn2:incoming>SequenceFlow_11fnnkb</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
     </bpmn2:callActivity>
     <bpmn2:callActivity id="CustomE2EPutService" name="Call Custom E2E Put Service" calledElement="CustomE2EPutService">
       <bpmn2:extensionElements>
         <camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" />
         <camunda:in source="serviceInstanceId" target="GENPS_serviceInstanceId" />
-        <camunda:in source="subscriptionServiceType" target="GENPS_serviceType" />
+        <camunda:in source="serviceType" target="GENPS_serviceType" />
         <camunda:in sourceExpression="service-instance" target="GENPS_type" />
         <camunda:in source="serviceInstanceData" target="GENPS_payload" />
         <camunda:out source="GENPS_SuccessIndicator" target="GENPS_SuccessIndicator" />
         <camunda:in source="msoRequestId" target="GENPS_requesId" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
       </bpmn2:extensionElements>
-      <bpmn2:incoming>SequenceFlow_1uw2p9a</bpmn2:incoming>
       <bpmn2:incoming>SequenceFlow_1w01tqs</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_129ih1g</bpmn2:outgoing>
     </bpmn2:callActivity>
     <bpmn2:sequenceFlow id="SequenceFlow_129ih1g" sourceRef="CustomE2EPutService" targetRef="ScriptTask_0q37vn9" />
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_09wkav2" name="sdncVersion is 1610 or serviceInstance name is populated?" default="SequenceFlow_1uw2p9a">
-      <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_11fnnkb</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_1uw2p9a</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_11fnnkb" name="yes" sourceRef="ExclusiveGateway_09wkav2" targetRef="CustomE2EGetService">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("serviceInstanceName" )  != null && execution.getVariable("serviceInstanceName" )  != "" ) || execution.getVariable("sdncVersion" )   == "1610" }]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_1uw2p9a" name="no" sourceRef="ExclusiveGateway_09wkav2" targetRef="CustomE2EPutService" />
     <bpmn2:subProcess id="SubProcess_06d8lk8" name="Sub-process for Application Errors" triggeredByEvent="true">
       <bpmn2:startEvent id="StartEvent_0yljq9y">
         <bpmn2:outgoing>SequenceFlow_0tgrn11</bpmn2:outgoing>
@@ -100,17 +83,6 @@ dcsi.postProcessRollback(execution)
       </bpmn2:scriptTask>
       <bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" />
     </bpmn2:subProcess>
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_1nk6aol" name="sdncVersion is 1610?">
-      <bpmn2:incoming>SequenceFlow_1dd86x8</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_00v4npo</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_1170ztf</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:endEvent id="EndEvent_10659gr">
-      <bpmn2:incoming>SequenceFlow_00v4npo</bpmn2:incoming>
-    </bpmn2:endEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_00v4npo" name="yes" sourceRef="ExclusiveGateway_1nk6aol" targetRef="EndEvent_10659gr">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("sdncVersion" ) == "1610"}]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
     <bpmn2:scriptTask id="ScriptTask_0i8cqdy" name="Post Process AAI GET" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1w01tqs</bpmn2:outgoing>
@@ -121,27 +93,26 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_1w01tqs" sourceRef="ScriptTask_0i8cqdy" targetRef="CustomE2EPutService" />
     <bpmn2:scriptTask id="ScriptTask_0q37vn9" name="Post Process AAI PUT" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_129ih1g</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_1dd86x8</bpmn2:outgoing>
+      <bpmn2:outgoing>SequenceFlow_03fabby</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
 def ddsi = new DoCreateE2EServiceInstance()
 ddsi.postProcessAAIPUT(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_1dd86x8" sourceRef="ScriptTask_0q37vn9" targetRef="ExclusiveGateway_1nk6aol" />
     <bpmn2:scriptTask id="ScriptTask_0081lne" name="Prepare  Resource Requst For overlay" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_1pjr82f</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0ofqw6v</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-String nsName = "overlay"
+execution.setVariable("resourceType", "overlay")
 def csi = new  DoCreateE2EServiceInstance()
-csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
+csi.preResourceRequest(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:scriptTask id="ScriptTask_0wvq4t8" name="Prepare Resource Request for vEPC" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_05gdjox</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_15zgrcq</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-String resourceName= "vEPC"
+execution.setVariable("resourceType", "vEPC")
 def csi = new  DoCreateE2EServiceInstance()
-csi.preResourceRequest(execution, resourceName)]]></bpmn2:script>
+csi.preResourceRequest(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:callActivity id="CallActivity_0uwm4l1" name="Call DoCreateVFCNetworkServiceInstance For vEPC" calledElement="DoCreateVFCNetworkServiceInstance">
       <bpmn2:extensionElements>
@@ -170,14 +141,13 @@ csi.postConfigRequest(execution)]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_15zgrcq" sourceRef="ScriptTask_0wvq4t8" targetRef="CallActivity_0uwm4l1" />
     <bpmn2:sequenceFlow id="SequenceFlow_1vvdkcs" sourceRef="CallActivity_09c3ajg" targetRef="ScriptTask_1xdjlzm" />
     <bpmn2:sequenceFlow id="SequenceFlow_092ghvu" sourceRef="ScriptTask_1xdjlzm" targetRef="EndEvent_0kbbt94" />
-    <bpmn2:sequenceFlow id="SequenceFlow_1170ztf" sourceRef="ExclusiveGateway_1nk6aol" targetRef="Task_0uiekmn" />
     <bpmn2:endEvent id="EndEvent_0kbbt94">
       <bpmn2:incoming>SequenceFlow_092ghvu</bpmn2:incoming>
     </bpmn2:endEvent>
     <bpmn2:sequenceFlow id="SequenceFlow_0k4q7jm" sourceRef="CallActivity_0uwm4l1" targetRef="Task_0aidjmp" />
     <bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" />
-    <bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status">
-      <bpmn2:incoming>SequenceFlow_1170ztf</bpmn2:incoming>
+    <bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy">
+      <bpmn2:incoming>SequenceFlow_03fabby</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1qctzm0</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
 def ddsi = new DoCreateE2EServiceInstance()
@@ -188,11 +158,11 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script>
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
             <camunda:inputParameter name="headers">
               <camunda:map>
                 <camunda:entry key="content-type">application/soap+xml</camunda:entry>
-                <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
+                <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
               </camunda:map>
             </camunda:inputParameter>
             <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter>
@@ -211,9 +181,9 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script>
       <bpmn2:incoming>SequenceFlow_0k4q7jm</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0ua1bbk</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-String nsName = "vIMS"
+execution.setVariable("resourceType", "vIMS")
 def csi = new  DoCreateE2EServiceInstance()
-csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
+csi.preResourceRequest(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_1hgiln0" sourceRef="Task_03n6y9h" targetRef="Task_0io5qby" />
     <bpmn2:callActivity id="Task_03n6y9h" name="Call DoCreateVFCNetworkServiceInstance For vIMS" calledElement="DoCreateVFCNetworkServiceInstance">
@@ -239,13 +209,13 @@ csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
     </bpmn2:serviceTask>
     <bpmn2:sequenceFlow id="SequenceFlow_17i1ors" sourceRef="Task_0pkhzoj" targetRef="Task_0gs55f1" />
     <bpmn2:sequenceFlow id="SequenceFlow_1pjr82f" sourceRef="Task_0gs55f1" targetRef="ScriptTask_0081lne" />
-    <bpmn2:scriptTask id="Task_0pkhzoj" name="Prepare Resource Request For underlay">
+    <bpmn2:scriptTask id="Task_0pkhzoj" name="Prepare Resource Request For underlay" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_1vo0235</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_17i1ors</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-String nsName = "underlay"
+execution.setVariable("resourceType", "underlay")
 def csi = new  DoCreateE2EServiceInstance()
-csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
+csi.preResourceRequest(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:serviceTask id="Task_0gs55f1" name="Call Underlay Create" camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncNetworkTopologyOperationTask">
       <bpmn2:incoming>SequenceFlow_17i1ors</bpmn2:incoming>
@@ -255,53 +225,44 @@ csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
       <bpmn2:incoming>SequenceFlow_0ofqw6v</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1vvdkcs</bpmn2:outgoing>
     </bpmn2:serviceTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_03fabby" sourceRef="ScriptTask_0q37vn9" targetRef="Task_0uiekmn" />
   </bpmn2:process>
   <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateE2EServiceInstance">
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent">
-        <dc:Bounds x="152" y="79" width="36" height="36" />
+        <dc:Bounds x="34" y="79" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="147" y="120" width="48" height="14" />
+          <dc:Bounds x="28" y="120" width="50" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask">
         <dc:Bounds x="245" y="57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_47" targetElement="_BPMNShape_ScriptTask_61">
-        <di:waypoint xsi:type="dc:Point" x="188" y="97" />
+        <di:waypoint xsi:type="dc:Point" x="70" y="97" />
         <di:waypoint xsi:type="dc:Point" x="245" y="97" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="217" y="82" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_62" bpmnElement="getAAICustomerById_scriptTask">
-        <dc:Bounds x="393" y="57" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_62">
-        <di:waypoint xsi:type="dc:Point" x="493" y="97" />
-        <di:waypoint xsi:type="dc:Point" x="565" y="97" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="529" y="82" width="0" height="0" />
+          <dc:Bounds x="112.5" y="82" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_4">
-        <di:waypoint xsi:type="dc:Point" x="839" y="94" />
+        <di:waypoint xsi:type="dc:Point" x="626" y="94" />
         <di:waypoint xsi:type="dc:Point" x="971" y="94" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="905" y="79" width="0" height="0" />
+          <dc:Bounds x="753.5" y="79" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_61" targetElement="_BPMNShape_ScriptTask_62">
+      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_61" targetElement="CallActivity_1md4kyb_di">
         <di:waypoint xsi:type="dc:Point" x="345" y="97" />
-        <di:waypoint xsi:type="dc:Point" x="393" y="97" />
+        <di:waypoint xsi:type="dc:Point" x="526" y="97" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="369" y="82" width="0" height="0" />
+          <dc:Bounds x="390.5" y="82" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_1md4kyb_di" bpmnElement="CustomE2EGetService">
-        <dc:Bounds x="739" y="57" width="100" height="80" />
+        <dc:Bounds x="526" y="57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="CustomE2EPutService">
         <dc:Bounds x="972" y="206" width="100" height="80" />
@@ -313,27 +274,6 @@ csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
           <dc:Bounds x="1023" y="296" width="0" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_09wkav2_di" bpmnElement="ExclusiveGateway_09wkav2" isMarkerVisible="true">
-        <dc:Bounds x="565" y="72" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="547" y="7" width="81" height="62" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_11fnnkb_di" bpmnElement="SequenceFlow_11fnnkb">
-        <di:waypoint xsi:type="dc:Point" x="615" y="97" />
-        <di:waypoint xsi:type="dc:Point" x="739" y="97" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="635" y="76" width="18" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1uw2p9a_di" bpmnElement="SequenceFlow_1uw2p9a">
-        <di:waypoint xsi:type="dc:Point" x="590" y="122" />
-        <di:waypoint xsi:type="dc:Point" x="590" y="246" />
-        <di:waypoint xsi:type="dc:Point" x="972" y="246" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="594" y="132.89706349694825" width="12" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true">
         <dc:Bounds x="-155" y="387" width="783" height="195" />
       </bpmndi:BPMNShape>
@@ -366,47 +306,19 @@ csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
           <dc:Bounds x="-18" y="467" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_1nk6aol_di" bpmnElement="ExclusiveGateway_1nk6aol" isMarkerVisible="true">
-        <dc:Bounds x="997" y="460" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="905" y="472" width="72" height="24" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_10659gr_di" bpmnElement="EndEvent_10659gr">
-        <dc:Bounds x="1103" y="467" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1121" y="508" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_00v4npo_di" bpmnElement="SequenceFlow_00v4npo">
-        <di:waypoint xsi:type="dc:Point" x="1047" y="485" />
-        <di:waypoint xsi:type="dc:Point" x="1103" y="485" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1063" y="461" width="18" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0i8cqdy_di" bpmnElement="ScriptTask_0i8cqdy">
         <dc:Bounds x="971" y="57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1w01tqs_di" bpmnElement="SequenceFlow_1w01tqs">
         <di:waypoint xsi:type="dc:Point" x="1021" y="137" />
-        <di:waypoint xsi:type="dc:Point" x="1021" y="172" />
-        <di:waypoint xsi:type="dc:Point" x="1021" y="172" />
         <di:waypoint xsi:type="dc:Point" x="1021" y="206" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1036" y="172" width="0" height="0" />
+          <dc:Bounds x="991" y="171.5" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9">
         <dc:Bounds x="972" y="336" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1dd86x8_di" bpmnElement="SequenceFlow_1dd86x8">
-        <di:waypoint xsi:type="dc:Point" x="1022" y="416" />
-        <di:waypoint xsi:type="dc:Point" x="1022" y="460" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1037" y="438" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux">
         <dc:Bounds x="76" y="442" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -469,13 +381,6 @@ csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
           <dc:Bounds x="-809" y="838" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1170ztf_di" bpmnElement="SequenceFlow_1170ztf">
-        <di:waypoint xsi:type="dc:Point" x="1022" y="510" />
-        <di:waypoint xsi:type="dc:Point" x="1022" y="588" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="992" y="543" width="90" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94">
         <dc:Bounds x="-823" y="841" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -563,6 +468,13 @@ csi.preResourceRequest(execution, nsName)]]></bpmn2:script>
       <bpmndi:BPMNShape id="ServiceTask_1cnnn5b_di" bpmnElement="CallActivity_09c3ajg">
         <dc:Bounds x="-578" y="819" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_03fabby_di" bpmnElement="SequenceFlow_03fabby">
+        <di:waypoint xsi:type="dc:Point" x="1022" y="416" />
+        <di:waypoint xsi:type="dc:Point" x="1022" y="588" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1037" y="496" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn2:definitions>
index 58eb1f0..67b0f96 100644 (file)
@@ -34,10 +34,10 @@ dcsi.instantiateNetworkService(execution)]]></bpmn:script>
       <bpmn:outgoing>createNSFailed_SequenceFlow</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:sequenceFlow id="createNSSuccess_SequenceFlow" name="yes" sourceRef="ExclusiveGateway_0zfksms" targetRef="instantiate_NSTask">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("nsInstanceName" )  != null && execution.getVariable("nsInstanceName" )  != "" )}]]></bpmn:conditionExpression>
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("nsInstanceId" )  != null && execution.getVariable("nsInstanceId" )  != "" )}]]></bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:sequenceFlow id="createNSFailed_SequenceFlow" name="no" sourceRef="ExclusiveGateway_0zfksms" targetRef="createNSFailed_EndEvent">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("nsInstanceName" )  == null || execution.getVariable("nsInstanceName" )  == "" )}]]></bpmn:conditionExpression>
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("nsInstanceId" )  == null || execution.getVariable("nsInstanceId" )  == "" )}]]></bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:exclusiveGateway id="ExclusiveGateway_1is7zys" name="Instantiate NS Success?">
       <bpmn:incoming>SequenceFlow_1ywe21t</bpmn:incoming>
@@ -80,12 +80,12 @@ dcsi.instantiateNetworkService(execution)]]></bpmn:script>
 def dcsi = new DoCreateVFCNetworkServiceInstance()
 dcsi.queryNSProgress(execution)]]></bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:scriptTask id="finishNSCreate_Task" name="Finish NS Create">
+    <bpmn:scriptTask id="finishNSCreate_Task" name="Add NS RelationShip" scriptFormat="groovy">
       <bpmn:incoming>operationFinished_SequenceFlow</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing>
       <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
 def dcsi = new DoCreateVFCNetworkServiceInstance()
-dcsi.finishNSCreate(execution)]]></bpmn:script>
+dcsi.addNSRelationship(execution)]]></bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_0xqo13p" sourceRef="queryJob_Task" targetRef="ExclusiveGateway_15492gl" />
     <bpmn:scriptTask id="timeDelay_Task" name="timeDelay" scriptFormat="groovy">
index 91f5404..2224631 100644 (file)
@@ -112,7 +112,7 @@ ex.processJavaException(execution)]]></bpmn:script>
       <bpmn:incoming>SequenceFlow_1wmjau1</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0qquvgc</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:sequenceFlow id="SequenceFlow_1av166w" sourceRef="ExclusiveGateway_0veiutm" targetRef="Task_0oriv78" />
+    <bpmn:sequenceFlow id="SequenceFlow_1av166w" sourceRef="ExclusiveGateway_0veiutm" targetRef="ScriptTask_146jt8v" />
     <bpmn:sequenceFlow id="SequenceFlow_0qquvgc" sourceRef="CallActivity_Del_VFC" targetRef="ScriptTask_0mdub03" />
     <bpmn:scriptTask id="ScriptTask_0vcz9mj" name="Prepare Resource Delele For vEPC" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1931m8u</bpmn:incoming>
@@ -142,7 +142,7 @@ def ddsi = new DoCustomDeleteE2EServiceInstance()
 ddsi.postProcessSDNCDelete(execution, response, "delete")]]></bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="ScriptTask_0z30dax" name="Prepare Resource Delele For Overlay" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_13sc98g</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0l4w9nr</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1dza4q4</bpmn:outgoing>
       <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
 String resourceName = "overlay"
@@ -154,36 +154,6 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_0uhpfcl" name="yes" sourceRef="ExclusiveGateway_0veiutm" targetRef="CallActivity_06izbke">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{ execution.getVariable("sdncVersion" )   == "1610" }]]></bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_030y6yz" sourceRef="Task_0oriv78" targetRef="Task_0pkgoxn" />
-    <bpmn:scriptTask id="Task_0oriv78" name="Prepare Resource Oper Status">
-      <bpmn:incoming>SequenceFlow_1av166w</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_030y6yz</bpmn:outgoing>
-      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def ddsi = new DoCustomDeleteE2EServiceInstance()
-ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:serviceTask id="Task_0pkgoxn" name="Init Resource Oper Status">
-      <bpmn:extensionElements>
-        <camunda:connector>
-          <camunda:inputOutput>
-            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
-            <camunda:inputParameter name="headers">
-              <camunda:map>
-                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
-                <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
-              </camunda:map>
-            </camunda:inputParameter>
-            <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter>
-            <camunda:inputParameter name="method">POST</camunda:inputParameter>
-            <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
-            <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
-          </camunda:inputOutput>
-          <camunda:connectorId>http-connector</camunda:connectorId>
-        </camunda:connector>
-      </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_030y6yz</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_13sc98g</bpmn:outgoing>
-    </bpmn:serviceTask>
     <bpmn:sequenceFlow id="SequenceFlow_1wnkgpx" sourceRef="Task_0z1x3sg" targetRef="Task_0963dho" />
     <bpmn:sequenceFlow id="SequenceFlow_1931m8u" sourceRef="Task_0963dho" targetRef="ScriptTask_0vcz9mj" />
     <bpmn:scriptTask id="Task_0z1x3sg" name="Prepare Resource Delele For vIMS">
@@ -195,7 +165,6 @@ def ddsi = new DoCustomDeleteE2EServiceInstance()
 ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_1m7tont" sourceRef="ScriptTask_1g0tsto" targetRef="Task_0z1x3sg" />
-    <bpmn:sequenceFlow id="SequenceFlow_13sc98g" sourceRef="Task_0pkgoxn" targetRef="ScriptTask_0z30dax" />
     <bpmn:callActivity id="Task_0963dho" name="Call Network Service Delete for vIMS" calledElement="DODeleteVFCNetworkServiceInstance">
       <bpmn:extensionElements>
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
@@ -234,6 +203,37 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
       <bpmn:incoming>SequenceFlow_1g4djgh</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0uc2beq</bpmn:outgoing>
     </bpmn:serviceTask>
+    <bpmn:scriptTask id="ScriptTask_146jt8v" name="Prepare Resource Oper Status">
+      <bpmn:incoming>SequenceFlow_1av166w</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ym9otf</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def ddsi = new DoCustomDeleteE2EServiceInstance()
+ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="ServiceTask_00tg69u" name="Init Resource Oper Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1ym9otf</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0l4w9nr</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1ym9otf" sourceRef="ScriptTask_146jt8v" targetRef="ServiceTask_00tg69u" />
+    <bpmn:sequenceFlow id="SequenceFlow_0l4w9nr" sourceRef="ServiceTask_00tg69u" targetRef="ScriptTask_0z30dax" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCustomDeleteE2EServiceInstance">
@@ -375,9 +375,9 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1av166w_di" bpmnElement="SequenceFlow_1av166w">
         <di:waypoint xsi:type="dc:Point" x="42" y="-17" />
-        <di:waypoint xsi:type="dc:Point" x="87" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="83" y="-17" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="19.5" y="-38" width="90" height="12" />
+          <dc:Bounds x="17.5" y="-38" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0qquvgc_di" bpmnElement="SequenceFlow_0qquvgc">
@@ -404,20 +404,20 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
         <dc:Bounds x="1188" y="-57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0z30dax_di" bpmnElement="ScriptTask_0z30dax">
-        <dc:Bounds x="377" y="-57" width="100" height="80" />
+        <dc:Bounds x="356" y="-57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1dza4q4_di" bpmnElement="SequenceFlow_1dza4q4">
-        <di:waypoint xsi:type="dc:Point" x="477" y="-17" />
-        <di:waypoint xsi:type="dc:Point" x="523" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="456" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="524" y="-17" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="455" y="-38" width="90" height="12" />
+          <dc:Bounds x="445" y="-38" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0rpu756_di" bpmnElement="SequenceFlow_0rpu756">
-        <di:waypoint xsi:type="dc:Point" x="623" y="-17" />
-        <di:waypoint xsi:type="dc:Point" x="711" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="624" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="692" y="-17" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="622" y="-38" width="90" height="12" />
+          <dc:Bounds x="613" y="-38" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0uhpfcl_di" bpmnElement="SequenceFlow_0uhpfcl">
@@ -428,19 +428,6 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
           <dc:Bounds x="540.0043516100959" y="793" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_030y6yz_di" bpmnElement="SequenceFlow_030y6yz">
-        <di:waypoint xsi:type="dc:Point" x="187" y="-17" />
-        <di:waypoint xsi:type="dc:Point" x="212" y="-17" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="199.5" y="-38" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_19o0tpz_di" bpmnElement="Task_0oriv78">
-        <dc:Bounds x="87" y="-57" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ServiceTask_07erhm6_di" bpmnElement="Task_0pkgoxn">
-        <dc:Bounds x="212" y="-57" width="100" height="80" />
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1wnkgpx_di" bpmnElement="SequenceFlow_1wnkgpx">
         <di:waypoint xsi:type="dc:Point" x="1237" y="134" />
         <di:waypoint xsi:type="dc:Point" x="1238" y="192" />
@@ -465,13 +452,6 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
           <dc:Bounds x="1253" y="32.5" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_13sc98g_di" bpmnElement="SequenceFlow_13sc98g">
-        <di:waypoint xsi:type="dc:Point" x="312" y="-17" />
-        <di:waypoint xsi:type="dc:Point" x="377" y="-17" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="344.5" y="-38" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_1mwacgl_di" bpmnElement="Task_0963dho">
         <dc:Bounds x="1188" y="192" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -483,38 +463,58 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0v9q75y_di" bpmnElement="CallActivity_Del_SDNC_cust">
-        <dc:Bounds x="523" y="-57" width="100" height="80" />
+        <dc:Bounds x="524" y="-57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0d9lmlv_di" bpmnElement="SequenceFlow_0d9lmlv">
-        <di:waypoint xsi:type="dc:Point" x="811" y="-17" />
-        <di:waypoint xsi:type="dc:Point" x="898" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="792" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="855" y="-17" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="854.5" y="-38" width="0" height="12" />
+          <dc:Bounds x="778.5" y="-38" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1g4djgh_di" bpmnElement="SequenceFlow_1g4djgh">
-        <di:waypoint xsi:type="dc:Point" x="998" y="-17" />
-        <di:waypoint xsi:type="dc:Point" x="1052" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="955" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="1021" y="-17" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1025" y="-38" width="0" height="12" />
+          <dc:Bounds x="943" y="-38" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0uc2beq_di" bpmnElement="SequenceFlow_0uc2beq">
-        <di:waypoint xsi:type="dc:Point" x="1152" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="1121" y="-17" />
         <di:waypoint xsi:type="dc:Point" x="1188" y="-17" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1170" y="-38" width="0" height="12" />
+          <dc:Bounds x="1109.5" y="-38" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1e5z0wu_di" bpmnElement="Task_14erap6">
-        <dc:Bounds x="711" y="-57" width="100" height="80" />
+        <dc:Bounds x="692" y="-57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_0f0965f_di" bpmnElement="Task_1j1u666">
-        <dc:Bounds x="898" y="-57" width="100" height="80" />
+        <dc:Bounds x="855" y="-57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_0p4b7e1_di" bpmnElement="Task_0edkv0m">
-        <dc:Bounds x="1052" y="-57" width="100" height="80" />
+        <dc:Bounds x="1021" y="-57" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_146jt8v_di" bpmnElement="ScriptTask_146jt8v">
+        <dc:Bounds x="83" y="-57" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_00tg69u_di" bpmnElement="ServiceTask_00tg69u">
+        <dc:Bounds x="208" y="-57" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ym9otf_di" bpmnElement="SequenceFlow_1ym9otf">
+        <di:waypoint xsi:type="dc:Point" x="183" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="208" y="-17" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="151.5" y="-38" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0l4w9nr_di" bpmnElement="SequenceFlow_0l4w9nr">
+        <di:waypoint xsi:type="dc:Point" x="308" y="-17" />
+        <di:waypoint xsi:type="dc:Point" x="356" y="-17" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="332" y="-38" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index 80ec724..e89c64e 100644 (file)
@@ -89,7 +89,7 @@ public class DeleteVfModuleInfraTest extends WorkflowTest {
                        "</vfModuleException>" + EOL;\r
                                        \r
        private final String sdncAdapterDeleteCallback =\r
-               "<output xmlns=\"org:openecomp:sdnctl:l3api\">" + EOL +\r
+               "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +\r
                "  <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +\r
                "  <ack-final-indicator>Y</ack-final-indicator>" + EOL +\r
                "</output>" + EOL;\r
@@ -576,4 +576,4 @@ public class DeleteVfModuleInfraTest extends WorkflowTest {
                        }\r
 \r
        \r
-}
\ No newline at end of file
+}
index 18a5e07..1d0cb0c 100644 (file)
@@ -67,7 +67,7 @@ public class DoCreateVfModuleRollbackTest extends WorkflowTest {
                        "</vfModuleException>" + EOL;\r
                                \r
        private final String sdncAdapterDeleteCallback =\r
-               "<output xmlns=\"org:openecomp:sdnctl:l3api\">" + EOL +\r
+               "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +\r
                "  <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +\r
                "  <ack-final-indicator>Y</ack-final-indicator>" + EOL +\r
                "</output>" + EOL;\r
index 488c532..c741dfd 100644 (file)
@@ -70,7 +70,7 @@ public class DoDeleteVfModuleTest extends WorkflowTest {
                        "</vfModuleException>" + EOL;\r
                                \r
        private final String sdncAdapterDeleteCallback =\r
-               "<output xmlns=\"org:openecomp:sdnctl:l3api\">" + EOL +\r
+               "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +\r
                "  <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +\r
                "  <ack-final-indicator>Y</ack-final-indicator>" + EOL +\r
                "</output>" + EOL;\r
index 4b3ac85..5e0b8c6 100644 (file)
@@ -1,7 +1,7 @@
 <sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">\r
        <sdncadapterworkflow:response-data>\r
                <tag0:RequestData xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">\r
-               &lt;output xmlns="org:openecomp:sdnctl:vnf"&gt;&lt;svc-request-id&gt;1660b8da-0a94-442d-8ed5-ea079e3c67c8&lt;/svc-request-id&gt;&lt;response-code&gt;200&lt;/response-code&gt;&lt;ack-final-indicator&gt;Y&lt;/ack-final-indicator&gt;&lt;vnf-information&gt;&lt;vnf-id&gt;8925b50d-de67-44c1-b984-e7ce7b0f4dae&lt;/vnf-id&gt;&lt;/vnf-information&gt;&lt;service-information&gt;&lt;service-type&gt;a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb&lt;/service-type&gt;&lt;service-instance-id&gt;8925b50d-de67-44c1-b984-e7ce7b0f4dae&lt;/service-instance-id&gt;&lt;subscriber-name&gt;notsurewecare&lt;/subscriber-name&gt;&lt;/service-information&gt;&lt;/output&gt;\r
+               &lt;output xmlns="org:onap:sdnctl:vnf"&gt;&lt;svc-request-id&gt;1660b8da-0a94-442d-8ed5-ea079e3c67c8&lt;/svc-request-id&gt;&lt;response-code&gt;200&lt;/response-code&gt;&lt;ack-final-indicator&gt;Y&lt;/ack-final-indicator&gt;&lt;vnf-information&gt;&lt;vnf-id&gt;8925b50d-de67-44c1-b984-e7ce7b0f4dae&lt;/vnf-id&gt;&lt;/vnf-information&gt;&lt;service-information&gt;&lt;service-type&gt;a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb&lt;/service-type&gt;&lt;service-instance-id&gt;8925b50d-de67-44c1-b984-e7ce7b0f4dae&lt;/service-instance-id&gt;&lt;subscriber-name&gt;notsurewecare&lt;/subscriber-name&gt;&lt;/service-information&gt;&lt;/output&gt;\r
                </tag0:RequestData>\r
        </sdncadapterworkflow:response-data>\r
-</sdncadapterworkflow:SDNCAdapterWorkflowResponse>
\ No newline at end of file
+</sdncadapterworkflow:SDNCAdapterWorkflowResponse>
index 410ba05..d81b7e8 100644 (file)
@@ -1,5 +1,5 @@
-<output xmlns="org:openecomp:sdnctl:vnf">\r
-<brg-topology  xmlns="org:openecomp:sdnctl:vnf">\r
+<output xmlns="org:onap:sdnctl:vnf">\r
+<brg-topology  xmlns="org:onap:sdnctl:vnf">\r
     <ecomp-model-information>\r
         <model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>\r
         <model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>\r
index ac85be4..f770ec6 100644 (file)
@@ -1,5 +1,5 @@
-<output xmlns="org:openecomp:sdnctl:vnf">\r
-<tunnelxconn-topology  xmlns="org:openecomp:sdnctl:vnf">\r
+<output xmlns="org:onap:sdnctl:vnf">\r
+<tunnelxconn-topology  xmlns="org:onap:sdnctl:vnf">\r
     <ecomp-model-information>\r
         <model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>\r
         <model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>\r
index dc4669e..a0168bd 100644 (file)
                                        "subscriptionServiceType":"123456789",
                                        "aLaCarte":"false",
                                        "userParams":
-                                               {
-                                                       "BRG_WAN_MAC_Address" : "brgmac"
-                                               }
+                                          [
+                                               {
+                                                       "name":"BRG_WAN_MAC_Address",
+                                                       "value":"brgmac"
+                                               }
+                                          ]
                                }
                                
                }
index dc9ac49..17c6d15 100644 (file)
                                {
                                        "subscriptionServiceType":"123456789",
                                        "aLaCarte":"false",
-                                       "userParams":
-                                               {
-                                                       "BRG_WAN_MAC_Address" : "brgmac"
-                                               }
+                    "userParams":
+                       [
+                            {
+                                "name":"BRG_WAN_MAC_Address",
+                                "value":"brgmac"
+                            }
+                       ]
                                }
                                
                }
index d5b0713..8583e66 100644 (file)
                                {
                                        "subscriptionServiceType":"123456789",
                                        "aLaCarte":"false",
-                                       "userParams":
-                                               {
-                                                       "BRG_WAN_MAC_Address" : "brgmac"
-                                               }
+                    "userParams":
+                       [
+                            {
+                                "name":"BRG_WAN_MAC_Address",
+                                "value":"brgmac"
+                            }
+                       ]
                                }
                                
                }
index dc4669e..99941c9 100644 (file)
                                {
                                        "subscriptionServiceType":"123456789",
                                        "aLaCarte":"false",
-                                       "userParams":
-                                               {
-                                                       "BRG_WAN_MAC_Address" : "brgmac"
-                                               }
+                    "userParams":
+                       [
+                            {
+                                "name":"BRG_WAN_MAC_Address",
+                                "value":"brgmac"
+                            }
+                       ]
                                }
                                
                }
index 410ba05..d81b7e8 100644 (file)
@@ -1,5 +1,5 @@
-<output xmlns="org:openecomp:sdnctl:vnf">\r
-<brg-topology  xmlns="org:openecomp:sdnctl:vnf">\r
+<output xmlns="org:onap:sdnctl:vnf">\r
+<brg-topology  xmlns="org:onap:sdnctl:vnf">\r
     <ecomp-model-information>\r
         <model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>\r
         <model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>\r
index ac85be4..f770ec6 100644 (file)
@@ -1,5 +1,5 @@
-<output xmlns="org:openecomp:sdnctl:vnf">\r
-<tunnelxconn-topology  xmlns="org:openecomp:sdnctl:vnf">\r
+<output xmlns="org:onap:sdnctl:vnf">\r
+<tunnelxconn-topology  xmlns="org:onap:sdnctl:vnf">\r
     <ecomp-model-information>\r
         <model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>\r
         <model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>\r
index 11022f6..b579f23 100644 (file)
@@ -1,4 +1,4 @@
-       <output xmlns="org:openecomp:sdnctl:vnf">\r
+       <output xmlns="org:onap:sdnctl:vnf">\r
                <vnf-information>\r
                        <vnf-id>skask</vnf-id>                  \r
                </vnf-information>\r
@@ -13,4 +13,4 @@
                <instance-reference>\r
                        <object-path>restconf/SDNCObjectPath</object-path>\r
                </instance-reference>\r
-       </output>
\ No newline at end of file
+       </output>
index acea145..3cf0c81 100644 (file)
@@ -1,4 +1,4 @@
-<output xmlns="org:openecomp:sdnctl:vnf">\r
+<output xmlns="org:onap:sdnctl:vnf">\r
        <vnf-information>\r
                <vnf-id>skask</vnf-id>\r
        </vnf-information>\r
@@ -10,4 +10,4 @@
                <service-instance-id>0</service-instance-id>\r
                <service-type>SDN-MOBILITY</service-type>\r
        </service-information>\r
-</output>
\ No newline at end of file
+</output>
index 11022f6..b579f23 100644 (file)
@@ -1,4 +1,4 @@
-       <output xmlns="org:openecomp:sdnctl:vnf">\r
+       <output xmlns="org:onap:sdnctl:vnf">\r
                <vnf-information>\r
                        <vnf-id>skask</vnf-id>                  \r
                </vnf-information>\r
@@ -13,4 +13,4 @@
                <instance-reference>\r
                        <object-path>restconf/SDNCObjectPath</object-path>\r
                </instance-reference>\r
-       </output>
\ No newline at end of file
+       </output>
index 11022f6..b579f23 100644 (file)
@@ -1,4 +1,4 @@
-       <output xmlns="org:openecomp:sdnctl:vnf">\r
+       <output xmlns="org:onap:sdnctl:vnf">\r
                <vnf-information>\r
                        <vnf-id>skask</vnf-id>                  \r
                </vnf-information>\r
@@ -13,4 +13,4 @@
                <instance-reference>\r
                        <object-path>restconf/SDNCObjectPath</object-path>\r
                </instance-reference>\r
-       </output>
\ No newline at end of file
+       </output>
index 8a557c4..aad79b0 100644 (file)
@@ -14,7 +14,7 @@ mso.healthcheck.log.debug=false
 mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess\r
 mso.workflow.message.endpoint=http://localhost:8080/mso/WorkflowMessage\r
 mso.adapters.db.endpoint=http://localhost:28090/dbadapters/MsoRequestsDbAdapter\r
-mso.openecomp.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter\r
+mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter\r
 mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC\r
 \r
 mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter\r
diff --git a/bpmn/MSOMockServer/.gitignore b/bpmn/MSOMockServer/.gitignore
new file mode 100644 (file)
index 0000000..f6c8fbc
--- /dev/null
@@ -0,0 +1,4 @@
+/bin
+/target
+/target
+/target
diff --git a/bpmn/MSOMockServer/WebContent/META-INF/MANIFEST.MF b/bpmn/MSOMockServer/WebContent/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..254272e
--- /dev/null
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
diff --git a/bpmn/MSOMockServer/WebContent/WEB-INF/jboss-deployment-structure.xml b/bpmn/MSOMockServer/WebContent/WEB-INF/jboss-deployment-structure.xml
new file mode 100644 (file)
index 0000000..fb26891
--- /dev/null
@@ -0,0 +1,21 @@
+<jboss-deployment-structure>\r
+       <deployment>\r
+               <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->\r
+               <exclusions>\r
+                       <module name="org.apache.log4j" />\r
+                       <module name="org.slf4j" />\r
+                       <module name="org.slf4j.impl" />\r
+                       <module name="org.jboss.resteasy.resteasy-jackson-provider" />\r
+                       <module name="org.jboss.resteasy.resteasy-jettison-provider" />\r
+               </exclusions>\r
+               <dependencies>\r
+                           <module name="org.jboss.jandex" slot="main" />\r
+                <module name="org.javassist" slot="main" />\r
+                <module name="org.antlr" slot="main" />\r
+                <module name="org.dom4j" slot="main" />\r
+                <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />\r
+                <!-- This module contain the ProviderBase class: -->\r
+                <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" export="true" />\r
+               </dependencies>\r
+       </deployment>\r
+</jboss-deployment-structure>\r
diff --git a/bpmn/MSOMockServer/WebContent/WEB-INF/web.xml b/bpmn/MSOMockServer/WebContent/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..1aa8cdb
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+</web-app>
\ No newline at end of file
diff --git a/bpmn/MSOMockServer/pom.xml b/bpmn/MSOMockServer/pom.xml
new file mode 100644 (file)
index 0000000..500535d
--- /dev/null
@@ -0,0 +1,100 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <parent>
+        <groupId>org.openecomp.so</groupId>
+        <artifactId>bpmn</artifactId>
+               <version>1.1.0-SNAPSHOT</version>
+       </parent>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.openecomp.so</groupId>
+       <artifactId>MSOMockServer</artifactId>
+       <packaging>war</packaging>
+
+       <build>
+               <plugins>
+               
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-war-plugin</artifactId>
+                               <version>2.4</version>
+                               <configuration>
+                                   <attachClasses>true</attachClasses>
+                                       <archiveClasses>true</archiveClasses>                           
+                                       <failOnMissingWebXml>false</failOnMissingWebXml>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+       <dependencies>
+       
+               <dependency>
+                       <groupId>com.github.tomakehurst</groupId>
+                       <artifactId>wiremock</artifactId>
+                       <version>1.56</version>
+                       <classifier>standalone</classifier>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>org.mortbay.jetty</groupId>
+                                       <artifactId>jetty</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.google.guava</groupId>
+                                       <artifactId>guava</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-core</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-annotations</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-databind</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.apache.httpcomponents</groupId>
+                                       <artifactId>httpclient</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.skyscreamer</groupId>
+                                       <artifactId>jsonassert</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>xmlunit</groupId>
+                                       <artifactId>xmlunit</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.jayway.jsonpath</groupId>
+                                       <artifactId>json-path</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>net.sf.jopt-simple</groupId>
+                                       <artifactId>jopt-simple</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+               <dependency>
+            <groupId>org.openecomp.so</groupId>
+            <artifactId>common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+               <dependency>
+                       <groupId>javax.ws.rs</groupId>
+                       <artifactId>javax.ws.rs-api</artifactId>
+                       <version>2.0</version>
+               </dependency>
+               <dependency>
+                   <groupId>org.jboss.resteasy</groupId>
+                   <artifactId>resteasy-client</artifactId>
+                   <version>3.0.8.Final</version>
+                       <exclusions>                    
+                               <exclusion>
+                                       <groupId>org.apache.httpcomponents</groupId>                            
+                                       <artifactId>httpclient</artifactId>
+                               </exclusion>
+                       </exclusions>   
+               </dependency>
+       </dependencies>
+</project>
\ No newline at end of file
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java
new file mode 100644 (file)
index 0000000..2ebb44a
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * 
+ * File utility class.<br/>
+ * <p>
+ * </p>
+ * 
+ * @author
+ * @version     ONAP  Sep 15, 2017
+ */
+public class FileUtil {
+
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+    
+    private FileUtil() {
+        /**
+         * Constructor.
+         */
+    }
+       /**
+        * Read the specified resource file and return the contents as a String.
+        * 
+        * @param fileName Name of the resource file
+        * @return the contents of the resource file as a String
+        * @throws IOException if there is a problem reading the file
+        */
+       public static String readResourceFile(String fileName) {
+               InputStream stream;
+               try {
+                       stream = getResourceAsStream(fileName);
+                       byte[] bytes;
+                       bytes = new byte[stream.available()];
+                       stream.read(bytes);
+                       stream.close();
+                       return new String(bytes);
+               } catch (IOException e) {
+                   LOGGER.debug("Exception:", e);
+                       return "";
+               }
+       }
+       
+       /**
+        * Get an InputStream for the resource specified.
+        * 
+        * @param resourceName Name of resource for which to get InputStream.
+        * @return an InputStream for the resource specified.
+        * @throws IOException If we can't get the InputStream for whatever reason.
+        */
+       private static InputStream getResourceAsStream(String resourceName) throws IOException {
+               InputStream stream =
+                               FileUtil.class.getClassLoader().getResourceAsStream(resourceName);
+               if (stream == null) {
+                       throw new IOException("Can't access resource '" + resourceName + "'");
+               }
+               return stream;
+       }               
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java
new file mode 100644 (file)
index 0000000..fc97e69
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.client.WireMock;
+
+/**
+ * 
+ * Mock Resource which is used to start, stop the WireMock Server
+ * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer
+ * You can also selectively setup a stub (use reset before setting up), reset all stubs
+ */
+@Path("/server")
+public class MockResource {
+
+       private boolean started = false;
+       private final Integer defaultPort = 28090;
+       private WireMockServer wireMockServer = null;
+       private static Map<String,String> mockProperties = new HashMap<String,String>();
+
+       public static String getMockProperties(String key) {
+               return mockProperties.get(key);
+       }
+
+       private synchronized void initMockServer(int portNumber) {
+               String path = FileUtil.class.getClassLoader().getResource("__files/sdncSimResponse.xml").getFile();
+               path = path.substring(0,path.indexOf("__files/"));
+
+               wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterMockTransformer")
+                                                                                                                                                       .extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer")
+                                                                                                                                                       .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterCreateMockTransformer")
+                                                                                                                                                       .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterDeleteMockTransformer")
+                                                                                                                                                       .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterUpdateMockTransformer")
+                                                                                                                                                       .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterRollbackMockTransformer")
+                                                                                                                                                       .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterQueryMockTransformer"));
+                                                                                                                                                       //.withRootDirectory(path));
+               //Mocks were failing - commenting out for now, both mock and transformers seem to work fine
+               WireMock.configureFor("localhost", portNumber);
+               wireMockServer.start();
+//             StubResponse.setupAllMocks();
+               started= true;
+       }
+
+       public static void main(String [] args) {
+               MockResource mockresource = new MockResource();
+               mockresource.start(28090);
+               mockresource.reset();
+//             mockresource.setupStub("MockCreateTenant");
+       }
+       
+       /**
+        * Starts the wiremock server in default port
+        * @return
+        */
+       @GET
+       @Path("/start")
+       @Produces("application/json")
+       public Response start() {
+               return startMockServer(defaultPort);
+       }
+
+       private Response startMockServer(int port) {
+               if (!started) {
+                       initMockServer(defaultPort);
+                       System.out.println("Started Mock Server in port " + port);
+                       return Response.status(200).entity("Started Mock Server in port " + port).build();
+               } else {
+                       return Response.status(200).entity("Mock Server is already running").build();
+               }
+       }
+
+       /**
+        * Starts the wiremock server in a different port
+        * @param portNumber
+        * @return
+        */
+       @GET
+       @Path("/start/{portNumber}")
+       @Produces("application/json")
+       public Response start(@PathParam("portNumber") Integer portNumber) {
+               if (portNumber == null) portNumber = defaultPort;
+               return startMockServer(portNumber.intValue());
+       }
+
+
+       /**
+        * Stop the wiremock server
+        * @return
+        */
+       @GET
+       @Path("/stop")
+       @Produces("application/json")
+       public synchronized Response stop() {
+               if (wireMockServer.isRunning()) {
+                       wireMockServer.stop();
+                       started = false;
+                       return Response.status(200).entity("Stopped Mock Server in port ").build();
+               }
+               return Response.status(200).entity("Mock Server is not running").build();
+       }
+
+
+       /**
+        * Return list of mock properties
+        * @return
+        */
+       @GET
+       @Path("/properties")
+       @Produces("application/json")
+       public Response getProperties() {
+               return Response.status(200).entity(mockProperties).build();
+       }
+
+       /**
+        * Update a particular mock property at run-time
+        * @param name
+        * @param value
+        * @return
+        */
+       @POST
+       @Path("/properties/{name}/{value}")
+       public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) {
+               if (mockProperties.size() > 50) return Response.serverError().build();
+               mockProperties.put(name, value);
+               return Response.status(200).build();
+       }
+
+       /**
+        * Reset all stubs
+        * @return
+        */
+       @GET
+       @Path("/reset")
+       @Produces("application/json")
+       public Response reset() {
+               WireMock.reset();
+               return Response.status(200).entity("Wiremock stubs are reset").build();
+       }
+
+       
+       /**
+        * Setup a stub selectively
+        * Prior to use, make sure that stub method is available in StubResponse class
+        * @param methodName
+        * @return
+        */
+       
+       // commenting for now until we figure out a way to use new StubResponse classes to setupStubs
+//     @GET
+//     @Path("/stub/{methodName}")
+//     @Produces("application/json")
+//     public Response setupStub(@PathParam("methodName") String methodName) {
+//             
+//         @SuppressWarnings("rawtypes")
+//             Class params[] = {};
+//         Object paramsObj[] = {};
+//
+//         try {
+//                     Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params);
+//                     try {
+//                             thisMethod.invoke(StubResponse.class, paramsObj);
+//                     } catch (IllegalAccessException | IllegalArgumentException
+//                                     | InvocationTargetException e) {
+//                             return Response.status(200).entity("Error invoking " + methodName ).build();
+//                     }
+//             } catch (NoSuchMethodException | SecurityException e) {
+//                     return Response.status(200).entity("Stub " + methodName + " not found...").build();
+//             }               
+//             return Response.status(200).entity("Successfully invoked " + methodName).build();
+//     }
+       
+       
+       public static Map<String,String> getMockProperties(){
+               return mockProperties;
+       }
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java
new file mode 100644 (file)
index 0000000..ebbfea5
--- /dev/null
@@ -0,0 +1,50 @@
+/* 
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+/**
+ * 
+ * JAX RS Application wiring for Mock Resource
+ */
+@ApplicationPath("/console")
+public class MockResourceApplication extends Application {
+
+       private Set<Object> singletons = new HashSet<Object>();
+       private Set<Class<?>> classes = new HashSet<Class<?>>();
+
+       public MockResourceApplication() {
+               singletons.add(new MockResource());
+       }
+
+       @Override
+       public Set<Class<?>> getClasses() {
+               return classes;
+       }
+
+       @Override
+       public Set<Object> getSingletons() {
+               return singletons;
+       }
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java
new file mode 100644 (file)
index 0000000..9c4e793
--- /dev/null
@@ -0,0 +1,140 @@
+/* 
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
+
+import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
+import com.github.tomakehurst.wiremock.common.FileSource;
+import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
+import com.github.tomakehurst.wiremock.http.Request;
+import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+
+import org.openecomp.mso.logger.MsoLogger;
+/**
+ * 
+ * Simulates SDNC Adapter Callback response
+ *
+ */
+public class SDNCAdapterMockTransformer extends ResponseTransformer {
+
+       private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+       private String callbackResponse;
+       private String requestId;
+       
+       public SDNCAdapterMockTransformer() {
+               callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml");
+       }
+
+       public SDNCAdapterMockTransformer(String requestId) {
+               this.requestId = requestId;
+       }
+       
+       public String name() {
+               return "sdnc-adapter-transformer";
+       }
+
+       /**
+        * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
+        * so that callback response can be correlated
+        * 
+        * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
+        * the callback response is sent
+        */
+       @Override
+       public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+                       FileSource fileSource) {
+               String requestBody = request.getBodyAsString();
+               
+               String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
+               String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
+
+               callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+               System.out.println("callbackResponse:" + callbackResponse);
+               
+               if (this.requestId != null) {
+                       callbackResponse = callbackResponse.replace(this.requestId, requestId);
+               } else {
+                       callbackResponse = callbackResponse.replace("testRequestId", requestId);
+               }
+               
+
+               Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
+               int delay = 300;
+               if (sdncDelay != null) {
+                       delay = Integer.parseInt(sdncDelay.toString());
+               }
+               
+               //Kick off callback thread
+               System.out.println("callback Url:" + callbackUrl + ":delay:" + delay);
+               CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
+               calbackResponseThread.start();
+               
+               //return 200 OK with empty body
+               return ResponseDefinitionBuilder
+                .like(responseDefinition).but()
+                .withStatus(200).withBody("").withHeader("Content-Type", "text/xml")
+                .build();
+       }
+
+       @Override
+       public boolean applyGlobally() {
+           return false;
+       }
+       
+       /**
+        * 
+        * Callback response thread which sends the callback response asynchronously
+        *
+        */
+       private class CallbackResponseThread extends Thread {
+               
+               private String callbackUrl;
+               private String payLoad;
+               private int delay;
+               
+               public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+                       this.callbackUrl = callbackUrl;
+                       this.payLoad = payLoad;
+                       this.delay = delay;
+               }
+               
+               public void run () {
+                       try {
+                               //Delay sending callback response
+                               sleep(delay);
+                       } catch (InterruptedException e1) {
+                               LOGGER.debug("Exception :",e1);
+                       }
+                       LOGGER.debug("Sending callback response:" + callbackUrl);
+                       ClientRequest request = new ClientRequest(callbackUrl);
+                       request.body("text/xml", payLoad);
+                       System.err.println(payLoad);
+                       try {
+                               ClientResponse result = request.post();
+                               //System.err.println("Successfully posted callback:" + result.getStatus());
+                       } catch (Exception e) {
+                               LOGGER.debug("Exception :",e);
+                       }
+               }
+               
+       }
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
new file mode 100644 (file)
index 0000000..e59e3b6
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+
+import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
+import com.github.tomakehurst.wiremock.common.FileSource;
+import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
+import com.github.tomakehurst.wiremock.http.Request;
+import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+
+import org.openecomp.mso.logger.MsoLogger;
+
+public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransformer {
+
+       private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+       
+       private String callbackResponse;
+       private String requestId;
+       
+       public SDNCAdapterNetworkTopologyMockTransformer() {
+               callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml");
+       }
+
+       public SDNCAdapterNetworkTopologyMockTransformer(String requestId) {
+               this.requestId = requestId;
+       }
+       
+       public String name() {
+               return "network-topology-operation-transformer";
+       }
+
+       @Override
+       public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource) {
+               String requestBody = request.getBodyAsString();
+               
+               String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
+               String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
+               System.out.println("request callbackUrl : " + callbackUrl);
+               System.out.println("request requestId : " + requestId);
+               
+               System.out.println("file path/name : " + responseDefinition.getBodyFileName());
+               callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());                
+               // extract Response responseRequestId
+               String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>"));
+               System.out.println("response requestId: " + responseRequestId);         
+               System.out.println("callbackResponse (before): " + callbackResponse);
+               callbackResponse = callbackResponse.replace(responseRequestId, requestId);                              
+               if (this.requestId != null) {
+                       callbackResponse = callbackResponse.replace(this.requestId, requestId);
+               } else {
+                       callbackResponse = callbackResponse.replace(responseRequestId, requestId);
+               }       
+               System.out.println("callbackResponse (after):" + callbackResponse);             
+
+               Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
+               int delay = 300;
+               if (sdncDelay != null) {
+                       delay = Integer.parseInt(sdncDelay.toString());
+               }
+               
+               //Kick off callback thread
+               System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
+               CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
+               calbackResponseThread.start();
+               
+               //return 200 OK with body
+               return ResponseDefinitionBuilder
+                .like(responseDefinition).but()
+                .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml")
+                .build();
+       }
+
+       @Override
+       public boolean applyGlobally() {
+           return false;
+       }
+       
+       private class CallbackResponseThread extends Thread {
+               
+               private String callbackUrl;
+               private String payLoad;
+               private int delay;
+               
+               public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+                       this.callbackUrl = callbackUrl;
+                       this.payLoad = payLoad;
+                       this.delay = delay;
+               }
+               
+               public void run () {
+                       try {
+                               //Delay sending callback response
+                               sleep(delay);
+                       } catch (InterruptedException e1) {
+                               // TODO Auto-generated catch block
+                               LOGGER.debug("Exception :",e1);
+                       }
+                       LOGGER.debug("Sending callback response to url: " + callbackUrl);
+                       ClientRequest request = new ClientRequest(callbackUrl);
+                       request.body("text/xml", payLoad);
+                       //System.err.println(payLoad);
+                       try {
+                               ClientResponse result = request.post();
+                               LOGGER.debug("Successfully posted callback? Status: " + result.getStatus());
+                       } catch (Exception e) {
+                               // TODO Auto-generated catch block
+                           LOGGER.debug("catch error in - request.post() ");
+                               LOGGER.debug("Exception :",e);
+                       }
+               }
+               
+       }
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java
new file mode 100644 (file)
index 0000000..32f2641
--- /dev/null
@@ -0,0 +1,1069 @@
+/*\r
+ * ============LICENSE_START======================================================= \r
+ * ONAP - SO \r
+ * ================================================================================ \r
+ * Licensed under the Apache License, Version 2.0 (the "License"); \r
+ * you may not use this file except in compliance with the License. \r
+ * You may obtain a copy of the License at \r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0 \r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software \r
+ * distributed under the License is distributed on an "AS IS" BASIS, \r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \r
+ * See the License for the specific language governing permissions and \r
+ * limitations under the License. \r
+ * ============LICENSE_END========================================================= \r
+ */ \r
+\r
+package org.openecomp.mso.bpmn.mock;\r
+\r
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.get;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.post;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.patch;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.put;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;\r
+\r
+\r
+/**\r
+ * Reusable Mock StubResponses for AAI Endpoints\r
+ *\r
+ */\r
+public class StubResponseAAI {\r
+\r
+       public static void setupAllMocks() {\r
+\r
+       }\r
+\r
+\r
+       /**\r
+        * Tunnel-XConnect Mock Stub Response\r
+        */\r
+       public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+\r
+\r
+       /**\r
+        * Allotted Resource Mock StubResponses below\r
+        */\r
+       public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+\r
+       public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+       \r
+       public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(204)));\r
+       }\r
+       \r
+       public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {\r
+               stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+\r
+       public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+\r
+       /**\r
+        * Service Instance Mock StubResponses below\r
+        */\r
+       public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))\r
+                                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+\r
+       public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))\r
+                                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+\r
+       public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))\r
+                                               .willReturn(aResponse()\r
+                                               .withStatus(500)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+\r
+       public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+\r
+       public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+\r
+       public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+\r
+       public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(204)));\r
+       }\r
+       \r
+       public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)));\r
+       }\r
+       \r
+       public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(200)\r
+                                 .withHeader("Content-Type", "text/xml")));\r
+       }\r
+       \r
+       public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)));\r
+       }\r
+       \r
+       public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)));\r
+       }\r
+\r
+       public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))\r
+                                .willReturn(aResponse()\r
+                                 .withStatus(404)));\r
+       }\r
+\r
+       public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))\r
+                                .willReturn(aResponse()\r
+                                 .withStatus(500)));\r
+       }\r
+\r
+       public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+\r
+       /**\r
+        * Service-Subscription Mock StubResponses below\r
+        */\r
+       public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)));\r
+       }\r
+\r
+       public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) {\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+\r
+       public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+       \r
+       public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))\r
+                               .willReturn(aResponse()\r
+                               .withStatus(statusCode)));\r
+       }\r
+\r
+       /**\r
+        * Customer Mock StubResponses below\r
+        */\r
+       public static void MockGetCustomer(String globalCustId, String responseFile) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockDeleteCustomer(String globalCustId) {\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+\r
+       public static void MockPutCustomer(String globalCustId) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+\r
+       public static void MockPutCustomer_500(String globalCustId) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+\r
+\r
+       /**\r
+        * Generic-Vnf Mock StubResponses below\r
+        */\r
+       \r
+       public static void MockGetGenericVnfById(String vnfId, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))\r
+                               .atPriority(1)\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(statusCode)\r
+                                       .withHeader("Content-Type", "text/xml")\r
+                                       .withBodyFile(responseFile)));  \r
+       }\r
+       \r
+       public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))\r
+                               .atPriority(priority)\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(statusCode)\r
+                                       .withHeader("Content-Type", "text/xml")\r
+                                       .withBodyFile(responseFile)));  \r
+       }\r
+\r
+       public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetGenericVnfById_404(String vnfId){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+\r
+       public static void MockGetGenericVnfById_500(String vnfId){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+\r
+       public static void MockGetGenericVnfByName(String vnfName, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockGetGenericVnfByName_404(String vnfName){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+\r
+       public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(204)));\r
+       }\r
+\r
+       public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)));\r
+       }\r
+\r
+       public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+\r
+       public static void MockPutGenericVnf(String vnfId){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+       \r
+       public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))\r
+                               .withRequestBody(containing(requestBodyContaining))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(statusCode)));\r
+       }\r
+\r
+       public static void MockPutGenericVnf(String vnfId, int statusCode) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(statusCode)));\r
+       }\r
+       \r
+       public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)));\r
+       }\r
+\r
+       public static void MockPatchGenericVnf(String vnfId){\r
+               stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+       /**\r
+        * Vce Mock StubResponses below\r
+        */\r
+       public static void MockGetVceById(String vnfId, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockGetVceByName(String vnfName, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)));\r
+       }\r
+\r
+       public static void MockPutVce(String vnfId){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+       \r
+       public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       /**\r
+        * Tenant Mock StubResponses below\r
+        */\r
+       public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockGetTenant(String tenantId, String responseFile) {\r
+               stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       /**\r
+        * Network Mock StubResponses below\r
+        */\r
+       public static void MockGetNetwork(String networkId, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkByName(String networkName, String responseFile) {\r
+                  stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))\r
+                                       .willReturn(aResponse()\r
+                                                       .withStatus(200)\r
+                                                       .withHeader("Content-Type", "text/xml")\r
+                                                       .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockGetNetworkByName_404(String responseFile, String networkName) {\r
+       stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkCloudRegion_404(String cloudRegion) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+\r
+       public static void MockPutNetwork(String networkId, int statusCode, String responseFile) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }       \r
+       \r
+       public static void MockGetNetworkPolicy(String responseFile, String policy) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkTableReference(String responseFile, String tableReference) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth ))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockPatchVfModuleId(String vnfId, String vfModuleId) {\r
+               stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+       \r
+       /////////////\r
+       \r
+       public static void MockVNFAdapterRestVfModule() {\r
+               stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(202)\r
+                               .withHeader("Content-Type", "application/xml")));\r
+               stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(202)\r
+                                       .withHeader("Content-Type", "application/xml")));\r
+               stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(202)\r
+                               .withHeader("Content-Type", "application/xml")));\r
+               stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(202)\r
+                               .withHeader("Content-Type", "application/xml")));\r
+       }\r
+       \r
+       public static void MockDBUpdateVfModule(){\r
+               stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                           .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/DBUpdateResponse.xml")));\r
+       }\r
+       \r
+       // start of mocks used locally and by other VF Module unit tests\r
+       public static void MockSDNCAdapterVfModule() {\r
+               // simplified the implementation to return "success" for all requests\r
+               stubFor(post(urlEqualTo("/SDNCAdapter"))\r
+//                     .withRequestBody(containing("SvcInstanceId><"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));\r
+\r
+       }\r
+       \r
+       // start of mocks used locally and by other VF Module unit tests\r
+       public static void MockAAIVfModule() {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))\r
+                       .atPriority(1)\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/VfModule-supercool.xml")));         \r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm"))\r
+                       .atPriority(2)\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/VfModule-lukewarm.xml")));\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))\r
+                       .atPriority(5)\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/VfModule-new.xml")));\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/GenericVnf.xml")));\r
+               stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))\r
+//                     .withRequestBody(containing("PCRF"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)));\r
+               stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))\r
+//                             .withRequestBody(containing("PCRF"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)));\r
+               // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))\r
+                               .withRequestBody(containing("PCRF"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)));\r
+               // HTTP PUT stub still used by DoCreateVfModuleTest\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))\r
+                               .withRequestBody(containing("MODULELABEL"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)));\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))\r
+                               .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "text/xml")\r
+                               .withBodyFile("VfModularity/VolumeGroup.xml")));\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)\r
+                                       .withHeader("Content-Type", "text/xml")\r
+                                       .withBodyFile("VfModularity/VolumeGroup.xml")));\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020"))\r
+                            .willReturn(aResponse()\r
+                            .withStatus(200)\r
+                            .withHeader("Content-Type", "text/xml")\r
+                            .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml")));\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(200)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml")));\r
+               stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId"))\r
+                               .withRequestBody(containing("NEWvBNGModuleId"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)));\r
+       }\r
+\r
+       \r
+       \r
+       //////////////\r
+\r
+       /**\r
+        * Cloud infrastructure below\r
+        */\r
+       \r
+       public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       /**\r
+        * Volume Group StubResponse below\r
+        */\r
+       public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(statusCode)));\r
+       }\r
+\r
+       public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) {\r
+               stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))\r
+                               .willReturn(aResponse()\r
+                               .withStatus(404)));\r
+       }\r
+       \r
+       public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) {\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))\r
+                               .willReturn(aResponse()\r
+                               .withStatus(200)));\r
+       }\r
+       \r
+       /**\r
+        * VF-Module StubResponse below\r
+        * @param statusCode TODO\r
+        */\r
+       public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))\r
+                               .withRequestBody(containing(requestContaining))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")));\r
+       }\r
+\r
+       public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId))\r
+                               .withRequestBody(containing(requestContaining))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)));\r
+       }\r
+       \r
+       public static void MockPutVfModuleId(String vnfId, String vfModuleId) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+       \r
+       public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) {\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(returnCode)));\r
+       }\r
+       \r
+       public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) {\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(returnCode)));\r
+       }\r
+\r
+       public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) {\r
+               stubFor(patch(urlMatching(endpoint))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(statusCode)));\r
+       }\r
+       \r
+       /* AAI Pserver Queries */\r
+       public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) {\r
+               stubFor(put(urlMatching("/v10/query.*"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "application/json")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) {\r
+               stubFor(get(urlMatching("/v10/network/generic-vnfs/.*"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               .withHeader("Content-Type", "application/json; charset=utf-8")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+       \r
+       public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) {\r
+               stubFor(patch(urlMatching("/v10/network/generic-vnfs/.*"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(statusCode)\r
+                                               ));\r
+       }\r
+       \r
+       //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////\r
+       @Deprecated\r
+       public static void MockGetVceById(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericFlows/getVceResponse.xml")));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetVceByName(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericFlows/getVceByNameResponse.xml")));\r
+       }\r
+       @Deprecated\r
+       public static void MockPutVce(){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+       @Deprecated\r
+       public static void MockDeleteVce(){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(204)));\r
+       }\r
+       @Deprecated\r
+       public static void MockDeleteVce_404(){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+\r
+       @Deprecated\r
+       public static void MockDeleteServiceSubscription(){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(204)));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetServiceSubscription(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(200)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBodyFile("GenericFlows/getServiceSubscription.xml")));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetServiceSubscription_200Empty(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))\r
+                                 .willReturn(aResponse()\r
+                                 .withStatus(200)\r
+                                 .withHeader("Content-Type", "text/xml")\r
+                                 .withBody(" ")));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetServiceSubscription_404() {\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+       @Deprecated\r
+       public static void MockGENPSIPutServiceInstance(){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));\r
+       }\r
+\r
+       @Deprecated\r
+       public static void MockGENPSIPutServiceSubscription(){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));\r
+       }\r
+       @Deprecated\r
+       public static void MockGENPSIPutServiceInstance_get500(){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericPutServiceInstance/aaiFault.xml")));\r
+       }\r
+\r
+       @Deprecated\r
+       public static void MockGetGenericVnfById(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetGenericVnfById_404(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetGenericVnfByName(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetGenericVnfByName_hasRelationships(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetGenericVnfById_hasRelationships(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)\r
+                                               .withHeader("Content-Type", "text/xml")\r
+                                               .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetGenericVnfById_500(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+       @Deprecated\r
+       public static void MockGetGenericVnfByName_404(){\r
+               stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+       @Deprecated\r
+       public static void MockPutGenericVnf(){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(200)));\r
+       }\r
+       @Deprecated\r
+       public static void MockPutGenericVnf_400(){\r
+               stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(400)));\r
+       }\r
+       @Deprecated\r
+       public static void MockDeleteGenericVnf(){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(204)));\r
+       }\r
+       @Deprecated\r
+       public static void MockDeleteGenericVnf_404(){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(404)));\r
+       }\r
+       @Deprecated\r
+       public static void MockDeleteGenericVnf_500(){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)));\r
+       }\r
+       @Deprecated\r
+       public static void MockDeleteGenericVnf_412(){\r
+               stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(412)));\r
+       }\r
+\r
+}\r
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java
new file mode 100644 (file)
index 0000000..c9f64d9
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
+/**
+ * Stub response class for Database stubs
+ * including database adapter, catalog db,
+ * and other databases.
+ */
+public class StubResponseDatabase {
+
+       public static void setupAllMocks() {
+
+       }
+
+       public static void MockUpdateRequestDB(String fileName){
+               stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
+                               .willReturn(aResponse()
+                               .withStatus(200)
+                           .withHeader("Content-Type", "text/xml")
+                               .withBodyFile(fileName)));
+       }       
+       
+       public static void mockUpdateRequestDB(int statusCode, String reponseFile) {
+               stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
+                               .willReturn(aResponse()
+                               .withStatus(statusCode)
+                           .withHeader("Content-Type", "text/xml")
+                               .withBodyFile(reponseFile)));
+       }
+
+       public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile){
+               stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
+                               .willReturn(aResponse()
+                               .withStatus(200)
+                           .withHeader("Content-Type", "application/json")
+                               .withBodyFile(responseFile)));
+       }
+
+       public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile){
+               stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
+                               .willReturn(aResponse()
+                               .withStatus(500)));
+       }
+       
+       public static void MockGetVnfCatalogDataCustomizationUuid(String vnfModelCustomizationUuid,  String responseFile){
+               stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid))
+                                 .willReturn(aResponse()
+                                 .withStatus(200)
+                                 .withHeader("Content-Type", "application/json")
+                                 .withBodyFile(responseFile)));
+       }
+
+       public static void MockGetVfModuleByModelNameCatalogData(String vfModuleModelName, String responseFile){
+               stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName))
+                                 .willReturn(aResponse()
+                                 .withStatus(200)
+                                 .withHeader("Content-Type", "application/json")
+                                 .withBodyFile(responseFile)));
+       }
+       
+       public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){
+               stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid + 
+                               "&serviceModelVersion=" + serviceModelVersion))
+                                 .willReturn(aResponse()
+                                 .withStatus(200)
+                                 .withHeader("Content-Type", "application/json")
+                                 .withBodyFile(responseFile)));
+       }
+       
+       public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String responseFile){
+               stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid))
+                                 .willReturn(aResponse()
+                                 .withStatus(200)
+                                 .withHeader("Content-Type", "application/json")
+                                 .withBodyFile(responseFile)));
+       }       
+       
+
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java
new file mode 100644 (file)
index 0000000..8baeb1b
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
+/**
+ * Please describe the StubResponseNetwork.java class
+ *
+ */
+public class StubResponseNetworkAdapter {
+
+       private static final String EOL = "\n";
+
+       public static void setupAllMocks() {
+
+       }
+
+
+       public static void MockNetworkAdapter() {
+               stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+                       .willReturn(aResponse()
+                       .withStatus(200)));
+       }
+
+       public static void MockNetworkAdapter(String response) {
+               stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+                       .willReturn(aResponse()
+                       .withStatus(200)
+                       .withHeader("Content-Type", "text/xml")
+                       .withBodyFile(response)));
+       }
+
+       public static void MockNetworkAdapter_500() {
+               stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+                       .willReturn(aResponse()
+                       .withStatus(500)));
+       }
+
+       public static void MockNetworkAdapterPost(String responseFile, String requestContaining) {
+               stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+                       .withRequestBody(containing(requestContaining))                         
+                       .willReturn(aResponse()
+                       .withStatus(200)
+                       .withHeader("Content-Type", "text/xml")
+                       .withBodyFile(responseFile)));
+       }       
+       
+       public static void MockNetworkAdapter(String networkId, int statusCode, String responseFile) {
+               stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId))
+                                 .willReturn(aResponse()
+                                 .withStatus(statusCode)
+                                 .withHeader("Content-Type", "application/xml")
+                                 .withBodyFile(responseFile)));
+       }
+       
+       public static void MockNetworkAdapterContainingRequest(String requestContaining, int statusCode, String responseFile) {
+               stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+                                 .withRequestBody(containing(requestContaining))
+                                 .willReturn(aResponse()
+                                 .withStatus(statusCode)
+                                 .withHeader("Content-Type", "text/xml")
+                                 .withBodyFile(responseFile)));
+       }
+       
+       public static void MockPutNetworkAdapter(String networkId, String requestContaining, int statusCode, String responseFile) {
+               stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId))
+                                 .withRequestBody(containing(requestContaining))
+                                 .willReturn(aResponse()
+                                 .withStatus(statusCode)
+                                 .withHeader("Content-Type", "text/xml")
+                                 .withBodyFile(responseFile)));
+       }
+       
+       public static void MockNetworkAdapterRestRollbackDelete(String responseFile, String networkId) {
+               stubFor(delete(urlEqualTo("/networks/NetworkAdapter/"+networkId+"/rollback"))
+                       .willReturn(aResponse()
+                       .withStatus(200)
+                       .withHeader("Content-Type", "text/xml")
+                       .withBodyFile(responseFile)));
+       }       
+
+       public static void MockNetworkAdapterRestPut(String responseFile, String networkId) {
+               stubFor(put(urlEqualTo("/networks/NetworkAdapter/"+networkId))
+                       .willReturn(aResponse()
+                       .withStatus(200)
+                       .withHeader("Content-Type", "text/xml")
+                       .withBodyFile(responseFile)));
+       }               
+       
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java
new file mode 100644 (file)
index 0000000..38b81c5
--- /dev/null
@@ -0,0 +1,94 @@
+/*\r
+ * ============LICENSE_START======================================================= \r
+ * ONAP - SO \r
+ * ================================================================================ \r
+ * Licensed under the Apache License, Version 2.0 (the "License"); \r
+ * you may not use this file except in compliance with the License. \r
+ * You may obtain a copy of the License at \r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0 \r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software \r
+ * distributed under the License is distributed on an "AS IS" BASIS, \r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \r
+ * See the License for the specific language governing permissions and \r
+ * limitations under the License. \r
+ * ============LICENSE_END========================================================= \r
+ */ \r
+\r
+package org.openecomp.mso.bpmn.mock;\r
+\r
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.get;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.post;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.patch;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.put;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;\r
+\r
+/**\r
+ * Reusable Mock StubResponses for Policy\r
+ *\r
+ */\r
+public class StubResponsePolicy {\r
+\r
+       public static void setupAllMocks() {\r
+\r
+       }\r
+\r
+       // start of Policy mocks\r
+       public static void MockPolicyAbort() {          \r
+               stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
+                       .withRequestBody(containing("BB1"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "application/json")\r
+                               .withBodyFile("policyAbortResponse.json")));\r
+               \r
+               stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
+                               .withRequestBody(containing("UPDVnfI"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)\r
+                                       .withHeader("Content-Type", "application/json")\r
+                                       .withBodyFile("policyAbortResponse.json")));\r
+               \r
+               stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
+                               .withRequestBody(containing("RPLVnfI"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)\r
+                                       .withHeader("Content-Type", "application/json")\r
+                                       .withBodyFile("policyAbortResponse.json")));\r
+\r
+\r
+       }\r
+       \r
+       public static void MockPolicySkip() {           \r
+               stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
+                       .withRequestBody(containing("BB1"))\r
+                       .willReturn(aResponse()\r
+                               .withStatus(200)\r
+                               .withHeader("Content-Type", "application/json")\r
+                               .withBodyFile("Policy/policySkipResponse.json")));\r
+               \r
+               stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
+                               .withRequestBody(containing("UPDVnfI"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)\r
+                                       .withHeader("Content-Type", "application/json")\r
+                                       .withBodyFile("Policy/policySkipResponse.json")));\r
+               \r
+               stubFor(post(urlEqualTo("/pdp/api/getDecision"))\r
+                               .withRequestBody(containing("RPLVnfI"))\r
+                               .willReturn(aResponse()\r
+                                       .withStatus(200)\r
+                                       .withHeader("Content-Type", "application/json")\r
+                                       .withBodyFile("Policy/policySkipResponse.json")));\r
+\r
+\r
+       }\r
+       \r
+       \r
+}\r
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java
new file mode 100644 (file)
index 0000000..f41d6d7
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
+/**
+ * Please describe the StubResponseSDNC.java class
+ */
+public class StubResponseSDNCAdapter {
+
+       public static void setupAllMocks() {
+
+       }
+
+       public static void mockSDNCAdapter_500() {
+               stubFor(post(urlEqualTo("/SDNCAdapter"))
+                               .willReturn(aResponse()
+                                               .withStatus(500)));
+       }               
+       
+       public static void mockSDNCAdapter_500(String requestContaining) {
+               stubFor(post(urlEqualTo("/SDNCAdapter"))
+                 .withRequestBody(containing(requestContaining))
+                 .willReturn(aResponse()
+                 .withStatus(500)));
+       }               
+       
+       public static void mockSDNCAdapter(int statusCode) {
+               stubFor(post(urlEqualTo("/SDNCAdapter"))
+                               .willReturn(aResponse()
+                                               .withStatus(statusCode)));
+       }
+       
+       public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) {
+               stubFor(post(urlEqualTo(endpoint))      
+                                 .willReturn(aResponse()
+                                 .withStatus(statusCode)
+                                 .withHeader("Content-Type", "text/xml")
+                                 .withBodyFile(responseFile)));
+       }
+
+       public static void mockSDNCAdapter(String responseFile) {
+               stubFor(post(urlEqualTo("/SDNCAdapter"))
+                                 .willReturn(aResponse()
+                                 .withStatus(200)
+                                 .withHeader("Content-Type", "text/xml")
+                                 .withBodyFile(responseFile)));
+       }
+       
+       public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) {
+               stubFor(post(urlEqualTo(endpoint))
+                               .withRequestBody(containing(requestContaining))
+                               .willReturn(aResponse()
+                                       .withStatus(statusCode)
+                                       .withHeader("Content-Type", "text/xml")
+                                       .withBodyFile(responseFile)));
+       }
+
+       public static void mockSDNCAdapterSimulator(String responseFile) {
+               MockResource mockResource = new MockResource();
+               mockResource.updateProperties("sdnc_delay", "300");
+               stubFor(post(urlEqualTo("/SDNCAdapter"))
+                               .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "application/soap+xml")
+                                               .withTransformers("sdnc-adapter-transformer")
+                                               .withBodyFile(responseFile)));
+       }
+
+       public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) {
+               MockResource mockResource = new MockResource();
+               mockResource.updateProperties("sdnc_delay", "300");
+               stubFor(post(urlEqualTo("/SDNCAdapter"))
+                               .withRequestBody(containing(requestContaining))
+                               .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "application/soap+xml")
+                                               .withTransformers("sdnc-adapter-transformer")
+                                               .withBodyFile(responseFile)));
+       }
+
+       public static void mockSDNCAdapterRest() {
+               stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+                               .willReturn(aResponse()
+                                               .withStatus(202)
+                                               .withHeader("Content-Type", "application/json")));
+       }
+
+       public static void mockSDNCAdapterRest_500() {
+               stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+                               .willReturn(aResponse()
+                                               .withStatus(500)
+                                               .withHeader("Content-Type", "application/json")));
+       }
+
+       public static void mockSDNCAdapterRest(String requestContaining) {
+               stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+                               .withRequestBody(containing(requestContaining))
+                               .willReturn(aResponse()
+                                               .withStatus(202)
+                                               .withHeader("Content-Type", "application/json")));
+       }
+
+       public static void mockSDNCAdapterRest_500(String requestContaining) {
+               stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+                               .withRequestBody(containing(requestContaining))
+                               .willReturn(aResponse()
+                                               .withStatus(500)
+                                               .withHeader("Content-Type", "application/json")));
+       }
+
+       public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) {
+               MockResource mockResource = new MockResource();
+               mockResource.updateProperties("sdnc_delay", "300");             
+               stubFor(post(urlEqualTo("/SDNCAdapter"))
+                               .withRequestBody(containing(requestContaining))
+                               .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "text/xml")
+                                               .withTransformers("network-topology-operation-transformer")
+                                               .withBodyFile(responseFile)));
+       }
+
+       
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java
new file mode 100644 (file)
index 0000000..a8f4db8
--- /dev/null
@@ -0,0 +1,69 @@
+/*\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+/*\r
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.\r
+ */\r
+package org.openecomp.mso.bpmn.mock;\r
+\r
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.post;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;\r
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;\r
+\r
+/**\r
+ * Please describe the StubResponseSNIRO.java class\r
+ *\r
+ * @author cb645j\r
+ */\r
+public class StubResponseSNIRO {\r
+\r
+       public static void setupAllMocks() {\r
+\r
+       }\r
+\r
+       public static void mockSNIRO() {\r
+               stubFor(post(urlEqualTo("/sniro/api/v2/placement"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(202)\r
+                                               .withHeader("Content-Type", "application/json")));\r
+       }\r
+\r
+       public static void mockSNIRO(String responseFile) {\r
+               stubFor(post(urlEqualTo("/sniro/api/v2/placement"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(202)\r
+                                               .withHeader("Content-Type", "application/json")\r
+                                               .withBodyFile(responseFile)));\r
+       }\r
+\r
+       public static void mockSNIRO_400() {\r
+               stubFor(post(urlEqualTo("/sniro/api/v2/placement"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(400)\r
+                                               .withHeader("Content-Type", "application/json")));\r
+       }\r
+\r
+       public static void mockSNIRO_500() {\r
+               stubFor(post(urlEqualTo("/sniro/api/v2/placement"))\r
+                               .willReturn(aResponse()\r
+                                               .withStatus(500)\r
+                                               .withHeader("Content-Type", "application/json")));\r
+       }\r
+\r
+}\r
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java
new file mode 100644 (file)
index 0000000..b4aca50
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+/**
+ * Please describe the StubResponseVNF.java class
+ */
+public class StubResponseVNFAdapter {
+
+       public static void mockVNFAdapter() {
+               stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+                               .willReturn(aResponse()
+                                               .withStatus(200)));
+       }
+
+       public static void mockVNFAdapter(String responseFile) {
+               stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+                                 .willReturn(aResponse()
+                                 .withStatus(200)
+                                 .withHeader("Content-Type", "text/xml")
+                                 .withBodyFile(responseFile)));
+       }
+
+       public static void mockVNFAdapter_500() {
+               stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+                               .willReturn(aResponse()
+                                               .withStatus(500)));
+       }
+
+       public static void mockVNFAdapterTransformer(String transformer, String responseFile) {
+               MockResource mockResource = new MockResource();
+               mockResource.updateProperties("vnf_delay", "300");
+               stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+                               .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "application/soap+xml")
+                                               .withTransformers(transformer)
+                                               .withBodyFile(responseFile)));
+       }
+
+       public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) {
+               MockResource mockResource = new MockResource();
+               mockResource.updateProperties("vnf_delay", "300");
+               stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+                               .withRequestBody(containing(requestContaining))
+                               .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "application/soap+xml")
+                                               .withTransformers(transformer)
+                                               .withBodyFile(responseFile)));
+       }
+       
+       public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) {
+               stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+                               .willReturn(aResponse()
+                               .withStatus(statusCode)
+                               .withHeader("Content-Type", "application/xml")));
+       }
+       
+       public static void mockVNFPut(String vfModuleId, int statusCode) {
+               stubFor(put(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId))
+                               .willReturn(aResponse()
+                               .withStatus(statusCode)
+                               .withHeader("Content-Type", "application/xml")));
+       }
+       
+       public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) {
+               stubFor(put(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+                               .willReturn(aResponse()
+                               .withStatus(statusCode)
+                               .withHeader("Content-Type", "application/xml")));
+       }
+       
+       public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) {
+               stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+                               .willReturn(aResponse()
+                               .withStatus(statusCode)
+                               .withHeader("Content-Type", "application/xml")));
+       }
+       
+       public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) {
+               stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback"))
+                               .willReturn(aResponse()
+                               .withStatus(statusCode)
+                               .withHeader("Content-Type", "application/xml")));
+       }
+       
+       public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) {
+               stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId))
+                               .willReturn(aResponse()
+                                       .withStatus(statusCode)
+                                       .withHeader("Content-Type", "application/xml")));
+       }
+       
+       public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) {
+               stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback"))
+                               .willReturn(aResponse()
+                               .withStatus(statusCode)
+                               .withHeader("Content-Type", "application/xml")));
+       }
+       public static void mockPostVNFVolumeGroup(int statusCode) {
+               stubFor(post(urlEqualTo("/vnfs/v1/volume-groups"))
+                               .willReturn(aResponse()
+                                       .withStatus(statusCode)
+                                       .withHeader("Content-Type", "application/xml")));
+       }
+       
+       public static void mockVNFAdapterRest(String vnfId) {
+               stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules"))
+                               .willReturn(aResponse()
+                                               .withStatus(200)));
+       }
+
+       public static void mockVNFAdapterRest_500(String vnfId) {
+               stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules"))
+                               .willReturn(aResponse()
+                                               .withStatus(500)));
+       }
+       
+       public static void mockVfModuleDelete(String volumeGroupId) {
+               stubFor(delete(urlMatching("/vnfs/v1/volume-groups/"+ volumeGroupId))
+                               .willReturn(aResponse()
+                               .withStatus(202)
+                               .withHeader("Content-Type", "application/xml")));
+       }
+       
+       public static void mockVfModuleDelete(String volumeGroupId, int statusCode) {
+               stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+                               .willReturn(aResponse()
+                               .withStatus(statusCode)
+                               .withHeader("Content-Type", "application/xml")));
+       }
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java
new file mode 100644 (file)
index 0000000..23921da
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import javax.xml.ws.Endpoint;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
+
+import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
+import com.github.tomakehurst.wiremock.common.FileSource;
+import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
+import com.github.tomakehurst.wiremock.http.Request;
+import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+
+import org.openecomp.mso.logger.MsoLogger;
+/**
+ * Please describe the VnfAdapterCreateMockTransformer.java class
+ *
+ */
+public class VnfAdapterCreateMockTransformer extends ResponseTransformer {
+
+       private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+       
+       private String notifyCallbackResponse;
+       private String ackResponse;
+
+       public VnfAdapterCreateMockTransformer() {
+               notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response
+       }
+
+       @Override
+       public String name() {
+               return "vnf-adapter-create-transformer";
+       }
+
+       @Override
+       public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+                       FileSource fileSource) {
+
+               String requestBody = request.getBodyAsString();
+
+               String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
+               String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
+               String responseMessageId = "";
+               String updatedResponse = "";
+
+               try {
+                       // try supplied response file (if any)
+                       System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+                   ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+                       notifyCallbackResponse = ackResponse;
+                       responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
+                   updatedResponse = ackResponse.replace(responseMessageId, messageId);
+               } catch (Exception ex) {
+                       LOGGER.debug("Exception :",ex);
+                       System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'");
+                   responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
+                       updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+               }
+
+               System.out.println("response (mock) messageId       : " + responseMessageId);
+               System.out.println("request  (replacement) messageId: " + messageId);
+
+               System.out.println("vnf Response (before):" + notifyCallbackResponse);
+               System.out.println("vnf Response (after):" + updatedResponse);
+
+               Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+               int delay = 300;
+               if (vnfDelay != null) {
+                       delay = Integer.parseInt(vnfDelay.toString());
+               }
+
+               //Kick off callback thread
+               System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+               CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
+               callbackResponseThread.start();
+
+               return ResponseDefinitionBuilder
+                          .like(responseDefinition).but()
+                          .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+                          .build();
+
+       }
+
+       @Override
+       public boolean applyGlobally() {
+           return false;
+       }
+
+       private class CallbackResponseThread extends Thread {
+
+               private String callbackUrl;
+               private String payLoad;
+               private int delay;
+
+               public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+                       this.callbackUrl = callbackUrl;
+                       this.payLoad = payLoad;
+                       this.delay = delay;
+               }
+
+               @SuppressWarnings("deprecation")
+               public void run () {
+                       try {
+                               //Delay sending callback response
+                               sleep(delay);
+                       } catch (InterruptedException e1) {
+                               // TODO Auto-generated catch block
+                               LOGGER.debug("Exception :",e1);
+                       }
+                       LOGGER.debug("Sending callback response to url: " + callbackUrl);
+                       ClientRequest request = new ClientRequest(callbackUrl);
+                       request.body("text/xml", payLoad);
+                       //System.out.println("payLoad: " + payLoad);
+
+                       try {
+                               ClientResponse result = request.post();
+                               LOGGER.debug("Successfully posted callback? Status: " + result.getStatus());
+                               //System.err.println("Successfully posted callback:" + result.getStatus());
+                       } catch (Exception e) {
+                               // TODO Auto-generated catch block
+                           LOGGER.debug("catch error in - request.post() ");
+                               LOGGER.debug("Exception :",e);
+                       }
+               }
+
+       }
+
+
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java
new file mode 100644 (file)
index 0000000..ee6972e
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
+
+import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
+import com.github.tomakehurst.wiremock.common.FileSource;
+import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
+import com.github.tomakehurst.wiremock.http.Request;
+import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+/**
+ * Please describe the VnfAdapterCreateMockTransformer.java class
+ *
+ */
+public class VnfAdapterDeleteMockTransformer extends ResponseTransformer {
+
+       private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+       private String notifyCallbackResponse;
+       private String ackResponse;
+
+       public VnfAdapterDeleteMockTransformer() {
+               notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml");
+       }
+
+       @Override
+       public String name() {
+               return "vnf-adapter-delete-transformer";
+       }
+
+       @Override
+       public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+                       FileSource fileSource) {
+
+               // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse);
+
+               String requestBody = request.getBodyAsString();
+
+               String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
+               String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
+               String responseMessageId = "";
+               String updatedResponse = "";
+
+               try {
+                       // try supplied response file (if any)
+                       System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+                   ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+                       notifyCallbackResponse = ackResponse;
+                       responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
+                   updatedResponse = ackResponse.replace(responseMessageId, messageId);
+               } catch (Exception ex) {
+                       LOGGER.debug("Exception :",ex);
+                       System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
+                   responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
+                       updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+               }
+
+               System.out.println("response (mock) messageId       : " + responseMessageId);
+               System.out.println("request  (replacement) messageId: " + messageId);
+
+               System.out.println("vnf Response (before):" + notifyCallbackResponse);
+               System.out.println("vnf Response (after):" + updatedResponse);
+
+               Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+               int delay = 300;
+               if (vnfDelay != null) {
+                       delay = Integer.parseInt(vnfDelay.toString());
+               }
+
+               //Kick off callback thread
+               System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+               CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
+               callbackResponseThread.start();
+
+               return ResponseDefinitionBuilder
+                          .like(responseDefinition).but()
+                          .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+                          .build();
+
+       }
+
+       @Override
+       public boolean applyGlobally() {
+           return false;
+       }
+
+       private class CallbackResponseThread extends Thread {
+
+               private String callbackUrl;
+               private String payLoad;
+               private int delay;
+
+               public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+                       this.callbackUrl = callbackUrl;
+                       this.payLoad = payLoad;
+                       this.delay = delay;
+               }
+
+               @SuppressWarnings("deprecation")
+               public void run () {
+                       try {
+                               //Delay sending callback response
+                               sleep(delay);
+                       } catch (InterruptedException e1) {
+                               // TODO Auto-generated catch block
+                               LOGGER.debug("Exception :",e1);
+                       }
+                       System.out.println("Sending callback response to url: " + callbackUrl);
+                       ClientRequest request = new ClientRequest(callbackUrl);
+                       request.body("text/xml", payLoad);
+                       //System.err.println(payLoad);
+                       try {
+                               ClientResponse result = request.post();
+                               System.out.println("Successfully posted callback? Status: " + result.getStatus());
+                               //System.err.println("Successfully posted callback:" + result.getStatus());
+                       } catch (Exception e) {
+                               // TODO Auto-generated catch block
+                               System.out.println("catch error in - request.post() ");
+                               LOGGER.debug("Exception :",e);
+                       }
+               }
+
+       }
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java
new file mode 100644 (file)
index 0000000..1582071
--- /dev/null
@@ -0,0 +1,161 @@
+/* 
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+
+import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
+
+import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
+import com.github.tomakehurst.wiremock.common.FileSource;
+import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
+import com.github.tomakehurst.wiremock.http.Request;
+import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+
+import org.openecomp.mso.logger.MsoLogger;
+/**
+ * Please describe the VnfAdapterQueryMockTransformer.java class
+ *
+ */
+
+
+public class VnfAdapterQueryMockTransformer extends ResponseTransformer{
+       
+       private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+       
+       private String notifyCallbackResponse;
+       private String ackResponse;
+       private String messageId;
+
+       public VnfAdapterQueryMockTransformer() {
+               notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml");
+       }
+       
+       public VnfAdapterQueryMockTransformer(String messageId) {
+               this.messageId = messageId;
+       }
+
+       @Override
+       public String name() {
+               return "vnf-adapter-query-transformer";
+       }
+       
+       @Override
+       public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+                       FileSource fileSource) {
+
+               String requestBody = request.getBodyAsString();
+
+               String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
+               String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
+       //      String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId);
+       
+               String responseMessageId = "";
+               String updatedResponse = "";
+               
+       //      if (ackResponse == null) {
+                       //System.err.println("file:" + responseDefinition.getBodyFileName());
+               //      ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+               //}
+
+               
+               try {
+                       // try supplied response file (if any)
+                       System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+                   ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+                       notifyCallbackResponse = ackResponse;
+                       responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
+                   updatedResponse = ackResponse.replace(responseMessageId, messageId); 
+               } catch (Exception ex) {
+                       LOGGER.debug("Exception :",ex);
+                       System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
+                   responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
+                       updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+               }
+               
+               System.out.println("response (mock) messageId       : " + responseMessageId);           
+               System.out.println("request  (replacement) messageId: " + messageId);
+               
+               System.out.println("vnf Response (before):" + notifyCallbackResponse);
+               System.out.println("vnf Response (after):" + updatedResponse);
+               
+               
+               Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+               int delay = 300;
+               if (vnfDelay != null) {
+                       delay = Integer.parseInt(vnfDelay.toString());
+               }
+
+               //Kick off callback thread
+               
+               //System.out.println("notficationUrl" + notficationUrl);
+               //System.out.println("updatedResponse" + updatedResponse);
+               System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+               CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
+               System.out.println("Inside Callback" );
+               callbackResponseThread.start();
+
+                               return ResponseDefinitionBuilder
+                            .like(responseDefinition).but()
+                            .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+                            .build();
+       }
+
+       @Override
+       public boolean applyGlobally() {
+           return false;
+       }
+
+       private class CallbackResponseThread extends Thread {
+
+               private String callbackUrl;
+               private String payLoad;
+               private int delay;
+
+               public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+                       this.callbackUrl = callbackUrl;
+                       this.payLoad = payLoad;
+                       this.delay = delay;
+               }
+
+               public void run () {
+                       try {
+                               //Delay sending callback response
+                               sleep(delay);
+                       } catch (InterruptedException e1) {
+                               LOGGER.debug("Exception :",e1);
+                       }
+                       ClientRequest request = new ClientRequest(callbackUrl);
+                       request.body("text/xml", payLoad);
+                       //System.err.println(payLoad);
+                       try {
+                               ClientResponse result = request.post();
+                               //System.err.println("Successfully posted callback:" + result.getStatus());
+                       } catch (Exception e) {
+                               LOGGER.debug("Exception :",e);
+                       }
+               }
+
+       }
+
+
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java
new file mode 100644 (file)
index 0000000..186fd35
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * 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.openecomp.mso.bpmn.mock;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+
+import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
+import com.github.tomakehurst.wiremock.common.FileSource;
+import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
+import com.github.tomakehurst.wiremock.http.Request;
+import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+
+import org.openecomp.mso.logger.MsoLogger;
+/**
+ * Please describe the VnfAdapterCreateMockTransformer.java class
+ *
+ */
+public class VnfAdapterRollbackMockTransformer extends ResponseTransformer {
+
+       private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+       private String notifyCallbackResponse;
+       private String ackResponse;
+       private String messageId;
+
+       public VnfAdapterRollbackMockTransformer() {
+               notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml");
+       }
+       
+       public VnfAdapterRollbackMockTransformer(String messageId) {
+               this.messageId = messageId;
+       }
+
+       @Override
+       public String name() {
+               return "vnf-adapter-rollback-transformer";
+       }
+
+       @Override
+       public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+                       FileSource fileSource) {
+
+               String requestBody = request.getBodyAsString();
+
+               String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
+               String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
+               String responseMessageId = "";
+               String updatedResponse = "";
+               
+               try {
+                       // try supplied response file (if any)
+                       System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+                   ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+                       notifyCallbackResponse = ackResponse;
+                       responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
+                   updatedResponse = ackResponse.replace(responseMessageId, messageId); 
+               } catch (Exception ex) {
+                       LOGGER.debug("Exception :",ex);
+                       System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
+                   responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
+                       updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+               }
+               
+               System.out.println("response (mock) messageId       : " + responseMessageId);           
+               System.out.println("request  (replacement) messageId: " + messageId);
+               
+               System.out.println("vnf Response (before):" + notifyCallbackResponse);
+               System.out.println("vnf Response (after):" + updatedResponse);
+
+               Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+               int delay = 300;
+               if (vnfDelay != null) {
+                       delay = Integer.parseInt(vnfDelay.toString());
+               }
+
+               //Kick off callback thread
+               System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);         
+               CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
+               callbackResponseThread.start();
+
+               return ResponseDefinitionBuilder
+                          .like(responseDefinition).but()
+                          .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+                          .build();
+               
+       }
+
+       @Override
+       public boolean applyGlobally() {
+           return false;
+       }
+
+       private class CallbackResponseThread extends Thread {
+
+               private String callbackUrl;
+               private String payLoad;
+               private int delay;
+
+               public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+                       this.callbackUrl = callbackUrl;
+                       this.payLoad = payLoad;
+                       this.delay = delay;
+               }
+
+               public void run () {
+                       try {
+                               //Delay sending callback response
+                               sleep(delay);
+                       } catch (InterruptedException e1) {
+                               LOGGER.debug("Exception :",e1);
+                       }
+                       System.out.println("Sending callback response to url: " + callbackUrl);
+                       ClientRequest request = new ClientRequest(callbackUrl);
+                       request.body("text/xml", payLoad);
+                       //System.err.println(payLoad);
+                       try {
+                               ClientResponse result = request.post();
+                               System.out.println("Successfully posted callback? Status: " + result.getStatus());
+                               //System.err.println("Successfully posted callback:" + result.getStatus());
+                       } catch (Exception e) {
+                               System.out.println("catch error in - request.post() ");                         
+                               LOGGER.debug("Exception :",e);
+                       }
+               }
+
+       }
+}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java
new file mode 100644 (file)
index 0000000..7808b47
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.bpmn.mock;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
+
+import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
+import com.github.tomakehurst.wiremock.common.FileSource;
+import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
+import com.github.tomakehurst.wiremock.http.Request;
+import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+
+import org.openecomp.mso.logger.MsoLogger;
+/**
+ * Please describe the VnfAdapterUpdateMockTransformer.java class
+ *
+ */
+public class VnfAdapterUpdateMockTransformer extends ResponseTransformer {
+
+       private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+       
+       private String notifyCallbackResponse;
+       private String requestId;
+       private String ackResponse;
+
+       public VnfAdapterUpdateMockTransformer() {
+               notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml");
+       }
+
+       public VnfAdapterUpdateMockTransformer(String requestId) {
+               this.requestId = requestId;
+       }
+
+
+       public String name() {
+               return "vnf-adapter-update-transformer";
+       }
+
+       @Override
+       public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+                       FileSource fileSource) {
+
+               String requestBody = request.getBodyAsString();
+
+               String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
+               String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
+               String responseMessageId = "";
+               String updatedResponse = "";
+               
+               try {
+                       // try supplied response file (if any)
+                       System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+                   ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+                       notifyCallbackResponse = ackResponse;
+                       responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
+                   updatedResponse = ackResponse.replace(responseMessageId, messageId); 
+               } catch (Exception ex) {
+                       LOGGER.debug("Exception :",ex);
+                       System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
+                   responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
+                       updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+               }
+               
+               System.out.println("response (mock) messageId       : " + responseMessageId);           
+               System.out.println("request  (replacement) messageId: " + messageId);
+               
+               System.out.println("vnf Response (before):" + notifyCallbackResponse);
+               System.out.println("vnf Response (after):" + updatedResponse);
+               
+               Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+               int delay = 300;
+               if (vnfDelay != null) {
+                       delay = Integer.parseInt(vnfDelay.toString());
+               }
+
+               //Kick off callback thread
+               System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);           
+               CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
+               callbackResponseThread.start();
+
+               return ResponseDefinitionBuilder
+                          .like(responseDefinition).but()
+                          .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+                          .build();
+
+       }
+
+       @Override
+       public boolean applyGlobally() {
+           return false;
+       }
+
+       private class CallbackResponseThread extends Thread {
+
+               private String callbackUrl;
+               private String payLoad;
+               private int delay;
+
+               public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+                       this.callbackUrl = callbackUrl;
+                       this.payLoad = payLoad;
+                       this.delay = delay;
+               }
+
+               public void run () {
+                       try {
+                               //Delay sending callback response
+                               sleep(delay);
+                       } catch (InterruptedException e1) {
+                               LOGGER.debug("Exception :", e1);
+                       }
+                       System.out.println("Sending callback response to url: " + callbackUrl);                 
+                       ClientRequest request = new ClientRequest(callbackUrl);
+                       request.body("text/xml", payLoad);
+                       //System.err.println(payLoad);
+                       try {
+                               ClientResponse result = request.post();
+                               System.out.println("Successfully posted callback? Status: " + result.getStatus());                              
+                               //System.err.println("Successfully posted callback:" + result.getStatus());
+                       } catch (Exception e) {
+                               System.out.println("catch error in - request.post() ");
+                               LOGGER.debug("Exception :",e);
+                       }
+               }
+
+       }
+}
+
diff --git a/bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml b/bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml
new file mode 100644 (file)
index 0000000..bef293d
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
+       xmlns:v1="http://domain2.openecomp.org/workflow/sdnc/adapter/schema/v1">\r
+       <soapenv:Header />\r
+       <soapenv:Body>\r
+                       <SDNCAdapterCallbackRequest\r
+                               xmlns="http://domain2.openecomp.org/workflow/sdnc/adapter/schema/v1">\r
+                               <CallbackHeader>\r
+                                       <RequestId>d325c9a7-84c0-4081-b979-9cc773a0976d</RequestId>\r
+                                       <ResponseCode>200</ResponseCode>\r
+                                       <ResponseMessage>OK</ResponseMessage>\r
+                               </CallbackHeader>\r
+                               <RequestData xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
+                                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">&lt;layer3-service-list\r
+                                       xmlns="com:att:sdnctl:l3api"&gt;&lt;service-instance-id&gt;0XX/VXXX/003717//Shakeout&lt;/service-instance-id&gt;&lt;service-status&gt;&lt;rpc-name&gt;svc-topology-operation&lt;/rpc-name&gt;&lt;rpc-action&gt;delete&lt;/rpc-action&gt;&lt;request-status&gt;synccomplete&lt;/request-status&gt;&lt;final-indicator&gt;Y&lt;/final-indicator&gt;&lt;l3sdn-action&gt;DisconnectLayer3ServiceRequest&lt;/l3sdn-action&gt;&lt;response-timestamp&gt;2015-10-22T02:11:52.010Z&lt;/response-timestamp&gt;&lt;/service-status&gt;&lt;service-data&gt;&lt;svc-config-additional-data/&gt;&lt;/service-data&gt;&lt;/layer3-service-list&gt;\r
+                               </RequestData>\r
+                       </SDNCAdapterCallbackRequest>\r
+       </soapenv:Body>\r
+</soapenv:Envelope>\r
diff --git a/bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml b/bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml
new file mode 100644 (file)
index 0000000..cca27bb
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>  
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
+<jboss-web>
+  <security-domain>other</security-domain>
+  <context-root>/msomock</context-root>
+</jboss-web>  
\ No newline at end of file
diff --git a/bpmn/MSOURN-plugin/build.properties b/bpmn/MSOURN-plugin/build.properties
deleted file mode 100644 (file)
index 7e5fb9f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copy this file to 'build.properties' and modify it to match your system
-# Alternatively, you can also copy it to '${user.home}/.camunda/build.properties'
-# to have a central configuration that works with all camunda BPM projects
-
-# Defines the deployment folder in a camunda BPM installation (backslashes need to be escaped or replaced by forward slashes).
-#deploy.jboss.dir=C:/camunda/camunda-bpm-jboss-7.3.0/server/jboss-as-${jboss-version}/standalone/deployments
-deploy.jboss.dir=C:/D2/jboss-ee/server/jboss-as-7.2.0.Final/standalone/deployments
\ No newline at end of file
diff --git a/bpmn/MSOURN-plugin/build.xml b/bpmn/MSOURN-plugin/build.xml
deleted file mode 100644 (file)
index f2dbc55..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="urnMap-plugin" default="deploy.jboss">
-
-       <property file="build.properties" />
-       <property file="${user.home}/.camunda/build.properties" />
-       <property name="target.dir" value="target" />
-
-       <condition property="mvn.executable" value="mvn.bat" else="mvn">
-               <os family="windows"/>
-       </condition>
-
-       <target name="deploy.jboss" depends="package.mvn, install.cockpit.plugin" description="Copies the cockit plugin to the deployment directory defined in '${basedir}/build.properties' or '${user.home}/.camunda/build.properties'" />
-
-       <target name="deploy.tomcat" depends="package.mvn" description="Copies the cockpit plugin to the deployment directory defined in '${basedir}/build.properties' or '${user.home}/.camunda/build.properties'">
-               <fail unless="deploy.tomcat.dir" message="No deployment folder has been configured. Please copy the file '${basedir}/build.properties.example' to '${basedir}/build.properties' or '${user.home}/.camunda/build.properties' and change it according to your environment." />
-               <copy file="${target.dir}/${ant.project.name}.jar" todir="${deploy.tomcat.dir}/camunda/WEB-INF/lib" />
-               <touch file="${deploy.tomcat.dir}/camunda/WEB-INF/web.xml"/>
-       </target>
-
-       <target name="package.mvn">
-               <exec executable="${mvn.executable}" dir="." failonerror="true">
-                       <env key="MAVEN_OPTS" value="-Xmx1024m -Xms512m -DskipTests=true -Dmaven.test.skip=true" />
-                       <arg line="clean package" />
-               </exec>
-       </target>
-
-       <target name="install.cockpit.plugin">
-               <fail unless="deploy.jboss.dir" message="No deployment folder has been configured. Please copy the file '${basedir}/build.properties.example' to '${basedir}/build.properties' or '${user.home}/.camunda/build.properties' and change it according to your environment." />
-               <path id="cockpit.file.id"> 
-                       <fileset dir="${deploy.jboss.dir}"> 
-                               <include name="camunda-webapp-*.war"/> 
-                       </fileset> 
-               </path> 
-               <property name="cockpit.file" refid="cockpit.file.id"/> 
-               <war destfile="${cockpit.file}" update="true">
-                       <zipfileset file="${target.dir}/${ant.project.name}.jar" fullpath="WEB-INF/lib/${ant.project.name}.jar" />
-               </war>
-       </target>
-
-       <target name="undeploy.jboss" description="Deletes the cockpit plugin from the deployment directory defined in '${basedir}/build.properties' or '${user.home}/.camunda/build.properties'">
-               <path id="cockpit.file.id"> 
-                       <fileset dir="${deploy.jboss.dir}"> 
-                               <include name="camunda-webapp-*.war"/> 
-                       </fileset> 
-               </path> 
-               <property name="cockpit.file" refid="cockpit.file.id"/>
-               <basename property="cockpit.filename" file="${cockpit.file}"/>
-               <move file="${cockpit.file}" todir="${java.io.tmpdir}"/>
-               <zip destfile="${cockpit.file}">
-                       <zipfileset src="${java.io.tmpdir}/${cockpit.filename}">
-                               <exclude name="WEB-INF/lib/${ant.project.name}.jar"/>
-                       </zipfileset>
-               </zip>
-       </target>
-
-       <target name="undeploy.tomcat" description="Deletes the cockpit plugin from the deployment directory defined in '${basedir}/build.properties' or '${user.home}/.camunda/build.properties'">
-               <delete file="${deploy.tomcat.dir}/camunda/WEB-INF/lib/${ant.project.name}.jar" />
-       </target>
-
-</project>
diff --git a/bpmn/MSOURN-plugin/pom.xml b/bpmn/MSOURN-plugin/pom.xml
deleted file mode 100644 (file)
index 40dcd1f..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
-       <modelVersion>4.0.0</modelVersion>\r
-\r
-       <parent>\r
-               <groupId>org.openecomp.so</groupId>\r
-               <artifactId>bpmn</artifactId>\r
-               <version>1.1.0-SNAPSHOT</version>\r
-       </parent>\r
-\r
-       <groupId>org.openecomp.so</groupId>\r
-       <artifactId>cockpit-urnmap-plugin</artifactId>\r
-\r
-       <packaging>jar</packaging>\r
-\r
-       <name>MSO URN Mapping Cockpit Plugin</name>\r
-\r
-       <dependencies>\r
-               <dependency>\r
-                   <groupId>org.camunda.bpm.webapp</groupId>\r
-            <artifactId>camunda-webapp</artifactId>\r
-            <classifier>classes</classifier>\r
-            <version>${camunda.version}</version>\r
-                       <exclusions>\r
-                               <exclusion>\r
-                                       <groupId>commons-fileupload</groupId>\r
-                                       <artifactId>commons-fileupload</artifactId>\r
-                               </exclusion>\r
-                       </exclusions>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>commons-fileupload</groupId>\r
-                       <artifactId>commons-fileupload</artifactId>\r
-                       <version>1.3.2</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>javax.ws.rs</groupId>\r
-                       <artifactId>javax.ws.rs-api</artifactId>\r
-                       <version>2.0</version>\r
-               </dependency>\r
-               <!--  TODO Upate it to ee version -->\r
-               <dependency>\r
-                       <groupId>org.camunda.bpm</groupId>\r
-                       <artifactId>camunda-engine</artifactId>\r
-                       <version>${camunda.version}</version>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>com.h2database</groupId>\r
-                       <artifactId>h2</artifactId>\r
-                       <scope>test</scope>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>javax.servlet</groupId>\r
-                       <artifactId>javax.servlet-api</artifactId>\r
-                       <version>3.0.1</version>\r
-                       <scope>provided</scope>\r
-               </dependency>\r
-               <dependency>\r
-                       <groupId>org.openecomp.so</groupId>\r
-                       <artifactId>common</artifactId>\r
-                       <version>${project.version}</version>\r
-                       <scope>compile</scope>\r
-               </dependency>\r
-       </dependencies>\r
-</project>\r
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java
deleted file mode 100644 (file)
index 4f6ead0..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.camunda.bpmn.plugin.urnmap;\r
-\r
-import java.util.Arrays;\r
-import java.util.HashSet;\r
-import java.util.List;\r
-import java.util.Set;\r
-\r
-import org.camunda.bpm.cockpit.plugin.spi.impl.AbstractCockpitPlugin;\r
-import org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource;\r
-\r
\r
-\r
-public class URNMapPlugin  extends AbstractCockpitPlugin{\r
-       public static final String ID = "urnMap-plugin";\r
-         \r
-         @Override\r
-         public String getId() {\r
-           return ID;\r
-         }\r
-\r
-         @Override\r
-         public Set<Class<?>> getResourceClasses() {\r
-           Set<Class<?>> classes = new HashSet<>();\r
-\r
-           classes.add(URNMapPluginRootResource.class);\r
-\r
-           return classes;\r
-         }\r
-\r
-         @Override\r
-         public List<String> getMappingFiles() {\r
-                 return Arrays.asList("org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml");\r
-         }\r
-}\r
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java
deleted file mode 100644 (file)
index 60d6566..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.camunda.bpmn.plugin.urnmap.db;\r
-\r
-import org.camunda.bpm.engine.ProcessEngineConfiguration;\r
-import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;\r
-import org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration;\r
-import org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor;\r
-import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;\r
-import org.camunda.bpm.engine.impl.interceptor.LogInterceptor;\r
-import org.camunda.bpm.engine.impl.util.ReflectUtil;\r
-\r
-import java.io.InputStream;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-public class MyBatisExtendedSessionFactory extends StandaloneProcessEngineConfiguration {\r
-\r
-  private String resourceName;\r
-\r
-  @Override\r
-  protected void init() {\r
-    throw new IllegalArgumentException(\r
-            "Normal 'init' on process engine only used for extended MyBatis mappings is not allowed, please use 'initFromProcessEngineConfiguration'. You cannot construct a process engine with this configuration.");\r
-  }\r
-\r
-  /**\r
-   * initialize the {@link ProcessEngineConfiguration} from an existing one,\r
-   * just using the database settings and initialize the database / MyBatis\r
-   * stuff.\r
-   */\r
-  public void initFromProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration, String resourceName) {\r
-    this.resourceName = resourceName;\r
-\r
-    setDatabaseType(processEngineConfiguration.getDatabaseType());\r
-    setDataSource(processEngineConfiguration.getDataSource());\r
-    setDatabaseTablePrefix(processEngineConfiguration.getDatabaseTablePrefix());\r
-\r
-    initDataSource();\r
-    initCommandContextFactory();\r
-    initTransactionFactory();\r
-    initTransactionContextFactory();\r
-    initCommandExecutors();\r
-    initSqlSessionFactory();\r
-    initIncidentHandlers();\r
-    initIdentityProviderSessionFactory();\r
-    initSessionFactories();\r
-  }\r
-\r
-  /**\r
-   * In order to always open a new command context set the property\r
-   * "alwaysOpenNew" to true inside the CommandContextInterceptor.\r
-   *\r
-   * If you execute the custom queries inside the process engine\r
-   * (for example in a service task), you have to do this.\r
-   */\r
-  @Override\r
-  protected Collection<? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequired() {\r
-    List<CommandInterceptor> defaultCommandInterceptorsTxRequired = new ArrayList<>();\r
-    defaultCommandInterceptorsTxRequired.add(new LogInterceptor());\r
-    defaultCommandInterceptorsTxRequired.add(new CommandContextInterceptor(commandContextFactory, this, true));\r
-    return defaultCommandInterceptorsTxRequired;\r
-  }\r
-\r
-  @Override\r
-  protected InputStream getMyBatisXmlConfigurationSteam() {\r
-    return ReflectUtil.getResourceAsStream(resourceName);\r
-  }\r
-\r
-}\r
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java
deleted file mode 100644 (file)
index f81d8c6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.camunda.bpmn.plugin.urnmap.db;\r
-\r
-import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;\r
-import org.camunda.bpm.engine.impl.interceptor.Command;\r
-\r
-/**\r
- * Helper to initialize a minimized process engine which does all the transaction and MyBatis mapping stuff for us\r
- * and can be used to execute queries.\r
- */\r
-public class MyBatisQueryCommandExecutor {\r
-  \r
-  private MyBatisExtendedSessionFactory myBatisExtendedSessionFactory;\r
-\r
-  public MyBatisQueryCommandExecutor(ProcessEngineConfigurationImpl processEngineConfiguration, String mappingResourceName) {\r
-    myBatisExtendedSessionFactory = new MyBatisExtendedSessionFactory();\r
-    myBatisExtendedSessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration, mappingResourceName);\r
-  }\r
-  \r
-  public <T> T executeQueryCommand(Command<T> command) {\r
-       return myBatisExtendedSessionFactory.getCommandExecutorTxRequired().execute(command);\r
-  }\r
-  \r
-  \r
-}\r
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java
deleted file mode 100644 (file)
index 1eb0ba6..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.camunda.bpmn.plugin.urnmap.db;\r
-\r
-import java.util.List;\r
-\r
-import org.camunda.bpm.engine.ProcessEngines;\r
-import org.camunda.bpm.engine.impl.ProcessEngineImpl;\r
-import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;\r
-import org.camunda.bpm.engine.impl.interceptor.Command;\r
-import org.camunda.bpm.engine.impl.interceptor.CommandContext;\r
-\r
-public class URNService {\r
-\r
-\r
-  public List<URNData> getProperties() {\r
-    ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();\r
-    ProcessEngineConfigurationImpl processEngineConfiguration = processEngine.getProcessEngineConfiguration();\r
-\r
-    MyBatisQueryCommandExecutor commandExecutor = new MyBatisQueryCommandExecutor(processEngineConfiguration, "mappings.xml");\r
-    return commandExecutor.executeQueryCommand(new Command<List<URNData>>() {\r
-\r
-      @SuppressWarnings("unchecked")\r
-      @Override\r
-      public List<URNData> execute(CommandContext commandContext) {\r
-        return (List<URNData>) commandContext.getDbSqlSession().selectList("retrieveUrnKeyValuePair", null);\r
-      }\r
-    });\r
-  }\r
-\r
-}\r
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java
deleted file mode 100644 (file)
index 5cf6f6c..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.camunda.bpmn.plugin.urnmap.resources;\r
-\r
-import java.util.List;\r
-import java.util.StringTokenizer;\r
-\r
-import javax.ws.rs.GET;\r
-import javax.ws.rs.POST;\r
-import javax.ws.rs.PUT;\r
-\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import org.camunda.bpm.cockpit.db.QueryParameters;\r
-import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource;\r
-import org.camunda.bpm.cockpit.db.CommandExecutor;\r
-import org.openecomp.camunda.bpmn.plugin.urnmap.db.*;\r
-\r
-public class ProcessInstanceResource extends AbstractPluginResource {\r
-\r
-  private static final Logger log = LoggerFactory.getLogger(ProcessInstanceResource.class);\r
-\r
-  public ProcessInstanceResource(String engineName) {\r
-    super(engineName);\r
-  }\r
-\r
-  @GET\r
-  public List<URNData> getUrnDataMap() {    \r
-    List<URNData> list = getQueryService()\r
-            .executeQuery(\r
-                    "cockpit.urnMap.retrieveUrnKeyValuePair",\r
-                    new QueryParameters<URNData>());\r
-    \r
-    log.info("urnmap-plugin project - Results Retrieved: ");\r
-    log.info("URNName: " + "           " + "URNValue: " );\r
-    for(URNData d: list)\r
-    {\r
-       log.info(  d.getURNName() + "           "  + d.getURNValue());\r
-    }\r
-   \r
-    return list;\r
-  }\r
-  \r
-  @PUT\r
-  //public void insertNewRow(String key_, String value_) \r
-  public void insertNewRow(String temp) \r
-   {  \r
-        log.info("AddNewRow: XXXXXXXXXXXXXXXXX ---> " + temp);\r
-        StringTokenizer st = new StringTokenizer(temp, "|");\r
-        String key_ = "";\r
-        String value_ = "";\r
-        \r
-        while(st.hasMoreTokens()) { \r
-                 key_ = st.nextToken(); \r
-                 value_ = st.nextToken(); \r
-                System.out.println(key_ + "\t" + value_); \r
-                } \r
-                        \r
-         log.info("AddNewRow: XXXXXXXXXXXXXXXXX ---> key: " + key_ + " , Value: " + value_);\r
-         URNData nRow = new URNData();\r
-         nRow.setVer_("1");     \r
-         nRow.setURNName(key_);\r
-         nRow.setURNValue(value_);\r
-         \r
-        getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class);\r
-        \r
-        log.info("AddNewRow: XXXXXX    END   XXXXXXXXXXX");\r
-   }\r
-  \r
-  @POST\r
- // public void getPersistData(List<URNData > myList) {  \r
-  public void getPersistData(URNData d) {  \r
-         \r
-         log.info("getPersistData:  UrnName: " + d.getURNName() + " , URNValue: " + d.getURNValue() );\r
-           \r
-               getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class);\r
-               //getQueryService().executeQuery("cockpit.sample.persistURNData", d, ProcessInstanceCountDto.class);\r
-            \r
-                   \r
-           log.info("XXXXXXXXXX - END - XXXXXXXXXXXXXXX");\r
-       }\r
-}\r
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java
deleted file mode 100644 (file)
index 938b9d3..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.camunda.bpmn.plugin.urnmap.resources;\r
-/***\r
-import java.beans.Statement;\r
-import java.sql.DriverManager;\r
-import java.sql.ResultSet;\r
-import java.sql.SQLException;\r
-*/\r
-import java.sql.Connection;\r
-import java.sql.PreparedStatement;\r
-import java.sql.ResultSet;\r
-import java.sql.SQLException;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.StringTokenizer;\r
-\r
-import javax.naming.Context;\r
-import javax.naming.InitialContext;\r
-import javax.sql.DataSource;\r
-import javax.ws.rs.GET;\r
-import javax.ws.rs.POST;\r
-import javax.ws.rs.PUT;\r
-\r
-import org.camunda.bpm.cockpit.db.QueryParameters;\r
-import org.camunda.bpm.cockpit.plugin.resource.AbstractCockpitPluginResource;\r
-\r
-\r
-//import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource;\r
-import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData;\r
-import org.openecomp.mso.logger.MsoLogger;\r
-\r
-\r
-//public class ProcessInstanceResource extends AbstractPluginResource {\r
-public class URNResource extends AbstractCockpitPluginResource{\r
-  public URNResource(String engineName) {\r
-    super(engineName);\r
-  }\r
-  \r
-  private Connection conn;\r
-  private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);\r
-  @GET\r
-  public List<URNData> getUrnDataMap() \r
-  {  \r
-         List<URNData> list = new ArrayList();\r
-         PreparedStatement psData = null;\r
-         try {\r
-                       \r
-                   conn = getDBConnection();\r
-                       psData = conn\r
-                                               .prepareStatement("select * from MSO_URN_MAPPING order by NAME_");\r
-                           \r
-                           ResultSet r = psData.executeQuery();\r
-                           \r
-                               while(r.next()) \r
-                               {\r
-                                       URNData d = new URNData();\r
-                                       d.setURNName(r.getString("NAME_"));\r
-                                       d.setURNValue(r.getString("VALUE_"));\r
-                                       d.setVer_( r.getString("REV_"));\r
-                                       \r
-                                       list.add(d);                                    \r
-                               }\r
-                               \r
-               } catch (Exception e) \r
-               {\r
-                       msoLogger.debug("Exception in getUrnDataMap ", e);                      \r
-               } finally {\r
-                       if(psData != null){\r
-                               try {\r
-                                       psData.close();\r
-                                       conn.close();\r
-                               } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the PreparedStatement: ", e);\r
-                               }\r
-                       }\r
-                       if(conn != null){\r
-                               try {\r
-                                       conn.close();\r
-                               } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the connection: ", e);\r
-                               }\r
-                       }\r
-               }\r
-     \r
-    for(URNData d: list)\r
-    {\r
-       msoLogger.debug(  d.getURNName() + "            "  + d.getURNValue());\r
-       //msoLogger.debug("Started Executing " + getTaskName());\r
-       msoLogger.debug("Started Executing " + d.getURNName() + " " + d.getURNValue());\r
-    }\r
-   \r
-    return list;\r
-  }\r
-  \r
-  public List<URNData> getUrnDataMapOLD() \r
-  {  \r
-         \r
-    List<URNData> list = getQueryService()\r
-            .executeQuery("cockpit.urnMap.retrieveUrnKeyValuePair", new QueryParameters<URNData>());\r
-    \r
-    msoLogger.debug("urnmap-plugin project - Results Retrieved: ");\r
-    msoLogger.debug("URNName: " + "            " + "URNValue: " );\r
-    \r
-    for(URNData d: list)\r
-    {\r
-       msoLogger.debug( d.getURNName() + "             "  + d.getURNValue());\r
-    }\r
-   \r
-    return list;\r
-  }\r
-  \r
-  public Connection getDBConnection()\r
-  {\r
-         try {\r
-                       \r
-                       if(conn == null)\r
-                       {\r
-                               Context ctx = new InitialContext();\r
-                           DataSource ds = (DataSource)ctx.lookup("java:jboss/datasources/ProcessEngine");//jboss\r
-                       conn =                  ds.getConnection();\r
-        \r
-                       }                        \r
-                       \r
-               } catch (Exception e) \r
-               {\r
-                       msoLogger.debug("Exception in DBConnection ", e);\r
-               }\r
-         \r
-         return conn;\r
-  }\r
-  \r
-  @PUT\r
-  public void insertNewRow(String temp) \r
-   {  \r
-        msoLogger.debug("AddNewRow: XXXXXXXXXXXXXXXXX ---> " + temp);\r
-        msoLogger.debug("AddNewRow: EngineName  ---> " + engineName);\r
-        \r
-        StringTokenizer st = new StringTokenizer(temp, "|");\r
-        String key_ = "";\r
-        String value_ = "";\r
-        \r
-        while(st.hasMoreTokens()) { \r
-                 key_ = st.nextToken(); \r
-                 value_ = st.nextToken(); \r
-                msoLogger.debug(key_ + "\t" + value_); \r
-                } \r
-                        \r
-       msoLogger.debug("AddNewRow: XXXXXXXXXXXXXXXXX ---> key: " + key_ + " , Value: " + value_);\r
-         final URNData nRow = new URNData();\r
-         nRow.setVer_("1");\r
-         PreparedStatement psData = null;\r
-         \r
-               msoLogger.debug("----------- START ----------------------");\r
-               try {\r
-                       \r
-                   conn = getDBConnection();\r
-                       psData = conn\r
-                                               .prepareStatement("Insert into MSO_URN_MAPPING values ('" + key_ + "', '" + value_  + "', '1')");\r
-                           \r
-                           psData.executeUpdate();              \r
-                       \r
-               } catch (Exception e) \r
-               {\r
-                       msoLogger.debug("Exception in insertNewRow ", e);\r
-               }finally {\r
-                       if(psData != null){\r
-                               try {\r
-                                       psData.close();\r
-                                       conn.close();\r
-                               } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the PreparedStatement: ", e);\r
-                               }\r
-                       }\r
-                       if(conn != null){\r
-                               try {\r
-                                       conn.close();\r
-                               } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the connection: ", e);\r
-                               }\r
-                       }\r
-               }\r
-       // getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class);\r
-   }\r
-  \r
-  @POST\r
-  public void getPersistData(URNData d) {  \r
-         \r
-               //getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class);\r
-           PreparedStatement psData = null;\r
-         try {\r
-                       \r
-                   conn = getDBConnection();\r
-                       psData = conn\r
-                                               .prepareStatement("UPDATE MSO_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'");\r
-                           \r
-                           psData.executeUpdate();\r
-                          \r
-               } catch (Exception e) \r
-               {\r
-                       msoLogger.debug("Exception in PersistData ", e);\r
-               }finally {\r
-                       if(psData != null){\r
-                               try {\r
-                                       psData.close();\r
-                                       conn.close();\r
-                               } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the PreparedStatement: ", e);\r
-                               }\r
-                       }\r
-                       if(conn != null){\r
-                               try {\r
-                                       conn.close();\r
-                               } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the connection: ", e);\r
-                               }\r
-                       }\r
-               }\r
-        \r
-       }\r
-}\r
diff --git a/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin b/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin
deleted file mode 100644 (file)
index 9a5055a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-org.openecomp.camunda.bpm.plugin.urnmap.URNMapPlugin
\ No newline at end of file
diff --git a/bpmn/MSOURN-plugin/src/main/resources/mappings.xml b/bpmn/MSOURN-plugin/src/main/resources/mappings.xml
deleted file mode 100644 (file)
index c66704e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-  ============LICENSE_START=======================================================\r
-  ECOMP MSO\r
-  ================================================================================\r
-  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
-  ================================================================================\r
-  Licensed under the Apache License, Version 2.0 (the "License");\r
-  you may not use this file except in compliance with the License.\r
-  You may obtain a copy of the License at\r
-  \r
-       http://www.apache.org/licenses/LICENSE-2.0\r
-  \r
-  Unless required by applicable law or agreed to in writing, software\r
-  distributed under the License is distributed on an "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-  See the License for the specific language governing permissions and\r
-  limitations under the License.\r
-  ============LICENSE_END=========================================================\r
-  -->\r
-\r
-\r
-<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">\r
-\r
-<configuration>\r
-       <settings>\r
-               <setting name="lazyLoadingEnabled" value="false" />\r
-       </settings>\r
-       <mappers>\r
-        <mapper resource="org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml" />\r
-       </mappers>\r
-</configuration>\r
diff --git a/bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml b/bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml
deleted file mode 100644 (file)
index d0b5861..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  ============LICENSE_START=======================================================
-  ECOMP MSO
-  ================================================================================
-  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=========================================================
-  -->
-
-
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="cockpit.urnMap">
-  <resultMap id="urnDataMap" type="org.openecomp.camunda.bpm.plugin.urnmap.db.URNData">
-    <result property="URNName" column="URNNAME" jdbcType="VARCHAR"/>
-    <result property="URNValue" column="URNVALUE" jdbcType="VARCHAR" />
-  </resultMap>
-
-  <select id="retrieveUrnKeyValuePair" resultMap="urnDataMap">
-    select NAME_ URNName, VALUE_ URNValue from MSO_URN_MAPPING
-  </select>
-
-
-  <!-- INSERT cockpit.InsertURNData  keyProperty="NAME_" -->
-  <resultMap id="insertNewRow" type="org.openecomp.camunda.bpm.plugin.urnmap.db.URNData">
-    <result property="URNName"           column="NAME_"        jdbcType="VARCHAR" />
-    <result property="URNValue"   column="VALUE_"   jdbcType="VARCHAR" />
-    <result property="1"             column="REV_"     jdbcType="INTEGER"/>
-  </resultMap>
-  
-       <insert id="insertNewRow" parameterType="org.openecomp.camunda.bpm.plugin.urnmap.db.URNData">
-           insert into MSO_URN_MAPPING (NAME_, VALUE_, REV_) 
-           values (
-                               #{URNName}, #{URNValue}, 1
-                 )
-       </insert>
-       
-<!-- UPDATE cockpit.InsertURNData -->
-  <resultMap id="saveURNMappingDataMap" type="org.openecomp.camunda.bpm.plugin.urnmap.db.URNData">
-    <result property="URNName"         column="NAME_"  jdbcType="VARCHAR" />
-    <result property="URNValue"   column="VALUE_" jdbcType="VARCHAR" />
-    <result property="1"           column="REV_"       jdbcType="INTEGER"/>
-  </resultMap>
-  
-  <update id="persistURNData">
-  update  MSO_URN_MAPPING set
-    NAME_ = #{URNName},
-    VALUE_ = #{URNValue},
-    REV_ = 1
-    where NAME_=#{URNName}
-</update>
-</mapper>
diff --git a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/dashboard.html b/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/dashboard.html
deleted file mode 100644 (file)
index cc794e5..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-  ECOMP MSO
-  ================================================================================
-  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=========================================================
-  -->
-
-<div class="form-group container">  
-       <form novalidate="novalidate" class="simple-form" name="urnMapper">               
-               <div class="panel panel-default">  
-                       <div class="panel-heading" style="padding:3px;background:#871020 !important;color:#fff"> <h3 style="margin:1px" class="heading">Process Engine - URN Mapping</h3></div>
-                       <div class="panel-body">
-                               <div class="well">
-                                       <div class="input-group well" style="padding:5px">                                      
-                                               <input id="new_key" class="form-control input-md"  placeholder="New URN Key"   size="25" type="text"  name="URNName"  value="" ng-blur="enableAddRowBtn()">
-                                               <span class="input-group-btn" style="width:0px;"></span>
-                                               <input type="text" class="form-control input-md" size="55" style="margin-left:-1px" id="new_value" placeholder="New URN Value"  name="URNValue" />
-                                               <span class="input-group-btn" style="width:0px;"></span>                                
-                                               <span class="input-group-btn">
-                                                       <button class="btn btn-primary" type="button" id="addRow_BTN" data-ng-click="addNewRow(); setTimeout( retrieveData(), 1000);" disabled data-original-title="" title="">Add!</button>
-                                               </span>
-                                       </div>
-                                       <div>
-                                         <table cellpadding="0" cellspacing="0" class="table responsive" widht="100%">
-                                               <tbody>        
-                                                 <tr data-ng-repeat="urnData in UrnDataMap">       
-                                                        <td>
-                                                               <div class="input-group">
-                                                                 <input id="{{ urnData.urnname }}_key" type="text"  style="border:0px solid #bfbfbf" size="25" class="form-control input-md" ng-blur="SaveRow( urnData )" value="{{ urnData.urnName }}" data-ng-model= "urnData.urnname" data-ng-change="enableButton(urnData)"/>
-                                                                 <span class="input-group-btn" style="width:0px;"></span>
-                                                                 <input id="{{ urnData.urnname }}_value" type="text" style="border:0px solid #dfdfdf;border-left:1px solid #bfbfbf" size="55" class="form-control input-md" ng-blur="SaveRow( urnData )" value="{{ urnData.urnvalue }}" data-ng-model="urnData.urnvalue" data-ng-change="enableButton(urnData)"/>
-                                                                 <span class="input-group-btn">
-                                                                       <button disabled="true" class="btn btn-primary" type="button" id="btn_{{ urnData.urnname }}_key" data-ng-click="SaveRow( urnData ); setTimeout( retrieveData(), 1000);">
-                                                                               <span class="glyphicon glyphicon-floppy-disk"></span>
-                                                                       </button>
-                                                                 </span>
-                                                               </div><!-- /input-group -->
-                                                        </td>      
-                                                        <!-- 
-                                                       <td><button id="btn_{{ urnData.urnname }}_key" data-ng-click="SaveRow( urnData )" disabled>SaveRecord</button> </td>
-                                                        -->
-                                                 </tr>       
-                                               </tbody>
-                                         </table>      
-                                       </div>
-                               </div>
-                       </div>
-               </div>
-       </form>
-</div>
diff --git a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/plugin.js b/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/app/plugin.js
deleted file mode 100644 (file)
index 702f6cd..0000000
+++ /dev/null
@@ -1,132 +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=========================================================
- */
-
-define(['angular'], function(angular) {
-
-  var DashboardController = ["$scope", "$http", "Uri", function($scope, $http, Uri) {
-
-    $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"))
-      .success(function(data) {
-        $scope.UrnDataMap = data;
-      });
-    //enable saveRow button
-    $scope.enableButton=function(urnData)
-    {
-               document.getElementById("btn_" + urnData.urnname + "_key").disabled = false;
-    };
-    
-    $scope.enableAddRowBtn=function()
-    {
-       if(document.getElementById("new_key").value.trim().length >0)
-                document.getElementById("addRow_BTN").disabled = false;
-       else
-               document.getElementById("addRow_BTN").disabled = true;
-    };
-    
-    
-    $scope.addNewRow = function() 
-    {
-       var newKey = document.getElementById("new_key").value.trim();
-       var newValue = document.getElementById("new_value").value.trim();
-       var x;
-       
-       for (var i=0;i<$scope.UrnDataMap.length;i++)
-       {
-               var n = $scope.UrnDataMap[i].urnname.localeCompare(newKey);
-               if(n == 0){
-                       x = "match";
-               }
-       }
-       
-       if(Boolean(x))
-       {
-               alert("URN Name already exists, please check the KEY!");
-       }
-       else
-       {
-               if(newKey.length >0 )
-               {
-
-                       var temp = newKey + "|" + newValue;
-               
-                       $http.put(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"), temp);
-         
-                document.getElementById("new_key").value = "";
-                document.getElementById("new_value").value = "";
-
-               }
-               
-       }
-       //this.enableAddRowBtn;
-       document.getElementById("addRow_BTN").disabled = true;
-       
-     $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"))
-        .success(function(data) {
-          $scope.UrnDataMap = data;
-        });
-        
-        
-      }
-    
-    $scope.retrieveData = function() {
-       
-        $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"))
-         .success(function(data) {
-           $scope.UrnDataMap = data;
-         });
-    }
-    
-     $scope.SaveRow = function(user) 
-    {          
-        $http.post(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"), user);
-                   
-       document.getElementById("btn_" + user.urnname + "_key").disabled = true;
-        document.getElementById(user.urnname + "_status").style.display = "";
-        this.enableAddRowBtn;
-        
-        $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"))
-        .success(function(data) {
-          $scope.UrnDataMap = data;
-        });
-        
-        };
-  }];
-
-  var Configuration = ['ViewsProvider', function(ViewsProvider) {
-
-    ViewsProvider.registerDefaultView('cockpit.dashboard', {
-      id: 'process-definitions',
-      label: 'Deployed Processes',
-      url: 'plugin://urnMap-plugin/static/app/dashboard.html',
-      controller: DashboardController,
-       // make sure we have a higher priority than the default plugin
-      priority: 12
-    });
-  }];
-//START
-//END
-  
-  var ngModule = angular.module('cockpit.plugin.urnMap-plugin', []);
-
-  ngModule.config(Configuration);
-
-  return ngModule;
-});
diff --git a/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/info.txt b/bpmn/MSOURN-plugin/src/main/resources/plugin-webapp/urnMap-plugin/info.txt
deleted file mode 100644 (file)
index 09b6262..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# Client side assets of the urnMap-plugin
\ No newline at end of file
index b878467..4f96cc1 100644 (file)
 
   <modules>
     <module>MSOCoreBPMN</module>
-    <!--<module>MSOMockServer</module> -->
+    <module>MSOMockServer</module>
     <module>MSORESTClient</module>
     <module>MSOCommonBPMN</module>
     <module>MSOInfrastructureBPMN</module>
-    <module>MSOURN-plugin</module>
     <module>MSOCockpit</module>
   </modules>
 
index 19115ce..86aedc1 100644 (file)
@@ -135,7 +135,7 @@ public class MsoLogger {
         }
     };
 
-    private EELFLogger          debugLogger, errorLogger, auditLogger, metricsLogger;
+    private EELFLogger          logger, auditLogger, metricsLogger;
     private static final String CONFIG_FILE = System.getProperty("jboss.home.dir") + "/mso-config/uuid/uuid_"
             + System.getProperty("jboss.server.name");
     private static String       instanceUUID, serverIP, serverName;
@@ -145,8 +145,7 @@ public class MsoLogger {
     private static final Logger LOGGER      = Logger.getLogger(MsoLogger.class.getName());
 
     private MsoLogger(MsoLogger.Catalog cat) {
-       this.debugLogger = EELFManager.getInstance().getDebugLogger();
-       this.errorLogger = EELFManager.getInstance().getErrorLogger();
+        this.logger = EELFManager.getInstance().getErrorLogger();
         this.auditLogger = EELFManager.getInstance().getAuditLogger();
         this.metricsLogger = EELFManager.getInstance().getMetricsLogger();
         MsoLogger.initialization();
@@ -238,7 +237,7 @@ public class MsoLogger {
      */
     public void debug(String msg) {
         prepareMsg(DEBUG_LEVEL);
-        debugLogger.debug(msg);
+        logger.debug(msg);
     }
 
     /**
@@ -251,7 +250,7 @@ public class MsoLogger {
      */
     public void debug(String msg, Throwable t) {
         prepareMsg(DEBUG_LEVEL);
-        debugLogger.debug(msg, t);
+        logger.debug(msg, t);
     }
 
     // Info methods
@@ -264,7 +263,7 @@ public class MsoLogger {
     public void info(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName) {
         prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
 
-        debugLogger.info(msg);
+        logger.info(msg);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -280,7 +279,7 @@ public class MsoLogger {
     public void info(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName) {
         prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
 
-        debugLogger.info(msg, normalize(arg0));
+        logger.info(msg, normalize(arg0));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -297,7 +296,7 @@ public class MsoLogger {
             String targetServiceName) {
         prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
 
-        debugLogger.info(msg, normalize(arg0), normalize(arg1));
+        logger.info(msg, normalize(arg0), normalize(arg1));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -314,7 +313,7 @@ public class MsoLogger {
             String targetServiceName) {
         prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
 
-        debugLogger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+        logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -331,7 +330,7 @@ public class MsoLogger {
             String targetEntity, String targetServiceName) {
         prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
 
-        debugLogger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
+        logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -348,7 +347,7 @@ public class MsoLogger {
             String targetEntity, String targetServiceName) {
         prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
 
-        debugLogger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
+        logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -365,7 +364,7 @@ public class MsoLogger {
             String arg5, String targetEntity, String targetServiceName) {
         prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
 
-        debugLogger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4),
+        logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4),
                 normalize(arg5));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
@@ -382,7 +381,7 @@ public class MsoLogger {
             String errorDesc) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
 
-        errorLogger.warn(msg);
+        logger.warn(msg);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -398,9 +397,9 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
             String errorDesc, Throwable t) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg);
-        errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.warn(msg);
+        logger.warn("Exception raised: " + getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -416,7 +415,7 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg, String targetEntity, String targetServiceName,
             ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, arg);
+        logger.warn(msg, arg);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -434,9 +433,9 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg, String targetEntity, String targetServiceName,
             ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, arg);
-        errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.warn(msg, arg);
+        logger.warn("Exception raised: " + getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -452,7 +451,7 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
             String targetServiceName, ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, normalize(arg0), normalize(arg1));
+        logger.warn(msg, normalize(arg0), normalize(arg1));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -470,9 +469,9 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
             String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, normalize(arg0), normalize(arg1));
-        errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.warn(msg, normalize(arg0), normalize(arg1));
+        logger.warn("Exception raised: " + getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -488,7 +487,7 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
             String targetServiceName, ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+        logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -506,9 +505,9 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
             String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
-        errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+        logger.warn("Exception raised: " + getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -524,7 +523,7 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
             String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
+        logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -542,9 +541,9 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
             String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
-        errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
+        logger.warn("Exception raised: " + getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -560,7 +559,7 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
             String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
+        logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -578,9 +577,9 @@ public class MsoLogger {
     public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
             String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
-        errorLogger.warn("Exception raised: " + getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
+        logger.warn("Exception raised: " + getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -595,7 +594,7 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
             String errorDesc) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg);
+        logger.error(msg);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -611,9 +610,9 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
             String errorDesc, Throwable t) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg);
-        errorLogger.error(exceptionArg, getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.error(msg);
+        logger.error(exceptionArg, getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -629,7 +628,7 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName,
             ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0));
+        logger.error(msg, normalize(arg0));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -647,9 +646,9 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName,
             ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0));
-        errorLogger.error(exceptionArg, getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.error(msg, normalize(arg0));
+        logger.error(exceptionArg, getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -665,7 +664,7 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
             String targetServiceName, ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0), normalize(arg1));
+        logger.error(msg, normalize(arg0), normalize(arg1));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -683,9 +682,9 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
             String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0), normalize(arg1));
-        errorLogger.error(exceptionArg, getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.error(msg, normalize(arg0), normalize(arg1));
+        logger.error(exceptionArg, getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -701,7 +700,7 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
             String targetServiceName, ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+        logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -719,9 +718,9 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
             String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2));
-        errorLogger.error(exceptionArg, getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+        logger.error(exceptionArg, getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -737,7 +736,7 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
             String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
+        logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -755,9 +754,9 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
             String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
-        errorLogger.error(exceptionArg, getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
+        logger.error(exceptionArg, getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -773,7 +772,7 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
             String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
+        logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
@@ -791,15 +790,15 @@ public class MsoLogger {
     public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
             String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
         prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-        errorLogger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
-        errorLogger.error(exceptionArg, getNormalizedStackTrace(t));
-        debugLogger.debug("Exception raised", t);
+        logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
+        logger.error(exceptionArg, getNormalizedStackTrace(t));
+        logger.debug("Exception raised", t);
         MDC.remove(TARGETENTITY);
         MDC.remove(TARGETSERVICENAME);
     }
 
     public boolean isDebugEnabled() {
-        return debugLogger.isDebugEnabled();
+        return logger.isDebugEnabled();
     }
 
     private void prepareMsg(String loggingLevel) {
index 3e29a82..328ef81 100644 (file)
@@ -23,6 +23,9 @@ package org.openecomp.mso.apihandlerinfra;
 \r
 public class Constants {\r
 \r
+       private Constants() {\r
+       }\r
+\r
        public static final String VNF_TYPES_PATH = "/{version: v1|v2|v3}/vnf-types";\r
        public static final String NETWORK_TYPES_PATH = "/{version: v1|v2|v3}/network-types";\r
        public static final String VF_MODULE_MODEL_NAMES_PATH = "/{version: v2|v3}/vf-module-model-names";\r
@@ -47,4 +50,4 @@ public class Constants {
        public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$";\r
 \r
        public static final String A_LA_CARTE = "aLaCarte";\r
-}
\ No newline at end of file
+}\r
index 2386848..ecd0e4d 100644 (file)
@@ -21,6 +21,7 @@
 package org.openecomp.mso.apihandlerinfra;
 
 import java.io.IOException;
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -39,18 +40,27 @@ import javax.ws.rs.core.Response;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.codehaus.jackson.map.ObjectMapper;
+import org.hibernate.Session;
+import org.json.JSONObject;
 import org.openecomp.mso.apihandler.common.ErrorNumbers;
 import org.openecomp.mso.apihandler.common.RequestClient;
 import org.openecomp.mso.apihandler.common.RequestClientFactory;
 import org.openecomp.mso.apihandler.common.ResponseHandler;
+import org.openecomp.mso.apihandlerinfra.Messages;
+import org.openecomp.mso.apihandlerinfra.MsoException;
+import org.openecomp.mso.apihandlerinfra.MsoRequest;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.DelE2ESvcResp;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
 import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
 import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EUserParam;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
 import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
 import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails;
 import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo;
 import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters;
 import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
 import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.SubscriberInfo;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
 import org.openecomp.mso.db.catalog.CatalogDatabase;
 import org.openecomp.mso.db.catalog.beans.Service;
 import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
@@ -58,446 +68,688 @@ import org.openecomp.mso.logger.MessageEnum;
 import org.openecomp.mso.logger.MsoAlarmLogger;
 import org.openecomp.mso.logger.MsoLogger;
 import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.OperationStatus;
 import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
 import org.openecomp.mso.utils.UUIDChecker;
 
 import com.wordnik.swagger.annotations.Api;
 import com.wordnik.swagger.annotations.ApiOperation;
 
 @Path("/e2eServiceInstances")
-@Api(value="/e2eServiceInstances",description="API Requests for E2E Service Instances")
+@Api(value = "/e2eServiceInstances", description = "API Requests for E2E Service Instances")
 public class E2EServiceInstances {
 
-       private HashMap<String, String> instanceIdMap = new HashMap<String,String>();
-       private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
-       private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
-       public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
-       public E2EServiceInstances() {
-       }
+       private HashMap<String, String> instanceIdMap = new HashMap<>();
+       private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+       private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+       public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+       private ServiceInstancesRequest sir = null;
        
+       public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+       public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB";
+       public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine";
+
        /**
-     *POST Requests for E2E Service create Instance on a version provided
-     */
+        * POST Requests for E2E Service create Instance on a version provided
+        */
 
        @POST
        @Path("/{version:[vV][3-5]}")
        @Consumes(MediaType.APPLICATION_JSON)
        @Produces(MediaType.APPLICATION_JSON)
-       @ApiOperation(value="Create a E2E Service Instance on a version provided",response=Response.class)
+       @ApiOperation(value = "Create a E2E Service Instance on a version provided", response = Response.class)
        public Response createE2EServiceInstance(String request, @PathParam("version") String version) {
 
-        return E2EserviceInstances(request, Action.createInstance,     null, version);
+               return processE2EserviceInstances(request, Action.createInstance, null, version);
        }
 
        /**
-     *DELETE Requests for E2E Service delete Instance on a specified version and serviceId
-     */
-       
+        * DELETE Requests for E2E Service delete Instance on a specified version
+        * and serviceId
+        */
+
        @DELETE
        @Path("/{version:[vV][3-5]}/{serviceId}")
        @Consumes(MediaType.APPLICATION_JSON)
        @Produces(MediaType.APPLICATION_JSON)
-       @ApiOperation(value="Delete E2E Service Instance on a specified version and serviceId",response=Response.class)
-       public Response deleteE2EServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceId") String serviceId) {
+       @ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
+       public Response deleteE2EServiceInstance(String request, @PathParam("version") String version,
+                       @PathParam("serviceId") String serviceId) {
 
-        instanceIdMap.put("serviceId", serviceId);
+               instanceIdMap.put("serviceId", serviceId);
 
-        return E2EserviceInstances(request, Action.deleteInstance, null, version);
+               return deleteE2EserviceInstances(request, Action.deleteInstance, instanceIdMap, version);
        }
        
-       private Response E2EserviceInstances(String requestJSON, Action action,
-        HashMap<String, String> instanceIdMap, String version) {
+       @GET
+       @Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
+       @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class)
+       @Produces(MediaType.APPLICATION_JSON)
+       public Response getE2EServiceInstances(@PathParam("serviceId") String serviceId,
+                       @PathParam("version") String version, @PathParam("operationId") String operationId) {
+               RequestsDatabase requestsDB = RequestsDatabase.getInstance();
+               
+               GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
 
-               String requestId = UUIDChecker.generateUUID(msoLogger);
+               MsoRequest msoRequest = new MsoRequest(serviceId);
+
+               long startTime = System.currentTimeMillis();
+
+               OperationStatus operationStatus = null;
+
+               try {
+                       operationStatus = requestsDB.getOperationStatus(serviceId, operationId);
+
+               } catch (Exception e) {
+                       msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.AvailabilityError,
+                                       "Exception while communciate with Request DB - Infra Request Lookup", e);
+                       msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+                                       MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null);
+                       alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+                                       Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+                                       "Exception while communciate with Request DB");
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+                       return response;
+
+               }
+
+               if (operationStatus == null) {
+                       Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT,
+                                       MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB",
+                                       ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+                       msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.BusinessProcesssError,
+                                       "Null response from RequestDB when searching by serviceId");
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+                                       "Null response from RequestDB when searching by serviceId");
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+                       return resp;
+
+               }
+
+               e2eServiceResponse.setE2eRequest(operationStatus);
+
+               return Response.status(200).entity(e2eServiceResponse).build();
+       }
+
+       private Response deleteE2EserviceInstances(String requestJSON, Action action,
+                       HashMap<String, String> instanceIdMap, String version) {
+               //TODO should be a new one or the same service instance Id
+               String requestId = instanceIdMap.get("serviceId");
                long startTime = System.currentTimeMillis();
                msoLogger.debug("requestId is: " + requestId);
-               E2EServiceInstanceRequest sir = null;
+               E2EServiceInstanceDeleteRequest e2eDelReq = null;
 
                MsoRequest msoRequest = new MsoRequest(requestId);
+               
                ObjectMapper mapper = new ObjectMapper();
                try {
-                       sir = mapper
-                                       .readValue(requestJSON, E2EServiceInstanceRequest.class);
+                       e2eDelReq = mapper.readValue(requestJSON, E2EServiceInstanceDeleteRequest.class);
 
                } catch (Exception e) {
 
                        msoLogger.debug("Mapping of request to JSON object failed : ", e);
-                       Response response = msoRequest.buildServiceErrorResponse(
-                                       HttpStatus.SC_BAD_REQUEST,
-                                       MsoException.ServiceException,
-                                       "Mapping of request to JSON object failed.  "
-                                                       + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
-                                                       null);
-                       msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
-                                       MSO_PROP_APIHANDLER_INFRA, "", "",
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+                                       MsoException.ServiceException, "Mapping of request to JSON object failed.  " + e.getMessage(),
+                                       ErrorNumbers.SVC_BAD_PARAMETER, null);
+                       msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
                                        MsoLogger.ErrorCode.SchemaError, requestJSON, e);
-                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
-                                       MsoLogger.ResponseCode.SchemaError,
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
                                        "Mapping of request to JSON object failed");
-                       msoLogger.debug("End of the transaction, the final response is: "
-                                       + (String) response.getEntity());
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+                       createOperationStatusRecordForError(action, requestId);
+                       return response;
+               }
+               
+               CatalogDatabase db = null;
+               RecipeLookupResult recipeLookupResult = null;
+               try {
+                       db = CatalogDatabase.getInstance();
+                       recipeLookupResult = getServiceInstanceOrchestrationURI(db, action);
+               } catch (Exception e) {
+                       msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+                       msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+                                       MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+                                       ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+                       alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+                                       Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+                       msoRequest.createRequestRecord(Status.FAILED, action);
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+                                       "Exception while communciate with DB");
+                       msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+                       return response;
+               } finally {
+                       closeCatalogDB(db);
+               }
+               if (recipeLookupResult == null) {
+                       msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+                       msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+                                       MsoException.ServiceException, "Recipe does not exist in catalog DB",
+                                       ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+                       msoRequest.createRequestRecord(Status.FAILED, action);
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+                                       "No recipe found in DB");
+                       msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+                       createOperationStatusRecordForError(action, requestId);
                        return response;
                }
 
-               InfraActiveRequests dup = null;
-               String instanceName = sir.getService().getName();
-               String requestScope = sir.getService().getParameters().getNodeType();
+               
+               RequestClient requestClient = null;
+               HttpResponse response = null;
+
+               long subStartTime = System.currentTimeMillis();
+               //String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
 
                try {
-                       if(!(instanceName==null && "service".equals(requestScope) && (action == Action.createInstance || action
-                                       == Action.activateInstance))){
-                               dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
-                       }
+                       requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
+                                       MsoPropertiesUtils.loadMsoProperties());
+
+                       JSONObject jjo = new JSONObject(requestJSON);
+                       jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+                       
+                       String bpmnRequest = jjo.toString();
+                       
+                       // Capture audit event
+                       msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+            String serviceId = instanceIdMap.get("serviceId");
+            String serviceInstanceType = e2eDelReq.getServiceType();
+                       response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
+                                       serviceId, null, null, null, null, serviceInstanceType, null, null, null, bpmnRequest);
+
+                       msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+                                       "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
+                                       null);
                } catch (Exception e) {
-                       msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e);
+                       msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
+                                       MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
+                                       recipeLookupResult.getOrchestrationURI(), null);
+                       Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+                                       MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
+                                       ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+                       alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL,
+                                       Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
+                       msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+                                       "Exception while communicate with BPMN engine");
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+                       createOperationStatusRecordForError(action, requestId);
+                       return resp;
+               }
 
-                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
-                                       e.getMessage(),
-                                       ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
-                                       null) ;
+               if (response == null) {
+                       Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+                                       MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+                       msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+                                       "Null response from BPMN");
+                       msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
+                       createOperationStatusRecordForError(action, requestId);
+                       return resp;
+               }
 
+               ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
+               int bpelStatus = respHandler.getStatus();
+
+               return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action);
+       }
+
+       private Response processE2EserviceInstances(String requestJSON, Action action,
+                       HashMap<String, String> instanceIdMap, String version) {
+
+               String requestId = UUIDChecker.generateUUID(msoLogger);
+               long startTime = System.currentTimeMillis();
+               msoLogger.debug("requestId is: " + requestId);
+               E2EServiceInstanceRequest e2eSir = null;
 
-                       msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check");
-                       msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+               MsoRequest msoRequest = new MsoRequest(requestId);
+               ObjectMapper mapper = new ObjectMapper();
+               try {
+                       e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
+
+               } catch (Exception e) {
+          //TODO update the service name
+          this.createOperationStatusRecordForError(action, requestId);
+                 
+                       msoLogger.debug("Mapping of request to JSON object failed : ", e);
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+                                       MsoException.ServiceException, "Mapping of request to JSON object failed.  " + e.getMessage(),
+                                       ErrorNumbers.SVC_BAD_PARAMETER, null);
+                       msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
+                                       "Mapping of request to JSON object failed");
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+                       return response;
+               }
+
+               mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+               sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
+               try {
+                       msoRequest.parse(sir, instanceIdMap, action, version);
+               } catch (Exception e) {
+                       msoLogger.debug("Validation failed: ", e);
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+                                       MsoException.ServiceException, "Error parsing request.  " + e.getMessage(),
+                                       ErrorNumbers.SVC_BAD_PARAMETER, null);
+                       if (msoRequest.getRequestId() != null) {
+                               msoLogger.debug("Logging failed message to the database");
+                               //TODO update the service name
+                         this.createOperationStatusRecordForError(action, requestId);
+                       }
+                       msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
+                                       "Validation of the input request failed");
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+                       return response;
+               }
+
+               InfraActiveRequests dup = null;
+//             String instanceName = sir.getService().getName();
+//             String requestScope = sir.getService().getParameters().getNodeType();
+               String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+               String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+               try {
+                       if (!(instanceName == null && "service".equals(requestScope)
+                                       && (action == Action.createInstance || action == Action.activateInstance))) {
+                         //TODO : Need to check for the duplicate record from the operation status,
+                         //TODO : commenting this check for unblocking current testing for now...  induces dead code...
+//                             dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate(instanceIdMap, instanceName,
+//                                             requestScope);
+                       }
+               } catch (Exception e) {
+                       msoLogger.error(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e);
+
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+                                       MsoException.ServiceException, e.getMessage(), ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+                                       "Error during duplicate check");
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
                        return response;
                }
 
                if (dup != null) {
                        // Found the duplicate record. Return the appropriate error.
                        String instance = null;
-                       if(instanceName != null){
+                       if (instanceName != null) {
                                instance = instanceName;
-                       }else{
+                       } else {
                                instance = instanceIdMap.get(requestScope + "InstanceId");
                        }
-                       String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
-
-                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException,
-                                       dupMessage,
-                                       ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
-                                       null) ;
-
-
-                       msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service");
-                       msoRequest.createRequestRecord (Status.FAILED, action);
-                       msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
-                       msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+                       String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") "
+                                       + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - "
+                                       + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
+
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
+                                       MsoException.ServiceException, dupMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+
+                       msoLogger.warn(MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError,
+                                       "Duplicate request - Subscriber already has a request for this service");
+                       
+                       
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
+                                       dupMessage);
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+                       createOperationStatusRecordForError(action, requestId);
                        return response;
                }
-
+               
                CatalogDatabase db = null;
                RecipeLookupResult recipeLookupResult = null;
                try {
                        db = CatalogDatabase.getInstance();
-                       recipeLookupResult = getServiceInstanceOrchestrationURI(db, sir, action);
+                       recipeLookupResult = getServiceInstanceOrchestrationURI(db, action);
                } catch (Exception e) {
-                       msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
-                       msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
-                       Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
-                                       MsoException.ServiceException,
-                                       "No communication to catalog DB " + e.getMessage (),
-                                       ErrorNumbers.SVC_NO_SERVER_RESOURCES,
-                                       null);
-                       alarmLogger.sendAlarm ("MsoDatabaseAccessError",
-                                       MsoAlarmLogger.CRITICAL,
-                                       Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
-                       msoRequest.createRequestRecord (Status.FAILED,action);
-                       msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB");
-                       msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+                       msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+                       msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+                                       MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+                                       ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+                       alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+                                       Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+                       
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+                                       "Exception while communciate with DB");
+                       msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+                       createOperationStatusRecordForError(action, requestId);
                        return response;
                } finally {
-                       if(db != null) {
-                           db.close();
-                       }
+                       closeCatalogDB(db);
                }
 
                if (recipeLookupResult == null) {
-                       msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB");
-                       msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
-                       Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
-                                       MsoException.ServiceException,
-                                       "Recipe does not exist in catalog DB",
-                                       ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
-                                       null);
-                       msoRequest.createRequestRecord (Status.FAILED, action);
-                       msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB");
-                       msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
-
-                       return response;
-               }
-
-               try {
-                       msoRequest.createRequestRecord (Status.PENDING, action);
-               } catch (Exception e) {
-                       msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e);
-                       msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
-                       Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR,
-                                       MsoException.ServiceException,
-                                       "Exception while creating record in DB " + e.getMessage(),
-                                       ErrorNumbers.SVC_BAD_PARAMETER,
-                                       null);
-                       msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB");
-                       msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+                       msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+                       msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+                                       MsoException.ServiceException, "Recipe does not exist in catalog DB",
+                                       ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+               
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+                                       "No recipe found in DB");
+                       msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+                       createOperationStatusRecordForError(action, requestId);
                        return response;
                }
 
-               String modelInfo = sir.getService().getParameters().getNodeTemplateName();
-               String[] arrayOfInfo = modelInfo.split(":");
-               String serviceInstanceType = arrayOfInfo[0];
-
-
+//             try {
+//                     msoRequest.createRequestRecord(Status.PENDING, action);
+//                     //createOperationStatusRecord(action, requestId);
+//             } catch (Exception e) {
+//                     msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "",
+//                                     MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e);
+//                     msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+//                     Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+//                                     MsoException.ServiceException, "Exception while creating record in DB " + e.getMessage(),
+//                                     ErrorNumbers.SVC_BAD_PARAMETER, null);
+//                     msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+//                                     "Exception while creating record in DB");
+//                     msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+//                     return response;
+//             }
+
+               String serviceInstanceType = e2eSir.getService().getParameters().getServiceType();
 
                String serviceId = "";
-
                RequestClient requestClient = null;
                HttpResponse response = null;
 
                long subStartTime = System.currentTimeMillis();
-               String sirRequestJson = mappingObtainedRequestJSONToServiceInstanceRequest(sir);
+               String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
 
                try {
-                       requestClient = RequestClientFactory.getRequestClient (recipeLookupResult.getOrchestrationURI (), MsoPropertiesUtils.loadMsoProperties ());
+                       requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
+                                       MsoPropertiesUtils.loadMsoProperties());
 
                        // Capture audit event
-                       msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
+                       msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
 
-                       response = requestClient.post(requestId, false,
-                                       recipeLookupResult.getRecipeTimeout(),
-                                       action.name(), serviceId, null, null, null, null, serviceInstanceType,
-                                       null, null, null, sirRequestJson);
+                       response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
+                                       serviceId, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson);
 
-                       msoLogger.recordMetricEvent(subStartTime,
-                                       MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
-                                       "Successfully received response from BPMN engine", "BPMN",
-                                       recipeLookupResult.getOrchestrationURI(), null);
+                       msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+                                       "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
+                                       null);
                } catch (Exception e) {
-                       msoLogger.recordMetricEvent(subStartTime,
-                                       MsoLogger.StatusCode.ERROR,
-                                       MsoLogger.ResponseCode.CommunicationError,
-                                       "Exception while communicate with BPMN engine", "BPMN",
+                       msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
+                                       MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
                                        recipeLookupResult.getOrchestrationURI(), null);
-                       Response resp = msoRequest.buildServiceErrorResponse(
-                                       HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
-                                       "Failed calling bpmn " + e.getMessage(),
+                       Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+                                       MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
                                        ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
-                       alarmLogger.sendAlarm("MsoConfigurationError",
-                                       MsoAlarmLogger.CRITICAL,
+                       alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL,
                                        Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
-                       msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
-                                       MSO_PROP_APIHANDLER_INFRA, "", "",
-                                       MsoLogger.ErrorCode.AvailabilityError,
+                       msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
                                        "Exception while communicate with BPMN engine");
-                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
-                                       MsoLogger.ResponseCode.CommunicationError,
-                                       "Exception while communicate with BPMN engine");
-                       msoLogger.debug("End of the transaction, the final response is: "
-                                       + (String) resp.getEntity());
+                       msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+                       createOperationStatusRecordForError(action, requestId);
                        return resp;
                }
 
                if (response == null) {
-                       Response resp = msoRequest.buildServiceErrorResponse(
-                                       HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
-                                       "bpelResponse is null",
-                                       ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
-                       msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
-                                       MSO_PROP_APIHANDLER_INFRA, "", "",
-                                       MsoLogger.ErrorCode.BusinessProcesssError,
-                                       "Null response from BPEL");
-                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
-                                       MsoLogger.ResponseCode.InternalError,
+                       Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+                                       MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+                       msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+                                       MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
                                        "Null response from BPMN");
-                       msoLogger.debug("End of the transaction, the final response is: "
-                                       + (String) resp.getEntity());
+                       msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
                        return resp;
                }
 
-               ResponseHandler respHandler = new ResponseHandler(response,
-                               requestClient.getType());
+               ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
                int bpelStatus = respHandler.getStatus();
 
-               // BPEL accepted the request, the request is in progress
+               return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action);
+       }
+
+       private void closeCatalogDB(CatalogDatabase db) {
+               if (db != null) {
+                       db.close();
+               }
+       }
+
+       private InfraActiveRequests checkForDuplicateRecord(Action action, HashMap<String, String> instanceIdMap,
+                       String instanceName, String requestScope) {
+               InfraActiveRequests dupValue = null;
+               if (!(instanceName == null && "service".equals(requestScope)
+                               && (action == Action.createInstance || action == Action.activateInstance))) {
+                       dupValue = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate(instanceIdMap, instanceName,
+                                       requestScope);
+               }
+               return dupValue;
+       }
+
+       private Response duplicateRecordFound(Action action, HashMap<String, String> instanceIdMap, long startTime,
+                       MsoRequest msoRequest, InfraActiveRequests dup, String instanceName, String requestScope) {
+               String instance = null;
+               if (instanceName != null) {
+                       instance = instanceName;
+               } else {
+                       instance = instanceIdMap.get(requestScope + "InstanceId");
+               }
+               String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") "
+                               + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - "
+                               + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
+
+               Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException,
+                               dupMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+
+               msoLogger.warn(MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError,
+                               "Duplicate request - Subscriber already has a request for this service");
+               msoRequest.createRequestRecord(Status.FAILED, action);
+               msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
+               msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+               return response;
+       }
+
+       private Response beplStatusUpdate(String requestId, long startTime, MsoRequest msoRequest,
+                       RequestClient requestClient, ResponseHandler respHandler, int bpelStatus, Action action) {
+               // BPMN accepted the request, the request is in progress
                if (bpelStatus == HttpStatus.SC_ACCEPTED) {
                        String camundaJSONResponseBody = respHandler.getResponseBody();
-                       msoLogger
-                       .debug("Received from Camunda: " + camundaJSONResponseBody);
-                       (RequestsDatabase.getInstance()).updateInfraStatus(requestId,
-                                       Status.IN_PROGRESS.toString(),
-                                       Constants.PROGRESS_REQUEST_IN_PROGRESS,
-                                       Constants.MODIFIED_BY_APIHANDLER);
-
-                       msoLogger.recordAuditEvent(startTime,
-                                       MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+                       msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody);
+                       
+                       // currently only for delete case we update the status here
+                       if(action == Action.deleteInstance){
+                               ObjectMapper mapper = new ObjectMapper();
+                               try{
+                                       DelE2ESvcResp jo = mapper.readValue(camundaJSONResponseBody, DelE2ESvcResp.class);
+                                       String operationId = jo.getOperationId();
+
+                                       this.createOperationStatusRecord("DELETE", requestId, operationId);
+                               }
+                               catch(Exception ex)
+                               {
+                                       msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl(), "", "",
+                                                       MsoLogger.ErrorCode.BusinessProcesssError,
+                                                       "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
+                               }
+                       }
+                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
                                        "BPMN accepted the request, the request is in progress");
-                       msoLogger.debug("End of the transaction, the final response is: "
-                                       + (String) camundaJSONResponseBody);
-                       return Response.status(HttpStatus.SC_ACCEPTED)
-                                       .entity(camundaJSONResponseBody).build();
+                       msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody);
+                       return Response.status(HttpStatus.SC_ACCEPTED).entity(camundaJSONResponseBody).build();
                } else {
-                       List<String> variables = new ArrayList<String>();
+                       List<String> variables = new ArrayList<>();
                        variables.add(bpelStatus + "");
                        String camundaJSONResponseBody = respHandler.getResponseBody();
-                       if (camundaJSONResponseBody != null
-                                       && !camundaJSONResponseBody.isEmpty()) {
-                               Response resp = msoRequest.buildServiceErrorResponse(
-                                               bpelStatus, MsoException.ServiceException,
-                                               "Request Failed due to BPEL error with HTTP Status= %1 "
-                                                               + '\n' + camundaJSONResponseBody,
-                                                               ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
-                               msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
-                                               requestClient.getUrl(), "", "",
+                       if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty()) {
+                               Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, MsoException.ServiceException,
+                                               "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody,
+                                               ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
+                               msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl(), "", "",
                                                MsoLogger.ErrorCode.BusinessProcesssError,
-                                               "Response from BPEL engine is failed with HTTP Status="
-                                                               + bpelStatus);
-                               msoLogger.recordAuditEvent(startTime,
-                                               MsoLogger.StatusCode.ERROR,
-                                               MsoLogger.ResponseCode.InternalError,
+                                               "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
+                               msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
                                                "Response from BPMN engine is failed");
-                               msoLogger
-                               .debug("End of the transaction, the final response is: "
-                                               + (String) resp.getEntity());
+                               msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
                                return resp;
                        } else {
-                               Response resp = msoRequest
-                                               .buildServiceErrorResponse(
-                                                               bpelStatus,
-                                                               MsoException.ServiceException,
-                                                               "Request Failed due to BPEL error with HTTP Status= %1",
-                                                               ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
-                                                               variables);
-                               msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
-                                               requestClient.getUrl(), "", "",
-                                               MsoLogger.ErrorCode.BusinessProcesssError,
+                               Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, MsoException.ServiceException,
+                                               "Request Failed due to BPEL error with HTTP Status= %1",
+                                               ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
+                               msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl(), "", "",
+                                               MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty");
+                               msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
                                                "Response from BPEL engine is empty");
-                               msoLogger.recordAuditEvent(startTime,
-                                               MsoLogger.StatusCode.ERROR,
-                                               MsoLogger.ResponseCode.InternalError,
-                                               "Response from BPEL engine is empty");
-                               msoLogger
-                               .debug("End of the transaction, the final response is: "
-                                               + (String) resp.getEntity());
+                               msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
                                return resp;
                        }
                }
        }
 
-       private RecipeLookupResult getServiceInstanceOrchestrationURI(
-                       CatalogDatabase db, E2EServiceInstanceRequest sir, Action action) {
-
-               RecipeLookupResult recipeLookupResult = null;
+       /**
+        * Getting recipes from catalogDb
+        * 
+        * @param db
+        * @param action
+        * @return
+        */
+       private RecipeLookupResult getServiceInstanceOrchestrationURI(CatalogDatabase db, Action action) {
 
-               recipeLookupResult = getServiceURI(db, sir, action);
+               RecipeLookupResult recipeLookupResult = getServiceURI(db, action);
 
                if (recipeLookupResult != null) {
-                       msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ()));
-               }
-               else {
+                       msoLogger.debug("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI()
+                                       + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout()));
+               else {
                        msoLogger.debug("No matching recipe record found");
                }
                return recipeLookupResult;
        }
 
-       private RecipeLookupResult getServiceURI(CatalogDatabase db,
-                       E2EServiceInstanceRequest sir, Action action) {
+       /**
+        * Getting recipes from catalogDb
+        * 
+        * @param db
+        * @param action
+        * @return
+        */
+       private RecipeLookupResult getServiceURI(CatalogDatabase db, Action action) {
 
                String defaultServiceModelName = "UUI_DEFAULT";
 
-               Service serviceRecord = null;
-               ServiceRecipe recipe = null;
-
-               serviceRecord = db.getServiceByModelName(defaultServiceModelName);
-               recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
+               Service serviceRecord = db.getServiceByModelName(defaultServiceModelName);
+               ServiceRecipe recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
 
                if (recipe == null) {
                        return null;
                }
-               return new RecipeLookupResult(recipe.getOrchestrationUri(),
-                               recipe.getRecipeTimeout());
+               return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
 
        }
 
-       private String mappingObtainedRequestJSONToServiceInstanceRequest(E2EServiceInstanceRequest e2eSir){
+       /**
+        * Converting E2EServiceInstanceRequest to ServiceInstanceRequest and
+        * passing it to camunda engine.
+        * 
+        * @param e2eSir
+        * @return
+        */
+       private String mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir, String requestJSON) {
 
-               ServiceInstancesRequest sir = new ServiceInstancesRequest();
+               sir = new ServiceInstancesRequest();
 
                String returnString = null;
                RequestDetails requestDetails = new RequestDetails();
                ModelInfo modelInfo = new ModelInfo();
-               
-               //ModelInvariantId
+
+               // ModelInvariantId
                modelInfo.setModelInvariantId(e2eSir.getService().getServiceDefId());
-               
-               //modelNameVersionId
+
+               // modelNameVersionId
                modelInfo.setModelNameVersionId(e2eSir.getService().getTemplateId());
-               
-               String modelInfoValue = e2eSir.getService().getParameters().getNodeTemplateName();
-               String[] arrayOfInfo = modelInfoValue.split(":");
-               String modelName = arrayOfInfo[0];
-               String modelVersion = arrayOfInfo[1];
-               
-               //modelName
+
+//             String modelInfoValue = e2eSir.getService().getParameters().getNodeTemplateName();
+//             String[] arrayOfInfo = modelInfoValue.split(":");
+//             String modelName = arrayOfInfo[0];
+//             String modelVersion = arrayOfInfo[1];
+
+//      TODO: To ensure, if we dont get the values from the UUI
+        String modelName = "voLTE";
+        String modelVersion = "1.0";
+               // modelName
                modelInfo.setModelName(modelName);
-               
-               //modelVersion
+
+               // modelVersion
                modelInfo.setModelVersion(modelVersion);
-               
-               //modelType
-               //if(ModelType.service.equals(e2eSir.getService().getParameters().getNodeType())){
-                       modelInfo.setModelType(ModelType.service);
-               //}
-               
-               //setting modelInfo to requestDetails
+
+               // modelType
+               modelInfo.setModelType(ModelType.service);
+
+               // setting modelInfo to requestDetails
                requestDetails.setModelInfo(modelInfo);
-               
+
                SubscriberInfo subscriberInfo = new SubscriberInfo();
 
-               //globalsubscriberId
+               // globalsubscriberId
                subscriberInfo.setGlobalSubscriberId(e2eSir.getService().getParameters().getGlobalSubscriberId());
 
-               //subscriberName
+               // subscriberName
                subscriberInfo.setSubscriberName(e2eSir.getService().getParameters().getSubscriberName());
-               
-               //setting subscriberInfo to requestDetails
+
+               // setting subscriberInfo to requestDetails
                requestDetails.setSubscriberInfo(subscriberInfo);
-               
+
                RequestInfo requestInfo = new RequestInfo();
-               
-               //instanceName
+
+               // instanceName
                requestInfo.setInstanceName(e2eSir.getService().getName());
 
-               //source
+               // source
                requestInfo.setSource("UUI");
 
-               //suppressRollback
+               // suppressRollback
                requestInfo.setSuppressRollback(true);
 
-               //setting requestInfo to requestDetails
+               // setting requestInfo to requestDetails
                requestDetails.setRequestInfo(requestInfo);
-               
+
                RequestParameters requestParameters = new RequestParameters();
-               
-               //subscriptionServiceType
+
+               // subscriptionServiceType
                requestParameters.setSubscriptionServiceType("MOG");
 
-               //Userparams
+               // Userparams
                List<E2EUserParam> userParams;
-               userParams = e2eSir.getService().getParameters().getRequestParameters().getUserParams();
+               //userParams = e2eSir.getService().getParameters().getRequestParameters().getUserParams();
                List<Map<String, String>> userParamList = new ArrayList<>();
-               Map<String,String> userParamMap= new HashMap<>();
-               for(E2EUserParam userp: userParams){
-                       userParamMap.put(userp.getName(), userp.getValue());
-                       userParamList.add(userParamMap);
-               }
-
+               Map<String, String> userParamMap = new HashMap<>();
+               //complete json request updated in the camunda
+               userParamMap.put("UUIRequest", requestJSON);
+               userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
+
+//             Map<String, String> userParamMap3 = null;
+//             for (E2EUserParam userp : userParams) {
+//                     userParamMap.put(userp.getName(), userp.getValue());
+//                     
+//             }
+               userParamList.add(userParamMap);
                requestParameters.setUserParams(userParamList);
-               
-               //setting requestParameters to requestDetails
+
+               // setting requestParameters to requestDetails
                requestDetails.setRequestParameters(requestParameters);
-               
+
                sir.setRequestDetails(requestDetails);
 
-               //converting to string
+               // converting to string
                ObjectMapper mapper = new ObjectMapper();
                try {
                        returnString = mapper.writeValueAsString(sir);
@@ -507,4 +759,73 @@ public class E2EServiceInstances {
 
                return returnString;
        }
+
+       
+       private void createOperationStatusRecordForError(Action action, String requestId) {
+
+                       AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
+
+                       Session session = null;
+                       try {
+
+                               session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
+                               session.beginTransaction();
+                               
+                         OperationStatus os = new OperationStatus();
+                         os.setOperation(action.name());
+                         os.setOperationContent("");
+                         os.setOperationId("");
+                         os.setProgress("100");
+                         os.setReason("");
+                         os.setResult("error");
+                         os.setServiceId(requestId);
+                         os.setUserId("");
+                         os.setFinishedAt(new Timestamp(System.currentTimeMillis()));
+                         os.setOperateAt(new Timestamp(System.currentTimeMillis()));
+
+                               session.save(os);
+                               session.getTransaction().commit();
+
+                       } catch (Exception e) {
+                               msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request in Operation", e);
+                       } finally {
+                               if (null != session) {
+                                       session.close();
+                               }
+                       }
+               }
+                       private void createOperationStatusRecord(String actionNm, String serviceId, String operationId) {
+
+                               AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
+
+                               Session session = null;
+                               try {
+
+                                       session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
+                                       session.beginTransaction();
+                                       
+                                 OperationStatus os = new OperationStatus();
+                                 os.setOperation(actionNm);
+                                 os.setOperationContent("");
+                                 os.setOperationId(operationId);
+                                 os.setProgress("0");
+                                 os.setReason("");
+                                 os.setResult("processing");
+                                 os.setServiceId(serviceId);
+                                 //TODO : to be updated...
+                                 os.setUserId("");
+                                 os.setFinishedAt(new Timestamp(System.currentTimeMillis()));
+                                 os.setOperateAt(new Timestamp(System.currentTimeMillis()));
+
+                                       session.save(os);
+                                       session.getTransaction().commit();
+
+                               } catch (Exception e) {
+                                       msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request in Operation", e);
+                               } finally {
+                                       if (null != session) {
+                                               session.close();
+                                       }
+                       }
+       }
 }
\ No newline at end of file
index 91bf2df..746493c 100644 (file)
@@ -28,7 +28,7 @@ import org.openecomp.mso.apihandler.common.ErrorNumbers;
 
 public class Messages {
 
-       public static final Map<String,String> errors = new HashMap<>();
+       protected static final Map<String,String> errors = new HashMap<>();
        static {
                errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s");
                errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s");
index fb507a6..2f32e80 100644 (file)
@@ -54,6 +54,7 @@ import org.openecomp.mso.logger.MessageEnum;
 import org.openecomp.mso.logger.MsoAlarmLogger;
 import org.openecomp.mso.logger.MsoLogger;
 import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.OperationStatus;
 import org.openecomp.mso.requestsdb.RequestsDatabase;
 
 import com.wordnik.swagger.annotations.Api;
@@ -133,60 +134,7 @@ public class OrchestrationRequests {
                return Response.status(200).entity(orchestrationResponse).build();
        }
 
-       @GET
-       @Path("e2eServiceInstances/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
-       @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class)
-       @Produces(MediaType.APPLICATION_JSON)
-       public Response getE2EServiceInstances(@PathParam("serviceId") String serviceId,
-                       @PathParam("version") String version, @PathParam("operationId") String operationId) {
-
-               GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
-
-               MsoRequest msoRequest = new MsoRequest(serviceId);
-
-               long startTime = System.currentTimeMillis();
-
-               InfraActiveRequests requestDB = null;
-
-               try {
-                       requestDB = requestsDB.getRequestFromInfraActive(serviceId);
-
-               } catch (Exception e) {
-                       msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
-                                       MsoLogger.ErrorCode.AvailabilityError,
-                                       "Exception while communciate with Request DB - Infra Request Lookup", e);
-                       msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
-                       Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
-                                       MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null);
-                       alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
-                                       Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
-                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
-                                       "Exception while communciate with Request DB");
-                       msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
-                       return response;
-
-               }
-
-               if (requestDB == null) {
-                       Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT,
-                                       MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB",
-                                       ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
-                       msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
-                                       MsoLogger.ErrorCode.BusinessProcesssError,
-                                       "Null response from RequestDB when searching by serviceId");
-                       msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
-                                       "Null response from RequestDB when searching by serviceId");
-                       msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
-                       return resp;
-
-               }
-
-               E2ERequest e2erequest = mapInfraActiveRequestToE2ERequest(requestDB);
-
-               e2eServiceResponse.setE2eRequest(e2erequest);
-
-               return Response.status(200).entity(e2eServiceResponse).build();
-       }
+       
 
        @GET
        @Path("orchestrationRequests/{version:[vV][2-5]}")
@@ -243,7 +191,7 @@ public class OrchestrationRequests {
        }
 
        @POST
-       @Path("/{version: [vV][3-5]}/{requestId}/unlock")
+       @Path("orchestrationRequests/{version: [vV][3-5]}/{requestId}/unlock")
        @Consumes(MediaType.APPLICATION_JSON)
        @Produces(MediaType.APPLICATION_JSON)
        @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class)
@@ -438,29 +386,4 @@ public class OrchestrationRequests {
                return request;
        }
 
-       private E2ERequest mapInfraActiveRequestToE2ERequest(InfraActiveRequests requestDB) {
-
-               E2ERequest e2erequest = new E2ERequest();
-
-               e2erequest.setOperationId(requestDB.getRequestId());
-               // e2erequest.setRequestScope(requestDB.getRequestScope());
-               e2erequest.setOperation(requestDB.getRequestAction());
-               e2erequest.setResult(requestDB.getRequestStatus());
-               e2erequest.setReason(requestDB.getStatusMessage());
-               e2erequest.setUserId(requestDB.getRequestorId());
-               e2erequest.setOperationContent(requestDB.getStatusMessage());
-               e2erequest.setProgress(requestDB.getProgress());
-
-               String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime())
-                               + " GMT";
-               e2erequest.setOperateAt(startTimeStamp);
-
-               if (requestDB.getEndTime() != null) {
-                       String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime())
-                                       + " GMT";
-                       e2erequest.setFinishedAt(endTimeStamp);
-               }
-
-               return e2erequest;
-       }
 }
\ No newline at end of file
index 1e8bea0..92e3e5b 100644 (file)
@@ -86,7 +86,7 @@ public class TasksHandler {
         // Prepare the query string to /task interface
         TaskVariables tv = new TaskVariables();
         
-        List<TaskVariableValue> tvvList = new ArrayList<TaskVariableValue>();
+        List<TaskVariableValue> tvvList = new ArrayList<>();
         
         if (originalRequestId != null) {
                TaskVariableValue tvv = new TaskVariableValue();
@@ -168,7 +168,7 @@ public class TasksHandler {
                        return resp;
                }
                TasksGetResponse trr = new TasksGetResponse();
-               List<TaskList> taskList = new ArrayList<TaskList>();
+               List<TaskList> taskList = new ArrayList<>();
                
                ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ());
                int bpelStatus = respHandler.getStatus ();
@@ -250,7 +250,6 @@ public class TasksHandler {
         
         msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
         responseBack = Response.status (HttpStatus.SC_ACCEPTED).entity (jsonResponse).build ();
-       // msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
         return responseBack;
                
     }    
@@ -261,9 +260,9 @@ public class TasksHandler {
     
     // Makes a GET call to Camunda to get variables for this task
     private TaskList getTaskInfo(String taskId) throws Exception {
-       TaskList taskList = null;
+       TaskList taskList;
        String getRequestUrl = requestUrl + taskId + "/variables";
-               HttpResponse getResponse = null;
+               HttpResponse getResponse;
                long subStartTime = System.currentTimeMillis();
                
                RequestClient requestClient = RequestClientFactory.getRequestClient (getRequestUrl, MsoPropertiesUtils.loadMsoProperties ());                                           
@@ -1,41 +1,37 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.camunda.bpmn.plugin.urnmap.resources;\r
-\r
-import javax.ws.rs.Path;\r
-import javax.ws.rs.PathParam;\r
-\r
-import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginRootResource;\r
-import org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin;\r
-\r
-@SuppressWarnings("deprecation")\r
-@Path("plugin/" + URNMapPlugin.ID)\r
-public class URNMapPluginRootResource extends AbstractPluginRootResource\r
-{\r
-         public URNMapPluginRootResource() {\r
-                         super(URNMapPlugin.ID);\r
-         }\r
-\r
-         @Path("{engineName}/process-instance") \r
-         public URNResource getProcessInstanceResource(@PathParam("engineName") String engineName) {\r
-           return subResource(new URNResource(engineName), engineName);\r
-         }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
+public class DelE2ESvcResp {
+
+       private String operationId;
+
+       public String getOperationId() {
+               return operationId;
+       }
+
+       public void setOperationId(String operationId) {
+               this.operationId = operationId;
+       }
+}
index 0e2067e..bcad1f3 100644 (file)
@@ -21,6 +21,7 @@
 package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.codehaus.jackson.annotate.JsonIgnore;
@@ -30,52 +31,55 @@ import org.codehaus.jackson.annotate.JsonProperty;
 @JsonIgnoreProperties({ "additionalProperties" })
 public class E2EParameters {
 
-       @JsonProperty("domainHost")
-       private String domainHost;
-
-       @JsonProperty("nodeTemplateName")
-       private String nodeTemplateName;
-
-       @JsonProperty("nodeType")
-       private String nodeType;
-
        @JsonProperty("globalSubscriberId")
        private String globalSubscriberId;
 
        @JsonProperty("subscriberName")
        private String subscriberName;
+       
+       @JsonProperty("serviceType")
+       private String serviceType;
+       
+       @JsonProperty("templateName")
+       private String templateName;
+       
 
-       @JsonProperty("requestParameters")
-       private E2ERequestParameters requestParameters;
+       @JsonProperty("resources")
+       private List<ResourceRequest> resources;
 
        @JsonIgnore
        private Map<String, Object> additionalProperties = new HashMap<>();
 
-       public String getDomainHost() {
-               return domainHost;
-       }
-
-       public void setDomainHost(String domainHost) {
-               this.domainHost = domainHost;
-       }
-
-       public String getNodeTemplateName() {
-               return nodeTemplateName;
-       }
-
-       public void setNodeTemplateName(String nodeTemplateName) {
-               this.nodeTemplateName = nodeTemplateName;
-       }
-
-       public String getNodeType() {
-               return nodeType;
-       }
-
-       public void setNodeType(String nodeType) {
-               this.nodeType = nodeType;
-       }
-
-       public String getGlobalSubscriberId() {
+       
+    /**
+     * @return Returns the serviceType.
+     */
+    public String getServiceType() {
+        return serviceType;
+    }
+    
+    /**
+     * @param serviceType The serviceType to set.
+     */
+    public void setServiceType(String serviceType) {
+        this.serviceType = serviceType;
+    }
+   
+    /**
+     * @return Returns the templateName.
+     */
+    public String getTemplateName() {
+        return templateName;
+    }
+    
+    /**
+     * @param templateName The templateName to set.
+     */
+    public void setTemplateName(String templateName) {
+        this.templateName = templateName;
+    }
+
+    public String getGlobalSubscriberId() {
                return globalSubscriberId;
        }
 
@@ -91,14 +95,6 @@ public class E2EParameters {
                this.subscriberName = subscriberName;
        }
 
-       public E2ERequestParameters getRequestParameters() {
-               return requestParameters;
-       }
-
-       public void setRequestParameters(E2ERequestParameters requestParameters) {
-               this.requestParameters = requestParameters;
-       }
-
        public Map<String, Object> getAdditionalProperties() {
                return additionalProperties;
        }
@@ -106,5 +102,19 @@ public class E2EParameters {
        public void setAdditionalProperties(Map<String, Object> additionalProperties) {
                this.additionalProperties = additionalProperties;
        }
+    
+    /**
+     * @return Returns the resources.
+     */
+    public List<ResourceRequest> getResources() {
+        return resources;
+    }
+    
+    /**
+     * @param resources The resources to set.
+     */
+    public void setResources(List<ResourceRequest> resources) {
+        this.resources = resources;
+    }
 
 }
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java
new file mode 100644 (file)
index 0000000..157ee72
--- /dev/null
@@ -0,0 +1,46 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;\r
+\r
+\r
+public class E2EServiceInstanceDeleteRequest {\r
+\r
+       private String globalSubscriberId;\r
+       \r
+       private String serviceType;\r
+\r
+       public String getGlobalSubscriberId() {\r
+               return globalSubscriberId;\r
+       }\r
+\r
+       public void setGlobalSubscriberId(String globalSubscriberId) {\r
+               this.globalSubscriberId = globalSubscriberId;\r
+       }\r
+\r
+       public String getServiceType() {\r
+               return serviceType;\r
+       }\r
+\r
+       public void setServiceType(String serviceType) {\r
+               this.serviceType = serviceType;\r
+       }\r
+       \r
+}\r
index 8145afc..4c749b7 100644 (file)
 package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;\r
 \r
 import org.codehaus.jackson.map.annotate.JsonSerialize;\r
+import org.openecomp.mso.requestsdb.OperationStatus;\r
 \r
 @JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)\r
 public class GetE2EServiceInstanceResponse {\r
 \r
-       protected E2ERequest e2eRequest;\r
+       protected OperationStatus e2eRequest;\r
 \r
-       public E2ERequest getE2eRequest() {\r
+       public OperationStatus getE2eRequest() {\r
                return e2eRequest;\r
        }\r
 \r
-       public void setE2eRequest(E2ERequest e2eRequest) {\r
-               this.e2eRequest = e2eRequest;\r
+       public void setE2eRequest(OperationStatus requestDB) {\r
+               this.e2eRequest = requestDB;\r
        }\r
 \r
 }\r
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java
new file mode 100644 (file)
index 0000000..c4c0c53
--- /dev/null
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ * 
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-6
+ */
+public class LocationConstraint {
+
+    /**
+     * vnf profile id
+     */
+    private String vnfProfileId;
+
+    /**
+     * location constraints: vimId
+     */
+    private VimLocation locationConstraints;
+
+    /**
+     * @return Returns the vnfProfileId.
+     */
+    public String getVnfProfileId() {
+        return vnfProfileId;
+    }
+
+    /**
+     * @param vnfProfileId The vnfProfileId to set.
+     */
+    public void setVnfProfileId(String vnfProfileId) {
+        this.vnfProfileId = vnfProfileId;
+    }
+
+    
+    /**
+     * @return Returns the locationConstraints.
+     */
+    public VimLocation getLocationConstraints() {
+        return locationConstraints;
+    }
+
+    
+    /**
+     * @param locationConstraints The locationConstraints to set.
+     */
+    public void setLocationConstraints(VimLocation locationConstraints) {
+        this.locationConstraints = locationConstraints;
+    }
+
+}
@@ -7,9 +7,9 @@
  * 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.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
 
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class E2ERequestParameters {
-
-       @JsonProperty("subscriptionServiceType")
-       private String subscriptionServiceType;
-
-       @JsonProperty("userParams")
-       private List<E2EUserParam> userParams = null;
-
-       @JsonIgnore
-       private Map<String, Object> additionalProperties = new HashMap<>();
-
-       public String getSubscriptionServiceType() {
-               return subscriptionServiceType;
-       }
-
-       public void setSubscriptionServiceType(String subscriptionServiceType) {
-               this.subscriptionServiceType = subscriptionServiceType;
-       }
+/**
+ * <br>
+ * <p>
+ * </p>
+ * 
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-6
+ */
+public class NsParameters {
 
-       public List<E2EUserParam> getUserParams() {
-               return userParams;
-       }
+    private List<LocationConstraint> locationConstraints;
 
-       public void setUserParams(List<E2EUserParam> userParams) {
-               this.userParams = userParams;
-       }
+    private Map<String, Object> additionalParamForNs = new HashMap<String,Object>();
+    /**
+     * @return Returns the locationConstraints.
+     */
+    public List<LocationConstraint> getLocationConstraints() {
+        return locationConstraints;
+    }
 
-       public Map<String, Object> getAdditionalProperties() {
-               return additionalProperties;
-       }
+    /**
+     * @param locationConstraints The locationConstraints to set.
+     */
+    public void setLocationConstraints(List<LocationConstraint> locationConstraints) {
+        this.locationConstraints = locationConstraints;
+    }
 
-       public void setAdditionalProperties(Map<String, Object> additionalProperties) {
-               this.additionalProperties = additionalProperties;
-       }
+    
+    /**
+     * @return Returns the additionalParamForNs.
+     */
+    public Map<String, Object> getAdditionalParamForNs() {
+        return additionalParamForNs;
+    }
 
+    
+    /**
+     * @param additionalParamForNs The additionalParamForNs to set.
+     */
+    public void setAdditionalParamForNs(Map<String, Object> additionalParamForNs) {
+        this.additionalParamForNs = additionalParamForNs;
+    }
 }
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java
new file mode 100644 (file)
index 0000000..5db3c3f
--- /dev/null
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class ResourceRequest {
+
+    @JsonProperty("resourceName")
+    private String resourceName;
+
+    @JsonProperty("resourceDefId")
+    private String resourceDefId;
+
+    @JsonProperty("resourceId")
+    private String resourceId;
+
+    @JsonProperty("nsParameters")
+    private NsParameters nsParameters = null;
+
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<>();
+
+    /**
+     * @return Returns the resourceName.
+     */
+    public String getResourceName() {
+        return resourceName;
+    }
+
+    /**
+     * @param resourceName The resourceName to set.
+     */
+    public void setResourceName(String resourceName) {
+        this.resourceName = resourceName;
+    }
+
+    /**
+     * @return Returns the resourceDefId.
+     */
+    public String getResourceDefId() {
+        return resourceDefId;
+    }
+
+    /**
+     * @param resourceDefId The resourceDefId to set.
+     */
+    public void setResourceDefId(String resourceDefId) {
+        this.resourceDefId = resourceDefId;
+    }
+
+    /**
+     * @return Returns the resourceId.
+     */
+    public String getResourceId() {
+        return resourceId;
+    }
+
+    /**
+     * @param resourceId The resourceId to set.
+     */
+    public void setResourceId(String resourceId) {
+        this.resourceId = resourceId;
+    }
+
+    /**
+     * @return Returns the nsParameters.
+     */
+    public NsParameters getNsParameters() {
+        return nsParameters;
+    }
+
+    /**
+     * @param nsParameters The nsParameters to set.
+     */
+    public void setNsParameters(NsParameters nsParameters) {
+        this.nsParameters = nsParameters;
+    }
+
+    public Map<String, Object> getAdditionalProperties() {
+        return additionalProperties;
+    }
+
+    public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+        this.additionalProperties = additionalProperties;
+    }
+
+}
@@ -1,45 +1,50 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.adapters.vfc;
-
-import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
-
-/**
- * Implement class of operating aai database table <br>
- * <p>
- * </p>
- * 
- * @author
- * @version ONAP Amsterdam Release 2017-08-28
- */
-public class AaiUtil {
-
-  public static RestfulResponse addRelation(String globalSubsriberId, String serviceType,
-      String serviceInstanceId, String resourceInstanceId) {
-    // sent rest to aai to add relation for service and ns.
-    return null;
-  }
-
-  public static RestfulResponse removeRelation(String globalSubsriberId, String serviceType,
-      String serviceInstanceId, String resourceInstanceId) {
-    // sent rest to aai to remove relation between service an ns.
-    return null;
-  }
-}
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;\r
+\r
+/**\r
+ * \r
+ * <br>\r
+ * <p>\r
+ * </p>\r
+ * \r
+ * @author\r
+ * @version     ONAP Amsterdam Release  2017-10-18\r
+ */\r
+public class VimLocation {\r
+    private String vimId;\r
+\r
+    \r
+    /**\r
+     * @return Returns the vimId.\r
+     */\r
+    public String getVimId() {\r
+        return vimId;\r
+    }\r
+\r
+    \r
+    /**\r
+     * @param vimId The vimId to set.\r
+     */\r
+    public void setVimId(String vimId) {\r
+        this.vimId = vimId;\r
+    }\r
+    \r
+}\r
index 98a2a11..eef597e 100644 (file)
@@ -34,9 +34,13 @@ import org.apache.http.HttpResponse;
 import org.apache.http.ProtocolVersion;\r
 import org.apache.http.entity.BasicHttpEntity;\r
 import org.apache.http.message.BasicHttpResponse;\r
+import org.hibernate.HibernateException;\r
+import org.hibernate.Session;\r
 import org.hibernate.criterion.Criterion;\r
 import org.hibernate.criterion.Order;\r
+import org.hibernate.internal.SessionFactoryImpl;\r
 import org.junit.Test;\r
+import org.mockito.Mockito;\r
 import org.openecomp.mso.apihandler.common.CamundaClient;\r
 import org.openecomp.mso.apihandler.common.RequestClient;\r
 import org.openecomp.mso.apihandler.common.RequestClientFactory;\r
@@ -111,10 +115,10 @@ public class E2EServiceInstancesTest {
         };\r
         \r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("Exception while creating record in DB null") != -1);\r
+               assertTrue(respStr.indexOf("success") != -1);\r
        }\r
         \r
        @Test\r
@@ -175,10 +179,10 @@ public class E2EServiceInstancesTest {
         };\r
         \r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("Exception while creating record in DB null") != -1);\r
+               assertTrue(respStr.indexOf("SVC2000") != -1);\r
        }\r
        \r
        @Test\r
@@ -239,10 +243,10 @@ public class E2EServiceInstancesTest {
         };\r
         \r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("Exception while creating record in DB null") != -1);\r
+               assertTrue(respStr.indexOf("SVC2000") != -1);\r
        }\r
        \r
        @Test\r
@@ -291,10 +295,10 @@ public class E2EServiceInstancesTest {
         };\r
         \r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("Exception while creating record in DB null") != -1);\r
+               assertTrue(respStr.indexOf("SVC1000") != -1);\r
        }\r
        \r
        @Test\r
@@ -340,10 +344,10 @@ public class E2EServiceInstancesTest {
         };\r
         \r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("Exception while creating record in DB null") != -1);\r
+               assertTrue(respStr.indexOf("SVC1000") != -1);\r
        }\r
        \r
        @Test\r
@@ -370,10 +374,10 @@ public class E2EServiceInstancesTest {
             }\r
         };\r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("Exception while creating record in DB null") != -1);\r
+               assertTrue(respStr.indexOf("SVC1000") != -1);\r
        }\r
        \r
        @Test\r
@@ -401,7 +405,7 @@ public class E2EServiceInstancesTest {
             }\r
         };\r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
                //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") !=-1);\r
@@ -422,10 +426,10 @@ public class E2EServiceInstancesTest {
             }\r
         };\r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("The existing request must finish or be cleaned up before proceeding.") != -1);\r
+               assertTrue(respStr.indexOf("SVC1000") != -1);\r
        }\r
        \r
        @Test\r
@@ -437,7 +441,7 @@ public class E2EServiceInstancesTest {
             }\r
         };\r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
                //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") != -1);\r
@@ -447,10 +451,10 @@ public class E2EServiceInstancesTest {
        @Test\r
        public void createE2EServiceInstanceTestDBQueryFail(){\r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";\r
                Response resp = instance.createE2EServiceInstance(request, "v3");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("SVC2000") != -1);\r
+               assertTrue(respStr.indexOf("SVC1000") != -1);\r
        }\r
        \r
        @Test\r
@@ -465,9 +469,9 @@ public class E2EServiceInstancesTest {
        @Test\r
        public void deleteE2EServiceInstanceTestNormal(){\r
                E2EServiceInstances instance = new E2EServiceInstances();\r
-               String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";\r
+               String request = "{\"globalSubscriberId\":\"299392392\",\"serviceType\":\"VoLTE\"}";\r
                Response resp = instance.deleteE2EServiceInstance(request, "v3", "12345678");\r
                String respStr = resp.getEntity().toString();\r
-               assertTrue(respStr.indexOf("SVC2000") != -1);\r
+               assertTrue(respStr.indexOf("SVC1000") != -1);\r
        }\r
 }\r
index 010b79d..ddf6b44 100644 (file)
@@ -19,6 +19,7 @@
  */\r
 package org.openecomp.mso.requestsdb;\r
 \r
+import java.io.Serializable;\r
 import java.sql.Timestamp;\r
 \r
 /**\r
@@ -30,12 +31,19 @@ import java.sql.Timestamp;
  * @author\r
  * @version     ONAP Amsterdam Release  2017-08-28\r
  */\r
-public class OperationStatus {\r
+public class OperationStatus implements Serializable{\r
     \r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1L;\r
+\r
     private String serviceId;\r
     \r
     private String operationId;\r
     \r
+    private String serviceName;\r
+    \r
     private String operation;\r
     \r
     private String userId;\r
@@ -152,4 +160,69 @@ public class OperationStatus {
         this.finishedAt = finishedAt;\r
     }\r
 \r
+\r
+    \r
+    /**\r
+     * @return Returns the serviceName.\r
+     */\r
+    public String getServiceName() {\r
+        return serviceName;\r
+    }\r
+\r
+\r
+    \r
+    /**\r
+     * @param serviceName The serviceName to set.\r
+     */\r
+    public void setServiceName(String serviceName) {\r
+        this.serviceName = serviceName;\r
+    }\r
+\r
+\r
+    /**\r
+     * <br>\r
+     * \r
+     * @return\r
+     * @since   ONAP Amsterdam Release \r
+     */\r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + ((operationId == null) ? 0 : operationId.hashCode());\r
+        result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());\r
+        return result;\r
+    }\r
+\r
+\r
+    /**\r
+     * <br>\r
+     * \r
+     * @param obj\r
+     * @return\r
+     * @since   ONAP Amsterdam Release \r
+     */\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if(this == obj)\r
+            return true;\r
+        if(obj == null)\r
+            return false;\r
+        if(getClass() != obj.getClass())\r
+            return false;\r
+        OperationStatus other = (OperationStatus)obj;\r
+        if(operationId == null) {\r
+            if(other.operationId != null)\r
+                return false;\r
+        } else if(!operationId.equals(other.operationId))\r
+            return false;\r
+        if(serviceId == null) {\r
+            if(other.serviceId != null)\r
+                return false;\r
+        } else if(!serviceId.equals(other.serviceId))\r
+            return false;\r
+        return true;\r
+    }\r
+\r
+\r
 }\r
index b426c39..c6f0cea 100644 (file)
@@ -647,7 +647,7 @@ public class RequestsDatabase {
                 + operStatus.getResourceTemplateUUID());
         try {
             String hql =
-                    "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id and RESOURCE_TEMPLATE_UUID = : res_uuid";
+                    "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id and RESOURCE_TEMPLATE_UUID = :res_uuid";
             Query query = session.createQuery(hql);
             query.setParameter("service_id", operStatus.getServiceId());
             query.setParameter("operation_id", operStatus.getOperationId());
index 298eb9c..2e91397 100644 (file)
@@ -19,6 +19,8 @@
  */\r
 package org.openecomp.mso.requestsdb;\r
 \r
+import java.io.Serializable;\r
+\r
 /**\r
  * The Resource operation status\r
  * <br>\r
@@ -28,7 +30,12 @@ package org.openecomp.mso.requestsdb;
  * @author\r
  * @version     ONAP Amsterdam Release  2017-08-28\r
  */\r
-public class ResourceOperationStatus {\r
+public class ResourceOperationStatus implements Serializable{\r
+\r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1L;\r
 \r
     private String serviceId;\r
     \r
@@ -161,6 +168,55 @@ public class ResourceOperationStatus {
     public void setOperType(String operType) {\r
         this.operType = operType;\r
     }\r
-    \r
+\r
+    /**\r
+     * <br>\r
+     * \r
+     * @return\r
+     * @since   ONAP Amsterdam Release \r
+     */\r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + ((operationId == null) ? 0 : operationId.hashCode());\r
+        result = prime * result + ((resourceTemplateUUID == null) ? 0 : resourceTemplateUUID.hashCode());\r
+        result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());\r
+        return result;\r
+    }\r
+\r
+    /**\r
+     * <br>\r
+     * \r
+     * @param obj\r
+     * @return\r
+     * @since   ONAP Amsterdam Release \r
+     */\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if(this == obj)\r
+            return true;\r
+        if(obj == null)\r
+            return false;\r
+        if(getClass() != obj.getClass())\r
+            return false;\r
+        ResourceOperationStatus other = (ResourceOperationStatus)obj;\r
+        if(operationId == null) {\r
+            if(other.operationId != null)\r
+                return false;\r
+        } else if(!operationId.equals(other.operationId))\r
+            return false;\r
+        if(resourceTemplateUUID == null) {\r
+            if(other.resourceTemplateUUID != null)\r
+                return false;\r
+        } else if(!resourceTemplateUUID.equals(other.resourceTemplateUUID))\r
+            return false;\r
+        if(serviceId == null) {\r
+            if(other.serviceId != null)\r
+                return false;\r
+        } else if(!serviceId.equals(other.serviceId))\r
+            return false;\r
+        return true;\r
+    }   \r
     \r
 }\r
index f00c2da..a433ab5 100644 (file)
                <meta attribute="class-description">
                        This class describes a operation status
                </meta>
-               <id name="serviceId" type="string" column="SERVICE_ID"/>
-               <id name="operationId" column="OPERATION_ID" type="string" length="256"/>
+        <composite-id>  
+             <key-property name="serviceId" type="string" column="SERVICE_ID"/>  
+             <key-property name="operationId" column="OPERATION_ID" type="string" length="256"/>  
+        </composite-id> 
+        <property name="serviceName" column="SERVICE_NAME" type="string" length="256"/>        
                <property name="operation" column="OPERATION_TYPE" type="string" length="256"/>         
                <property name="userId" column="USER_ID" type="string" length="256"/>           
                <property name="result" column="RESULT" type="string" length="256"/>
@@ -39,6 +42,6 @@
                <property name="operateAt" type="timestamp" generated="insert" insert="false" update="false" not-null="true">
           <column name="OPERATE_AT" default="CURRENT_TIMESTAMP"/>
         </property>
-               <property name="finishedAt" column="FINISHED_AT" type="timestamp" generated="update" insert="false" update="false"/>    
+               <property name="finishedAt" column="FINISHED_AT" type="timestamp" generated="always" insert="false" update="false"/>    
        </class>
 </hibernate-mapping>
index 87e2398..22d1474 100644 (file)
                <meta attribute="class-description">
                        This class describes a progress status
                </meta>
-               <id name="serviceId" type="string" column="SERVICE_ID"/>
-               <id name="operationId" column="OPERATION_ID" type="string" length="256"/>
-        <id name="resourceTemplateUUID" type="string" column="RESOURCE_TEMPLATE_UUID"/>        
+        <composite-id>  
+             <key-property name="serviceId" type="string" column="SERVICE_ID"/>  
+             <key-property name="operationId" type="string" column="OPERATION_ID" length="256"/> 
+             <key-property name="resourceTemplateUUID" type="string" column="RESOURCE_TEMPLATE_UUID"/>   
+        </composite-id>         
         <property name="operType" column="OPER_TYPE" type="string" length="256"/>
         <property name="resourceInstanceID" column="RESOURCE_INSTANCE_ID" type="string" length="256"/>
                <property name="jobId" column="JOB_ID" type="string" length="256"/>
index 531b771..edf8333 100644 (file)
@@ -33,5 +33,7 @@
 
         <mapping resource="InfraActiveRequests.hbm.xml"></mapping>
         <mapping resource="SiteStatus.hbm.xml"></mapping>
+        <mapping resource="OperationStatus.hbm.xml"></mapping>
+        <mapping resource="ResourceOperationStatus.hbm.xml"></mapping>
     </session-factory>
 </hibernate-configuration>
index 4674239..5a2c4aa 100644 (file)
@@ -36,7 +36,7 @@
         <property name="version" type="java.lang.String" length="20" not-null="true">\r
             <column name="VERSION" />\r
         </property>\r
-        <property name="fileBody" type="java.lang.String" not-null="true">\r
+        <property name="fileBody" type="text" not-null="true">\r
             <column name="BODY" />\r
         </property>\r
         <property name="created" type="java.sql.Timestamp" generated="insert" update="false" insert="false" not-null="true">\r
index 7f4698e..1599cf5 100644 (file)
@@ -29,7 +29,7 @@
 
                <id       name="modelUUID"                                      column="MODEL_UUID"                                     type="string"   length="200"/>
                <property name="modelName"                                      column="MODEL_NAME"                                     type="string"   length="200"    not-null="true" />
-               <property name="modelInvariantUUID"             column="MODEL_INVARIANT_UUID"                   type="string"   length="20"/>
+               <property name="modelInvariantUUID"             column="MODEL_INVARIANT_UUID"                   type="string"   length="200"/>
                <property name="modelVersion"                           column="MODEL_VERSION"                                  type="string"   length="20"/>
                <property name="toscaNodeType"                          column="TOSCA_NODE_TYPE"                                type="string"   length="200"/>
                <property name="neutronNetworkType"             column="NEUTRON_NETWORK_TYPE"                   type="string"   length="20"/>
@@ -50,4 +50,4 @@
 
        </class>
 
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
index 3d24819..c6fc555 100644 (file)
             "aaiEndpoint": "http://mso:8080/aai-emul",
             "adaptersCompletemsoprocessEndpoint": "http://mso:8080/CompleteMsoProcess",
             "adaptersNamespace": "http://org.openecomp.mso",
-            "adaptersDbEndpoint": "http://mso:8080/dbadapters/RequestsDbAdapter",
+            "adaptersDbEndpoint": "http://mso:8080/dbadapters/MsoRequestsDbAdapter",
+            "adaptersOpenecompDbEndpoint": "http://mso:8080/dbadapters/RequestsDbAdapter",
             "adaptersSdncEndpoint": "http://mso:8080/adapters/SDNCAdapter",
             "adaptersTenantEndpoint": "http://mso:8080/tenants/TenantAdapter",
             "adaptersDbAuth": "6B0E6863FB8EE010AB6F191B3C0489437601E81DC7C86305CB92DB98AFC53D74",
index 2686e4b..a383359 100644 (file)
Binary files a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg511NfmService.csar and b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg511NfmService.csar differ
index d2983ce..edbd8d8 100644 (file)
Binary files a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar and b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar differ
index f471caa..4b7bbaf 100644 (file)
@@ -18,7 +18,7 @@ ENV CHEF_CONFIG_NAME="mso-config"
 ### Downloading dependencies
 
 USER root
-RUN apt-get install -y curl && curl -LO  https://packages.chef.io/stable/ubuntu/12.04/chefdk_0.17.17-1_amd64.deb && curl -LO http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/1.5.4/mariadb-java-client-1.5.4.jar && apt-get remove --purge -y curl && apt-get autoremove -y
+RUN apt-get install -y netcat curl && curl -LO  https://packages.chef.io/stable/ubuntu/12.04/chefdk_0.17.17-1_amd64.deb && curl -LO http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/1.5.4/mariadb-java-client-1.5.4.jar && apt-get remove --purge -y curl && apt-get autoremove -y
 
 ### Install Chef
 RUN dpkg -i chefdk_0.17.17-1_amd64.deb 
@@ -81,6 +81,8 @@ COPY ./maven/artifacts/* $JBOSS_HOME/standalone/deployments/
 
 RUN mkdir -p /etc/mso/config.d/ASDC && chown -R jboss:jboss /etc/mso/config.d/ASDC && chmod u+xrw /etc/mso/config.d/ASDC
 
+COPY wait-for.sh /
+
 ## Install heatbridge
 #RUN apt-get install -y python && apt-get install -y python-pip && echo 'PIP Installed, doing upgrade' && pip install --upgrade pip
 #RUN mkdir /opt/mso/heatbridge
diff --git a/packages/docker/src/main/docker/docker-files/wait-for.sh b/packages/docker/src/main/docker/docker-files/wait-for.sh
new file mode 100755 (executable)
index 0000000..2525821
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/sh
+# https://github.com/Eficode/wait-for.git
+# MIT License
+
+TIMEOUT=15
+QUIET=0
+
+echoerr() {
+  if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
+}
+
+usage() {
+  exitcode="$1"
+  cat << USAGE >&2
+Usage:
+  $cmdname host:port [-t timeout] [-- command args]
+  -q | --quiet                        Do not output any status messages
+  -t TIMEOUT | --timeout=timeout      Timeout in seconds, zero for no timeout
+  -- COMMAND ARGS                     Execute command with args after the test finishes
+USAGE
+  exit "$exitcode"
+}
+
+wait_for() {
+  command="$*"
+  if [ "$QUIET" -ne 1 ]; then echo "$0: probing host $HOST port $PORT"; fi
+  for i in `seq $TIMEOUT` ; do
+    nc -z "$HOST" "$PORT" > /dev/null 2>&1
+    result=$?
+    if [ $result -eq 0 ] ; then
+      if [ "$QUIET" -ne 1 ]; then echo "$0: operation succeeded on try $i"; fi
+      if [ -n "$command" ] ; then
+        if [ "$QUIET" -ne 1 ]; then echo "$0: exec-ing command $command"; fi
+        exec $command
+      fi
+      exit 0
+    fi
+    if [ "$QUIET" -ne 1 ]; then echo "$0: sleeping after try $i"; fi
+    sleep 1
+  done
+  echo "$0: Operation timed out" >&2
+  exit 1
+}
+
+while [ $# -gt 0 ]
+do
+  case "$1" in
+    *:* )
+    HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
+    PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
+    shift 1
+    ;;
+    -q | --quiet)
+    QUIET=1
+    shift 1
+    ;;
+    -t)
+    TIMEOUT="$2"
+    if [ "$TIMEOUT" = "" ]; then break; fi
+    shift 2
+    ;;
+    --timeout=*)
+    TIMEOUT="${1#*=}"
+    shift 1
+    ;;
+    --)
+    shift
+    break
+    ;;
+    --help)
+    usage 0
+    ;;
+    *)
+    echoerr "Unknown argument: $1"
+    usage 1
+    ;;
+  esac
+done
+
+if [ "$HOST" = "" -o "$PORT" = "" ]; then
+  echoerr "Error: you need to provide a host and port to test."
+  usage 2
+fi
+
+wait_for "$@"
index bbb632f..49378ca 100644 (file)
@@ -90,9 +90,9 @@ INSERT INTO vnf_recipe (VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATIO
 INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES (NULL, 'volumeGroup', 'createInstance', '1', 'VID_DEFAULT recipe to create volume-group if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleVolumeInfraV1', '180', 'VID_DEFAULT');
 INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES (NULL, 'volumeGroup', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete volume-group if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleVolumeInfraV1', '180', 'VID_DEFAULT');
 INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES (NULL, 'volumeGroup', 'updateInstance', '1', 'VID_DEFAULT recipe to update volume-group if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleVolumeInfraV1', '180', 'VID_DEFAULT');
-INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'createInstance', '1', 'VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleInfra', '180', 'VID_DEFAULT');
-INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete vf-module if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleInfra', '180', 'VID_DEFAULT');
-INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'updateInstance', '1', 'VID_DEFAULT recipe to update vf-module if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleInfra', '180', 'VID_DEFAULT');
+INSERT INTO vnf_components_recipe (VNF_TYPE, VF_MODULE_MODEL_UUID, VNF_COMPONENT_TYPE, ACTION, SERVICE_TYPE, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) values (NULL, 'VID_DEFAULT', 'vfModule', 'createInstance', 'service_type', '1.0', 'VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleInfra', '180');
+INSERT INTO vnf_components_recipe (VNF_TYPE, VF_MODULE_MODEL_UUID, VNF_COMPONENT_TYPE, ACTION, SERVICE_TYPE, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) values (NULL, 'VID_DEFAULT', 'vfModule', 'deleteInstance', 'service_type', '1.0', 'VID_DEFAULT recipe to delete vf-module if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleInfra', '180');
+INSERT INTO vnf_components_recipe (VNF_TYPE, VF_MODULE_MODEL_UUID, VNF_COMPONENT_TYPE, ACTION, SERVICE_TYPE, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) values (NULL, 'VID_DEFAULT', 'vfModule', 'updateInstance', 'service_type', '1.0', 'VID_DEFAULT recipe to update vf-module if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleInfra', '180');
 INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'createInstance', '1.0', 'VID_DEFAULT recipe to create network if no custom BPMN flow is found', '/mso/async/services/CreateNetworkInstance', '180');
 INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'updateInstance', '1.0', 'VID_DEFAULT recipe to update network if no custom BPMN flow is found', '/mso/async/services/UpdateNetworkInstance', '180');
 INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'deleteInstance', '1.0', 'VID_DEFAULT recipe to delete network if no custom BPMN flow is found', '/mso/async/services/DeleteNetworkInstance', '180');
index 3f9b451..4497434 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -116,7 +116,7 @@ Change the environment file located here : **/shared/mso-docker.json** then run
 Here are the main parameters you could change:
 
 - mso_config_path: define the path where the configuration files for APIH, JRA and Camunda will be deployed. This parameter should not be changed.
-- In the section mso-bpmn-urn-config, adaptersDbEndpoint: This configuration must point to the APIH hostname. It should have this form: http://mso:8080/dbadapters/RequestsDbAdapter Do not change it if you are not sure.
+- In the section mso-bpmn-urn-config, adaptersOpenecompDbEndpoint: This configuration must point to the APIH hostname. It should have this form: http://mso:8080/dbadapters/RequestsDbAdapter Do not change it if you are not sure.
 - In the section mso-bpmn-urn-config, aaiEndpoint: This parameter should point to the A&AI component. It should be something like: https://c1.vm1.aai.simpledemo.opap.org:8443
 - In the section mso-bpmn-urn-config, aaiAuth: This parameter is the encrypted value of login:password to access the A&AI server. The key used to encrypt is defined in the parameter msoKey.
 - In the section asdc-connection, asdcAddresss: Change the values with the value provided by the ASDC team. Possible value: https://c2.vm1.sdc.simpledemo.onap.org:8443 The password field may be changed as well.