diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java
index 0af0e94..ef37f9f 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,6 +26,7 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
+import java.util.Optional;
 import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.map.DeserializationConfig;
 import org.codehaus.jackson.map.ObjectMapper;
@@ -36,8 +37,8 @@
 /**
  * JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud
  * configuration file to Java. The CloudConfig contains information about
- * Openstack cloud configurations. It includes: 
- * - CloudIdentity objects,representing DCP nodes (Openstack Identity Service) 
+ * Openstack cloud configurations. It includes:
+ * - CloudIdentity objects,representing DCP nodes (Openstack Identity Service)
  * - CloudSite objects, representing LCP nodes (Openstack Compute & other services)
  *
  * Note that this is only used to access Cloud Configurations loaded from a JSON
@@ -51,19 +52,17 @@
 @JsonRootName("cloud_config")
 public class CloudConfig {
 
-    private boolean                    validCloudConfig = false;
+    private static final String CLOUD_SITE_VERSION = "2.5";
+    private static final String DEFAULT_CLOUD_SITE_ID = "default";
+    private boolean validCloudConfig = false;
+    private static ObjectMapper mapper = new ObjectMapper();
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+    protected String configFilePath;
+    protected int refreshTimerInMinutes;
     @JsonProperty("identity_services")
     private Map<String, CloudIdentity> identityServices = new HashMap<>();
     @JsonProperty("cloud_sites")
-    private Map<String, CloudSite>     cloudSites       = new HashMap<>();
-
-    private static ObjectMapper        mapper           = new ObjectMapper();
-
-    private static final MsoLogger     LOGGER           = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
-    protected String                   configFilePath;
-
-    protected int                      refreshTimerInMinutes;
+    private Map<String, CloudSite> cloudSites = new HashMap<>();
 
     public CloudConfig() {
         mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
@@ -71,18 +70,14 @@
     }
 
     /**
-     * Get a Map of all IdentityServices that have been loaded.
-     * 
-     * @return the Map
+     * Get a map of all identity services that have been loaded.
      */
     public synchronized Map<String, CloudIdentity> getIdentityServices() {
         return identityServices;
     }
 
     /**
-     * Get a Map of all CloudSites that have been loaded.
-     * 
-     * @return the Map
+     * Get a map of all cloud sites that have been loaded.
      */
     public synchronized Map<String, CloudSite> getCloudSites() {
         return cloudSites;
@@ -93,7 +88,7 @@
      * against the regions, and if no match is found there, then against
      * individual entries to try and find one with a CLLI that matches the ID
      * and an AIC version of 2.5.
-     * 
+     *
      * @param id
      *            the ID to match
      * @return a CloudSite, or null of no match found
@@ -104,53 +99,35 @@
                 return cloudSites.get(id);
             }
             // check for id == CLLI now as well
-            return getCloudSiteWithClli(id, "2.5");
+            return getCloudSiteWithClli(id);
         }
         return null;
     }
 
