Merge "Fixed multiple so issues"
authorSeshu Kumar M <seshu.kumar.m@huawei.com>
Mon, 23 Oct 2017 05:17:51 +0000 (05:17 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 23 Oct 2017 05:17:51 +0000 (05:17 +0000)
80 files changed:
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-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.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/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
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/workflow/service/WorkflowAsyncResource.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java
bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
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/CreateVfModuleInfra.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/DoCreateVfModuleVolumeRollback.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
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/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/DoCustomDeleteE2EServiceInstance.bpmn
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/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/URNData.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/URNMapPluginRootResource.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
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/Messages.java
packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json
readme.md

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 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 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 fda95ac..e8718fa 100644 (file)
@@ -62,7 +62,7 @@ public class RestfulUtil {
 
     private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
 
-    private static final int DEFAULT_TIME_OUT = 60;
+    private static final int DEFAULT_TIME_OUT = 60000;
 
     private static final MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
 
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 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 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 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 73066b3..abd6936 100644 (file)
@@ -140,7 +140,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                        
                        utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
                        execution.setVariable("serviceInputParams", inputMap)
-                       
+                       execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
                        //TODO
                        //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
                        //execution.setVariable("failExists", true)
@@ -304,7 +304,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
             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)
 
@@ -317,7 +317,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                             <serviceId>${serviceId}</serviceId>
                             <operationId>${operationId}</operationId>
                             <operationType>${operationType}</operationType>
-                            <userId>${userId}</responseBody>
+                            <userId>${userId}</userId>
                             <result>${result}</result>
                             <operationContent>${operationContent}</operationContent>
                             <progress>${progress}</progress>
@@ -338,4 +338,4 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
         utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)    
        }
        
-}
\ No newline at end of file
+}
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 a2be303..a8506fd 100644 (file)
@@ -636,7 +636,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                 }
             }            
 
-            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 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..8ab8d61 100644 (file)
@@ -523,7 +523,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
                 }
             }           
 
-            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 04b47b4..4b26e6b 100644 (file)
@@ -152,11 +152,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">${URN_mso_adapters_openecomp_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: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 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..43c8aee 100644 (file)
@@ -188,11 +188,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">${URN_mso_adapters_openecomp_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:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
               </camunda:map>
             </camunda:inputParameter>
             <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter>
index 91f5404..581ab3a 100644 (file)
@@ -166,7 +166,7 @@ ddsi.preInitResourcesOperStatus(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">${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 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/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/URNData.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java
deleted file mode 100644 (file)
index b2dcefb..0000000
+++ /dev/null
@@ -1,47 +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
-public class URNData {\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
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 484981c..0000000
+++ /dev/null
@@ -1,98 +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.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
-                 log.info(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(URNData d) {  \r
-         \r
-         log.info("getPersistData:  UrnName: " + d.getURNName() + " , URNValue: " + d.getURNValue() );\r
-           \r
-               getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.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/URNMapPluginRootResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java
deleted file mode 100644 (file)
index e8e5e47..0000000
+++ /dev/null
@@ -1,41 +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 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
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 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 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 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 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.