-    /**
-     * Get a specific CloudSites, based on a CLLI and (optional) version, which
-     * will be matched against the aic_version field of the CloudSite.
-     * 
-     * @param clli
-     *            the CLLI to match
-     * @param version
-     *            the version to match; may be null in which case any version
-     *            matches
-     * @return a CloudSite, or null of no match found
-     */
-    public synchronized CloudSite getCloudSiteWithClli(String clli, String version) {
-        if (clli != null) {
-            // New with 1610 - find cloud site called "DEFAULT" - return that
-            // object,with the name modified to match what they asked for. We're
-            // looping thru the cloud sites anyway - so save off the default one in case we
-            // need it.
-            CloudSite defaultCloudSite = null;
-            for (CloudSite cs : cloudSites.values()) {
-                if (cs.getClli() != null && clli.equals(cs.getClli())) {
-                    if (version == null || version.equals(cs.getAic_version())) {
-                        return cs;
-                    }
-                } else if ("default".equalsIgnoreCase(cs.getId())) {
-                    // save it off in case we need it
-                    defaultCloudSite = cs.clone();
-                }
-            }
-            // If we get here - we didn't find a match - so return the default
-            // cloud site
-            if (defaultCloudSite != null) {
-                defaultCloudSite.setRegionId(clli);
-                defaultCloudSite.setId(clli);
-            }
+    private CloudSite getCloudSiteWithClli(String clli) {
+        Optional <CloudSite> cloudSiteOptional = cloudSites.values().stream().filter(cs ->
+                cs.getClli() != null && clli.equals(cs.getClli()) && (CLOUD_SITE_VERSION.equals(cs.getAic_version())))
+                .findAny();
+        return cloudSiteOptional.orElse(getDefaultCloudSite(clli));
+    }
+
+    // TODO in future the result will be optional
+    private CloudSite getDefaultCloudSite(String clli) {
+        Optional<CloudSite> cloudSiteOpt = cloudSites.values().stream()
+                .filter(cs -> cs.getId().equalsIgnoreCase(DEFAULT_CLOUD_SITE_ID)).findAny();
+        if (cloudSiteOpt.isPresent()) {
+            CloudSite defaultCloudSite = cloudSiteOpt.get();
+            defaultCloudSite.setRegionId(clli);
+            defaultCloudSite.setId(clli);
             return defaultCloudSite;
+        } else {
+            return null;
         }
-        return null;
     }
 
     /**
      * Get a specific CloudIdentity, based on an ID.
-     * 
+     *
      * @param id
      *            the ID to match
      * @return a CloudIdentity, or null of no match found
@@ -173,7 +150,7 @@
         configFilePath = configFile;
         this.refreshTimerInMinutes = refreshTimer;
         this.validCloudConfig=false;
-        
+
         try {
             reader = new FileReader(configFile);
             // Parse the JSON input into a CloudConfig
@@ -200,7 +177,7 @@
                 }
             }
             this.validCloudConfig=true;
-            
+
         } finally {
             try {
                 if (reader != null) {
@@ -227,12 +204,9 @@
     public synchronized CloudConfig clone() {
         CloudConfig ccCopy = new CloudConfig();
         for (Entry<String, CloudIdentity> e : identityServices.entrySet()) {
-
             ccCopy.identityServices.put(e.getKey(), e.getValue().clone());
         }
-
         for (Entry<String, CloudSite> e : cloudSites.entrySet()) {
-
             ccCopy.cloudSites.put(e.getKey(), e.getValue().clone());
         }
         ccCopy.configFilePath = this.configFilePath;
@@ -290,5 +264,5 @@
         return true;
     }
 
-  
+
 }
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java
deleted file mode 100644
index 9677d0e..0000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.cloud;
-
-/**
- * This interface provides the method signature for mapping registration.
- * All mappings should be registered by the implementing class.
- */
-@FunctionalInterface
-public interface CloudConfigIdentityMapper {
-
-	public void registerAllMappings();
-}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
index fad0c23..08ea84d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -22,12 +22,10 @@
 package org.openecomp.mso.openstack.utils;
 
 import java.io.Serializable;
-import java.rmi.server.ObjID;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java
deleted file mode 100644
index dd1b396..0000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapter_utils.tests;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import java.util.Map;
-import org.openecomp.mso.cloud.CloudConfig;
-import org.openecomp.mso.cloud.CloudConfigFactory;
-import org.openecomp.mso.cloud.CloudIdentity;
-import org.openecomp.mso.cloud.CloudSite;
-import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound;
-
-/**
- * This class implements test methods of the CloudConfig features.
- */
-public class CloudConfigTest {
-
-	private static CloudConfig con;
-	private static CloudConfigFactory cloudConfigFactory= new CloudConfigFactory();
-
-	public CloudConfigTest () {
-
-	}
-
-	/**
-    * This method is called before any test occurs.
-    * It creates a fake tree from scratch
-	 * @throws MsoCloudIdentityNotFound 
-    */
-   @Before
-   public final void prepare () throws MsoCloudIdentityNotFound {
-	   ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
-	   String config = classLoader.getResource("cloud_config.json").toString().substring(5);
-
-	   cloudConfigFactory.initializeCloudConfig(config,1);
-	   con = cloudConfigFactory.getCloudConfig();
-   }
-
-   /**
-    * This method implements a test for the getCloudConfig method.
-    */
-   @Test
-   public final void testGetCloudConfig () {
-	   assertNotNull(con);
-   }
-
-   /**
-    * This method implements a test for the getCloudSites method.
-    */
-   @Test
-   public final void testGetCloudSites () {
-	   Map<String,CloudSite> siteMap = con.getCloudSites();
-	   assertNotNull(siteMap);
-
-	   CloudSite site1 = siteMap.get("MT");
-	   CloudSite site2 = siteMap.get("DAN");
-	   CloudSite site3 = siteMap.get("MTINJVCC101");
-	   CloudSite site4 = siteMap.get("MTSNJA4LCP1");
-
-	   assertEquals (site1.getRegionId(), "regionOne");
-	   assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE");
-	   assertEquals (site2.getRegionId(), "RegionOne");
-	   assertEquals (site2.getIdentityServiceId(), "DAN_KEYSTONE");
-	   assertEquals (site3.getRegionId(), "regionTwo");
-	   assertEquals (site3.getIdentityServiceId(), "MTINJVCC101_DCP");
-	   assertEquals (site4.getRegionId(), "mtsnjlcp1");
-	   assertEquals (site4.getIdentityServiceId(), "MTSNJA3DCP1");
-   }
-
-
-   /**
-    * This method implements a test for the getIdentityServices method.
-    */
-   @Test
-   public final void testGetIdentityServices () {
-	   Map<String,CloudIdentity> identityMap = con.getIdentityServices ();
-	   assertNotNull(identityMap);
-
-	   CloudIdentity identity1 = identityMap.get("MT_KEYSTONE");
-	   CloudIdentity identity2 = identityMap.get("DAN_KEYSTONE");
-	   CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP");
-	   CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1");
-
-	   assertEquals("john", identity1.getMsoId());
-	   assertEquals("changeme", identity1.getMsoPass());
-	   assertEquals("admin", identity1.getAdminTenant());
-	   assertEquals("_member_", identity1.getMemberRole());
-	   assertEquals(false, identity1.hasTenantMetadata());
-
-	   assertEquals("mockId", identity2.getMsoId());
-	   assertEquals("stack123", identity2.getMsoPass());
-	   assertEquals("service", identity2.getAdminTenant());
-	   assertEquals("_member_", identity2.getMemberRole());
-	   assertEquals(false, identity2.hasTenantMetadata());
-
-	   assertEquals("mockIdToo", identity3.getMsoId());
-	   assertEquals("AICG@mm@@2015", identity3.getMsoPass());
-	   assertEquals("service", identity3.getAdminTenant());
-	   assertEquals("admin", identity3.getMemberRole());
-	   assertEquals(true, identity3.hasTenantMetadata());
-
-	   assertEquals("mockIdToo", identity4.getMsoId());
-	   assertEquals("2315QRS2015srq", identity4.getMsoPass());
-	   assertEquals("service", identity4.getAdminTenant());
-	   assertEquals("admin", identity4.getMemberRole());
-	   assertEquals(true, identity4.hasTenantMetadata());
-
-   }
-
-   /**
-    * This method implements a test for the getCloudSite method.
-    */
-   @Test
-   public final void testGetCloudSite () {
-	   CloudSite site1  = con.getCloudSite("MT");
-	   assertNotNull(site1);
-	   assertEquals (site1.getRegionId(), "regionOne");
-	   assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE");
-   }
-
-   /**
-    * This method implements a test for the getIdentityService method.
-    */
-   @Test
-   public final void testGetIdentityService () {
-	   CloudIdentity identity1  = con.getIdentityService("MT_KEYSTONE");
-	   assertNotNull(identity1);
-	   assertEquals (identity1.getMsoId(), "john");
-	   assertEquals (identity1.getMsoPass(), "changeme");
-	   assertEquals (identity1.getAdminTenant(), "admin");
-	   assertEquals (identity1.getMemberRole(), "_member_");
-	   assertEquals (identity1.hasTenantMetadata(), false);
-
-	   CloudIdentity identity2  = con.getIdentityService("Test");
-	   assertNull(identity2);
-   }
-   
-   @Test (expected = MsoCloudIdentityNotFound.class)
-   public final void testLoadWithWrongFile () throws MsoCloudIdentityNotFound {
-       ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
-       String config = classLoader.getResource("cloud_config_bad.json").toString().substring(5);
-
-       cloudConfigFactory.initializeCloudConfig(config,1);
-   }
-   
-   @Test
-   public final void testReloadWithWrongFile () {
-       ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
-       String config = classLoader.getResource("cloud_config_bad.json").toString().substring(5);
-
-       try {
-           cloudConfigFactory.initializeCloudConfig(config,1);
-           Assert.fail("MsoCloudIdentityNotFound was expected");
-       } catch (MsoCloudIdentityNotFound e) {
-           
-       }
-       Assert.assertTrue("Should be an empty CloudConfig", cloudConfigFactory.getCloudConfig().getCloudSites().isEmpty());
-       Assert.assertTrue("Should be an empty CloudConfig", cloudConfigFactory.getCloudConfig().getIdentityServices().isEmpty());
-       
-       // Now reload the right config
-       config = classLoader.getResource("cloud_config.json").toString().substring(5);
-       cloudConfigFactory.changeMsoPropertiesFilePath(config);
-       cloudConfigFactory.reloadCloudConfig();
-       Assert.assertTrue("Flag valid Config should be true now that the cloud_config is correct", cloudConfigFactory.getCloudConfig().isValidCloudConfig());
-
-   }
-
-}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
index cd96756..6fd95d5 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
@@ -25,6 +25,7 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.cloud.CloudConfigTest;
 import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound;
 import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
 import org.openecomp.mso.openstack.exceptions.MsoException;
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java
new file mode 100644
index 0000000..a73e435
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java
@@ -0,0 +1,179 @@
+/*-
+ * ============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.cloud;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import java.util.Map;
+import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound;
+
+public class CloudConfigTest {
+
+    private static String cloudConfigJsonFilePath;
+    private static String cloudDefaultConfigJsonFilePath;
+    private static String cloudConfigInvalidJsonFilePath;
+
+    @BeforeClass
+    public static void preparePaths() {
+        ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
+        cloudConfigJsonFilePath = classLoader.getResource("cloud_config.json").getPath();
+        cloudDefaultConfigJsonFilePath = classLoader.getResource("cloud_default_config.json").getPath();
+        cloudConfigInvalidJsonFilePath = classLoader.getResource("cloud_config_bad.json").getPath();
+    }
+
+    private CloudConfig createTestObject(String jsonFilePath) throws MsoCloudIdentityNotFound {
+        CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
+        cloudConfigFactory.initializeCloudConfig(jsonFilePath, 1);
+        return cloudConfigFactory.getCloudConfig();
+    }
+
+    @Test
+    public void testGetCloudSites() throws MsoCloudIdentityNotFound {
+        CloudConfig con = createTestObject(cloudConfigJsonFilePath);
+        Map<String, CloudSite> siteMap = con.getCloudSites();
+        assertNotNull(siteMap);
+
+        CloudSite site1 = siteMap.get("MT");
+        CloudSite site2 = siteMap.get("DAN");
+        CloudSite site3 = siteMap.get("MTINJVCC101");
+        CloudSite site4 = siteMap.get("MTSNJA4LCP1");
+
+        assertEquals("regionOne", site1.getRegionId());
+        assertEquals("MT_KEYSTONE", site1.getIdentityServiceId());
+        assertEquals("RegionOne", site2.getRegionId());
+        assertEquals("DAN_KEYSTONE", site2.getIdentityServiceId());
+        assertEquals("regionTwo", site3.getRegionId());
+        assertEquals("MTINJVCC101_DCP", site3.getIdentityServiceId());
+        assertEquals("mtsnjlcp1", site4.getRegionId());
+        assertEquals("MTSNJA3DCP1", site4.getIdentityServiceId());
+    }
+
+    @Test
+    public void testGetIdentityServices() throws MsoCloudIdentityNotFound {
+        CloudConfig con = createTestObject(cloudConfigJsonFilePath);
+        Map<String, CloudIdentity> identityMap = con.getIdentityServices();
+        assertNotNull(identityMap);
+
+        CloudIdentity identity1 = identityMap.get("MT_KEYSTONE");
+        CloudIdentity identity2 = identityMap.get("DAN_KEYSTONE");
+        CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP");
+        CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1");
+
+        assertEquals("john", identity1.getMsoId());
+        assertEquals("changeme", identity1.getMsoPass());
+        assertEquals("admin", identity1.getAdminTenant());
+        assertEquals("_member_", identity1.getMemberRole());
+        assertFalse(identity1.hasTenantMetadata());
+
+        assertEquals("mockId", identity2.getMsoId());
+        assertEquals("stack123", identity2.getMsoPass());
+        assertEquals("service", identity2.getAdminTenant());
+        assertEquals("_member_", identity2.getMemberRole());
+        assertFalse(identity2.hasTenantMetadata());
+
+        assertEquals("mockIdToo", identity3.getMsoId());
+        assertEquals("AICG@mm@@2015", identity3.getMsoPass());
+        assertEquals("service", identity3.getAdminTenant());
+        assertEquals("admin", identity3.getMemberRole());
+        assertTrue(identity3.hasTenantMetadata());
+
+        assertEquals("mockIdToo", identity4.getMsoId());
+        assertEquals("2315QRS2015srq", identity4.getMsoPass());
+        assertEquals("service", identity4.getAdminTenant());
+        assertEquals("admin", identity4.getMemberRole());
+        assertTrue(identity4.hasTenantMetadata());
+    }
+
+    @Test
+    public void cloudSiteIsGotById_when_IdFound() throws MsoCloudIdentityNotFound {
+        CloudConfig con = createTestObject(cloudConfigJsonFilePath);
+        CloudSite cloudSite = con.getCloudSite("MT");
+        assertNotNull(cloudSite);
+        assertEquals("regionOne", cloudSite.getRegionId());
+        assertEquals("MT_KEYSTONE", cloudSite.getIdentityServiceId());
+    }
+
+    @Test
+    public void cloudSiteIsGotByClli_when_IdNotFound() throws MsoCloudIdentityNotFound {
+        CloudConfig con = createTestObject(cloudConfigJsonFilePath);
+        CloudSite cloudSite = con.getCloudSite("CS_clli");
+        assertNotNull(cloudSite);
+        assertEquals("clliRegion", cloudSite.getRegionId());
+        assertEquals("CS_clli", cloudSite.getClli());
+        assertEquals("CS_service", cloudSite.getIdentityServiceId());
+    }
+
+    @Test
+    public void cloudSiteIsGotByDefault_when_IdAndClliNotFound() throws MsoCloudIdentityNotFound {
+        CloudConfig con = createTestObject(cloudDefaultConfigJsonFilePath);
+        CloudSite cloudSite = con.getCloudSite("not_existing_id");
+        assertNotNull(cloudSite);
+        assertEquals("not_existing_id", cloudSite.getId());
+        assertEquals("not_existing_id", cloudSite.getRegionId());
+    }
+
+    @Test
+    public void testGetIdentityService() throws MsoCloudIdentityNotFound {
+        CloudConfig con = createTestObject(cloudConfigJsonFilePath);
+        CloudIdentity identity1 = con.getIdentityService("MT_KEYSTONE");
+        assertNotNull(identity1);
+        assertEquals("john", identity1.getMsoId());
+        assertEquals("changeme", identity1.getMsoPass());
+        assertEquals("admin", identity1.getAdminTenant());
+        assertEquals("_member_", identity1.getMemberRole());
+        assertFalse(identity1.hasTenantMetadata());
+
+        CloudIdentity identity2 = con.getIdentityService("Test");
+        assertNull(identity2);
+    }
+
+    @Test(expected = MsoCloudIdentityNotFound.class)
+    public void testLoadWithWrongFile() throws MsoCloudIdentityNotFound {
+        createTestObject(cloudConfigInvalidJsonFilePath);
+    }
+
+    @Test
+    public void testReloadWithWrongFile() {
+        CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
+        try {
+            cloudConfigFactory.initializeCloudConfig(cloudConfigInvalidJsonFilePath, 1);
+            Assert.fail("MsoCloudIdentityNotFound was expected");
+        } catch (MsoCloudIdentityNotFound e) {
+
+        }
+        assertTrue("Should be an empty CloudConfig", cloudConfigFactory.getCloudConfig().getCloudSites().isEmpty());
+        assertTrue("Should be an empty CloudConfig",
+                cloudConfigFactory.getCloudConfig().getIdentityServices().isEmpty());
+        // Now reload the right config
+        cloudConfigFactory.changeMsoPropertiesFilePath(cloudConfigJsonFilePath);
+        cloudConfigFactory.reloadCloudConfig();
+        assertTrue("Flag valid Config should be true now that the cloud_config is correct",
+                cloudConfigFactory.getCloudConfig().isValidCloudConfig());
+    }
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/resources/cloud_config.json b/adapters/mso-adapter-utils/src/test/resources/cloud_config.json
index ee3532f..ff24633 100644
--- a/adapters/mso-adapter-utils/src/test/resources/cloud_config.json
+++ b/adapters/mso-adapter-utils/src/test/resources/cloud_config.json
@@ -44,7 +44,8 @@
 			"tenant_metadata": true,
 			"identity_server_type": "KEYSTONE",
 			"identity_authentication_type": "USERNAME_PASSWORD"
-		}
+		},
+		"CS_service": {}
 
 	},
 	"cloud_sites":
@@ -76,8 +77,14 @@
 			"clli": "MTSNJA4LCP1",
 			"aic_version": "2.5",
 			"identity_service_id": "MTSNJA3DCP1"
+		},
+		"CS":
+		{
+			"region_id": "clliRegion",
+			"clli": "CS_clli",
+			"aic_version": "2.5",
+			"identity_service_id": "CS_service"
 		}
-
 	}
 }
 }
diff --git a/adapters/mso-adapter-utils/src/test/resources/cloud_default_config.json b/adapters/mso-adapter-utils/src/test/resources/cloud_default_config.json
new file mode 100644
index 0000000..35d18e9
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/cloud_default_config.json
@@ -0,0 +1,13 @@
+{
+  "cloud_config": {
+    "identity_services": {
+      "default_service": {}
+    },
+    "cloud_sites": {
+      "default": {
+        "region_id": "defaultRegion",
+        "identity_service_id": "default_service"
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
index 0699245..719aeb8 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
@@ -986,4 +986,31 @@
 
 		return requestId
 	}
+
+	/**
+	 * Remove all the empty nodes and attributes from the within the given node
+	 * @param node
+	 * @return true if all empty nodes and attributes were removed.
+	 */
+	public boolean cleanNode( Node node ) {
+		node.attributes().with { a ->
+			a.findAll { !it.value }.each { a.remove( it.key ) }
+		}
+		node.children().with { kids ->
+			kids.findAll { it instanceof Node ? !cleanNode( it ) : false }
+					.each { kids.remove( it ) }
+		}
+		node.attributes() || node.children() || node.text()
+	}
+
+	/**
+	 *
+	 * @param xml
+	 * @return String representation of xml after removing the empty nodes and attributes
+	 */
+	public String cleanNode(String xmlString) {
+		def xml = new XmlParser(false, false).parseText(xmlString)
+		cleanNode(xml)
+		return XmlUtil.serialize(xml)
+	}
 }
diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml
index b3edded..6884c1e 100644
--- a/bpmn/MSOCoreBPMN/pom.xml
+++ b/bpmn/MSOCoreBPMN/pom.xml
@@ -167,5 +167,11 @@
             <artifactId>status-control</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <version>3.8.0</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java
index e9da235..77e418d 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java
@@ -23,510 +23,432 @@
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.Expression;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.core.internal.VariableNameExtractor;
 
 /**
  * Base class for service tasks.
  */
 public class BaseTask implements JavaDelegate {
 
-	/**
-	 * Get the value of a required field.  This method throws
-	 * MissingInjectedFieldException if the expression is null, and
-	 * BadInjectedFieldException if the expression evaluates to a null
-	 * value.
-	 *
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the field value
-	 */
-	protected Object getField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		return getFieldImpl(expression, execution, fieldName, false);
-	}
-	
-	/**
-	 * Gets the value of an optional field.  There are three conditions
-	 * in which this method returns null:
-	 * <p>
-	 * <ol>
-	 * <li> The expression itself is null (i.e. the field is missing
-	 * altogether.</li>
-	 * <li>The expression evaluates to a null value.</li>
-	 * <li>The expression references a single variable which has not
-	 * been set.</li>
-	 * </ol>
-	 * <p>
-	 * Examples:<br>
-	 * Expression ${x} when x is null: return null<br>
-	 * Expression ${x} when x is unset: return null<br>
-	 * Expression ${x+y} when x and/or y are unset: exception<br>
-	 * 
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the field value, possibly null
-	 */
-	protected Object getOptionalField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		return getFieldImpl(expression, execution, fieldName, true);
-	}
-	
-	/**
-	 * Get the value of a required output variable field. This method
-	 * throws MissingInjectedFieldException if the expression is null, and
-	 * BadInjectedFieldException if the expression produces a null or
-	 * illegal variable name.  Legal variable names contain only letters,
-	 * numbers, and the underscore character ('_').
-	 *
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the output variable name
-	 */
-	protected String getOutputField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		Object o = getFieldImpl(expression, execution, fieldName, false);
-		if (o instanceof String) {
-			String variable = (String) o;
-			if (!isLegalVariable(variable)) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), "'" + variable
-						+ "' is not a legal variable name");
-			}
-			return variable;
-		} else {
-			throw new BadInjectedFieldException(
-				fieldName, getTaskName(), "expected a variable name string"
-					+ ", got object of type " + o.getClass().getName());
-		}
-	}
-	
-	/**
-	 * Get the value of an optional output variable field. This method
-	 * throws BadInjectedFieldException if the expression produces an illegal
-	 * variable name.  Legal variable names contain only letters, numbers,
-	 * and the underscore character ('_').
-	 * 
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the output variable name, possibly null
-	 */
-	protected String getOptionalOutputField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		Object o = getFieldImpl(expression, execution, fieldName, true);
-		if (o instanceof String) {
-			String variable = (String) o;
-			if (!isLegalVariable(variable)) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), "'" + variable
-						+ "' is not a legal variable name");
-			}
-			return variable;
-		} else if (o == null) {
-			return null;
-		} else {
-			throw new BadInjectedFieldException(
-				fieldName, getTaskName(), "expected a variable name string"
-					+ ", got object of type " + o.getClass().getName());
-		}
-	}
+    /**
+     * Get the value of a required field.  This method throws
+     * MissingInjectedFieldException if the expression is null, and
+     * BadInjectedFieldException if the expression evaluates to a null
+     * value.
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the field value
+     */
+    protected Object getField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        return getFieldImpl(expression, execution, fieldName, false);
+    }
 
-	/**
-	 * Get the value of a required string field.  This method throws
-	 * MissingInjectedFieldException if the expression is null, and
-	 * BadInjectedFieldException if the expression evaluates to a null
-	 * value.
-	 * <p>
-	 * Note: the result is coerced to a string value, if necessary.
-	 *
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the field value
-	 */
-	protected String getStringField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		Object o = getFieldImpl(expression, execution, fieldName, false);
-		if (o instanceof String) {
-			return (String) o;
-		} else {
-			throw new BadInjectedFieldException(
-				fieldName, getTaskName(), "cannot convert '" + o.toString()
-				+ "' to Integer");
-		}
-	}
-	
-	/**
-	 * Gets the value of an optional string field.  There are three conditions
-	 * in which this method returns null:
-	 * <p>
-	 * <ol>
-	 * <li> The expression itself is null (i.e. the field is missing
-	 * altogether.</li>
-	 * <li>The expression evaluates to a null value.</li>
-	 * <li>The expression references a single variable which has not
-	 * been set.</li>
-	 * </ol>
-	 * <p>
-	 * Examples:<br>
-	 * Expression ${x} when x is null: return null<br>
-	 * Expression ${x} when x is unset: return null<br>
-	 * Expression ${x+y} when x and/or y are unset: exception<br>
-	 * <p>
-	 * Note: the result is coerced to a string value, if necessary.
-	 * 
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the field value, possibly null
-	 */
-	protected String getOptionalStringField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		Object o = getFieldImpl(expression, execution, fieldName, true);
-		if (o instanceof String) {
-			return (String) o;
-		} else if (o == null) {
-			return null;
-		} else {
-			return o.toString();
-		}
-	}
-	
-	/**
-	 * Get the value of a required integer field. This method throws
-	 * MissingInjectedFieldException if the expression is null, and
-	 * BadInjectedFieldException if the expression evaluates to a null
-	 * value or a value that cannot be coerced to an integer.
-	 *
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the field value
-	 */
-	protected Integer getIntegerField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		Object o = getFieldImpl(expression, execution, fieldName, false);
-		if (o instanceof Integer) {
-			return (Integer) o;
-		} else {
-			try {
-				return Integer.parseInt(o.toString());
-			} catch (NumberFormatException e) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), "cannot convert '" + o.toString()
-					+ "' to Integer");
-			}
-		}
-	}
-	
-	/**
-	 * Gets the value of an optional integer field.  There are three conditions
-	 * in which this method returns null:
-	 * <p>
-	 * <ol>
-	 * <li> The expression itself is null (i.e. the field is missing
-	 * altogether.</li>
-	 * <li>The expression evaluates to a null value.</li>
-	 * <li>The expression references a single variable which has not
-	 * been set.</li>
-	 * </ol>
-	 * <p>
-	 * Examples:<br>
-	 * Expression ${x} when x is null: return null<br>
-	 * Expression ${x} when x is unset: return null<br>
-	 * Expression ${x+y} when x and/or y are unset: exception<br>
-	 * <p>
-	 * Note: the result is coerced to an integer value, if necessary. This
-	 * method throws BadInjectedFieldException if the result cannot be coerced
-	 * to an integer.
-	 * 
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the field value, possibly null
-	 */
-	protected Integer getOptionalIntegerField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		Object o = getFieldImpl(expression, execution, fieldName, true);
-		if (o instanceof Integer) {
-			return (Integer) o;
-		} else if (o == null) {
-			return null;
-		} else {
-			try {
-				return Integer.parseInt(o.toString());
-			} catch (NumberFormatException e) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), "cannot convert '" + o.toString()
-					+ "' to Integer");
-			}
-		}
-	}
-	
-	/**
-	 * Gets the value of an optional long field.  There are three conditions
-	 * in which this method returns null:
-	 * <p>
-	 * <ol>
-	 * <li> The expression itself is null (i.e. the field is missing
-	 * altogether.</li>
-	 * <li>The expression evaluates to a null value.</li>
-	 * <li>The expression references a single variable which has not
-	 * been set.</li>
-	 * </ol>
-	 * <p>
-	 * Examples:<br>
-	 * Expression ${x} when x is null: return null<br>
-	 * Expression ${x} when x is unset: return null<br>
-	 * Expression ${x+y} when x and/or y are unset: exception<br>
-	 * <p>
-	 * Note: the result is coerced to a long value, if necessary. This
-	 * method throws BadInjectedFieldException if the result cannot be coerced
-	 * to a long.
-	 * 
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the field value, possibly null
-	 */
-	protected Long getOptionalLongField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		Object o = getFieldImpl(expression, execution, fieldName, true);
-		if (o instanceof Long) {
-			return (Long) o;
-		} else if (o == null) {
-			return null;
-		} else {
-			try {
-				return Long.parseLong(o.toString());
-			} catch (NumberFormatException e) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), "cannot convert '" + o.toString()
-					+ "' to Long");
-			}
-		}
-	}
-	
-	/**
-	 * Get the value of a required long field. This method throws
-	 * MissingInjectedFieldException if the expression is null, and
-	 * BadInjectedFieldException if the expression evaluates to a null
-	 * value or a value that cannot be coerced to a long.
-	 *
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @return the field value
-	 */
-	protected Long getLongField(Expression expression,
-			DelegateExecution execution, String fieldName) {
-		Object o = getFieldImpl(expression, execution, fieldName, false);
-		if (o instanceof Long) {
-			return (Long) o;
-		} else {
-			try {
-				return Long.parseLong(o.toString());
-			} catch (NumberFormatException e) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), "cannot convert '" + o.toString()
-					+ "' to Long");
-			}
-		}
-	}
+    /**
+     * Gets the value of an optional field.  There are three conditions
+     * in which this method returns null:
+     * <p>
+     * <ol>
+     * <li> The expression itself is null (i.e. the field is missing
+     * altogether.</li>
+     * <li>The expression evaluates to a null value.</li>
+     * <li>The expression references a single variable which has not
+     * been set.</li>
+     * </ol>
+     * <p>
+     * Examples:<br>
+     * Expression ${x} when x is null: return null<br>
+     * Expression ${x} when x is unset: return null<br>
+     * Expression ${x+y} when x and/or y are unset: exception<br>
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the field value, possibly null
+     */
+    protected Object getOptionalField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        return getFieldImpl(expression, execution, fieldName, true);
+    }
 
-	/**
-	 * Common implementation for field "getter" methods.
-	 * @param expression the expression
-	 * @param execution the execution
-	 * @param fieldName the field name (for logging and exceptions)
-	 * @param optional true if the field is optional
-	 * @return the field value, possibly null
-	 */
-	private Object getFieldImpl(Expression expression,
-			DelegateExecution execution, String fieldName, boolean optional) {
-		if (expression == null) {
-			if (!optional) {
-				throw new MissingInjectedFieldException(
-					fieldName, getTaskName());
-			}
-			return null;
-		}
+    /**
+     * Get the value of a required output variable field. This method
+     * throws MissingInjectedFieldException if the expression is null, and
+     * BadInjectedFieldException if the expression produces a null or
+     * illegal variable name.  Legal variable names contain only letters,
+     * numbers, and the underscore character ('_').
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the output variable name
+     */
+    protected String getOutputField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        Object o = getFieldImpl(expression, execution, fieldName, false);
+        if (o instanceof String) {
+            String variable = (String) o;
+            if (!isLegalVariable(variable)) {
+                throw new BadInjectedFieldException(
+                        fieldName, getTaskName(), "'" + variable
+                        + "' is not a legal variable name");
+            }
+            return variable;
+        } else {
+            throw new BadInjectedFieldException(
+                    fieldName, getTaskName(), "expected a variable name string"
+                    + ", got object of type " + o.getClass().getName());
+        }
+    }
 
-		Object value;
+    /**
+     * Get the value of an optional output variable field. This method
+     * throws BadInjectedFieldException if the expression produces an illegal
+     * variable name.  Legal variable names contain only letters, numbers,
+     * and the underscore character ('_').
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the output variable name, possibly null
+     */
+    protected String getOptionalOutputField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        Object o = getFieldImpl(expression, execution, fieldName, true);
+        if (o instanceof String) {
+            String variable = (String) o;
+            if (!isLegalVariable(variable)) {
+                throw new BadInjectedFieldException(
+                        fieldName, getTaskName(), "'" + variable
+                        + "' is not a legal variable name");
+            }
+            return variable;
+        } else if (o == null) {
+            return null;
+        } else {
+            throw new BadInjectedFieldException(
+                    fieldName, getTaskName(), "expected a variable name string"
+                    + ", got object of type " + o.getClass().getName());
+        }
+    }
 
-		try {
-			value = expression.getValue(execution);
-		} catch (Exception e) {
-			if (!optional) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), e.getClass().getSimpleName(), e);
-			}
+    /**
+     * Get the value of a required string field.  This method throws
+     * MissingInjectedFieldException if the expression is null, and
+     * BadInjectedFieldException if the expression evaluates to a null
+     * value.
+     * <p>
+     * Note: the result is coerced to a string value, if necessary.
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the field value
+     */
+    protected String getStringField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        Object o = getFieldImpl(expression, execution, fieldName, false);
+        if (o instanceof String) {
+            return (String) o;
+        } else {
+            throw new BadInjectedFieldException(
+                    fieldName, getTaskName(), "cannot convert '" + o.toString()
+                    + "' to Integer");
+        }
+    }
 
-			// At this point, we have an exception that occurred while
-			// evaluating an expression for an optional field. A common 
-			// problem is that the expression is a simple reference to a
-			// variable which has never been set, e.g. the expression is
-			// ${x}. The normal activiti behavior is to throw an exception,
-			// but we don't like that, so we have the following workaround,
-			// which parses the expression text to see if it is a "simple"
-			// variable reference, and if so, returns null.  If the
-			// expression is anything other than a single variable
-			// reference, then an exception is thrown, as it would have
-			// been without this workaround.
+    /**
+     * Gets the value of an optional string field.  There are three conditions
+     * in which this method returns null:
+     * <p>
+     * <ol>
+     * <li> The expression itself is null (i.e. the field is missing
+     * altogether.</li>
+     * <li>The expression evaluates to a null value.</li>
+     * <li>The expression references a single variable which has not
+     * been set.</li>
+     * </ol>
+     * <p>
+     * Examples:<br>
+     * Expression ${x} when x is null: return null<br>
+     * Expression ${x} when x is unset: return null<br>
+     * Expression ${x+y} when x and/or y are unset: exception<br>
+     * <p>
+     * Note: the result is coerced to a string value, if necessary.
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the field value, possibly null
+     */
+    protected String getOptionalStringField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        Object o = getFieldImpl(expression, execution, fieldName, true);
+        if (o instanceof String) {
+            return (String) o;
+        } else if (o == null) {
+            return null;
+        } else {
+            return o.toString();
+        }
+    }
 
-			// Get the expression text so we can parse it
-			String s = expression.getExpressionText();
+    /**
+     * Get the value of a required integer field. This method throws
+     * MissingInjectedFieldException if the expression is null, and
+     * BadInjectedFieldException if the expression evaluates to a null
+     * value or a value that cannot be coerced to an integer.
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the field value
+     */
+    protected Integer getIntegerField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        Object o = getFieldImpl(expression, execution, fieldName, false);
+        if (o instanceof Integer) {
+            return (Integer) o;
+        } else {
+            try {
+                return Integer.parseInt(o.toString());
+            } catch (NumberFormatException e) {
+                throw new BadInjectedFieldException(
+                        fieldName, getTaskName(), "cannot convert '" + o.toString()
+                        + "' to Integer");
+            }
+        }
+    }
 
-//			if (isDebugEnabled(execution)) {
-//				logDebug(execution, getTaskName() + " field '" + fieldName
-//					+ "' expression evaluation failed: " + s);
-//			}
+    /**
+     * Gets the value of an optional integer field.  There are three conditions
+     * in which this method returns null:
+     * <p>
+     * <ol>
+     * <li> The expression itself is null (i.e. the field is missing
+     * altogether.</li>
+     * <li>The expression evaluates to a null value.</li>
+     * <li>The expression references a single variable which has not
+     * been set.</li>
+     * </ol>
+     * <p>
+     * Examples:<br>
+     * Expression ${x} when x is null: return null<br>
+     * Expression ${x} when x is unset: return null<br>
+     * Expression ${x+y} when x and/or y are unset: exception<br>
+     * <p>
+     * Note: the result is coerced to an integer value, if necessary. This
+     * method throws BadInjectedFieldException if the result cannot be coerced
+     * to an integer.
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the field value, possibly null
+     */
+    protected Integer getOptionalIntegerField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        Object o = getFieldImpl(expression, execution, fieldName, true);
+        if (o instanceof Integer) {
+            return (Integer) o;
+        } else if (o == null) {
+            return null;
+        } else {
+            try {
+                return Integer.parseInt(o.toString());
+            } catch (NumberFormatException e) {
+                throw new BadInjectedFieldException(
+                        fieldName, getTaskName(), "cannot convert '" + o.toString()
+                        + "' to Integer");
+            }
+        }
+    }
 
-			int len = s.length();
-			int i = 0;
+    /**
+     * Gets the value of an optional long field.  There are three conditions
+     * in which this method returns null:
+     * <p>
+     * <ol>
+     * <li> The expression itself is null (i.e. the field is missing
+     * altogether.</li>
+     * <li>The expression evaluates to a null value.</li>
+     * <li>The expression references a single variable which has not
+     * been set.</li>
+     * </ol>
+     * <p>
+     * Examples:<br>
+     * Expression ${x} when x is null: return null<br>
+     * Expression ${x} when x is unset: return null<br>
+     * Expression ${x+y} when x and/or y are unset: exception<br>
+     * <p>
+     * Note: the result is coerced to a long value, if necessary. This
+     * method throws BadInjectedFieldException if the result cannot be coerced
+     * to a long.
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the field value, possibly null
+     */
+    protected Long getOptionalLongField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        Object o = getFieldImpl(expression, execution, fieldName, true);
+        if (o instanceof Long) {
+            return (Long) o;
+        } else if (o == null) {
+            return null;
+        } else {
+            try {
+                return Long.parseLong(o.toString());
+            } catch (NumberFormatException e) {
+                throw new BadInjectedFieldException(
+                        fieldName, getTaskName(), "cannot convert '" + o.toString()
+                        + "' to Long");
+            }
+        }
+    }
 
-			// Skip whitespace
-			while (i < len && Character.isWhitespace(s.charAt(i))) {
-				i++;
-			}
+    /**
+     * Get the value of a required long field. This method throws
+     * MissingInjectedFieldException if the expression is null, and
+     * BadInjectedFieldException if the expression evaluates to a null
+     * value or a value that cannot be coerced to a long.
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @return the field value
+     */
+    protected Long getLongField(Expression expression,
+            DelegateExecution execution, String fieldName) {
+        Object o = getFieldImpl(expression, execution, fieldName, false);
+        if (o instanceof Long) {
+            return (Long) o;
+        } else {
+            try {
+                return Long.parseLong(o.toString());
+            } catch (NumberFormatException e) {
+                throw new BadInjectedFieldException(
+                        fieldName, getTaskName(), "cannot convert '" + o.toString()
+                        + "' to Long");
+            }
+        }
+    }
 
-			// Next character must be '$'
-			if (i == len || s.charAt(i++) != '$') {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), e.getClass().getSimpleName(), e);
-			}
+    /**
+     * Common implementation for field "getter" methods.
+     *
+     * @param expression the expression
+     * @param execution the execution
+     * @param fieldName the field name (for logging and exceptions)
+     * @param optional true if the field is optional
+     * @return the field value, possibly null
+     */
+    private Object getFieldImpl(Expression expression,
+            DelegateExecution execution, String fieldName, boolean optional) {
+        if (expression == null) {
+            if (!optional) {
+                throw new MissingInjectedFieldException(
+                        fieldName, getTaskName());
+            }
+            return null;
+        }
 
-			// Skip whitespace
-			while (i < len && Character.isWhitespace(s.charAt(i))) {
-				i++;
-			}
+        Object value = null;
 
-			// Next character must be '{'
-			if (i == len || s.charAt(i++) != '{') {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), e.getClass().getSimpleName(), e);
-			}
+        try {
+            value = expression.getValue(execution);
+        } catch (Exception e) {
+            if (!optional) {
+                throw new BadInjectedFieldException(
+                        fieldName, getTaskName(), e.getClass().getSimpleName(), e);
+            }
 
-			// Skip whitespace
-			while (i < len && Character.isWhitespace(s.charAt(i))) {
-				i++;
-			}
+            // At this point, we have an exception that occurred while
+            // evaluating an expression for an optional field. A common
+            // problem is that the expression is a simple reference to a
+            // variable which has never been set, e.g. the expression is
+            // ${x}. The normal activiti behavior is to throw an exception,
+            // but we don't like that, so we have the following workaround,
+            // which parses the expression text to see if it is a "simple"
+            // variable reference, and if so, returns null.  If the
+            // expression is anything other than a single variable
+            // reference, then an exception is thrown, as it would have
+            // been without this workaround.
 
-			// Collect the variable name
-			StringBuilder variable = new StringBuilder();
-			while (i < len && isWordCharacter(s.charAt(i))) {
-				variable.append(s.charAt(i));
-				i++;
-			}
+            // Get the expression text so we can parse it
+            String s = expression.getExpressionText();
+            new VariableNameExtractor(s).extract().ifPresent(name -> {
+                if (execution.hasVariable(name)) {
+                    throw new BadInjectedFieldException(
+                            fieldName, getTaskName(), e.getClass().getSimpleName(), e);
+                }
+            });
+        }
 
-			if (variable.length() == 0) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), e.getClass().getSimpleName(), e);
-			}
+        if (value == null && !optional) {
+            throw new BadInjectedFieldException(
+                    fieldName, getTaskName(), "required field has null value");
+        }
 
-			// Skip whitespace
-			while (i < len && Character.isWhitespace(s.charAt(i))) {
-				i++;
-			}
+        return value;
+    }
 
-			// Next character must be '}'
-			if (i == len || s.charAt(i++) != '}') {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), e.getClass().getSimpleName(), e);
-			}
+    /**
+     * Tests if a character is a "word" character.
+     *
+     * @param c the character
+     * @return true if the character is a "word" character.
+     */
+    private static boolean isWordCharacter(char c) {
+        return (Character.isLetterOrDigit(c) || c == '_');
+    }
 
-			// Skip whitespace
-			while (i < len && Character.isWhitespace(s.charAt(i))) {
-				i++;
-			}
+    /**
+     * Tests if the specified string is a legal flow variable name.
+     *
+     * @param name the string
+     * @return true if the string is a legal flow variable name
+     */
+    private boolean isLegalVariable(String name) {
+        if (name == null) {
+            return false;
+        }
 
-			// Must be at end of string
-			if (i != len) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), e.getClass().getSimpleName(), e);
-			}
+        int len = name.length();
 
-//			if (isDebugEnabled(execution)) {
-//				logDebug(execution, "Checking if variable '"
-//					+ variable.toString() + "' exists");
-//			}
+        if (len == 0) {
+            return false;
+        }
 
-			// If the variable exists then the problem was
-			// something else...
-			if (execution.hasVariable(variable.toString())) {
-				throw new BadInjectedFieldException(
-					fieldName, getTaskName(), e.getClass().getSimpleName(), e);
-			}
+        char c = name.charAt(0);
 
-			// The variable doesn't exist.
+        if (!Character.isLetter(c) && c != '_') {
+            return false;
+        }
 
-//			if (isDebugEnabled(execution)) {
-//				logDebug(execution, "Variable '" + variable.toString()
-//					+ "' does not exist [ok]");
-//			}
+        for (int i = 1; i < len; i++) {
+            c = name.charAt(i);
+            if (!Character.isLetterOrDigit(c) && c != '_') {
+                return false;
+            }
+        }
 
-			value = null;
-		}
+        return true;
+    }
 
-		if (value == null && !optional) {
-			throw new BadInjectedFieldException(
-				fieldName, getTaskName(), "required field has null value");
-		}
-	
-		return value;
-	}
-	
-	/**
-	 * Tests if a character is a "word" character.
-	 * @param c the character
-	 * @return true if the character is a "word" character.
-	 */
-	private boolean isWordCharacter(char c) {
-		return (Character.isLetterOrDigit(c) || c == '_');
-	}
-	
-	/**
-	 * Tests if the specified string is a legal flow variable name.
-	 * @param name the string
-	 * @return true if the string is a legal flow variable name
-	 */
-	private boolean isLegalVariable(String name) {
-		if (name == null) {
-			return false;
-		}
+    /**
+     * Returns the name of the task (normally the java class name).
+     *
+     * @return the name of the task
+     */
+    public String getTaskName() {
+        return getClass().getSimpleName();
+    }
 
-		int len = name.length();
-
-		if (len == 0) {
-			return false;
-		}
-
-		char c = name.charAt(0);
-
-		if (!Character.isLetter(c) && c != '_') {
-			return false;
-		}
-
-		for (int i = 1; i < len; i++) {
-			c = name.charAt(i);
-			if (!Character.isLetterOrDigit(c) && c != '_') {
-				return false;
-			}
-		}
-
-		return true;
-	}
-	
-	/**
-	 * Returns the name of the task (normally the java class name).
-	 * @return the name of the task
-	 */
-	public String getTaskName() {
-		return getClass().getSimpleName();
-	}
-
-	@Override
-	public void execute(DelegateExecution execution) throws Exception {	}
+    @Override
+    public void execute(DelegateExecution execution) throws Exception {
+    }
 }
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java
new file mode 100644
index 0000000..e1aaba7
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.core.internal;
+
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Extracts variable name from expression if entire expression is just
+ * one variable, for example "${x}".
+ *
+ * Ignores all whitespaces, except inside variable name.
+ *
+ * Examples:
+ * "${x}", extracted variable name is "x"
+ * " ${\t weird_NAME    }", extracted variable name is "weird_NAME"
+ * "${incorrect name}", no extracted name
+ * "${two}+${two}", no extracted name
+ */
+public class VariableNameExtractor {
+
+    private static final Pattern VARIABLE_NAME_PATTERN = Pattern
+            .compile("^\\s*\\$\\s*\\{\\s*([a-zA-Z0-9_]+)\\s*\\}\\s*$");
+
+    private final String expression;
+
+
+    /**
+     * Creates new VariableNameExtractor
+     * @param expression expression to be parsed
+     */
+    public VariableNameExtractor(String expression) {
+        this.expression = expression;
+    }
+
+    /**
+     * Extracts variable name from expression given in constructor
+     * @return Optional of variable name, empty if expression wasn't single variable
+     */
+    public Optional<String> extract() {
+        Matcher matcher = VARIABLE_NAME_PATTERN.matcher(expression);
+        if (!matcher.matches()) {
+            return Optional.empty();
+        }
+        return Optional.of(matcher.group(1));
+    }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java
new file mode 100644
index 0000000..57f479f
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java
@@ -0,0 +1,86 @@
+/*-
+ * ============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.core.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Optional;
+import org.junit.Test;
+
+public class VariableNameExtractorTest {
+
+    @Test
+    public void shouldExtractVariableName() throws Exception {
+        // given
+        String name = "A_different_NAME123";
+        String variable = "${A_different_NAME123}";
+        VariableNameExtractor extractor = new VariableNameExtractor(variable);
+        // when
+        Optional<String> extracted = extractor.extract();
+        // then
+        assertThat(extracted).isPresent().contains(name);
+    }
+
+    @Test
+    public void shouldExtractVariableNameFromWhitespaces() throws Exception {
+        // given
+        String name = "name";
+        String variable = " \n\t$ \n\t{ \n\tname \n\t} \n\t";
+        VariableNameExtractor extractor = new VariableNameExtractor(variable);
+        // when
+        Optional<String> extracted = extractor.extract();
+        // then
+        assertThat(extracted).isPresent().contains(name);
+    }
+
+    @Test
+    public void shouldReturnEmptyIfThereIsMoreThanVariable() throws Exception {
+        // given
+        String variable = "a ${test}";
+        VariableNameExtractor extractor = new VariableNameExtractor(variable);
+        // when
+        Optional<String> extracted = extractor.extract();
+        // then
+        assertThat(extracted).isNotPresent();
+    }
+
+    @Test
+    public void shouldReturnEmptyIfVariableNameIsIncorrect() throws Exception {
+        // given
+        String variable = "${name with space}";
+        VariableNameExtractor extractor = new VariableNameExtractor(variable);
+        // when
+        Optional<String> extracted = extractor.extract();
+        // then
+        assertThat(extracted).isNotPresent();
+    }
+
+    @Test
+    public void shouldReturnEmptyIfTwoVariablesPresent() throws Exception {
+        // given
+        String variable = "${var1} ${var2}";
+        VariableNameExtractor extractor = new VariableNameExtractor(variable);
+        // when
+        Optional<String> extracted = extractor.extract();
+        // then
+        assertThat(extracted).isNotPresent();
+    }
+}
\ No newline at end of file
diff --git a/bpmn/MSORESTClient/pom.xml b/bpmn/MSORESTClient/pom.xml
index dead7d0..c17015c 100644
--- a/bpmn/MSORESTClient/pom.xml
+++ b/bpmn/MSORESTClient/pom.xml
@@ -22,11 +22,6 @@
 			<artifactId>httpmime</artifactId>
 			<version>4.5</version>
 		</dependency>
-		<dependency>
-			<groupId>com.metaparadigm</groupId>
-			<artifactId>json-rpc</artifactId>
-			<version>1.0</version>
-		</dependency>
 
 		<dependency>
 			<groupId>org.mockito</groupId>
diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml
index 8b663c1..0dc9e34 100644
--- a/mso-catalog-db/pom.xml
+++ b/mso-catalog-db/pom.xml
@@ -171,5 +171,11 @@
 			<artifactId>common</artifactId>
 			<version>${project.version}</version>
 		</dependency>
-	</dependencies>
+        <dependency>
+            <groupId>org.jmockit</groupId>
+            <artifactId>jmockit</artifactId>
+            <version>1.8</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 </project>
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
index dd60bc7..cdde98d 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
@@ -155,29 +155,29 @@
      * @return A list of HeatTemplate objects
      */
     @SuppressWarnings("unchecked")
-    public List <HeatTemplate> getAllHeatTemplates () {
-        long startTime = System.currentTimeMillis ();
-        LOGGER.debug ("Catalog database - get all Heat templates");
+    public List <HeatTemplate> getAllHeatTemplates() {
+        long startTime = System.currentTimeMillis();
+        LOGGER.debug("Catalog database - get all Heat templates");
         String hql = "FROM HeatTemplate";
-        Query query = getSession ().createQuery (hql);
+        Query query = getSession().createQuery(hql);
 
-        List <HeatTemplate> result = query.list ();
-        LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllHeatTemplates", null);
+        List <HeatTemplate> result = query.list();
+        LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllHeatTemplates", null);
         return result;
     }
 
     /**
      * Fetch a specific Heat Template by ID.
      *
-     * @param templateId
+     * @param templateId template id
      * @return HeatTemplate object or null if none found
      */
     @Deprecated
-    public HeatTemplate getHeatTemplate (int templateId) {
-        long startTime = System.currentTimeMillis ();
+    public HeatTemplate getHeatTemplate(int templateId) {
+        long startTime = System.currentTimeMillis();
         LOGGER.debug ("Catalog database - get Heat template with id " + templateId);
 
-        HeatTemplate template = (HeatTemplate) getSession ().get (HeatTemplate.class, templateId);
+        HeatTemplate template = (HeatTemplate) getSession().get(HeatTemplate.class, templateId);
         LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null);
         return template;
     }
@@ -185,31 +185,31 @@
     /**
      * Return the newest version of a specific Heat Template (queried by Name).
      *
-     * @param templateName
+     * @param templateName template name
      * @return HeatTemplate object or null if none found
      */
-    public HeatTemplate getHeatTemplate (String templateName) {
+    public HeatTemplate getHeatTemplate(String templateName) {
 
-        long startTime = System.currentTimeMillis ();
-        LOGGER.debug ("Catalog database - get Heat template with name " + templateName);
+        long startTime = System.currentTimeMillis();
+        LOGGER.debug("Catalog database - get Heat template with name " + templateName);
 
         String hql = "FROM HeatTemplate WHERE templateName = :template_name";
-        Query query = getSession ().createQuery (hql);
-        query.setParameter ("template_name", templateName);
+        Query query = getSession().createQuery (hql);
+        query.setParameter("template_name", templateName);
 
         @SuppressWarnings("unchecked")
-        List <HeatTemplate> resultList = query.list ();
+        List <HeatTemplate> resultList = query.list();
 
         // See if something came back. Name is unique, so
         if (resultList.isEmpty ()) {
             LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No template found", "CatalogDB", "getHeatTemplate", null);
             return null;
         }
-        Collections.sort (resultList, new MavenLikeVersioningComparator ());
-        Collections.reverse (resultList);
+        Collections.sort(resultList, new MavenLikeVersioningComparator());
+        Collections.reverse(resultList);
 
-        LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null);
-        return resultList.get (0);
+        LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null);
+        return resultList.get(0);
     }
 
     /**
diff --git a/mso-catalog-db/src/main/resources/ServiceToResourceCustomization.hbm.xml b/mso-catalog-db/src/main/resources/ServiceToResourceCustomization.hbm.xml
index d806b48..cd37fc9 100644
--- a/mso-catalog-db/src/main/resources/ServiceToResourceCustomization.hbm.xml
+++ b/mso-catalog-db/src/main/resources/ServiceToResourceCustomization.hbm.xml
@@ -29,11 +29,11 @@
 		<composite-id>
 			<key-property name="modelType"  					type="string" column="MODEL_TYPE" length="20" />
 			<key-property name="resourceModelCustomizationUUID" type="string" column="RESOURCE_MODEL_CUSTOMIZATION_UUID" length="200" />
+			<key-property name="serviceModelUUID" 				type="string" column="SERVICE_MODEL_UUID" length="200" />
 		</composite-id>
 		<property name="created" type="timestamp" generated="insert" update="false" insert="false" not-null="true">
           <column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
         </property>
-		<property name="serviceModelUUID" 				type="string" column="SERVICE_MODEL_UUID" length="200" not-null="true"/>
 
 	</class>
 </hibernate-mapping>
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
index a00079d..9b0f120 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
@@ -20,16 +20,59 @@
 
 package org.openecomp.mso.db.catalog.test;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Connection;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
+import mockit.Mock;
+import mockit.MockUp;
+import org.hibernate.CacheMode;
+import org.hibernate.Criteria;
+import org.hibernate.Filter;
+import org.hibernate.FlushMode;
+import org.hibernate.HibernateException;
+import org.hibernate.IdentifierLoadAccess;
+import org.hibernate.LobHelper;
+import org.hibernate.LockMode;
+import org.hibernate.LockOptions;
+import org.hibernate.NaturalIdLoadAccess;
+import org.hibernate.Query;
+import org.hibernate.ReplicationMode;
+import org.hibernate.SQLQuery;
+import org.hibernate.ScrollMode;
+import org.hibernate.ScrollableResults;
+import org.hibernate.Session;
+import org.hibernate.SessionEventListener;
+import org.hibernate.SessionFactory;
+import org.hibernate.SharedSessionBuilder;
+import org.hibernate.SimpleNaturalIdLoadAccess;
+import org.hibernate.Transaction;
+import org.hibernate.TypeHelper;
+import org.hibernate.UnknownProfileException;
+import org.hibernate.jdbc.ReturningWork;
+import org.hibernate.jdbc.Work;
+import org.hibernate.metamodel.source.annotations.xml.mocker.MockHelper;
+import org.hibernate.procedure.ProcedureCall;
+import org.hibernate.stat.SessionStatistics;
+import org.hibernate.transform.ResultTransformer;
+import org.hibernate.type.Type;
 import org.junit.Before;
 import org.junit.Test;
 import org.openecomp.mso.db.catalog.CatalogDatabase;
@@ -58,268 +101,370 @@
 
 public class CatalogDatabaseTest {
 
-	CatalogDatabase cd = null;
-	
-	@Before
-	public void setup(){
-		cd = CatalogDatabase.getInstance();
-	}
-	@Test(expected = Exception.class)
-	public void getAllHeatTemplatesTestException(){
-		List <HeatTemplate> list = cd.getAllHeatTemplates();
-	}
-	
-	@Test(expected = Exception.class)
-	public void getHeatTemplateTestException(){
-		HeatTemplate ht = cd.getHeatTemplate(10);
-	}
-	
-	@Test(expected = Exception.class)
-	public void getHeatTemplateTest2Exception(){
-		HeatTemplate ht = cd.getHeatTemplate("heat123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getHeatTemplateTest3Exception(){
-		HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getHeatTemplateByArtifactUuidException(){
-		HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getHeatTemplateByArtifactUuidRegularQueryException(){
-		HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getParametersForHeatTemplateTestException(){
-		List<HeatTemplateParam> ht = cd.getParametersForHeatTemplate("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getHeatEnvironmentByArtifactUuidTestException(){
-		HeatEnvironment ht = cd.getHeatEnvironmentByArtifactUuid("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getServiceByInvariantUUIDTestException(){
-		Service ht = cd.getServiceByInvariantUUID("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getServiceTestException(){
-		Service ht = cd.getService("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getServiceByModelUUIDTestException(){
-		Service ht = cd.getServiceByModelUUID("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getService2TestException(){
-		HashMap<String, String> map = new HashMap<>();
-		map.put("serviceNameVersionId", "v2");
-		Service ht = cd.getService(map, "123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getServiceByModelNameTestException(){
-		Service ht = cd.getServiceByModelName("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getServiceByVersionAndInvariantIdTestException() throws Exception{
-		Service ht = cd.getServiceByVersionAndInvariantId("123","tetwe");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getServiceRecipeTestException() throws Exception{
-		ServiceRecipe ht = cd.getServiceRecipe("123","tetwe");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getServiceRecipeByServiceModelUuidTestException() throws Exception{
-		ServiceRecipe ht = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getServiceRecipesTestException() throws Exception{
-		List<ServiceRecipe> ht = cd.getServiceRecipes("123");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getVnfComponentTestException() throws Exception{
-		VnfComponent ht = cd.getVnfComponent(123,"vnf");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getVnfResourceTestException() throws Exception{
-		VnfResource ht = cd.getVnfResource("vnf");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getVnfResource2TestException() throws Exception{
-		VnfResource ht = cd.getVnfResource("vnf","3992");
-	}
-	
-	@Test(expected = Exception.class)
-	public void getVnfResourceByModelCustomizationIdTestException() throws Exception{
-		VnfResource ht = cd.getVnfResourceByModelCustomizationId("3992");
-	}
+    CatalogDatabase cd = null;
+
+    @Before
+    public void setup(){
+        cd = CatalogDatabase.getInstance();
+    }
+
+
+    @Test
+    public void getAllHeatTemplatesTest(){
+
+        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+            @Mock
+            public List<HeatTemplate> list() {
+                HeatTemplate heatTemplate = new HeatTemplate();
+                return Arrays.asList(heatTemplate);
+            }
+        };
+
+        MockUp<Session> mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+
+        List <HeatTemplate> list = cd.getAllHeatTemplates();
+        assertEquals(list.size(), 1);
+    }
+
+    @Test
+    public void getHeatTemplateByIdTest(){
+
+        MockUp<Session> mockedSession = new MockUp<Session>() {
+            @Mock
+            public Object get(Class cls, Serializable id) {
+                HeatTemplate heatTemplate = new HeatTemplate();
+                heatTemplate.setAsdcUuid("123-uuid");
+                return heatTemplate;
+            }
+        };
+
+        new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+
+        HeatTemplate ht = cd.getHeatTemplate(10);
+        assertEquals("123-uuid", ht.getAsdcUuid());
+    }
+
+    @Test
+    public void getHeatTemplateByNameEmptyListTest(){
+
+        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+            @Mock
+            public List<HeatTemplate> list() {
+                HeatTemplate heatTemplate = new HeatTemplate();
+                return Arrays.asList();
+            }
+        };
+
+        MockUp<Session> mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+
+        HeatTemplate ht = cd.getHeatTemplate("heat123");
+        assertEquals(null, ht);
+    }
+
+    @Test
+    public void getHeatTemplateByNameTest(){
+
+        MockUp<Query> mockUpQuery = new MockUp<Query>() {
+            @Mock
+            public List<HeatTemplate> list() {
+                HeatTemplate heatTemplate1 = new HeatTemplate();
+                heatTemplate1.setAsdcUuid("123-uuid");
+                heatTemplate1.setVersion("1.2");
+                HeatTemplate heatTemplate2 = new HeatTemplate();
+                heatTemplate2.setAsdcUuid("456-uuid");
+                heatTemplate2.setVersion("1.3");
+                return Arrays.asList(heatTemplate1, heatTemplate2);
+            }
+        };
+
+        MockUp<Session> mockedSession = new MockUp<Session>() {
+            @Mock
+            public Query createQuery(String hql) {
+                return mockUpQuery.getMockInstance();
+            }
+        };
+
+        new MockUp<CatalogDatabase>() {
+            @Mock
+            private Session getSession() {
+                return mockedSession.getMockInstance();
+            }
+        };
+
+        HeatTemplate ht = cd.getHeatTemplate("heat123");
+        assertEquals("456-uuid", ht.getAsdcUuid());
+    }
 
     @Test(expected = Exception.class)
-	public void getServiceRecipeTest2Exception() throws Exception{
-		ServiceRecipe ht = cd.getServiceRecipe(1001,"3992");
-	}
-    
+    public void getHeatTemplateTest3Exception(){
+        HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
+    }
+
+    @Test(expected = Exception.class)
+    public void getHeatTemplateByArtifactUuidException(){
+        HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getHeatTemplateByArtifactUuidRegularQueryException(){
+        HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getParametersForHeatTemplateTestException(){
+        List<HeatTemplateParam> ht = cd.getParametersForHeatTemplate("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getHeatEnvironmentByArtifactUuidTestException(){
+        HeatEnvironment ht = cd.getHeatEnvironmentByArtifactUuid("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceByInvariantUUIDTestException(){
+        Service ht = cd.getServiceByInvariantUUID("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceTestException(){
+        Service ht = cd.getService("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceByModelUUIDTestException(){
+        Service ht = cd.getServiceByModelUUID("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getService2TestException(){
+        HashMap<String, String> map = new HashMap<>();
+        map.put("serviceNameVersionId", "v2");
+        Service ht = cd.getService(map, "123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceByModelNameTestException(){
+        Service ht = cd.getServiceByModelName("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceByVersionAndInvariantIdTestException() throws Exception{
+        Service ht = cd.getServiceByVersionAndInvariantId("123","tetwe");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceRecipeTestException() throws Exception{
+        ServiceRecipe ht = cd.getServiceRecipe("123","tetwe");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceRecipeByServiceModelUuidTestException() throws Exception{
+        ServiceRecipe ht = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceRecipesTestException() throws Exception{
+        List<ServiceRecipe> ht = cd.getServiceRecipes("123");
+    }
+
+    @Test(expected = Exception.class)
+    public void getVnfComponentTestException() throws Exception{
+        VnfComponent ht = cd.getVnfComponent(123,"vnf");
+    }
+
+    @Test(expected = Exception.class)
+    public void getVnfResourceTestException() throws Exception{
+        VnfResource ht = cd.getVnfResource("vnf");
+    }
+
+    @Test(expected = Exception.class)
+    public void getVnfResource2TestException() throws Exception{
+        VnfResource ht = cd.getVnfResource("vnf","3992");
+    }
+
+    @Test(expected = Exception.class)
+    public void getVnfResourceByModelCustomizationIdTestException() throws Exception{
+        VnfResource ht = cd.getVnfResourceByModelCustomizationId("3992");
+    }
+
+    @Test(expected = Exception.class)
+    public void getServiceRecipeTest2Exception() throws Exception{
+        ServiceRecipe ht = cd.getServiceRecipe(1001,"3992");
+    }
+
     @Test(expected = Exception.class)
     public void getVnfResourceCustomizationByModelCustomizationNameTestException(){
-    	VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
+        VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
     }
-    
+
     @Test(expected = Exception.class)
     public void getVnfResourceByModelInvariantIdTestException(){
-    	VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+        VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
     }
-    
+
     @Test(expected = Exception.class)
     public void getVnfResourceByIdTestException(){
-    	VnfResource vnf = cd.getVnfResourceById(19299);
+        VnfResource vnf = cd.getVnfResourceById(19299);
     }
-    
+
     @Test(expected = Exception.class)
     public void getVfModuleModelNameTestException(){
-    	VfModule vnf = cd.getVfModuleModelName("tetes");
+        VfModule vnf = cd.getVfModuleModelName("tetes");
     }
-    
+
     @Test(expected = Exception.class)
     public void getVfModuleModelName2TestException(){
-    	VfModule vnf = cd.getVfModuleModelName("tetes","4kidsl");
+        VfModule vnf = cd.getVfModuleModelName("tetes","4kidsl");
     }
-    
+
     @Test(expected = Exception.class)
     public void ggetVfModuleCustomizationByModelNameTestException(){
-    	VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelName("tetes");
+        VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelName("tetes");
     }
-    
+
     @Test(expected = Exception.class)
     public void getNetworkResourceTestException(){
-    	NetworkResource vnf = cd.getNetworkResource("tetes");
+        NetworkResource vnf = cd.getNetworkResource("tetes");
     }
-    
+
     @Test(expected = Exception.class)
     public void getVnfRecipeTestException(){
-    	VnfRecipe vnf = cd.getVnfRecipe("tetes","ergfedrf","4993493");
+        VnfRecipe vnf = cd.getVnfRecipe("tetes","ergfedrf","4993493");
     }
-    
+
     @Test(expected = Exception.class)
     public void getVnfRecipe2TestException(){
-    	VnfRecipe vnf = cd.getVnfRecipe("tetes","4993493");
+        VnfRecipe vnf = cd.getVnfRecipe("tetes","4993493");
     }
-    
+
     @Test(expected = Exception.class)
     public void getVnfRecipeByVfModuleIdTestException(){
-    	VnfRecipe vnf = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
+        VnfRecipe vnf = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
     }
-    
+
     @Test(expected = Exception.class)
     public void getVfModuleTypeTestException(){
-    	VfModule vnf = cd.getVfModuleType("4993493");
+        VfModule vnf = cd.getVfModuleType("4993493");
     }
-    
+
     @Test(expected = Exception.class)
     public void getVfModuleType2TestException(){
-    	VfModule vnf = cd.getVfModuleType("4993493","vnf");
+        VfModule vnf = cd.getVfModuleType("4993493","vnf");
     }
     @Test(expected = Exception.class)
     public void getVnfResourceByServiceUuidTestException(){
-    	VnfResource vnf = cd.getVnfResourceByServiceUuid("4993493");
+        VnfResource vnf = cd.getVnfResourceByServiceUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVnfResourceByVnfUuidTestException(){
-    	VnfResource vnf = cd.getVnfResourceByVnfUuid("4993493");
+        VnfResource vnf = cd.getVnfResourceByVnfUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVfModuleByModelInvariantUuidTestException(){
-    	VfModule vnf = cd.getVfModuleByModelInvariantUuid("4993493");
+        VfModule vnf = cd.getVfModuleByModelInvariantUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVfModuleByModelCustomizationUuidTestException(){
-    	VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493");
+        VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){
-    	VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf");
+        VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf");
     }
     @Test(expected = Exception.class)
     public void getVfModuleCustomizationByModelCustomizationIdTestException(){
-    	VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493");
+        VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493");
     }
     @Test(expected = Exception.class)
     public void getVfModuleByModelUuidTestException(){
-    	VfModule vnf = cd.getVfModuleByModelUuid("4993493");
+        VfModule vnf = cd.getVfModuleByModelUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){
-    	VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493");
+        VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVnfResourceCustomizationByModelVersionIdTestException(){
-    	VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493");
+        VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493");
     }
     @Test(expected = Exception.class)
     public void getVfModuleByModelCustomizationIdAndVersionTestException(){
-    	cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test");
+        cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test");
     }
     @Test(expected = Exception.class)
     public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){
-    	cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test");
+        cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test");
     }
     @Test(expected = Exception.class)
     public void getVnfResourceCustomizationByModelInvariantIdTest(){
-    	cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test");
+        cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test");
     }
     @Test(expected = Exception.class)
     public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){
-    	cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493");
+        cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){
-    	cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test");
+        cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test");
     }
     @Test(expected = Exception.class)
     public void getAllVfModuleCustomizationstest(){
-    	cd.getAllVfModuleCustomizations("4993493");
+        cd.getAllVfModuleCustomizations("4993493");
     }
     @Test(expected = Exception.class)
     public void getVnfResourceByModelUuidTest(){
-    	cd.getVnfResourceByModelUuid("4993493");
+        cd.getVnfResourceByModelUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVnfResCustomToVfModuleTest(){
-    	cd.getVnfResCustomToVfModule("4993493","test");
+        cd.getVnfResCustomToVfModule("4993493","test");
     }
     @Test(expected = Exception.class)
     public void getVfModulesForVnfResourceTest(){
-    	VnfResource vnfResource = new VnfResource();
-    	vnfResource.setModelUuid("48839");
-    	cd.getVfModulesForVnfResource(vnfResource);
+        VnfResource vnfResource = new VnfResource();
+        vnfResource.setModelUuid("48839");
+        cd.getVfModulesForVnfResource(vnfResource);
     }
     @Test(expected = Exception.class)
     public void getVfModulesForVnfResource2Test(){
-    	cd.getVfModulesForVnfResource("4993493");
+        cd.getVfModulesForVnfResource("4993493");
     }
     @Test(expected = Exception.class)
     public void getServiceByUuidTest(){
-    	cd.getServiceByUuid("4993493");
+        cd.getServiceByUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getNetworkResourceById2Test(){
-    	cd.getNetworkResourceById(4993493);
+        cd.getNetworkResourceById(4993493);
     }
     @Test(expected = Exception.class)
     public void getNetworkResourceByIdTest(){
@@ -327,431 +472,431 @@
     }
     @Test
     public void isEmptyOrNullTest(){
-    	boolean is = cd.isEmptyOrNull("4993493");
-    	assertFalse(is);
+        boolean is = cd.isEmptyOrNull("4993493");
+        assertFalse(is);
     }
     @Test(expected = Exception.class)
     public void getSTRTest(){
-    	cd.getSTR("4993493","test","vnf");
+        cd.getSTR("4993493","test","vnf");
     }
     @Test(expected = Exception.class)
     public void getVRCtoVFMCTest(){
-    	cd.getVRCtoVFMC("4993493","388492");
+        cd.getVRCtoVFMC("4993493","388492");
     }
     @Test(expected = Exception.class)
     public void getVfModuleTypeByUuidTestException(){
-    	cd.getVfModuleTypeByUuid("4993493");
+        cd.getVfModuleTypeByUuid("4993493");
     }
-    
+
     @Test(expected = Exception.class)
     public void getTempNetworkHeatTemplateLookupTest(){
-    	cd.getTempNetworkHeatTemplateLookup("4993493");
+        cd.getTempNetworkHeatTemplateLookup("4993493");
     }
-    
+
     @Test(expected = Exception.class)
     public void getAllNetworksByServiceModelUuidTest(){
-    	cd.getAllNetworksByServiceModelUuid("4993493");
+        cd.getAllNetworksByServiceModelUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllNetworksByServiceModelInvariantUuidTest(){
-    	cd.getAllNetworksByServiceModelInvariantUuid("4993493");
+        cd.getAllNetworksByServiceModelInvariantUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllNetworksByServiceModelInvariantUuid2Test(){
-    	cd.getAllNetworksByServiceModelInvariantUuid("4993493","test");
+        cd.getAllNetworksByServiceModelInvariantUuid("4993493","test");
     }
     @Test(expected = Exception.class)
     public void getAllNetworksByNetworkModelCustomizationUuidTest(){
-    	cd.getAllNetworksByNetworkModelCustomizationUuid("4993493");
+        cd.getAllNetworksByNetworkModelCustomizationUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllNetworksByNetworkTypeTest(){
-    	cd.getAllNetworksByNetworkType("4993493");
+        cd.getAllNetworksByNetworkType("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllVfmcForVrcTest(){
-    	VnfResourceCustomization re = new VnfResourceCustomization();
-    	re.setModelCustomizationUuid("377483");
-    	cd.getAllVfmcForVrc(re);
+        VnfResourceCustomization re = new VnfResourceCustomization();
+        re.setModelCustomizationUuid("377483");
+        cd.getAllVfmcForVrc(re);
     }
     @Test(expected = Exception.class)
     public void getAllVnfsByServiceModelUuidTest(){
-    	cd.getAllVnfsByServiceModelUuid("4993493");
+        cd.getAllVnfsByServiceModelUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllVnfsByServiceModelInvariantUuidTest(){
-    	cd.getAllVnfsByServiceModelInvariantUuid("4993493");
+        cd.getAllVnfsByServiceModelInvariantUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllVnfsByServiceModelInvariantUuid2Test(){
-    	cd.getAllVnfsByServiceModelInvariantUuid("4993493","test");
+        cd.getAllVnfsByServiceModelInvariantUuid("4993493","test");
     }
     @Test(expected = Exception.class)
     public void getAllVnfsByServiceNameTest(){
-    	cd.getAllVnfsByServiceName("4993493","test");
+        cd.getAllVnfsByServiceName("4993493","test");
     }
     @Test(expected = Exception.class)
     public void getAllVnfsByServiceName2Test(){
-    	cd.getAllVnfsByServiceName("4993493");
+        cd.getAllVnfsByServiceName("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllVnfsByVnfModelCustomizationUuidTest(){
-    	cd.getAllVnfsByVnfModelCustomizationUuid("4993493");
+        cd.getAllVnfsByVnfModelCustomizationUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllAllottedResourcesByServiceModelUuidTest(){
-    	cd.getAllAllottedResourcesByServiceModelUuid("4993493");
+        cd.getAllAllottedResourcesByServiceModelUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){
-    	cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493");
+        cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){
-    	cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test");
+        cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test");
     }
     @Test(expected = Exception.class)
     public void getAllAllottedResourcesByArModelCustomizationUuidTest(){
-    	cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493");
+        cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllottedResourceByModelUuidTest(){
-    	cd.getAllottedResourceByModelUuid("4993493");
+        cd.getAllottedResourceByModelUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllResourcesByServiceModelUuidTest(){
-    	cd.getAllResourcesByServiceModelUuid("4993493");
+        cd.getAllResourcesByServiceModelUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllResourcesByServiceModelInvariantUuidTest(){
-    	cd.getAllResourcesByServiceModelInvariantUuid("4993493");
+        cd.getAllResourcesByServiceModelInvariantUuid("4993493");
     }
-    
+
     @Test(expected = Exception.class)
     public void getAllResourcesByServiceModelInvariantUuid2Test(){
-    	cd.getAllResourcesByServiceModelInvariantUuid("4993493","test");
+        cd.getAllResourcesByServiceModelInvariantUuid("4993493","test");
     }
     @Test(expected = Exception.class)
     public void getSingleNetworkByModelCustomizationUuidTest(){
-    	cd.getSingleNetworkByModelCustomizationUuid("4993493");
+        cd.getSingleNetworkByModelCustomizationUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getSingleAllottedResourceByModelCustomizationUuidTest(){
-    	cd.getSingleAllottedResourceByModelCustomizationUuid("4993493");
+        cd.getSingleAllottedResourceByModelCustomizationUuid("4993493");
     }
     @Test(expected = Exception.class)
     public void getVfModuleRecipeTest(){
-    	cd.getVfModuleRecipe("4993493","test","get");
+        cd.getVfModuleRecipe("4993493","test","get");
     }
     @Test(expected = Exception.class)
     public void getVfModuleTest(){
-    	cd.getVfModule("4993493","test","get","v2","vnf");
+        cd.getVfModule("4993493","test","get","v2","vnf");
     }
     @Test(expected = Exception.class)
     public void getVnfComponentsRecipeTest(){
-    	cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992");
+        cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992");
     }
     @Test(expected = Exception.class)
     public void getVnfComponentsRecipeByVfModuleTest(){
-    	List <VfModule> resultList = new ArrayList<>();
-    	VfModule m = new VfModule();
-    	resultList.add(m);
-    	cd.getVnfComponentsRecipeByVfModule(resultList,"4993493");
+        List <VfModule> resultList = new ArrayList<>();
+        VfModule m = new VfModule();
+        resultList.add(m);
+        cd.getVnfComponentsRecipeByVfModule(resultList,"4993493");
     }
     @Test(expected = Exception.class)
     public void getAllVnfResourcesTest(){
-    	cd.getAllVnfResources();
+        cd.getAllVnfResources();
     }
     @Test(expected = Exception.class)
     public void getVnfResourcesByRoleTest(){
-    	cd.getVnfResourcesByRole("4993493");
+        cd.getVnfResourcesByRole("4993493");
     }
     @Test(expected = Exception.class)
     public void getVnfResourceCustomizationsByRoleTest(){
-    	cd.getVnfResourceCustomizationsByRole("4993493");
+        cd.getVnfResourceCustomizationsByRole("4993493");
     }
     @Test(expected = Exception.class)
     public void getAllNetworkResourcesTest(){
-    	cd.getAllNetworkResources();
+        cd.getAllNetworkResources();
     }
     @Test(expected = Exception.class)
     public void getAllNetworkResourceCustomizationsTest(){
-    	cd.getAllNetworkResourceCustomizations();
+        cd.getAllNetworkResourceCustomizations();
     }
     @Test(expected = Exception.class)
     public void getAllVfModulesTest(){
-    	cd.getAllVfModules();
+        cd.getAllVfModules();
     }
     @Test(expected = Exception.class)
     public void getAllVfModuleCustomizationsTest(){
-    	cd.getAllVfModuleCustomizations();
+        cd.getAllVfModuleCustomizations();
     }
     @Test(expected = Exception.class)
     public void getAllHeatEnvironmentTest(){
-    	cd.getAllHeatEnvironment();
+        cd.getAllHeatEnvironment();
     }
     @Test(expected = Exception.class)
     public void getHeatEnvironment2Test(){
-    	cd.getHeatEnvironment(4993493);
+        cd.getHeatEnvironment(4993493);
     }
     @Test(expected = Exception.class)
     public void getNestedTemplatesTest(){
-    	cd.getNestedTemplates(4993493);
+        cd.getNestedTemplates(4993493);
     }
     @Test(expected = Exception.class)
     public void getNestedTemplates2Test(){
-    	cd.getNestedTemplates("4993493");
+        cd.getNestedTemplates("4993493");
     }
     @Test(expected = Exception.class)
     public void getHeatFilesTest(){
-    	cd.getHeatFiles(4993493);
+        cd.getHeatFiles(4993493);
     }
     @Test(expected = Exception.class)
     public void getVfModuleToHeatFilesEntryTest(){
-    	cd.getVfModuleToHeatFilesEntry("4993493","49959499");
+        cd.getVfModuleToHeatFilesEntry("4993493","49959499");
     }
     @Test(expected = Exception.class)
     public void getServiceToResourceCustomization(){
-    	cd.getServiceToResourceCustomization("4993493","599349","49900");
+        cd.getServiceToResourceCustomization("4993493","599349","49900");
     }
     @Test(expected = Exception.class)
     public void getHeatFilesForVfModuleTest(){
-    	cd.getHeatFilesForVfModule("4993493");
+        cd.getHeatFilesForVfModule("4993493");
     }
     @Test(expected = Exception.class)
     public void getHeatTemplateTest(){
-    	cd.getHeatTemplate("4993493","test","heat");
+        cd.getHeatTemplate("4993493","test","heat");
     }
-    
+
     @Test(expected = Exception.class)
     public void saveHeatTemplateTest(){
-    	HeatTemplate heat = new HeatTemplate();
-    	Set <HeatTemplateParam> paramSet = new HashSet<HeatTemplateParam>();
-    	cd.saveHeatTemplate(heat,paramSet);
+        HeatTemplate heat = new HeatTemplate();
+        Set <HeatTemplateParam> paramSet = new HashSet<HeatTemplateParam>();
+        cd.saveHeatTemplate(heat,paramSet);
     }
     @Test(expected = Exception.class)
     public void getHeatEnvironmentTest(){
-    	cd.getHeatEnvironment("4993493","test","heat");
+        cd.getHeatEnvironment("4993493","test","heat");
     }
     @Test(expected = Exception.class)
     public void getHeatEnvironment3Test(){
-    	cd.getHeatEnvironment("4993493","test");
+        cd.getHeatEnvironment("4993493","test");
     }
     @Test(expected = Exception.class)
     public void saveHeatEnvironmentTest(){
-    	HeatEnvironment en = new HeatEnvironment();
-    	cd.saveHeatEnvironment(en);
+        HeatEnvironment en = new HeatEnvironment();
+        cd.saveHeatEnvironment(en);
     }
     @Test(expected = Exception.class)
     public void saveHeatTemplate2Test(){
-    	HeatTemplate heat = new HeatTemplate();
-    	cd.saveHeatTemplate(heat);
+        HeatTemplate heat = new HeatTemplate();
+        cd.saveHeatTemplate(heat);
     }
     @Test(expected = Exception.class)
     public void saveHeatFileTest(){
-    	HeatFiles hf = new HeatFiles();
-    	cd.saveHeatFile(hf);
+        HeatFiles hf = new HeatFiles();
+        cd.saveHeatFile(hf);
     }
     @Test(expected = Exception.class)
     public void saveVnfRecipeTest(){
-    	VnfRecipe vr = new VnfRecipe();
-    	cd.saveVnfRecipe(vr);
+        VnfRecipe vr = new VnfRecipe();
+        cd.saveVnfRecipe(vr);
     }
     @Test(expected = Exception.class)
     public void saveVnfComponentsRecipe(){
-    	VnfComponentsRecipe vr = new VnfComponentsRecipe();
-    	cd.saveVnfComponentsRecipe(vr);
+        VnfComponentsRecipe vr = new VnfComponentsRecipe();
+        cd.saveVnfComponentsRecipe(vr);
     }
     @Test(expected = Exception.class)
     public void saveOrUpdateVnfResourceTest(){
-    	VnfResource vr = new VnfResource();
-    	cd.saveOrUpdateVnfResource(vr);
+        VnfResource vr = new VnfResource();
+        cd.saveOrUpdateVnfResource(vr);
     }
     @Test(expected = Exception.class)
     public void saveVnfResourceCustomizationTest(){
-    	VnfResourceCustomization vr = new VnfResourceCustomization();
-    	cd.saveVnfResourceCustomization(vr);
+        VnfResourceCustomization vr = new VnfResourceCustomization();
+        cd.saveVnfResourceCustomization(vr);
     }
     @Test(expected = Exception.class)
     public void saveAllottedResourceCustomizationTest(){
-    	AllottedResourceCustomization arc = new AllottedResourceCustomization();
-    	cd.saveAllottedResourceCustomization(arc);
+        AllottedResourceCustomization arc = new AllottedResourceCustomization();
+        cd.saveAllottedResourceCustomization(arc);
     }
     @Test(expected = Exception.class)
     public void saveAllottedResourceTest(){
-    	AllottedResource ar = new AllottedResource();
-    	cd.saveAllottedResource(ar);
+        AllottedResource ar = new AllottedResource();
+        cd.saveAllottedResource(ar);
     }
     @Test(expected = Exception.class)
     public void saveNetworkResourceTest() throws RecordNotFoundException {
-    	NetworkResource nr = new NetworkResource();
-    	cd.saveNetworkResource(nr);
+        NetworkResource nr = new NetworkResource();
+        cd.saveNetworkResource(nr);
     }
     @Test(expected = Exception.class)
     public void saveToscaCsarTest()throws RecordNotFoundException {
-    	ToscaCsar ts = new ToscaCsar();
-    	cd.saveToscaCsar(ts);
+        ToscaCsar ts = new ToscaCsar();
+        cd.saveToscaCsar(ts);
     }
     @Test(expected = Exception.class)
     public void getToscaCsar(){
-    	cd.getToscaCsar("4993493");
+        cd.getToscaCsar("4993493");
     }
     @Test(expected = Exception.class)
     public void saveTempNetworkHeatTemplateLookupTest(){
-    	TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup();
-    	cd.saveTempNetworkHeatTemplateLookup(t);
+        TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup();
+        cd.saveTempNetworkHeatTemplateLookup(t);
     }
     @Test(expected = Exception.class)
     public void saveVfModuleToHeatFiles(){
-    	VfModuleToHeatFiles v = new VfModuleToHeatFiles();
-    	cd.saveVfModuleToHeatFiles(v);
+        VfModuleToHeatFiles v = new VfModuleToHeatFiles();
+        cd.saveVfModuleToHeatFiles(v);
     }
     @Test(expected = Exception.class)
     public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException {
-    	VnfResourceCustomization v =new VnfResourceCustomization();
-    	VfModuleCustomization vm = new VfModuleCustomization();
-    	cd.saveVnfResourceToVfModuleCustomization(v, vm);
+        VnfResourceCustomization v =new VnfResourceCustomization();
+        VfModuleCustomization vm = new VfModuleCustomization();
+        cd.saveVnfResourceToVfModuleCustomization(v, vm);
     }
     @Test(expected = Exception.class)
     public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException {
-    	NetworkResourceCustomization nrc = new NetworkResourceCustomization();
-    	cd.saveNetworkResourceCustomization(nrc);
+        NetworkResourceCustomization nrc = new NetworkResourceCustomization();
+        cd.saveNetworkResourceCustomization(nrc);
     }
-    
+
     @Test(expected = Exception.class)
     public void saveServiceToNetworksTest(){
-    	AllottedResource ar = new AllottedResource();
-    	cd.saveAllottedResource(ar);
+        AllottedResource ar = new AllottedResource();
+        cd.saveAllottedResource(ar);
     }
     @Test(expected = Exception.class)
     public void saveServiceToResourceCustomizationTest(){
-    	ServiceToResourceCustomization ar = new ServiceToResourceCustomization();
-    	cd.saveServiceToResourceCustomization(ar);
+        ServiceToResourceCustomization ar = new ServiceToResourceCustomization();
+        cd.saveServiceToResourceCustomization(ar);
     }
     @Test(expected = Exception.class)
     public void saveServiceTest(){
-    	Service ar = new Service();
-    	cd.saveService(ar);
+        Service ar = new Service();
+        cd.saveService(ar);
     }
     @Test(expected = Exception.class)
     public void saveOrUpdateVfModuleTest(){
-    	VfModule ar = new VfModule();
-    	cd.saveOrUpdateVfModule(ar);
+        VfModule ar = new VfModule();
+        cd.saveOrUpdateVfModule(ar);
     }
     @Test(expected = Exception.class)
     public void saveOrUpdateVfModuleCustomizationTest(){
-    	VfModuleCustomization ar = new VfModuleCustomization();
-    	cd.saveOrUpdateVfModuleCustomization(ar);
+        VfModuleCustomization ar = new VfModuleCustomization();
+        cd.saveOrUpdateVfModuleCustomization(ar);
     }
-    
+
     @Test(expected = Exception.class)
     public void getNestedHeatTemplateTest(){
-    	cd.getNestedHeatTemplate(101,201);
+        cd.getNestedHeatTemplate(101,201);
     }
     @Test(expected = Exception.class)
     public void getNestedHeatTemplate2Test(){
-    	cd.getNestedHeatTemplate("1002","1002");
+        cd.getNestedHeatTemplate("1002","1002");
     }
     @Test(expected = Exception.class)
     public void saveNestedHeatTemplateTest(){
-    	HeatTemplate ar = new HeatTemplate();
-    	cd.saveNestedHeatTemplate("1001",ar,"test");
+        HeatTemplate ar = new HeatTemplate();
+        cd.saveNestedHeatTemplate("1001",ar,"test");
     }
     @Test(expected = Exception.class)
     public void getHeatFiles2Test(){
-    	VfModuleCustomization ar = new VfModuleCustomization();
-    	cd.getHeatFiles(101,"test","1001","v2");
+        VfModuleCustomization ar = new VfModuleCustomization();
+        cd.getHeatFiles(101,"test","1001","v2");
     }
     @Test(expected = Exception.class)
     public void getHeatFiles3Test(){
-    	VfModuleCustomization ar = new VfModuleCustomization();
-    	cd.getHeatFiles("200192");
+        VfModuleCustomization ar = new VfModuleCustomization();
+        cd.getHeatFiles("200192");
     }
     @Test(expected = Exception.class)
     public void saveHeatFilesTest(){
-    	HeatFiles ar = new HeatFiles();
-    	cd.saveHeatFiles(ar);
+        HeatFiles ar = new HeatFiles();
+        cd.saveHeatFiles(ar);
     }
     @Test(expected = Exception.class)
     public void saveVfModuleToHeatFilesTest(){
-    	HeatFiles ar = new HeatFiles();
-    	cd.saveVfModuleToHeatFiles("3772893",ar);
+        HeatFiles ar = new HeatFiles();
+        cd.saveVfModuleToHeatFiles("3772893",ar);
     }
     @Test
     public void getNetworkResourceByModelUuidTest(){
-    	
-    	cd.getNetworkResourceByModelUuid("3899291");
+
+        cd.getNetworkResourceByModelUuid("3899291");
     }
     @Test(expected = Exception.class)
     public void getNetworkRecipeTest(){
-    	
-    	cd.getNetworkRecipe("test","test1","test2");
+
+        cd.getNetworkRecipe("test","test1","test2");
     }
     @Test(expected = Exception.class)
     public void getNetworkRecipe2Test(){
-    	
-    	cd.getNetworkRecipe("test","test1");
+
+        cd.getNetworkRecipe("test","test1");
     }
     @Test
     public void getNetworkResourceByModelCustUuidTest(){
-    	
-    	cd.getNetworkResourceByModelCustUuid("test");
+
+        cd.getNetworkResourceByModelCustUuid("test");
     }
     @Test(expected = Exception.class)
     public void getVnfComponentsRecipe2Test(){
-    	
-    	cd.getVnfComponentsRecipe("test1","test2","test3","test4");
+
+        cd.getVnfComponentsRecipe("test1","test2","test3","test4");
     }
     @Test(expected = Exception.class)
     public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){
-    	
-    	cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3");
+
+        cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3");
     }
     @Test(expected = Exception.class)
     public void getVnfComponentRecipesTest(){
-    	
-    	cd.getVnfComponentRecipes("test");
+
+        cd.getVnfComponentRecipes("test");
     }
     @Test(expected = Exception.class)
     public void saveOrUpdateVnfComponentTest(){
-    	VnfComponent ar = new VnfComponent();
-    	cd.saveOrUpdateVnfComponent(ar);
+        VnfComponent ar = new VnfComponent();
+        cd.saveOrUpdateVnfComponent(ar);
     }
-    
+
     @Test(expected = Exception.class)
     public void getVfModule2Test(){
-    	
-    	cd.getVfModule("test");
+
+        cd.getVfModule("test");
     }
     @Test(expected = Exception.class)
     public void getVfModuleByModelUUIDTest(){
-    	
-    	cd.getVfModuleByModelUUID("test");
+
+        cd.getVfModuleByModelUUID("test");
     }
     @Test(expected = Exception.class)
     public void getServiceRecipeByModelUUIDTest(){
-    	
-    	cd.getServiceRecipeByModelUUID("test1","test2");
+
+        cd.getServiceRecipeByModelUUID("test1","test2");
     }
     @Test(expected = Exception.class)
     public void getModelRecipeTest(){
-    	
-    	cd.getModelRecipe("test1","test2","test3");
+
+        cd.getModelRecipe("test1","test2","test3");
     }
     @Test(expected = Exception.class)
     public void healthCheck(){
-    	
-    	cd.healthCheck();
+
+        cd.healthCheck();
     }
     @Test(expected = Exception.class)
     public void executeQuerySingleRow(){
-    	VnfComponent ar = new VnfComponent();
-    	HashMap<String, String> variables = new HashMap<String, String>();
-    	cd.executeQuerySingleRow("tets",variables,false);
+        VnfComponent ar = new VnfComponent();
+        HashMap<String, String> variables = new HashMap<String, String>();
+        cd.executeQuerySingleRow("tets",variables,false);
     }
     @Test(expected = Exception.class)
     public void executeQueryMultipleRows(){
-    	HashMap<String, String> variables = new HashMap<String, String>();
-    	cd.executeQueryMultipleRows("select",variables,false);
+        HashMap<String, String> variables = new HashMap<String, String>();
+        cd.executeQueryMultipleRows("select",variables,false);
     }
 }
