diff --git a/asdc-controller/WebContent/WEB-INF/web.xml b/asdc-controller/WebContent/WEB-INF/web.xml
index a8ccd17..f9b9e92 100644
--- a/asdc-controller/WebContent/WEB-INF/web.xml
+++ b/asdc-controller/WebContent/WEB-INF/web.xml
@@ -2,8 +2,8 @@
 
 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
   <display-name>ASDC Controller</display-name>
- 
- 
+
+
    <!-- enable the Asynchronous Job Service -->
     <context-param>
         <param-name>resteasy.async.job.service.enabled</param-name>
@@ -15,7 +15,7 @@
 		<param-value>java:module/MsoPropertiesFactory</param-value>
 	 </context-param>
 
-    <!-- The next context parameters are all optional.  
+    <!-- The next context parameters are all optional.
          Their default values are shown as example param-values -->
 
     <!-- How many jobs results can be held in memory at once? -->
@@ -45,8 +45,8 @@
     <param-name>resteasy.scan</param-name>
     <param-value>true</param-value>
   </context-param>
- 
-  <!--  
+
+  <!--
   <context-param>
     <param-name>resteasy.servlet.mapping.prefix</param-name>
     <param-value>/v1</param-value>
@@ -56,18 +56,18 @@
   	<param-name>log.configuration</param-name>
   	<param-value>logback.asdc.xml</param-value>
   </context-param>
-  
+
   <context-param>
   	<param-name>mso.configuration</param-name>
   	<param-value>MSO_PROP_ASDC=mso.asdc.json,MSO_PROP_TOPOLOGY=topology.properties</param-value>
 
   </context-param>
-  
+
   <context-param>
     <param-name>resteasy.resources</param-name>
     <param-value>org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.asdc.healthcheck.HealthCheckHandler</param-value>
   </context-param>
-  
+
   <listener>
     <listener-class>
 			org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
@@ -86,7 +86,7 @@
 
     <filter>
 		<filter-name>LogFilter</filter-name>
-		<filter-class>org.openecomp.mso.logger.LogFilter</filter-class>	
+		<filter-class>org.openecomp.mso.logger.LogFilter</filter-class>
 	</filter>
       <filter-mapping>
 		<filter-name>LogFilter</filter-name>
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index 2db7518..7f94838 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -18,7 +18,7 @@
 		<plugins>
 			<plugin>
 				<artifactId>maven-war-plugin</artifactId>
-				<version>2.3</version>
+				<version>2.4</version>
 				<configuration>
 					<warSourceDirectory>WebContent</warSourceDirectory>
 					<failOnMissingWebXml>false</failOnMissingWebXml>
@@ -30,6 +30,17 @@
 
 	<dependencies>
 		<dependency>
+             <groupId>org.evosuite</groupId>
+             <artifactId>evosuite-standalone-runtime</artifactId>
+             <version>${evosuiteVersion}</version>
+             <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.jackson</groupId>
+            <artifactId>jackson-mapper-asl</artifactId>
+            <version>1.9.13</version>
+        </dependency>
+		<dependency>
 			<groupId>org.mockito</groupId>
 			<artifactId>mockito-all</artifactId>
 			<version>1.10.19</version>
@@ -62,9 +73,9 @@
 		</dependency>
 
 		<dependency>
-			<groupId>org.openecomp.sdc</groupId>
+			<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
             <artifactId>sdc-distribution-client</artifactId>
-            <version>1.0.0</version>
+            <version>1.1.6-SNAPSHOT</version>
 			<exclusions>
        		 <exclusion>  <!-- declare the exclusion here -->
 	         	 <groupId>org.slf4j</groupId>
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java
index 1d87ccb..61ca698 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.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.
@@ -75,8 +75,8 @@
     public static final String HEAT_VOL="HEAT_VOL";
     public static final String OTHER="OTHER";
     public static final String VF_MODULES_METADATA="VF_MODULES_METADATA";
-    
-    
+
+
     private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT,
     		HEAT_ARTIFACT,
     		HEAT_ENV,
@@ -84,10 +84,10 @@
     		HEAT_NET,
     		HEAT_VOL,
     		OTHER,
-    		VF_MODULES_METADATA};   
-    
-    public static final List<String>  SUPPORTED_ARTIFACT_TYPES_LIST =  Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES));   
-    
+    		VF_MODULES_METADATA};
+
+    public static final List<String>  SUPPORTED_ARTIFACT_TYPES_LIST =  Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES));
+
     /**
      * Default constructor, the mso.properties is searched in the classpath (for testing)
      * Or in /etc/ecomp/mso/config/mso.properties
@@ -97,7 +97,7 @@
      * @throws IOException If the key file has not been loaded properly
      */
     public ASDCConfiguration (String controllerName) throws ASDCParametersException, IOException {
-    	
+
         Properties keyProp = new Properties ();
         this.asdcControllerName = controllerName;
 
@@ -287,7 +287,7 @@
             return 0;
         }
     }
-    
+
 	@Override
 	public boolean activateServerTLSAuth() {
 		JsonNode masterConfigNode = getASDCControllerConfigJsonNode();
@@ -415,4 +415,12 @@
 
     }
 
+    /**
+     * The flag allows the client to receive metadata for all resources of the service regardless of the artifacts associated to them.
+     * Setting the flag to false will preserve legacy behavior.
+     */
+    public boolean isFilterInEmptyResources() {
+ 	   return true;
+    }
+
 }
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
index b553100..a0de24a 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.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.
@@ -270,17 +270,17 @@
         this.changeControllerStatus (ASDCControllerStatus.STOPPED);
     }
 
-    private boolean checkResourceAlreadyDeployed (VfResourceStructure vfResource) throws ArtifactInstallerException {
+    private boolean checkResourceAlreadyDeployed (VfResourceStructure resource) throws ArtifactInstallerException {
 
-    	if (this.resourceInstaller.isResourceAlreadyDeployed (vfResource)) {
+        if (this.resourceInstaller.isResourceAlreadyDeployed (resource)) {
             LOGGER.info (MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST,
-            			vfResource.getResourceInstance().getResourceInstanceName(),
-            			vfResource.getResourceInstance().getResourceUUID(),
-            			vfResource.getResourceInstance().getResourceName(), "", "");
-            
-            this.sendDeployNotificationsForResource(vfResource,DistributionStatusEnum.ALREADY_DOWNLOADED,null);
-            this.sendDeployNotificationsForResource(vfResource,DistributionStatusEnum.ALREADY_DEPLOYED,null);
-           
+                    resource.getResourceInstance().getResourceInstanceName(),
+                    resource.getResourceInstance().getResourceUUID(),
+                    resource.getResourceInstance().getResourceName(), "", "");
+
+            this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DOWNLOADED,null);
+            this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DEPLOYED,null);
+
             return true;
         } else {
             return false;
@@ -289,7 +289,7 @@
     }
 
     private final static String UUID_PARAM = "(UUID:";
-    
+
     private IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact,
                                                                    String distributionId) throws ASDCDownloadException {
 
@@ -299,7 +299,7 @@
                       + ")");
         IDistributionClientDownloadResult downloadResult;
 
-       
+
         try {
             downloadResult = distributionClient.download (artifact);
             if (null == downloadResult) {
@@ -366,14 +366,14 @@
 
     }
 
-   
+
     private void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) {
-    
+
     	for (IArtifactInfo artifactInfo : vfResourceStructure.getResourceInstance().getArtifacts()) {
-    	
-    		if (DistributionStatusEnum.DEPLOY_OK.equals(distribStatus) 
+
+    		if (DistributionStatusEnum.DEPLOY_OK.equals(distribStatus)
     				// This could be NULL if the artifact is a VF module artifact, this won't be present in the MAP
-    				&& vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null 
+    				&& vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null
     				&& vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()).getDeployedInDb() == 0) {
     			this.sendASDCNotification (NotificationType.DEPLOY,
 	    				artifactInfo.getArtifactURL (),
@@ -393,26 +393,30 @@
     		}
     	}
     }
-    
-    private void deployResourceStructure (VfResourceStructure vfResourceStructure) throws ArtifactInstallerException {
 
-    	LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, vfResourceStructure.getResourceInstance().getResourceInstanceName(), vfResourceStructure.getResourceInstance().getResourceUUID(), "ASDC", "deployResourceStructure");
+    private void deployResourceStructure (VfResourceStructure resourceStructure) throws ArtifactInstallerException {
+
+    	LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC", "deployResourceStructure");
         try {
-        	vfResourceStructure.createVfModuleStructures();
-        	resourceInstaller.installTheResource (vfResourceStructure);
-        	
+        	String resourceType = resourceStructure.getResourceInstance().getResourceType();
+        	String category = resourceStructure.getResourceInstance().getCategory();
+        	if(resourceType.equals("VF") && !category.equalsIgnoreCase("Allotted Resource")){
+        		resourceStructure.createVfModuleStructures();
+        	}
+        	resourceInstaller.installTheResource (resourceStructure);
+
         } catch (ArtifactInstallerException e) {
-        	
-        	sendDeployNotificationsForResource(vfResourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage());
+
+        	sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage());
         	throw e;
         }
 
-        if (vfResourceStructure.isDeployedSuccessfully()) {
+        if (resourceStructure.isDeployedSuccessfully()) {
 	        LOGGER.info (MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC,
-	           		vfResourceStructure.getResourceInstance().getResourceName(),
-	          		vfResourceStructure.getResourceInstance().getResourceUUID(),
-	                String.valueOf (vfResourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
-	        sendDeployNotificationsForResource(vfResourceStructure,DistributionStatusEnum.DEPLOY_OK ,null);
+	           		resourceStructure.getResourceInstance().getResourceName(),
+	          		resourceStructure.getResourceInstance().getResourceUUID(),
+	                String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+	        sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_OK ,null);
         }
 
     }
@@ -428,14 +432,14 @@
                                        DistributionStatusEnum status,
                                        String errorReason,
                                        long timestamp) {
-    	
+
         String event = "Sending " + notificationType.name ()
                        + "("
                        + status.name ()
                        + ")"
                        + " notification to ASDC for artifact:"
                        + artifactURL;
-        
+
         if (errorReason != null) {
         	event=event+"("+errorReason+")";
         }
@@ -480,7 +484,7 @@
     }
 
     public void treatNotification (INotificationData iNotif) {
-    	
+
     	int noOfArtifacts = 0;
     	for (IResourceInstance resource : iNotif.getResources ()) {
     		noOfArtifacts += resource.getArtifacts ().size ();
@@ -488,7 +492,7 @@
         LOGGER.info (MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF,
                      String.valueOf (noOfArtifacts),
                      iNotif.getServiceUUID (), "ASDC", "treatNotification");
-        
+
         try {
         	LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
 			LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, iNotif.getServiceUUID(), "ASDC", "treatNotification");
@@ -496,14 +500,15 @@
 			// Process only the Resource artifacts in MSO
 			for (IResourceInstance resource : iNotif.getResources()) {
 
+				// We process only VNF(VF) and Network(VL) resources on MSO Side
 				// We process only VNF resource on MSO Side
-				if ("VF".equals(resource.getResourceType())) {
-					this.processResourceNotification(iNotif,resource);		
+				if ("VF".equals(resource.getResourceType()) || "VL".equals(resource.getResourceType())) {
+					this.processResourceNotification(iNotif,resource);
 				}
 			}
-					
-					
-				
+
+
+
         } catch (RuntimeException e) {
             LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
                           "Unexpected exception caught during the notification processing", "ASDC", "treatNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException in treatNotification",
@@ -513,40 +518,41 @@
         }
     }
 
-        
+
     private void processResourceNotification (INotificationData iNotif,IResourceInstance resource) {
 		// For each artifact, create a structure describing the VFModule in a ordered flat level
-		VfResourceStructure vfResourceStructure = new VfResourceStructure(iNotif,resource);
+    	VfResourceStructure resourceStructure = new VfResourceStructure(iNotif,resource);
+
 		try {
-			
-			if (!this.checkResourceAlreadyDeployed(vfResourceStructure)) {
+
+			if (!this.checkResourceAlreadyDeployed(resourceStructure)) {
 				for (IArtifactInfo artifact : resource.getArtifacts()) {
-					
-						IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact, 
+
+						IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,
 								iNotif.getDistributionID());
 
 						if (resultArtifact != null) {
 							if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) {
 								LOGGER.debug("VF_MODULE_ARTIFACT: "+new String(resultArtifact.getArtifactPayload(),"UTF-8"));
-								LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(distributionClient.decodeVfModuleArtifact(resultArtifact.getArtifactPayload())));
+								LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact(resultArtifact.getArtifactPayload())));
 							}
-							vfResourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact);
-				
-						} 
+							resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact);
+
+						}
 
 				}
-				
-				this.deployResourceStructure(vfResourceStructure);
-				
-			} 
+
+				this.deployResourceStructure(resourceStructure);
+
+			}
 		} catch (ArtifactInstallerException | ASDCDownloadException | UnsupportedEncodingException e) {
 			LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
 					"Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
 		}
     }
-    
+
     private static final String UNKNOWN="Unknown";
-    
+
     /**
      * @return the address of the ASDC we are connected to.
      */
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java
index 5e59be5..e649a99 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.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.
@@ -35,12 +35,12 @@
  * A class representing a generic element whose information can be used for example to log artifacts, resource... data.
  */
 public class ASDCElementInfo {
-	
+
 	/**
 	 * A default, empty instance used in case a source element was not correctly provided.
 	 */
 	public static final ASDCElementInfo EMPTY_INSTANCE = new ASDCElementInfo();
-	
+
 	/**
 	 * Used to define the other possible ASDC Element types (usually in addition to existing artifact types, etc.).<br/>
 	 * <br/>
@@ -60,17 +60,17 @@
 	 * The map of element information fields useful for logging. The complete contents of this list will be concatenated.
 	 */
 	private final Map<String, String> elementInfoMap = new HashMap<>();
-	
+
 	/**
 	 * The type of this element.
 	 */
 	private final String type;
-	
+
 	private ASDCElementInfo () {
 		// Private parameterless constructor. Not visible, only used for EMPTY_INSTANCE.
 		this.type = "";
 	}
-	
+
 	/**
 	 * Artifact-type based constructor. Requires a valid artifact type.
 	 * @param artifactType The artifact type
@@ -79,7 +79,7 @@
 		// We need the exact type name here...
 		this.type = artifactType;
 	}
-	
+
 	/**
 	 * 'Other element type'-based constructor. Requires a valid element type.
 	 * @param elementType An ASDCElementTypeEnum entry. This will usually contain enumerated types not in the existing
@@ -88,10 +88,10 @@
 		// We need the exact type name here...
 		this.type = elementType.name();
 	}
-	
+
 	/**
 	 * Add an information entry (name, UUID, etc.) from an artifact/resource/..., once a at time.
-	 * 
+	 *
 	 * @param key The key (name) of the information entry (Artifact UUID, Resource Name, etc.)
 	 * @param value The value bound to the information entry.
 	 */
@@ -100,7 +100,7 @@
 			this.getElementInfoMap().put(key, value);
 		}
 	}
-	
+
 	/**
 	 * Returns an aggregated, formatted list of the expected details about an ASDC element.
 	 * (non-Javadoc)
@@ -123,7 +123,7 @@
 		}
 		return sb.toString();
 	}
-	
+
 	/**
 	 * The type that was defined at creation time. This is typically VNF_RESOURCE, VF_MODULE_METADATA, HEAT_ENV, etc.
 	 * @return The type of this element information type. This will usually be either an ArtifactTypeEnum entry name or an ASDCElementTypeEnum entry name.
@@ -150,7 +150,7 @@
 	 * <li>Resource Instance Name</li>
 	 * <li>Resource Instance UUID</li>
 	 * </ul>
-	 * 
+	 *
 	 * @param vfResourceStructure The VfResourceStructure to use as source of information (see {@link VfResourceStructure}).
 	 * @return an ASDCElementInfo using the information held in the VNF Resource.
 	 */
@@ -173,7 +173,7 @@
 	 * <li>Module Model Name</li>
 	 * <li>Module Model UUID</li>
 	 * </ul>
-	 * 
+	 *
 	 * @param vfModuleStructure The VfModuleStructure to use as source of information (see {@link VfModuleStructure}).
 	 * @return an ASDCElementInfo using the information held in the VF Module.
 	 */
@@ -182,12 +182,12 @@
 			return EMPTY_INSTANCE;
 		}
 		ASDCElementInfo elementInfo = new ASDCElementInfo(ASDCConfiguration.VF_MODULES_METADATA);
-		IVfModuleMetadata moduleMetadata = vfModuleStructure.getVfModuleMetadata();
+		IVfModuleData moduleMetadata = vfModuleStructure.getVfModuleMetadata();
 		elementInfo.addElementInfo("Module Model Name", moduleMetadata.getVfModuleModelName());
 		elementInfo.addElementInfo("Module Model Invariant UUID", moduleMetadata.getVfModuleModelInvariantUUID());
 		return elementInfo;
 	}
-	
+
 	/**
 	 * Create an ASDCElementInfo object from an IArtfiactInfo instance.<br/>
 	 * <br/>
@@ -196,7 +196,7 @@
 	 * <li>IArtifactInfo Name</li>
 	 * <li>IArtifactInfo UUID</li>
 	 * </ul>
-	 * 
+	 *
 	 * @param artifactInfo The VfModuleStructure to use as source of information (see {@link IArtifactInfo}).
 	 * @return an ASDCElementInfo using the information held in the IArtifactInfo instance.
 	 */
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java
new file mode 100644
index 0000000..d3aa041
--- /dev/null
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.asdc.installer;
+
+import java.util.Map;
+
+
+public interface IVfModuleData {
+
+	  // Method descriptor #4 ()Ljava/lang/String;
+	  public abstract java.lang.String getVfModuleModelName();
+
+	  // Method descriptor #4 ()Ljava/lang/String;
+	  public abstract java.lang.String getVfModuleModelInvariantUUID();
+
+	  // Method descriptor #4 ()Ljava/lang/String;
+	  public abstract java.lang.String getVfModuleModelCustomizationUUID();
+
+	  // Method descriptor #4 ()Ljava/lang/String;
+	  public abstract java.lang.String getVfModuleModelVersion();
+
+	  // Method descriptor #4 ()Ljava/lang/String;
+	  public abstract java.lang.String getVfModuleModelUUID();
+
+	  // Method descriptor #4 ()Ljava/lang/String;
+	  public abstract java.lang.String getVfModuleModelDescription();
+
+	  // Method descriptor #10 ()Z
+	  public abstract boolean isBase();
+
+	  // Method descriptor #12 ()Ljava/util/List;
+	  // Signature: ()Ljava/util/List<Ljava/lang/String;>;
+	  public abstract java.util.List<String> getArtifacts();
+
+	  public abstract java.util.Map<String,String> getProperties();
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java
new file mode 100644
index 0000000..284141b
--- /dev/null
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.asdc.installer;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonAnySetter;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import org.openecomp.sdc.api.notification.IVfModuleMetadata;
+
+public class VfModuleMetaData implements IVfModuleData {
+
+	@JsonProperty("artifacts")
+	private List<String> artifacts;
+
+	@JsonProperty("properties")
+	//private List<Map<String, Object>> properties = new ArrayList<>();
+	private Map<String,String> properties = new HashMap<>();
+
+	@JsonIgnore
+	private Map<String,Object> attributesMap = new HashMap<>();
+
+	@Override
+	public List<String> getArtifacts() {
+		return artifacts;
+	}
+
+	public Map<String, String> getProperties() {
+		return properties;
+	}
+
+	@Override
+	public String getVfModuleModelDescription() {
+		return (String)attributesMap.get("vfModuleModelDescription");
+	}
+
+	@Override
+	public String getVfModuleModelInvariantUUID() {
+		return (String)attributesMap.get("vfModuleModelInvariantUUID");
+	}
+
+	public String getVfModuleModelCustomizationUUID() {
+		return (String)attributesMap.get("vfModuleModelCustomizationUUID");
+	}
+
+	@Override
+	public String getVfModuleModelName() {
+		return (String)attributesMap.get("vfModuleModelName");
+	}
+
+	@Override
+	public String getVfModuleModelUUID() {
+		return (String)attributesMap.get("vfModuleModelUUID");
+	}
+
+	@Override
+	public String getVfModuleModelVersion() {
+		return (String)attributesMap.get("vfModuleModelVersion");
+	}
+
+	@Override
+	public boolean isBase() {
+		return (boolean)attributesMap.get("isBase");
+	}
+
+
+
+	@SuppressWarnings("unused")
+	@JsonAnySetter
+	public final void setAttribute(String attrName, Object attrValue) {
+		if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
+			this.attributesMap.put(attrName,attrValue);
+		}
+	}
+
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java
index 239bc8a..b1e6708 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.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.
@@ -31,24 +31,24 @@
 import org.openecomp.mso.db.catalog.beans.VfModule;
 
 public final class VfModuleStructure {
-	
-	private final IVfModuleMetadata vfModuleMetadata;
-	
+
+	private final IVfModuleData vfModuleMetadata;
+
 	private final VfResourceStructure parentVfResource;
-	
+
 	private VfModule catalogVfModule;
 	/**
 	 * The list of artifact existing in this resource hashed by artifactType.
 	 */
 	private final Map<String, List<VfModuleArtifact>> artifactsMap;
-	
-	public VfModuleStructure(VfResourceStructure vfParentResource,IVfModuleMetadata vfmoduleMetadata) throws ArtifactInstallerException {
-		
+
+	public VfModuleStructure(VfResourceStructure vfParentResource,IVfModuleData vfmoduleMetadata) throws ArtifactInstallerException {
+
 		vfModuleMetadata = vfmoduleMetadata;
 		parentVfResource = vfParentResource;
-		
+
 		artifactsMap = new HashMap<String, List<VfModuleArtifact>>();
-				
+
 		for (String artifactUUID:this.vfModuleMetadata.getArtifacts()) {
 			if (vfParentResource.getArtifactsMapByUUID().containsKey(artifactUUID)) {
 				this.addToStructure(vfParentResource.getArtifactsMapByUUID().get(artifactUUID));
@@ -57,42 +57,42 @@
 			}
 		}
 	}
-	
+
 	private void addToStructure(VfModuleArtifact vfModuleArtifact) {
-		
+
 		if (artifactsMap.containsKey(vfModuleArtifact.getArtifactInfo().getArtifactType())) {
 			artifactsMap.get(vfModuleArtifact.getArtifactInfo().getArtifactType()).add(vfModuleArtifact);
-			
+
 		} else {
 			List<VfModuleArtifact> nestedList = new LinkedList<VfModuleArtifact>();
 			nestedList.add(vfModuleArtifact);
-			
+
 			artifactsMap.put(vfModuleArtifact.getArtifactInfo().getArtifactType(), nestedList);
 		}
 	}
-	
+
 	public List<VfModuleArtifact> getOrderedArtifactList() {
-		
+
 		List <VfModuleArtifact> artifactsList = new LinkedList <VfModuleArtifact>();
-		
+
 		artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT));
 		artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_ENV));
 		artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL));
-		
+
 		for (VfModuleArtifact artifact:(artifactsMap.get(ASDCConfiguration.HEAT_NESTED))) {
 			artifactsList.add(artifact);
 		}
-		
+
 		for (VfModuleArtifact artifact:(artifactsMap.get(ASDCConfiguration.HEAT_ARTIFACT))) {
 			artifactsList.add(artifact);
 		}
-		
+
 		artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL));
-		
+
 		return null;
 	}
 
-	public IVfModuleMetadata getVfModuleMetadata() {
+	public IVfModuleData getVfModuleMetadata() {
 		return vfModuleMetadata;
 	}
 
@@ -112,6 +112,6 @@
 	public void setCatalogVfModule(VfModule catalogVfModule) {
 		this.catalogVfModule = catalogVfModule;
 	}
-	
-	
+
+
 }
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java
index 7be5e70..d27819b 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.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.
@@ -20,13 +20,18 @@
 
 package org.openecomp.mso.asdc.installer;
 
-
+import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.TypeReference;
+
 import org.openecomp.sdc.api.IDistributionClient;
 import org.openecomp.sdc.api.notification.IArtifactInfo;
 import org.openecomp.sdc.api.notification.INotificationData;
@@ -35,72 +40,84 @@
 import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
 import org.openecomp.mso.asdc.client.ASDCConfiguration;
 import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
+import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
 import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
+import org.openecomp.mso.db.catalog.beans.ServiceToNetworks;
 import org.openecomp.mso.db.catalog.beans.VnfResource;
 
 /**
  * This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree structure).
- * 
  *
  */
 public final class VfResourceStructure {
-	
+
 	private boolean isDeployedSuccessfully=false;
 	/**
-	 * The Raw notification data. 
+	 * The Raw notification data.
 	 */
 	private final INotificationData notification;
-	
+
 	/**
 	 * The resource we will try to deploy.
 	 */
 	private final IResourceInstance resourceInstance;
-	
+
 	/**
 	 * The list of VfModules defined for this resource.
 	 */
 	private final List<VfModuleStructure> vfModulesStructureList;
-	
+
 	/**
 	 * The list of VfModulesMetadata defined for this resource.
 	 */
-	private List<IVfModuleMetadata> vfModulesMetadataList;
-	
+	private List<IVfModuleData> vfModulesMetadataList;
+
 	private VnfResource catalogVnfResource;
-	
+
+	private NetworkResourceCustomization catalogNetworkResourceCustomization;
+
+	private ServiceToNetworks catalogServiceToNetworks;
+
+	private ServiceToAllottedResources catalogServiceToAllottedResources;
+
+	private AllottedResourceCustomization catalogResourceCustomization;
+
 	private Service catalogService;
-	
+
 	/**
 	 * The list of artifacts existing in this resource hashed by UUID.
 	 */
-	private final Map<String, VfModuleArtifact> artifactsMapByUUID; 
-	
-		
+	private final Map<String, VfModuleArtifact> artifactsMapByUUID;
+
+
 	public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) {
 		notification=notificationdata;
 		resourceInstance=resourceinstance;
-		
+
 
 		vfModulesStructureList = new LinkedList<VfModuleStructure>();
 		artifactsMapByUUID =  new HashMap<String, VfModuleArtifact>();
 	}
-	
+
+	//@Override
 	public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
 		VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult);
-		
+
 		switch(artifactinfo.getArtifactType()) {
 			case ASDCConfiguration.HEAT:
 			case ASDCConfiguration.HEAT_ENV:
 			case ASDCConfiguration.HEAT_VOL:
 			case ASDCConfiguration.HEAT_NESTED:    // For 1607 only 1 level tree is supported
-			case ASDCConfiguration.HEAT_ARTIFACT: 
+			case ASDCConfiguration.HEAT_ARTIFACT:
 			case ASDCConfiguration.HEAT_NET:
 			case ASDCConfiguration.OTHER:
 				artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact);
 				break;
 
 			case ASDCConfiguration.VF_MODULES_METADATA:
-				vfModulesMetadataList = distributionClient.decodeVfModuleArtifact(clientResult.getArtifactPayload());
+				vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload());
 				break;
 
 			default:
@@ -110,15 +127,15 @@
 	}
 
 	public void createVfModuleStructures() throws ArtifactInstallerException {
-		
+
 		if (vfModulesMetadataList == null) {
 			throw new ArtifactInstallerException("VfModule Meta DATA could not be decoded properly or was not present in the notification");
 		}
-		for (IVfModuleMetadata vfModuleMeta:vfModulesMetadataList) {
+		for (IVfModuleData vfModuleMeta:vfModulesMetadataList) {
 			vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta));
 		}
 	}
-	
+
 	public INotificationData getNotification() {
 		return notification;
 	}
@@ -134,7 +151,7 @@
 	public boolean isDeployedSuccessfully() {
 		return isDeployedSuccessfully;
 	}
-	
+
 	public void setSuccessfulDeployment() {
 		isDeployedSuccessfully = true;
 	}
@@ -155,6 +172,42 @@
 		this.catalogVnfResource = catalogVnfResource;
 	}
 
+	// Network Only
+	public NetworkResourceCustomization getCatalogNetworkResourceCustomization() {
+		return catalogNetworkResourceCustomization;
+	}
+	// Network Only
+	public void setCatalogNetworkResourceCustomization(NetworkResourceCustomization catalogNetworkResourceCustomization) {
+		this.catalogNetworkResourceCustomization = catalogNetworkResourceCustomization;
+	}
+	// Network Only
+	public ServiceToNetworks getCatalogServiceToNetworks() {
+		return catalogServiceToNetworks;
+	}
+	// Network Only
+	public void setCatalogServiceToNetworks(
+			ServiceToNetworks catalogServiceToNetworks) {
+		this.catalogServiceToNetworks = catalogServiceToNetworks;
+	}
+
+	public ServiceToAllottedResources getCatalogServiceToAllottedResources() {
+		return catalogServiceToAllottedResources;
+	}
+
+	public void setCatalogServiceToAllottedResources(
+			ServiceToAllottedResources catalogServiceToAllottedResources) {
+		this.catalogServiceToAllottedResources = catalogServiceToAllottedResources;
+	}
+
+	public AllottedResourceCustomization getCatalogResourceCustomization() {
+		return catalogResourceCustomization;
+	}
+
+	public void setCatalogResourceCustomization(
+			AllottedResourceCustomization catalogResourceCustomization) {
+		this.catalogResourceCustomization = catalogResourceCustomization;
+	}
+
 	public Service getCatalogService() {
 		return catalogService;
 	}
@@ -162,4 +215,19 @@
 	public void setCatalogService(Service catalogService) {
 		this.catalogService = catalogService;
 	}
+
+	public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) {
+		try {
+			List<IVfModuleData> listVFModuleMetaData = new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>(){});
+			return listVFModuleMetaData;
+
+		} catch (JsonParseException e) {
+			e.printStackTrace();
+		} catch (JsonMappingException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
 }
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java
index 4cef0f1..114f6f2 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.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.
@@ -20,15 +20,19 @@
 
 package org.openecomp.mso.asdc.installer.heat;
 
-
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.hibernate.exception.ConstraintViolationException;
 import org.hibernate.exception.LockAcquisitionException;
-
 import org.openecomp.sdc.api.notification.IArtifactInfo;
+
 import org.openecomp.mso.asdc.client.ASDCConfiguration;
 import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
 import org.openecomp.mso.asdc.installer.ASDCElementInfo;
@@ -43,7 +47,11 @@
 import org.openecomp.mso.db.catalog.beans.HeatFiles;
 import org.openecomp.mso.db.catalog.beans.HeatTemplate;
 import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
 import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
+import org.openecomp.mso.db.catalog.beans.ServiceToNetworks;
 import org.openecomp.mso.db.catalog.beans.VfModule;
 import org.openecomp.mso.db.catalog.beans.VnfResource;
 import org.openecomp.mso.logger.MessageEnum;
@@ -58,18 +66,26 @@
 	}
 
 	@Override
-	public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStructure)
+	public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct)
 			throws ArtifactInstallerException {
+
+		CatalogDatabase db = new CatalogDatabase();
 		boolean status = false;
+		VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct;
 
-		try (CatalogDatabase db = new CatalogDatabase()) {
+        try {
 
-			logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "VNFResource",
+			String resourceType = vfResourceStruct.getResourceInstance().getResourceType();
+			String category = vfResourceStruct.getResourceInstance().getCategory();
+
+			// Check for duplicate VF Module that is not an Allotted Resource
+			if(resourceType.equals("VF") && !category.equalsIgnoreCase("Allotted Resource")){
+				logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "VNFResource",
 					VfResourceInstaller.createVNFName(vfResourceStructure),
 					BigDecimalVersion.castAndCheckNotificationVersionToString(
 							vfResourceStructure.getNotification().getServiceVersion()), "", "");
 
-			VnfResource vnfResource = db.getVnfResource(
+				VnfResource vnfResource = db.getVnfResource(
 					VfResourceInstaller.createVNFName(vfResourceStructure),
 					BigDecimalVersion.castAndCheckNotificationVersionToString(
 							vfResourceStructure.getNotification().getServiceVersion()));
@@ -79,23 +95,73 @@
 
 			}
 
+			}
+
+			// Check dup for VF Allotted Resource
+			if(resourceType.equals("VF") && category.equalsIgnoreCase("Allotted Resource")){
+				logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "AllottedResource",
+						vfResourceStruct.getResourceInstance().getResourceInstanceName(),
+						BigDecimalVersion.castAndCheckNotificationVersionToString(
+								vfResourceStructure.getNotification().getServiceVersion()), "", "");
+
+				List<AllottedResourceCustomization> allottedResources = db.getAllAllottedResourcesByServiceModelUuid(vfResourceStruct.getNotification().getServiceUUID());
+
+				if(allottedResources != null && allottedResources.size() > 0){
+					for(AllottedResourceCustomization allottedResource : allottedResources){
+
+						String existingAllottedResource = allottedResource.getModelCustomizationUuid();
+						String notificationAllottedResource = vfResourceStruct.getResourceInstance().getResourceCustomizationUUID();
+
+						if(existingAllottedResource.equals(notificationAllottedResource)){
+							status=true;
+							break;
+						}
+					}
+
+				}
+			}
+
+			// Check Network for duplicates
+			if(resourceType.equals("VL")){
+				logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "NetworkResource",
+						vfResourceStruct.getResourceInstance().getResourceInstanceName(),
+						BigDecimalVersion.castAndCheckNotificationVersionToString(
+								vfResourceStructure.getNotification().getServiceVersion()), "", "");
+
+				List<NetworkResourceCustomization> networkResources = db.getAllNetworksByServiceModelUuid(vfResourceStruct.getNotification().getServiceUUID());
+
+				if(networkResources != null && networkResources.size() > 0){
+					for(NetworkResourceCustomization networkResource : networkResources){
+
+						String existingNetworkResource = networkResource.getModelCustomizationUuid();
+						String notificationNetworkResource = vfResourceStruct.getResourceInstance().getResourceCustomizationUUID();
+
+						if(existingNetworkResource.equals(notificationNetworkResource)){
+							status=true;
+							break;
+						}
+					}
+
+				}
+			}
+
 			if (status) {
 				logger.info(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
 						vfResourceStructure.getResourceInstance().getResourceInstanceName(),
-						vfResourceStructure.getResourceInstance().getResourceUUID(),
+						vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
 						vfResourceStructure.getNotification().getServiceName(),
 						BigDecimalVersion.castAndCheckNotificationVersionToString(
 								vfResourceStructure.getNotification().getServiceVersion()),
 						vfResourceStructure.getNotification().getServiceUUID(),
-						vfResourceStructure.getResourceInstance().getResourceName(), "", "");
+						vfResourceStructure.getResourceInstance().getResourceName(),"", "");
 			} else {
 				logger.info(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
 						vfResourceStructure.getResourceInstance().getResourceInstanceName(),
-						vfResourceStructure.getResourceInstance().getResourceUUID(),
+						vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
 						vfResourceStructure.getNotification().getServiceName(),
 						BigDecimalVersion.castAndCheckNotificationVersionToString(
 								vfResourceStructure.getNotification().getServiceVersion()),
-						vfResourceStructure.getNotification().getServiceUUID(), 
+						vfResourceStructure.getNotification().getServiceUUID(),
 						vfResourceStructure.getResourceInstance().getResourceName(),"", "");
 			}
 
@@ -108,13 +174,15 @@
 	}
 
 	@Override
-	public void installTheResource(VfResourceStructure vfResourceStructure) throws ArtifactInstallerException {
+	public void installTheResource(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException {
 
 		// 1. Add the DB object list (Hashed) to be created from the HashMap
 		// UUID
 		// The DB objects will be stored in each VfModuleArtifact objects
 		// Those objects could be reused by different VfModule
 
+		VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct;
+
 		for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
 
 			switch (vfModuleArtifact.getArtifactInfo().getArtifactType()) {
@@ -138,26 +206,53 @@
 
 			}
 		}
-		
+
 		// in case of deployment failure, use a string that will represent the type of artifact that failed...
 		List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
-		
+
 		CatalogDatabase catalogDB = new CatalogDatabase();
 		// 2. Create the VFModules/VNFResource objects by linking them to the
 		// objects created before and store them in Resource/module structure
 		// Opening a DB transaction, starting from here
 		try {
-			
+
 			VfResourceInstaller.createService(vfResourceStructure);
-			
-			VfResourceInstaller.createVnfResource(vfResourceStructure);
+
+			String resourceType = vfResourceStructure.getResourceInstance().getResourceType();
+			String resourceCategory = vfResourceStructure.getResourceInstance().getCategory();
+
+			if(resourceType.equals("VF")){
+
+				if(resourceCategory.equalsIgnoreCase("Allotted Resource")){
+					VfResourceInstaller.createAllottedResourceCustomization(vfResourceStructure);
+					catalogDB.saveAllottedResourceCustomization(vfResourceStructure.getCatalogResourceCustomization());
+				} else {
+					VfResourceInstaller.createVnfResource(vfResourceStructure);
+					catalogDB.saveOrUpdateVnfResource(vfResourceStructure.getCatalogVnfResource());
+				}
+			}
+
+			if(resourceType.equals("VL")){
+				VfResourceInstaller.createNetworkResourceCustomization(vfResourceStructure);
+				catalogDB.saveNetworkResourceCustomization(vfResourceStructure.getCatalogNetworkResourceCustomization());
+			}
 
 			// Add this one for logging
 			artifactListForLogging.add(ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure));
-			
-			catalogDB.saveOrUpdateVnfResource(vfResourceStructure.getCatalogVnfResource());
+
+			//catalogDB.saveOrUpdateVnfResource(vfResourceStructure.getCatalogVnfResource());
 			catalogDB.saveService(vfResourceStructure.getCatalogService());
-			
+
+			// Now that the service has been added we can populate the Service_to_AllottedResources table
+			if(resourceType.equals("VF") && resourceCategory.equalsIgnoreCase("Allotted Resource")){
+				catalogDB.saveServiceToAllottedResources(vfResourceStructure.getCatalogServiceToAllottedResources());
+			}
+
+			// Now that the service has been added we can populate the Service_to_Network table
+			if(resourceType.equals("VL")){
+				catalogDB.saveServiceToNetworks(vfResourceStructure.getCatalogServiceToNetworks());
+			}
+
 			for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
 
 				// Here we set the right db structure according to the Catalog
@@ -170,14 +265,14 @@
 
 				HeatTemplate heatMainTemplate = null;
 				HeatEnvironment heatEnv = null;
-				
+
 				HeatTemplate heatVolumeTemplate = null;
 				HeatEnvironment heatVolumeEnv = null;
-				
+
 				if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT)) {
 					IArtifactInfo mainEnvArtifactInfo = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT)
 							.get(0).getArtifactInfo().getGeneratedArtifact();
-					
+
 					// MAIN HEAT
 					heatMainTemplate = (HeatTemplate) vfModuleStructure.getArtifactsMap()
 							.get(ASDCConfiguration.HEAT).get(0).getCatalogObject();
@@ -185,77 +280,77 @@
 					// Add this one for logging
 					artifactListForLogging.add(ASDCElementInfo
 							.createElementFromVfArtifactInfo(vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo()));
-					
+
 					catalogDB.saveHeatTemplate(heatMainTemplate, heatMainTemplate.getParameters());
 					// Indicate we have deployed it in the DB
 					vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).incrementDeployedInDB();
-					
-					
+
+
 					// VOLUME HEAT
 					// We expect only one VOL HEAT per VFMODULE
 					// we can also obtain from it the Env ArtifactInfo, that's why
 					// we get the Volume IArtifactInfo
-				
+
 					if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_VOL)) {
 						IArtifactInfo volEnvArtifactInfo = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0)
 								.getArtifactInfo().getGeneratedArtifact();
-		
+
 						heatVolumeTemplate = (HeatTemplate) vfModuleStructure.getArtifactsMap()
 								.get(ASDCConfiguration.HEAT_VOL).get(0).getCatalogObject();
-					
+
 						// Add this one for logging
 						artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo()));
 
 						catalogDB.saveHeatTemplate(heatVolumeTemplate, heatVolumeTemplate.getParameters());
 						// Indicate we have deployed it in the DB
 						vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).incrementDeployedInDB();
-						
+
 						if (volEnvArtifactInfo != null) {
 							heatVolumeEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID()
 									.get(volEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
 
 							// Add this one for logging
 							artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(volEnvArtifactInfo));
-														
+
 							catalogDB.saveHeatEnvironment(heatVolumeEnv);
 							// Indicate we have deployed it in the DB
 							vfResourceStructure.getArtifactsMapByUUID().get(volEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB();
 						}
-						
+
 					}
-					
+
 					// NESTED HEAT
 					// Here we expect many HEAT_NESTED template to be there
 					// check first if we really have nested heat templates
 					if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_NESTED)) {
 						for (VfModuleArtifact heatNestedArtifact : vfModuleStructure.getArtifactsMap()
 								.get(ASDCConfiguration.HEAT_NESTED)) {
-	
+
 							// Check if this nested is well referenced by the MAIN HEAT
 							String parentArtifactType = VfResourceInstaller.identifyParentOfNestedTemplate(vfModuleStructure,heatNestedArtifact);
 							HeatTemplate heatNestedTemplate = (HeatTemplate) heatNestedArtifact.getCatalogObject();
-							
+
 							if (parentArtifactType != null) {
-														
+
 								switch (parentArtifactType) {
 									case ASDCConfiguration.HEAT:
-										
+
 										// Add this one for logging
 										artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
-								
+
 										catalogDB.saveNestedHeatTemplate (heatMainTemplate.getId(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
 										// Indicate we have deployed it in the DB
 										heatNestedArtifact.incrementDeployedInDB();
 										break;
 									case ASDCConfiguration.HEAT_VOL:
-										
+
 										// Add this one for logging
 										artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
 										catalogDB.saveNestedHeatTemplate (heatVolumeTemplate.getId(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
 										// Indicate we have deployed it in the DB
 										heatNestedArtifact.incrementDeployedInDB();
 										break;
-										
+
 									default:
 										break;
 
@@ -263,49 +358,49 @@
 							} else { // Assume it belongs to HEAT MAIN
 								// Add this one for logging
 								artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
-						
+
 								catalogDB.saveNestedHeatTemplate (heatMainTemplate.getId(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
 								// Indicate we have deployed it in the DB
 								heatNestedArtifact.incrementDeployedInDB();
 							}
 						}
 					}
-					
+
 					if (mainEnvArtifactInfo != null) {
 						heatEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID()
 								.get(mainEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
 
 						// Add this one for logging
 						artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(mainEnvArtifactInfo));
-												
+
 						catalogDB.saveHeatEnvironment(heatEnv);
 						// Indicate we have deployed it in the DB
 						vfResourceStructure.getArtifactsMapByUUID().get(mainEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB();
 					}
-					
+
 				}
-		
-					
+
+
 				// here we expect one VFModule to be there
 				VfResourceInstaller.createVfModule(vfModuleStructure,heatMainTemplate, heatVolumeTemplate, heatEnv, heatVolumeEnv);
 				VfModule vfModule = vfModuleStructure.getCatalogVfModule();
 
 				// Add this one for logging
 				artifactListForLogging.add(ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure));
-				
+
 				catalogDB.saveOrUpdateVfModule(vfModule);
 
 				// Here we expect many HEAT_TEMPLATE files to be there
 				if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_ARTIFACT)) {
 					for (VfModuleArtifact heatArtifact : vfModuleStructure.getArtifactsMap()
 							.get(ASDCConfiguration.HEAT_ARTIFACT)) {
-	
+
 						HeatFiles heatFile = (HeatFiles) heatArtifact.getCatalogObject();
-											
+
 						// Add this one for logging
 						artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatArtifact.getArtifactInfo()));
-					
-						
+
+
 						catalogDB.saveVfModuleToHeatFiles (vfModule.getId(), heatFile);
 						// Indicate we will deploy it in the DB
 						heatArtifact.incrementDeployedInDB();
@@ -313,10 +408,10 @@
 				}
 
 			}
-			
+
 			catalogDB.commit();
 			vfResourceStructure.setSuccessfulDeployment();
-			
+
 		} catch (Exception e) {
 
 			Throwable dbExceptionToCapture = e;
@@ -329,12 +424,12 @@
 				logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED, vfResourceStructure.getResourceInstance().getResourceName(),
 						vfResourceStructure.getNotification().getServiceVersion(), "", "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e);
 			} else {
-				String endEvent = "Exception caught during installation of the VFResource. Transaction rollback.";
+				String endEvent = "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.";
 				String elementToLog = (artifactListForLogging.size() > 0 ? artifactListForLogging.get(artifactListForLogging.size()-1).toString() : "No element listed");
-				logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError, "Exception caught during installation of the VFResource. Transaction rollback", e);
+				logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError, "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback", e);
 				catalogDB.rollback();
 				throw new ArtifactInstallerException(
-						"Exception caught during installation of the VFResource. Transaction rollback.", e);
+						"Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
 			}
 
 		} finally {
@@ -344,10 +439,10 @@
 		}
 
 	}
-	
+
 	private static String identifyParentOfNestedTemplate(VfModuleStructure vfModuleStructure,VfModuleArtifact heatNestedArtifact) {
 
-		if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null 
+		if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null
 				&& vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
 			for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0)
 					.getArtifactInfo().getRelatedArtifacts()) {
@@ -356,29 +451,29 @@
 				}
 
 			}
-		} 
-		
-		if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null 
+		}
+
+		if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null
 				&& vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
 			for (IArtifactInfo unknownArtifact:vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getRelatedArtifacts()) {
 				if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
 					return ASDCConfiguration.HEAT_VOL;
 				}
-			
+
 			}
 		}
-		
+
 		// Does not belong to anything
 		return null;
-			
+
 	}
-	
+
 	private static void createVnfResource(VfResourceStructure vfResourceStructure) {
 		VnfResource vnfResource = new VnfResource();
-		
+
 		vnfResource.setAsdcUuid(vfResourceStructure.getResourceInstance().getResourceUUID());
 		vnfResource.setDescription(vfResourceStructure.getNotification().getServiceDescription());
-		
+
 		vnfResource.setOrchestrationMode("HEAT");
 		// Set the version but Version is stored into ASDC_SERVICE_MODEL_VERSION
 		vnfResource.setVersion(BigDecimalVersion
@@ -386,15 +481,59 @@
 		vnfResource.setVnfType(VfResourceInstaller.createVNFName(vfResourceStructure));
 		vnfResource.setModelVersion(BigDecimalVersion
 				.castAndCheckNotificationVersionToString(vfResourceStructure.getResourceInstance().getResourceVersion()));
-		
+
 		vnfResource.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID());
 		vnfResource.setModelCustomizationName(vfResourceStructure.getResourceInstance().getResourceInstanceName());
+		vnfResource.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID());
 		vnfResource.setModelName(vfResourceStructure.getResourceInstance().getResourceName());
 		vnfResource.setServiceModelInvariantUUID(vfResourceStructure.getNotification().getServiceInvariantUUID());
-	
+		//vnfResource.setCreated(getCurrentTimeStamp());
+
 		vfResourceStructure.setCatalogVnfResource(vnfResource);
 	}
 
+	private static void createNetworkResourceCustomization(VfResourceStructure vfResourceStructure) {
+		NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
+
+		networkResourceCustomization.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID().trim());
+		networkResourceCustomization.setModelName(vfResourceStructure.getResourceInstance().getResourceName().trim());
+		networkResourceCustomization.setModelInstanceName(vfResourceStructure.getResourceInstance().getResourceInstanceName().trim());
+		networkResourceCustomization.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID().trim());
+		networkResourceCustomization.setModelUuid(vfResourceStructure.getResourceInstance().getResourceUUID().trim());
+		networkResourceCustomization.setModelVersion(vfResourceStructure.getResourceInstance().getResourceVersion().trim());
+		//networkResourceCustomization.setCreated(getCurrentTimeStamp());
+
+		vfResourceStructure.setCatalogNetworkResourceCustomization(networkResourceCustomization);
+
+		ServiceToNetworks serviceNetworks = new ServiceToNetworks();
+		serviceNetworks.setNetworkModelCustomizationUuid(networkResourceCustomization.getModelCustomizationUuid());
+		serviceNetworks.setServiceModelUuid(vfResourceStructure.getNotification().getServiceUUID());
+
+		vfResourceStructure.setCatalogServiceToNetworks(serviceNetworks);
+
+	}
+
+	private static void createAllottedResourceCustomization(VfResourceStructure vfResourceStructure) {
+		AllottedResourceCustomization resourceCustomization = new AllottedResourceCustomization();
+
+		resourceCustomization.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID().trim());
+		resourceCustomization.setModelName(vfResourceStructure.getResourceInstance().getResourceName().trim());
+		resourceCustomization.setModelInstanceName(vfResourceStructure.getResourceInstance().getResourceInstanceName().trim());
+		resourceCustomization.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID().trim());
+		resourceCustomization.setModelUuid(vfResourceStructure.getResourceInstance().getResourceUUID().trim());
+		resourceCustomization.setVersion(vfResourceStructure.getResourceInstance().getResourceVersion().trim());
+		//resourceCustomization.setCreated(getCurrentTimeStamp());
+
+		vfResourceStructure.setCatalogResourceCustomization(resourceCustomization);
+
+		ServiceToAllottedResources serviceAllottedResources = new ServiceToAllottedResources();
+		serviceAllottedResources.setArModelCustomizationUuid(resourceCustomization.getModelCustomizationUuid());
+		serviceAllottedResources.setServiceModelUuid(vfResourceStructure.getNotification().getServiceUUID());
+
+		vfResourceStructure.setCatalogServiceToAllottedResources(serviceAllottedResources);
+
+	}
+
 	private static void createVfModule(VfModuleStructure vfModuleStructure,HeatTemplate heatMain, HeatTemplate heatVolume,HeatEnvironment heatEnv, HeatEnvironment heatVolumeEnv) {
 		VfModule vfModule = new VfModule();
 		vfModule.setType(createVfModuleName(vfModuleStructure));
@@ -407,21 +546,41 @@
 			vfModule.setIsBase(0);
 		}
 
+		vfModule.setModelCustomizationUuid(vfModuleStructure.getVfModuleMetadata().getVfModuleModelCustomizationUUID());
 		vfModule.setModelInvariantUuid(vfModuleStructure.getVfModuleMetadata().getVfModuleModelInvariantUUID());
 		vfModule.setModelName(vfModuleStructure.getVfModuleMetadata().getVfModuleModelName());
-		
+
 		vfModule.setVersion(BigDecimalVersion.castAndCheckNotificationVersionToString(vfModuleStructure.getParentVfResource().getNotification().getServiceVersion()));
 		vfModule.setModelVersion(BigDecimalVersion.castAndCheckNotificationVersionToString(
 				vfModuleStructure.getVfModuleMetadata().getVfModuleModelVersion()));
-	
+
+		Map<String,String> map = vfModuleStructure.getVfModuleMetadata().getProperties();
+
+		if(map != null){
+
+			if(map.get("vf_module_label") != null){
+				vfModule.setLabel(map.get("vf_module_label"));
+			}
+			if(map.get("initial_count") != null && map.get("initial_count").length() > 0){
+				vfModule.setInitialCount(Integer.parseInt(map.get("initial_count")));
+			}
+			if(map.get("min_vf_module_instances") != null && map.get("min_vf_module_instances").length() > 0){
+				vfModule.setMinInstances(Integer.parseInt(map.get("min_vf_module_instances")));
+			}
+			if(map.get("max_vf_module_instances") != null && map.get("max_vf_module_instances").length() > 0){
+				vfModule.setMaxInstances(Integer.parseInt(map.get("max_vf_module_instances")));
+			}
+
+		}
+
 		vfModuleStructure.setCatalogVfModule(vfModule);
-		
+
 		VfResourceInstaller.createVfModuleLinks(vfModule, vfModuleStructure.getParentVfResource().getCatalogVnfResource(), heatMain,heatVolume, heatEnv,heatVolumeEnv);
 	}
 
 	private static void createVfModuleLinks(VfModule vfModule, VnfResource vnfResource, HeatTemplate heatMain,
 			HeatTemplate heatVolume, HeatEnvironment heatEnv, HeatEnvironment heatVolumeEnv) {
-		
+
 		if (heatMain !=null) {
 			vfModule.setTemplateId(heatMain.getId());
 		}
@@ -434,7 +593,7 @@
 		if (heatVolumeEnv != null) {
 			vfModule.setVolEnvironmentId(heatVolumeEnv.getId());
 		}
-		
+
 		vfModule.setVnfResourceId(vnfResource.getId());
 
 	}
@@ -448,53 +607,53 @@
 
 	}
 
-	
+
 	public static String verifyTheFilePrefixInArtifacts(String filebody, VfResourceStructure vfResourceStructure, List<String> listTypes) {
 		String newFileBody = filebody;
 		for (VfModuleArtifact moduleArtifact:vfResourceStructure.getArtifactsMapByUUID().values()) {
-			
+
 			if (listTypes.contains(moduleArtifact.getArtifactInfo().getArtifactType())) {
-				
+
 				newFileBody = verifyTheFilePrefixInString(newFileBody,moduleArtifact.getArtifactInfo().getArtifactName());
 			}
 		}
 		return newFileBody;
 	}
-	
+
 	public static String verifyTheFilePrefixInString(final String body, final String filenameToVerify) {
-		
+
 		String needlePrefix = "file:///";
 		String prefixedFilenameToVerify = needlePrefix+filenameToVerify;
-		
-		if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) { 
-			return body; 
-		} 
- 
-		StringBuffer sb = new StringBuffer(body.length()); 
- 
-		int currentIndex = 0; 
-		int startIndex = 0; 
- 
-		while (currentIndex != -1) { 
-			startIndex = currentIndex; 
-			currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex); 
- 
-			if (currentIndex == -1) { 
-				break; 
-			} 
- 
-			// We append from the startIndex up to currentIndex (start of File Name) 
-			sb.append(body.substring(startIndex, currentIndex)); 
-			sb.append(filenameToVerify); 
- 
-			currentIndex += prefixedFilenameToVerify.length(); 
-		} 
- 
-		sb.append(body.substring(startIndex)); 
- 
+
+		if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) {
+			return body;
+		}
+
+		StringBuffer sb = new StringBuffer(body.length());
+
+		int currentIndex = 0;
+		int startIndex = 0;
+
+		while (currentIndex != -1) {
+			startIndex = currentIndex;
+			currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex);
+
+			if (currentIndex == -1) {
+				break;
+			}
+
+			// We append from the startIndex up to currentIndex (start of File Name)
+			sb.append(body.substring(startIndex, currentIndex));
+			sb.append(filenameToVerify);
+
+			currentIndex += prefixedFilenameToVerify.length();
+		}
+
+		sb.append(body.substring(startIndex));
+
 		return sb.toString();
 	}
-	
+
 	private static void createHeatTemplateFromArtifact(VfResourceStructure vfResourceStructure,
 			VfModuleArtifact vfModuleArtifact) {
 		HeatTemplate heatTemplate = new HeatTemplate();
@@ -505,11 +664,11 @@
 		// reused
 		heatTemplate.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName());
 		heatTemplate.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-		
+
 		List<String> typeList = new ArrayList<String>();
 		typeList.add(ASDCConfiguration.HEAT_NESTED);
 		typeList.add(ASDCConfiguration.HEAT_ARTIFACT);
-		
+
 		heatTemplate.setTemplateBody(verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(),vfResourceStructure,typeList));
 		heatTemplate.setTemplateName(vfModuleArtifact.getArtifactInfo().getArtifactName());
 
@@ -522,6 +681,13 @@
 		heatTemplate.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
 		heatTemplate.setVersion(BigDecimalVersion
 				.castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
+
+		if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
+			heatTemplate.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+		} else {
+			heatTemplate.setArtifactChecksum("MANUAL_RECORD");
+		}
+
 		Set<HeatTemplateParam> heatParam = VfResourceInstaller
 				.extractHeatTemplateParameters(vfModuleArtifact.getResult());
 		heatTemplate.setParameters(heatParam);
@@ -536,11 +702,11 @@
 		heatEnvironment.setName(vfModuleArtifact.getArtifactInfo().getArtifactName());
 		// TODO Set the label
 		heatEnvironment.setAsdcLabel("Label");
-		
+
 		List<String> typeList = new ArrayList<String>();
 		typeList.add(ASDCConfiguration.HEAT);
 		typeList.add(ASDCConfiguration.HEAT_VOL);
-		
+
 		heatEnvironment.setEnvironment(verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(),vfResourceStructure,typeList));
 		heatEnvironment.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
 		heatEnvironment.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
@@ -548,8 +714,14 @@
 				.castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
 		heatEnvironment.setAsdcResourceName(VfResourceInstaller.createVNFName(vfResourceStructure));
 
+		if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
+			heatEnvironment.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+		} else{
+			heatEnvironment.setArtifactChecksum("MANUAL_RECORD");
+		}
+
 		vfModuleArtifact.setCatalogObject(heatEnvironment);
-		
+
 	}
 
 	private static void createHeatFileFromArtifact(VfResourceStructure vfResourceStructure,
@@ -566,31 +738,45 @@
 				.castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
 
 		heatFile.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName());
+
+		if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
+			heatFile.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+		} else {
+			heatFile.setArtifactChecksum("MANUAL_RECORD");
+		}
+
 		vfModuleArtifact.setCatalogObject(heatFile);
-		
+
 	}
 
 	private static void createService(VfResourceStructure vfResourceStructure) {
-		
+
 		Service service = new Service();
 		service.setDescription(vfResourceStructure.getNotification().getServiceDescription());
 		service.setServiceName(vfResourceStructure.getNotification().getServiceName());
 		service.setServiceNameVersionId(vfResourceStructure.getNotification().getServiceUUID());
 		service.setVersion(vfResourceStructure.getNotification().getServiceVersion());
 		service.setModelInvariantUUID(vfResourceStructure.getNotification().getServiceInvariantUUID());
-				
+
 		vfResourceStructure.setCatalogService(service);
 	}
-	
-	
+
+
 	private static String createVNFName(VfResourceStructure vfResourceStructure) {
 
 		return vfResourceStructure.getNotification().getServiceName() + "/" + vfResourceStructure.getResourceInstance().getResourceInstanceName();
 	}
 
 	private static String createVfModuleName(VfModuleStructure vfModuleStructure) {
-		
+
 		return createVNFName(vfModuleStructure.getParentVfResource())+"::"+vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
 	}
 
+
+	private static Timestamp getCurrentTimeStamp() {
+
+		return new Timestamp(new Date().getTime());
+	}
+
+
 }
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
index 312613d..a355f05 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.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.
@@ -22,122 +22,126 @@
 
 
 import java.util.List;
+import java.util.Map;
 
 import org.openecomp.sdc.api.notification.IArtifactInfo;
 import org.openecomp.sdc.api.notification.INotificationData;
 import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.api.notification.IVfModuleMetadata;
+
+import org.openecomp.mso.asdc.installer.IVfModuleData;
 
 public class ASDCNotificationLogging {
 
 	public static String dumpASDCNotification(INotificationData asdcNotification) {
-		
+
 		if (asdcNotification == null) {
 			return "NULL";
 		}
 		StringBuffer buffer = new StringBuffer("ASDC Notification:");
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("DistributionID:");
 		buffer.append(testNull(asdcNotification.getDistributionID()));
 		buffer.append(System.lineSeparator());
-		
-		
+
+
 		buffer.append("ServiceName:");
 		buffer.append(testNull(asdcNotification.getServiceName()));
 		buffer.append(System.lineSeparator());
-		
-		
+
+
 		buffer.append("ServiceVersion:");
 		buffer.append(testNull(asdcNotification.getServiceVersion()));
 		buffer.append(System.lineSeparator());
-		
-		
+
+
 		buffer.append("ServiceUUID:");
 		buffer.append(testNull(asdcNotification.getServiceUUID()));
 		buffer.append(System.lineSeparator());
-	
-		
+
+
 		buffer.append("ServiceInvariantUUID:");
 		buffer.append(testNull(asdcNotification.getServiceInvariantUUID()));
 		buffer.append(System.lineSeparator());
-		
-		
+
+
 		buffer.append("ServiceDescription:");
 		buffer.append(testNull(asdcNotification.getServiceDescription()));
 		buffer.append(System.lineSeparator());
-	
-		
+
+
 		buffer.append("Service Artifacts List:");
 		buffer.append(System.lineSeparator());
 		buffer.append(testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("Resource Instances List:");
 		buffer.append(System.lineSeparator());
 		buffer.append(testNull(dumpASDCResourcesList(asdcNotification)));
 		buffer.append(System.lineSeparator());
-		
-		
+
+
 		return buffer.toString();
 	}
-	
-	public static String dumpVfModuleMetaDataList(List<IVfModuleMetadata> moduleMetaDataList) {
+
+	public static String dumpVfModuleMetaDataList(List<IVfModuleData> moduleMetaDataList) {
 		if (moduleMetaDataList == null ) {
 			return null;
 		}
-		
-		StringBuffer buffer = new StringBuffer();		
+
+		StringBuffer buffer = new StringBuffer("VfModuleMetaData List:");
+		buffer.append(System.lineSeparator());
+
 		buffer.append("{");
-		
-		for (IVfModuleMetadata moduleMetaData:moduleMetaDataList) {
+
+		for (IVfModuleData moduleMetaData:moduleMetaDataList) {
 			buffer.append(System.lineSeparator());
 			buffer.append(testNull(dumpVfModuleMetaData(moduleMetaData)));
 			buffer.append(System.lineSeparator());
 			buffer.append(",");
-			
+
 		}
 		buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
 		buffer.append("}");
 		buffer.append(System.lineSeparator());
-		
+
 		return buffer.toString();
 	}
-	
-	private static String dumpVfModuleMetaData(IVfModuleMetadata moduleMetaData) {
-				
+
+	private static String dumpVfModuleMetaData(IVfModuleData moduleMetaData) {
+
 		if (moduleMetaData == null ) {
 			return "NULL";
 		}
-		
+
 		StringBuffer buffer = new StringBuffer("VfModuleMetaData:");
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("VfModuleModelName:");
 		buffer.append(testNull(moduleMetaData.getVfModuleModelName()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("VfModuleModelVersion:");
 		buffer.append(testNull(moduleMetaData.getVfModuleModelVersion()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("VfModuleModelUUID:");
 		buffer.append(testNull(moduleMetaData.getVfModuleModelUUID()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("VfModuleModelInvariantUUID:");
 		buffer.append(testNull(moduleMetaData.getVfModuleModelInvariantUUID()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("VfModuleModelDescription:");
 		buffer.append(testNull(moduleMetaData.getVfModuleModelDescription()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("Artifacts UUID List:");
-		
+
 		if (moduleMetaData.getArtifacts() != null) {
 			buffer.append("{");
-			
+
 			for (String artifactUUID:moduleMetaData.getArtifacts()) {
 				buffer.append(System.lineSeparator());
 				buffer.append(testNull(artifactUUID));
@@ -150,17 +154,33 @@
 		} else {
 			buffer.append("NULL");
 		}
-		
-		
+
+		if (moduleMetaData.getProperties() != null) {
+			Map<String, String> vfModuleMap = moduleMetaData.getProperties();
+			buffer.append("Properties List:");
+			buffer.append("{");
+
+			for (Map.Entry<String, String> entry : vfModuleMap.entrySet()) {
+				buffer.append(System.lineSeparator());
+				buffer.append("  " + entry.getKey() + " : " + entry.getValue());
+			}
+			buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
+			buffer.append("}");
+			buffer.append(System.lineSeparator());
+		} else {
+			buffer.append("NULL");
+		}
+
+
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("isBase:");
 		buffer.append(moduleMetaData.isBase());
 		buffer.append(System.lineSeparator());
-		
+
 		return buffer.toString();
 	}
-	
+
 	private static String testNull(Object object) {
 		if (object == null) {
 			return "NULL";
@@ -172,15 +192,15 @@
 			return "Type not recognized";
 		}
 	}
-	
+
 	private static String dumpASDCResourcesList(INotificationData asdcNotification) {
 		if (asdcNotification == null || asdcNotification.getResources() == null) {
 			return null;
 		}
-		
-		StringBuffer buffer = new StringBuffer();		
+
+		StringBuffer buffer = new StringBuffer();
 		buffer.append("{");
-		
+
 		for (IResourceInstance resourceInstanceElem:asdcNotification.getResources()) {
 			buffer.append(System.lineSeparator());
 			buffer.append(testNull(dumpASDCResourceInstance(resourceInstanceElem)));
@@ -190,136 +210,148 @@
 		buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
 		buffer.append("}");
 		buffer.append(System.lineSeparator());
-		
+
 		return buffer.toString();
-		
+
 	}
-	
+
 	private static String dumpASDCResourceInstance(IResourceInstance resourceInstance) {
-		
+
 		if (resourceInstance == null) {
 			return null;
 		}
-		
+
 		StringBuffer buffer = new StringBuffer("Resource Instance Info:");
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ResourceInstanceName:");
 		buffer.append(testNull(resourceInstance.getResourceInstanceName()));
 		buffer.append(System.lineSeparator());
-		
+
+		buffer.append("ResourceCustomizationUUID:");
+		buffer.append(testNull(resourceInstance.getResourceCustomizationUUID()));
+		buffer.append(System.lineSeparator());
+
 		buffer.append("ResourceInvariantUUID:");
 		buffer.append(testNull(resourceInstance.getResourceInvariantUUID()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ResourceName:");
 		buffer.append(testNull(resourceInstance.getResourceName()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ResourceType:");
 		buffer.append(testNull(resourceInstance.getResourceType()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ResourceUUID:");
 		buffer.append(testNull(resourceInstance.getResourceUUID()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ResourceVersion:");
 		buffer.append(testNull(resourceInstance.getResourceVersion()));
 		buffer.append(System.lineSeparator());
-		
+
+		buffer.append("Category:");
+		buffer.append(testNull(resourceInstance.getCategory()));
+		buffer.append(System.lineSeparator());
+
+		buffer.append("SubCategory:");
+		buffer.append(testNull(resourceInstance.getSubcategory()));
+		buffer.append(System.lineSeparator());
+
 		buffer.append("Resource Artifacts List:");
 		buffer.append(System.lineSeparator());
 		buffer.append(testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())));
 		buffer.append(System.lineSeparator());
-		
+
 		return buffer.toString();
-		
+
 	}
-	
-	
+
+
 	private static String dumpArtifactInfoList(List<IArtifactInfo> artifactsList) {
-		
+
 		if (artifactsList == null || artifactsList.isEmpty()) {
 			return null;
 		}
-		
-		StringBuffer buffer = new StringBuffer();		
+
+		StringBuffer buffer = new StringBuffer();
 		buffer.append("{");
 		for (IArtifactInfo artifactInfoElem:artifactsList) {
 			buffer.append(System.lineSeparator());
 			buffer.append(testNull(dumpASDCArtifactInfo(artifactInfoElem)));
 			buffer.append(System.lineSeparator());
 			buffer.append(",");
-			
+
 		}
 		buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
 		buffer.append("}");
 		buffer.append(System.lineSeparator());
-		
+
 		return buffer.toString();
 	}
-	
+
 	private static String dumpASDCArtifactInfo(IArtifactInfo artifactInfo) {
-		
+
 		if (artifactInfo == null) {
 			return null;
 		}
-		
+
 		StringBuffer buffer = new StringBuffer("Service Artifacts Info:");
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ArtifactName:");
 		buffer.append(testNull(artifactInfo.getArtifactName()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ArtifactVersion:");
 		buffer.append(testNull(artifactInfo.getArtifactVersion()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ArtifactType:");
 		buffer.append(testNull(artifactInfo.getArtifactType()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ArtifactDescription:");
 		buffer.append(testNull(artifactInfo.getArtifactDescription()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ArtifactTimeout:");
 		buffer.append(testNull(artifactInfo.getArtifactTimeout()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ArtifactURL:");
 		buffer.append(testNull(artifactInfo.getArtifactURL()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ArtifactUUID:");
 		buffer.append(testNull(artifactInfo.getArtifactUUID()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("ArtifactChecksum:");
 		buffer.append(testNull(artifactInfo.getArtifactChecksum()));
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("GeneratedArtifact:");
 		buffer.append("{");
 		buffer.append(testNull(dumpASDCArtifactInfo(artifactInfo.getGeneratedArtifact())));
 		buffer.append(System.lineSeparator());
 		buffer.append("}");
 		buffer.append(System.lineSeparator());
-		
+
 		buffer.append("RelatedArtifacts:");
-		
-		
+
+
 		if (artifactInfo.getRelatedArtifacts() != null) {
 			buffer.append("{");
 			buffer.append(System.lineSeparator());
 			for (IArtifactInfo artifactInfoElem:artifactInfo.getRelatedArtifacts()) {
-							
+
 				buffer.append(testNull(dumpASDCArtifactInfo(artifactInfoElem)));
 				buffer.append(System.lineSeparator());
 				buffer.append(",");
-			
+
 			}
 			buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
 			buffer.append("}");
@@ -327,9 +359,9 @@
 		} else {
 			buffer.append("NULL");
 		}
-		
+
 		buffer.append(System.lineSeparator());
-		
+
 		return buffer.toString();
 	}
 }
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
index 23b7a80..63da38d 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.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.
@@ -33,7 +33,6 @@
 
 import org.junit.Test;
 import org.mockito.Mockito;
-
 import org.openecomp.sdc.api.notification.IArtifactInfo;
 import org.openecomp.sdc.api.notification.INotificationData;
 import org.openecomp.sdc.api.notification.IResourceInstance;
@@ -43,20 +42,20 @@
 import org.openecomp.mso.asdc.installer.ASDCElementInfo;
 import org.openecomp.mso.asdc.installer.VfModuleStructure;
 import org.openecomp.mso.asdc.installer.VfResourceStructure;
-
+import org.openecomp.mso.asdc.installer.IVfModuleData;
 
 public class ASDCElementInfoTest {
-	
+
 	@Test
 	public void createASDCElementInfoWithNullParameterTest() {
 		ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null);
 		ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null);
 		ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null);
-		
+
 		elementInfoFromNullVfArtifact.addElementInfo(null, null);
 		elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue");
 		elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null);
-		
+
 		assertEquals(elementInfoFromNullVfArtifact.toString(), "");
 		assertEquals(elementInfoFromNullVfModuleStructure.toString(), "");
 		assertEquals(elementInfoFromNullVfResourceStructure.toString(), "");
@@ -66,107 +65,107 @@
 		assertNotNull(elementInfoFromNullVfResourceStructure);
 
 		assertNotNull(ASDCElementInfo.EMPTY_INSTANCE);
-		
+
 		assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE);
 		assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE);
 		assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE);
-		
+
 		assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), "");
 		assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), "");
-		
+
 		assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
 		assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
 		assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
 	}
-	
+
 	@Test
 	public void createASDCElementInfoFromVfResourceTest() {
-		
+
 		String resourceInstanceName = "Resource 1";
-		
+
 		UUID generatedUUID = UUID.randomUUID();
-		
+
 		INotificationData notificationData = Mockito.mock(INotificationData.class);
 		IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
-		
+
 		Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
 		Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
-		
+
 		VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
-		
+
 		ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure);
-		
+
 		assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName));
 		assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString()));
-		
+
 		assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType()));
 		assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType());
-		
+
 		assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
 		elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue");
 		assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
 	}
-	
+
 	@Test
 	public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException {
-		
+
 		String resourceInstanceName = "Resource 1";
-		
+
 		UUID generatedUUID = UUID.randomUUID();
-		
+
 		INotificationData notificationData = Mockito.mock(INotificationData.class);
 		IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
-		
+
 		Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
 		Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
-		
+
 		VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
-		
+
 		// Create module structure now
-		
+
 		String vfModuleModelName = "Module Model XYZ";
-		
+
 		UUID generatedUUIDForModule = UUID.randomUUID();
-		
-		IVfModuleMetadata moduleMetadata = Mockito.mock(IVfModuleMetadata.class);
+
+		IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class);
 		Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName);
 		Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString());
 		Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String> emptyList());
-		
+
 		VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata);
-		
+
 		ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure);
-		
+
 		assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName));
 		assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString()));
-		
+
 		assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType()));
 		assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType());
-		
+
 		assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
 		elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue");
 		assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
 	}
-	
+
 	@Test
 	public void createASDCElementInfoFromArtifact() {
 		for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) {
 			String generatedArtifactName = eVal + " 1";
 			UUID generatedUUIDForArtifact = UUID.randomUUID();
-			
+
 			IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class);
 			Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal);
 			Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName);
 			Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString());
-			
+
 			ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo);
 
 			assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName));
 			assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString()));
-			
+
 			assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType()));
 			assertEquals(eVal, elementInfoFromArtifact.getType());
-			
+
 			assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
 			elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue");
 			assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java
deleted file mode 100644
index 8dd5afe..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * This file was automatically generated by EvoSuite
- * Fri Nov 25 13:35:55 GMT 2016
- */
-
-package org.openecomp.mso.asdc.installer;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-import static org.evosuite.shaded.org.mockito.Mockito.*;
-import static org.evosuite.runtime.EvoAssertions.*;
-
-import java.util.List;
-import java.util.Map;
-import org.evosuite.runtime.EvoRunner;
-import org.evosuite.runtime.EvoRunnerParameters;
-import org.evosuite.runtime.PrivateAccess;
-import org.evosuite.runtime.ViolatedAssumptionAnswer;
-import org.junit.runner.RunWith;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.api.notification.IVfModuleMetadata;
-
-@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
-public class ASDCElementInfoESTest extends ASDCElementInfoESTestscaffolding {
-
-  @Test(timeout = 4000)
-  public void test00()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iResourceInstance0).getResourceInstanceName();
-      doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID();
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure0);
-      String string0 = aSDCElementInfo0.getType();
-      assertEquals("VNF_RESOURCE", string0);
-  }
-
-  @Test(timeout = 4000)
-  public void test01()  throws Throwable  {
-      ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfModuleStructure((VfModuleStructure) null);
-      Map<String, String> map0 = aSDCElementInfo0.getElementInfoMap();
-      assertTrue(map0.isEmpty());
-  }
-
-  @Test(timeout = 4000)
-  public void test02()  throws Throwable  {
-      Map<String, String> map0 = ASDCElementInfo.EMPTY_INSTANCE.getElementInfoMap();
-      assertTrue(map0.isEmpty());
-  }
-
-  @Test(timeout = 4000)
-  public void test03()  throws Throwable  {
-      ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.EMPTY_INSTANCE;
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iArtifactInfo0).getArtifactName();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactType();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
-      ASDCElementInfo aSDCElementInfo1 = ASDCElementInfo.createElementFromVfArtifactInfo(iArtifactInfo0);
-      aSDCElementInfo0.toString();
-      PrivateAccess.setVariable((Class<ASDCElementInfo>) ASDCElementInfo.class, aSDCElementInfo1, "elementInfoMap", (Object) null);
-      aSDCElementInfo0.toString();
-      // Undeclared exception!
-      try { 
-        aSDCElementInfo1.toString();
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("org.openecomp.mso.asdc.installer.ASDCElementInfo", e);
-      }
-  }
-
-  @Test(timeout = 4000)
-  public void test05()  throws Throwable  {
-      ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.EMPTY_INSTANCE;
-      aSDCElementInfo0.addElementInfo("V$", (String) null);
-      assertEquals("", aSDCElementInfo0.getType());
-  }
-
-  @Test(timeout = 4000)
-  public void test06()  throws Throwable  {
-      ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfModuleStructure((VfModuleStructure) null);
-      String string0 = aSDCElementInfo0.EMPTY_INSTANCE.getType();
-      assertEquals("", string0);
-  }
-
-  @Test(timeout = 4000)
-  public void test07()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, (IResourceInstance) null);
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn((List) null).when(iVfModuleMetadata0).getArtifacts();
-      VfModuleStructure vfModuleStructure0 = null;
-      try {
-        vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0);
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
-      }
-  }
-
-  @Test(timeout = 4000)
-  public void test08()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      doReturn(" Name").when(iResourceInstance0).getResourceInstanceName();
-      doReturn(" Name").when(iResourceInstance0).getResourceInvariantUUID();
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure0);
-      String string0 = aSDCElementInfo0.toString();
-      assertEquals("Resource Instance Invariant UUID:  Name, Resource Instance Name:  Name", string0);
-  }
-
-  @Test(timeout = 4000)
-  public void test09()  throws Throwable  {
-      ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfArtifactInfo((IArtifactInfo) null);
-      aSDCElementInfo0.addElementInfo((String) null, "");
-      assertEquals("", aSDCElementInfo0.getType());
-  }
-
-  @Test(timeout = 4000)
-  public void test10()  throws Throwable  {
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iArtifactInfo0).getArtifactName();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactType();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
-      ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfArtifactInfo(iArtifactInfo0);
-      String string0 = aSDCElementInfo0.getType();
-      assertNull(string0);
-  }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java
deleted file mode 100644
index 075970b..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * Scaffolding file used to store all the setups needed to run 
- * tests automatically generated by EvoSuite
- * Fri Nov 25 13:35:55 GMT 2016
- */
-
-package org.openecomp.mso.asdc.installer;
-
-import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
-import org.junit.BeforeClass;
-import org.junit.Before;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.evosuite.runtime.sandbox.Sandbox;
-
-@EvoSuiteClassExclude
-public class ASDCElementInfoESTestscaffolding {
-
-  @org.junit.Rule 
-  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
-
-  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
-
-  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
-
-  @BeforeClass 
-  public static void initEvoSuiteFramework() { 
-    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.installer.ASDCElementInfo"; 
-    org.evosuite.runtime.GuiSupport.initialize(); 
-    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
-    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
-    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
-    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
-    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
-    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
-    initializeClasses();
-    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
-  } 
-
-  @AfterClass 
-  public static void clearEvoSuiteFramework(){ 
-    Sandbox.resetDefaultSecurityManager(); 
-    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
-  } 
-
-  @Before 
-  public void initTestCase(){ 
-    threadStopper.storeCurrentThreads();
-    threadStopper.startRecordingTime();
-    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
-    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
-    
-    org.evosuite.runtime.GuiSupport.setHeadless(); 
-    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
-    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
-  } 
-
-  @After 
-  public void doneWithTestCase(){ 
-    threadStopper.killAndJoinClientThreads();
-    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
-    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
-    resetClasses(); 
-    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
-    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
-    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
-  } 
-
-  private static void initializeClasses() {
-    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ASDCElementInfoESTestscaffolding.class.getClassLoader() ,
-      "org.openecomp.sdc.api.IDistributionClient",
-      "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning",
-      "org.openecomp.mso.asdc.installer.VfResourceStructure",
-      "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException",
-      "org.openecomp.mso.db.catalog.beans.VnfResource",
-      "org.openecomp.sdc.api.notification.IVfModuleMetadata",
-      "org.openecomp.mso.db.catalog.beans.VfModule",
-      "org.openecomp.sdc.api.results.IDistributionClientResult",
-      "org.openecomp.sdc.api.notification.IArtifactInfo",
-      "org.openecomp.mso.db.catalog.beans.Service",
-      "org.openecomp.mso.asdc.installer.VfModuleStructure",
-      "org.openecomp.sdc.api.notification.INotificationData",
-      "org.openecomp.mso.asdc.installer.VfModuleArtifact",
-      "org.openecomp.sdc.api.notification.IResourceInstance",
-      "org.openecomp.mso.asdc.installer.ASDCElementInfo",
-      "org.openecomp.sdc.api.results.IDistributionClientDownloadResult",
-      "org.openecomp.mso.asdc.installer.ASDCElementInfo$ASDCElementTypeEnum"
-    );
-  } 
-
-  private static void resetClasses() {
-    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ASDCElementInfoESTestscaffolding.class.getClassLoader());
-
-    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
-      "org.openecomp.mso.asdc.installer.ASDCElementInfo$ASDCElementTypeEnum",
-      "org.openecomp.mso.asdc.installer.ASDCElementInfo",
-      "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException"
-    );
-  }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTest.java
new file mode 100644
index 0000000..f87f906
--- /dev/null
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTest.java
@@ -0,0 +1,517 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Fri Feb 24 16:02:34 GMT 2017
+ */
+
+package org.openecomp.mso.asdc.installer;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+import java.util.List;
+import java.util.Map;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.PrivateAccess;
+import org.evosuite.runtime.ViolatedAssumptionAnswer;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
+public class VfModuleMetaDataESTest extends VfModuleMetaDataESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      List<Boolean> list0 = (List<Boolean>) mock(List.class, new ViolatedAssumptionAnswer());
+      Integer integer0 = new Integer((-13));
+      vfModuleMetaData0.setAttribute("", integer0);
+      vfModuleMetaData0.setAttribute("", "");
+      Map<Boolean, Boolean> map0 = (Map<Boolean, Boolean>) mock(Map.class, new ViolatedAssumptionAnswer());
+      doReturn((Object) null).when(map0).put(any() , any());
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map0);
+      List<Boolean> list1 = (List<Boolean>) mock(List.class, new ViolatedAssumptionAnswer());
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list1);
+      vfModuleMetaData0.setAttribute("kup1s\"/L_ ", "kup1s\"/L_ ");
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list0);
+      Map<Object, Boolean> map1 = (Map<Object, Boolean>) mock(Map.class, new ViolatedAssumptionAnswer());
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "properties", (Object) map1);
+      Map<Object, Boolean> map2 = (Map<Object, Boolean>) mock(Map.class, new ViolatedAssumptionAnswer());
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map2);
+      Map<String, Integer> map3 = (Map<String, Integer>) mock(Map.class, new ViolatedAssumptionAnswer());
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map3);
+      VfModuleMetaData vfModuleMetaData1 = new VfModuleMetaData();
+      List<String> list2 = (List<String>) mock(List.class, new ViolatedAssumptionAnswer());
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData1, "artifacts", (Object) list2);
+      vfModuleMetaData1.setAttribute((String) null, "");
+      vfModuleMetaData1.setAttribute("", "");
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData1, "properties", (Object) null);
+      vfModuleMetaData1.getProperties();
+      vfModuleMetaData0.setAttribute("", integer0);
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) null);
+      // Undeclared exception!
+      try {
+        vfModuleMetaData1.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      Map<String, String> map0 = vfModuleMetaData0.getProperties();
+      List<Object> list0 = (List<Object>) mock(List.class, new ViolatedAssumptionAnswer());
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list0);
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map0);
+      vfModuleMetaData0.setAttribute(")aPjhY=.[,~@B5", ")aPjhY=.[,~@B5");
+      vfModuleMetaData0.setAttribute(")aPjhY=.[,~@B5", "");
+      vfModuleMetaData0.setAttribute(")aPjhY=.[,~@B5", "");
+      Integer integer0 = new Integer((-6));
+      vfModuleMetaData0.setAttribute(")aPjhY=.[,~@B5", integer0);
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "properties", (Object) map0);
+      Map<Boolean, String> map1 = (Map<Boolean, String>) mock(Map.class, new ViolatedAssumptionAnswer());
+      doReturn((Object) null).when(map1).put(any() , any());
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map1);
+      vfModuleMetaData0.setAttribute((String) null, integer0);
+      Integer integer1 = new Integer((-1));
+      vfModuleMetaData0.setAttribute("&$*6wB^=VXY/.Gj`T", integer1);
+      Map<String, String> map2 = vfModuleMetaData0.getProperties();
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map2);
+      Map<String, String> map3 = vfModuleMetaData0.getProperties();
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map3);
+      List<Boolean> list1 = (List<Boolean>) mock(List.class, new ViolatedAssumptionAnswer());
+      doReturn((String) null).when(list1).toString();
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list1);
+      List<String> list2 = vfModuleMetaData0.getArtifacts();
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "properties", (Object) map3);
+      PrivateAccess.setVariable((Class<VfModuleMetaData>) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list2);
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.getVfModuleModelUUID();
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.setAttribute("X0s-/&YT>", "X0s-/&YT>");
+      vfModuleMetaData0.getArtifacts();
+      vfModuleMetaData0.setAttribute("vfModuleModelUUID", "");
+      vfModuleMetaData0.setAttribute("RHO{0R!FJsK+:s.q", "");
+      vfModuleMetaData0.setAttribute((String) null, "");
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.getVfModuleModelUUID();
+      vfModuleMetaData0.getArtifacts();
+      vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.getVfModuleModelUUID();
+      vfModuleMetaData0.getArtifacts();
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.getVfModuleModelUUID();
+      vfModuleMetaData0.getArtifacts();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("6NJ#o #-{", "6NJ#o #-{");
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.setAttribute("", "3o(D\" <bgGVHg");
+      vfModuleMetaData0.setAttribute("vfModuleModelVersion", "");
+      vfModuleMetaData0.setAttribute("y", "");
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.getVfModuleModelVersion();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("vfModuleModelDescription", "vfModuleModelDescription");
+      vfModuleMetaData0.setAttribute("vfModuleModelDescription", "vfModuleModelDescription");
+      vfModuleMetaData0.getArtifacts();
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.setAttribute("vfModuleModelDescription", "");
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.setAttribute("z9,}N0\"L]xH@", (Object) null);
+      vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.setAttribute("", (Object) null);
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.getArtifacts();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.setAttribute((String) null, (Object) null);
+      vfModuleMetaData0.setAttribute("vfModuleModelUUID", "vfModuleModelUUID");
+      vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.getVfModuleModelUUID();
+      vfModuleMetaData0.getArtifacts();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.getVfModuleModelUUID();
+      VfModuleMetaData vfModuleMetaData1 = new VfModuleMetaData();
+      assertNull(vfModuleMetaData1.getVfModuleModelName());
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("a.8XV,jQU\"Su_&pz", (Object) null);
+      vfModuleMetaData0.setAttribute("<A|K", "vfModuleModelInvariantUUID");
+      vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", "vfModuleModelInvariantUUID");
+      vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", "");
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.setAttribute("vfModuleModelUUID", "vfModuleModelUUID");
+      Map<String, String> map0 = vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.setAttribute("", "w(f2d");
+      vfModuleMetaData0.setAttribute("", map0);
+      vfModuleMetaData0.setAttribute("<A|K", "");
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("vfModuleModelDescription", "vfModuleModelDescription");
+      Map<String, String> map0 = vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.setAttribute("vfModuleModelDescription", "vfModuleModelDescription");
+      vfModuleMetaData0.setAttribute("vfModuleModelDescription", map0);
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.getArtifacts();
+      vfModuleMetaData0.getProperties();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.getVfModuleModelDescription();
+        fail("Expecting exception: ClassCastException");
+
+      } catch(ClassCastException e) {
+         //
+         // java.util.HashMap cannot be cast to java.lang.String
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("vfModuleModelDescription", "vfModuleModelDescription");
+      vfModuleMetaData0.setAttribute("}U?", "");
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.setAttribute("f78C:y", (Object) null);
+      vfModuleMetaData0.getArtifacts();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.getVfModuleModelUUID();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.getVfModuleModelName();
+      vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("Q> 'piXimPhE", "Q> 'piXimPhE");
+      vfModuleMetaData0.setAttribute("Q> 'piXimPhE", "(");
+      vfModuleMetaData0.setAttribute("D0kbC~", "Q> 'piXimPhE");
+      vfModuleMetaData0.setAttribute("", "D0kbC~");
+      vfModuleMetaData0.setAttribute("(", "");
+      vfModuleMetaData0.setAttribute("vfModuleModelVersion", "][,6>~[xc,");
+      vfModuleMetaData0.setAttribute("", "(");
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.setAttribute("D0kbC~", "vfModuleModelVersion");
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("vfModuleModelUUID", "");
+      vfModuleMetaData0.setAttribute("vfModuleModelCustomizationUUID", "");
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("", "");
+      vfModuleMetaData0.setAttribute("isBase", "isBase");
+      vfModuleMetaData0.setAttribute("isBase", "");
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.getArtifacts();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: ClassCastException");
+
+      } catch(ClassCastException e) {
+         //
+         // java.lang.String cannot be cast to java.lang.Boolean
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("vfModuleModelName", "vfModuleModelName");
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.setAttribute("mp+0S", (Object) null);
+      vfModuleMetaData0.setAttribute("EVNf'G}^Q", "mp+0S");
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.getVfModuleModelName();
+      vfModuleMetaData0.getVfModuleModelName();
+      vfModuleMetaData0.getArtifacts();
+      vfModuleMetaData0.getVfModuleModelName();
+      vfModuleMetaData0.setAttribute("Pw5`cyIph)xX&#zj~'", (Object) null);
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.getVfModuleModelName();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("vfModuleModelName", "vfModuleModelName");
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.setAttribute("", (Object) null);
+      vfModuleMetaData0.setAttribute((String) null, "vfModuleModelName");
+      vfModuleMetaData0.setAttribute("vfModuleModelName", "");
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.getVfModuleModelName();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", "vfModuleModelInvariantUUID");
+      vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", "vfModuleModelInvariantUUID");
+      vfModuleMetaData0.getVfModuleModelUUID();
+      vfModuleMetaData0.getVfModuleModelName();
+      vfModuleMetaData0.getProperties();
+      vfModuleMetaData0.setAttribute("k", "k");
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.setAttribute("", (Object) null);
+      VfModuleMetaData vfModuleMetaData1 = new VfModuleMetaData();
+      vfModuleMetaData1.getProperties();
+      // Undeclared exception!
+      try {
+        vfModuleMetaData1.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test15()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.setAttribute("y&g B,yQlt!e=p`Q1", "y&g B,yQlt!e=p`Q1");
+      vfModuleMetaData0.setAttribute("vfModuleModelCustomizationUUID", "vfModuleModelCustomizationUUID");
+      vfModuleMetaData0.setAttribute("vfModuleModelCustomizationUUID", "vfModuleModelCustomizationUUID");
+      vfModuleMetaData0.setAttribute("y&g B,yQlt!e=p`Q1", "vfModuleModelCustomizationUUID");
+      vfModuleMetaData0.setAttribute("vfModuleModelCustomizationUUID", (Object) null);
+      vfModuleMetaData0.setAttribute("3m%.ng=pp5", "vfModuleModelCustomizationUUID");
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.setAttribute((String) null, (Object) null);
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.setAttribute((String) null, "vfModuleModelDescription");
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.setAttribute("n8'>kSe2Hv:m| ", "vfModuleModelCustomizationUUID");
+      vfModuleMetaData0.getVfModuleModelUUID();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.getVfModuleModelName();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      String string0 = vfModuleMetaData0.getVfModuleModelVersion();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test16()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.getVfModuleModelDescription();
+      vfModuleMetaData0.setAttribute((String) null, (Object) null);
+      vfModuleMetaData0.getVfModuleModelName();
+      vfModuleMetaData0.getVfModuleModelVersion();
+      vfModuleMetaData0.setAttribute(".+7u)hv;7kUOz", (Object) null);
+      vfModuleMetaData0.getVfModuleModelCustomizationUUID();
+      vfModuleMetaData0.getVfModuleModelInvariantUUID();
+      String string0 = vfModuleMetaData0.getVfModuleModelUUID();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test17()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      String string0 = "$";
+      vfModuleMetaData0.setAttribute("$", "$");
+      vfModuleMetaData0.setAttribute("$", "");
+      vfModuleMetaData0.setAttribute("", "$");
+      // Undeclared exception!
+      try {
+        vfModuleMetaData0.isBase();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test18()  throws Throwable  {
+      VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+      vfModuleMetaData0.getArtifacts();
+      Map<String, String> map0 = vfModuleMetaData0.getProperties();
+      assertEquals(0, map0.size());
+  }
+}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTestscaffolding.java
new file mode 100644
index 0000000..39bb3a7
--- /dev/null
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTestscaffolding.java
@@ -0,0 +1,78 @@
+/**
+ * Scaffolding file used to store all the setups needed to run
+ * tests automatically generated by EvoSuite
+ * Fri Feb 24 16:02:34 GMT 2017
+ */
+
+package org.openecomp.mso.asdc.installer;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
+
+@EvoSuiteClassExclude
+public class VfModuleMetaDataESTestscaffolding {
+
+  @org.junit.Rule
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) System.getProperties().clone();
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass
+  public static void initEvoSuiteFramework() {
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.installer.VfModuleMetaData";
+    org.evosuite.runtime.GuiSupport.initialize();
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = SandboxMode.RECOMMENDED;
+    Sandbox.initializeSecurityManagerForSUT();
+    org.evosuite.runtime.classhandling.JDKClassResetter.init();
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+  }
+
+  @AfterClass
+  public static void clearEvoSuiteFramework(){
+    Sandbox.resetDefaultSecurityManager();
+    System.setProperties((java.util.Properties) defaultProperties.clone());
+  }
+
+  @Before
+  public void initTestCase(){
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
+    Sandbox.goingToExecuteSUTCode();
+    org.evosuite.runtime.GuiSupport.setHeadless();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+    org.evosuite.runtime.agent.InstrumentingAgent.activate();
+  }
+
+  @After
+  public void doneWithTestCase(){
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset();
+    resetClasses();
+    Sandbox.doneWithExecutingSUTCode();
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
+  }
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(VfModuleMetaDataESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.asdc.installer.VfModuleMetaData",
+      "org.openecomp.mso.asdc.installer.IVfModuleData"
+    );
+  }
+
+  private static void resetClasses() {
+  }
+}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java
index f3c20c5..e63680b 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java
@@ -1,108 +1,97 @@
 /*
  * This file was automatically generated by EvoSuite
- * Fri Nov 25 13:37:00 GMT 2016
+ * Fri Feb 24 13:34:51 GMT 2017
  */
 
 package org.openecomp.mso.asdc.installer;
 
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+import static org.evosuite.runtime.MockitoExtension.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import org.evosuite.runtime.EvoRunner;
 import org.evosuite.runtime.EvoRunnerParameters;
 import org.evosuite.runtime.ViolatedAssumptionAnswer;
-import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.openecomp.mso.asdc.installer.IVfModuleData;
+import org.openecomp.mso.asdc.installer.VfModuleArtifact;
+import org.openecomp.mso.asdc.installer.VfModuleStructure;
+import org.openecomp.mso.asdc.installer.VfResourceStructure;
+import org.openecomp.mso.db.catalog.beans.VfModule;
 import org.openecomp.sdc.api.notification.INotificationData;
 import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.api.notification.IVfModuleMetadata;
 
-import java.util.LinkedList;
-import java.util.List;
-
-import static org.evosuite.runtime.EvoAssertions.verifyException;
-import static org.evosuite.shaded.org.mockito.Mockito.doReturn;
-import static org.evosuite.shaded.org.mockito.Mockito.mock;
-import static org.junit.Assert.fail;
-
-@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
 public class VfModuleStructureESTest extends VfModuleStructureESTestscaffolding {
 
-  @Test(timeout = 4000)
-  public void test1()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn((List) null).when(iVfModuleMetadata0).getArtifacts();
-      VfModuleStructure vfModuleStructure0 = null;
-      try {
-        vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0);
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
-      }
-  }
+    @Test(timeout = 4000)
+    public void test0()  throws Throwable  {
+        LinkedList<String> linkedList0 = new LinkedList<String>();
+        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
+        doReturn(linkedList0).when(iVfModuleData0).getArtifacts();
+        VfModuleStructure vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleData0);
+        VfModule vfModule0 = new VfModule();
+        vfModule0.setIsBase(1);
+        vfModuleStructure0.setCatalogVfModule(vfModule0);
+        VfModule vfModule1 = vfModuleStructure0.getCatalogVfModule();
+        assertNull(vfModule1.getModelInvariantUuid());
+    }
 
-  @Test(timeout = 4000)
-  public void test2()  throws Throwable  {
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn((List) null).when(iVfModuleMetadata0).getArtifacts();
-      VfModuleStructure vfModuleStructure0 = null;
-      try {
-        vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleMetadata0);
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
-      }
-  }
+    @Test(timeout = 4000)
+    public void test1()  throws Throwable  {
+        LinkedList<String> linkedList0 = new LinkedList<String>();
+        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
+        doReturn(linkedList0).when(iVfModuleData0).getArtifacts();
+        VfModuleStructure vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleData0);
+        VfModule vfModule0 = new VfModule();
+        vfModuleStructure0.setCatalogVfModule(vfModule0);
+        VfModule vfModule1 = vfModuleStructure0.getCatalogVfModule();
+        assertNull(vfModule1.getModelVersion());
+    }
+ @Test(timeout = 4000)
+    public void test4()  throws Throwable  {
+        LinkedList<String> linkedList0 = new LinkedList<String>();
+        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
+        doReturn(linkedList0).when(iVfModuleData0).getArtifacts();
+        VfModuleStructure vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleData0);
+        Map<String, List<VfModuleArtifact>> map0 = vfModuleStructure0.getArtifactsMap();
+        assertTrue(map0.isEmpty());
+    }
 
-  @Test(timeout = 4000)
-  public void test3()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      LinkedList<String> linkedList0 = new LinkedList<String>();
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn(linkedList0).when(iVfModuleMetadata0).getArtifacts();
-      linkedList0.add("");
-      VfModuleStructure vfModuleStructure0 = null;
-      try {
-        vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0);
-        fail("Expecting exception: Exception");
-      
-      } catch(Exception e) {
-         //
-         // Artifact (UUID:) referenced in the VFModule UUID list has not been downloaded, cancelling the Resource deployment
-         //
-         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
-      }
-  }
+    @Test(timeout = 4000)
+    public void test5()  throws Throwable  {
+        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
+        IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
+        VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
+        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
+        doReturn((List) null).when(iVfModuleData0).getArtifacts();
+        VfModuleStructure vfModuleStructure0 = null;
+        try {
+            vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleData0);
+            fail("Expecting exception: NullPointerException");
 
-  @Test(timeout = 4000)
-  public void test4()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      vfResourceStructure0.setSuccessfulDeployment();
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn((List) null).when(iVfModuleMetadata0).getArtifacts();
-      vfResourceStructure0.setSuccessfulDeployment();
-      VfModuleStructure vfModuleStructure0 = null;
-      try {
-        vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0);
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
-      }
-  }
+        } catch(NullPointerException e) {
+            //
+            // no message in exception (getMessage() returned null)
+            //
+            verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
+        }
+    }
+
+    @Test(timeout = 4000)
+    public void test6()  throws Throwable  {
+        LinkedList<String> linkedList0 = new LinkedList<String>();
+        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
+        doReturn(linkedList0).when(iVfModuleData0).getArtifacts();
+        VfModuleStructure vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleData0);
+        VfModule vfModule0 = vfModuleStructure0.getCatalogVfModule();
+        assertNull(vfModule0);
+    }
 }
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java
deleted file mode 100644
index 4a27df3..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * This file was automatically generated by EvoSuite
- * Fri Nov 25 13:29:36 GMT 2016
- */
-
-package org.openecomp.mso.asdc.installer;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-import static org.evosuite.shaded.org.mockito.Mockito.*;
-import static org.evosuite.runtime.EvoAssertions.*;
-
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import java.time.chrono.ChronoLocalDate;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import org.evosuite.runtime.EvoRunner;
-import org.evosuite.runtime.EvoRunnerParameters;
-import org.evosuite.runtime.PrivateAccess;
-import org.evosuite.runtime.ViolatedAssumptionAnswer;
-import org.evosuite.runtime.mock.java.time.chrono.MockHijrahDate;
-import org.junit.runner.RunWith;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.impl.DistributionClientDownloadResultImpl;
-import org.openecomp.sdc.impl.mock.DistributionClientDownloadResultStubImpl;
-import org.openecomp.sdc.impl.mock.DistributionClientStubImpl;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
-
-@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
-public class VfResourceStructureESTest extends VfResourceStructureESTestscaffolding {
-
-  @Test(timeout = 4000)
-  public void test00()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) null);
-      vfResourceStructure0.getVfModuleStructure();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test01()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      LinkedList<Object> linkedList0 = new LinkedList<Object>();
-      linkedList0.add((Object) vfResourceStructure0);
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) linkedList0);
-      vfResourceStructure0.getVfModuleStructure();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test02()  throws Throwable  {
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure((INotificationData) null, (IResourceInstance) null);
-      vfResourceStructure0.getResourceInstance();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test03()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("").when(iNotificationData0).toString();
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      vfResourceStructure0.getNotification();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test04()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      Service service0 = new Service();
-      service0.setId(6);
-      vfResourceStructure0.setCatalogService(service0);
-      vfResourceStructure0.getCatalogService();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test05()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      Iterator<ChronoLocalDate> iterator0 = (Iterator<ChronoLocalDate>) mock(Iterator.class, new ViolatedAssumptionAnswer());
-      List<ChronoLocalDate> list0 = (List<ChronoLocalDate>) mock(List.class, new ViolatedAssumptionAnswer());
-      doReturn((Iterator) null).when(list0).iterator();
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0);
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true);
-      List<MockHijrahDate> list1 = (List<MockHijrahDate>) mock(List.class, new ViolatedAssumptionAnswer());
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true);
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) list1);
-      // Undeclared exception!
-      try { 
-        vfResourceStructure0.createVfModuleStructures();
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e);
-      }
-  }
-
-  @Test(timeout = 4000)
-  public void test06()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      Iterator<ChronoLocalDate> iterator0 = (Iterator<ChronoLocalDate>) mock(Iterator.class, new ViolatedAssumptionAnswer());
-      doReturn(false).when(iterator0).hasNext();
-      List<ChronoLocalDate> list0 = (List<ChronoLocalDate>) mock(List.class, new ViolatedAssumptionAnswer());
-      doReturn(iterator0).when(list0).iterator();
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0);
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true);
-      List<MockHijrahDate> list1 = (List<MockHijrahDate>) mock(List.class, new ViolatedAssumptionAnswer());
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true);
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) list1);
-      vfResourceStructure0.createVfModuleStructures();
-      IDistributionClient iDistributionClient0 = mock(IDistributionClient.class, new ViolatedAssumptionAnswer());
-      IArtifactInfo iArtifactInfo0 = null;
-      DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.ARTIFACT_NOT_FOUND;
-      DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "");
-      List<Object> list2 = (List<Object>) mock(List.class, new ViolatedAssumptionAnswer());
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list2);
-      // Undeclared exception!
-      try { 
-        vfResourceStructure0.addArtifactToStructure(iDistributionClient0, (IArtifactInfo) null, distributionClientDownloadResultImpl0);
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-      }
-  }
-
-  @Test(timeout = 4000)
-  public void test07()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      ChronoLocalDate chronoLocalDate0 = mock(ChronoLocalDate.class, new ViolatedAssumptionAnswer());
-      Iterator<ChronoLocalDate> iterator0 = (Iterator<ChronoLocalDate>) mock(Iterator.class, new ViolatedAssumptionAnswer());
-      doReturn(true).when(iterator0).hasNext();
-      doReturn(chronoLocalDate0).when(iterator0).next();
-      List<ChronoLocalDate> list0 = (List<ChronoLocalDate>) mock(List.class, new ViolatedAssumptionAnswer());
-      doReturn(iterator0).when(list0).iterator();
-      PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0);
-      // Undeclared exception!
-      try { 
-        vfResourceStructure0.createVfModuleStructures();
-        fail("Expecting exception: ClassCastException");
-      
-      } catch(ClassCastException e) {
-         //
-         // $java.time.chrono.ChronoLocalDate$$EnhancerByMockitoWithCGLIB$$27d47344 cannot be cast to org.openecomp.sdc.api.notification.IVfModuleMetadata
-         //
-         verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e);
-      }
-  }
-
-  @Test(timeout = 4000)
-  public void test08()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      try { 
-        vfResourceStructure0.createVfModuleStructures();
-        fail("Expecting exception: Exception");
-      
-      } catch(Exception e) {
-         //
-         // VfModule Meta DATA could not be decoded properly or was not present in the notification
-         //
-         verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e);
-      }
-  }
-
-  @Test(timeout = 4000)
-  public void test09()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("%[76").when(iArtifactInfo0).getArtifactType();
-      DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0);
-      vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultStubImpl0);
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test10()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("HEAT_ARTIFACT").when(iArtifactInfo0).getArtifactType();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
-      DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0);
-      vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultStubImpl0);
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test11()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0);
-      IArtifactInfo iArtifactInfo1 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("HEAT").when(iArtifactInfo1).getArtifactType();
-      doReturn("%[76").when(iArtifactInfo1).getArtifactUUID();
-      vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo1, distributionClientDownloadResultStubImpl0);
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test12()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0);
-      IArtifactInfo iArtifactInfo1 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("HEAT_NET").when(iArtifactInfo1).getArtifactType();
-      doReturn("HEAT_ENV").when(iArtifactInfo1).getArtifactUUID();
-      vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo1, distributionClientDownloadResultStubImpl0);
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test13()  throws Throwable  {
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure((INotificationData) null, iResourceInstance0);
-      DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("HEAT_ENV").when(iArtifactInfo0).getArtifactType();
-      doReturn("*Z\"P4rvOA+mW").when(iArtifactInfo0).getArtifactUUID();
-      DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.UEB_KEYS_CREATION_FAILED;
-      byte[] byteArray0 = new byte[6];
-      DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "]=)|;N.$hV]d^", "s:h+", byteArray0);
-      vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultImpl0);
-      Map<String, VfModuleArtifact> map0 = vfResourceStructure0.getArtifactsMapByUUID();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-      assertFalse(map0.isEmpty());
-  }
-
-  @Test(timeout = 4000)
-  public void test14()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("VF_MODULES_METADATA").when(iArtifactInfo0).getArtifactType();
-      DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.BAD_REQUEST;
-      byte[] byteArray0 = new byte[2];
-      DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "<B['", "<B['", byteArray0);
-      vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultImpl0);
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test15()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("HEAT_NESTED").when(iArtifactInfo0).getArtifactType();
-      doReturn("HEAT_NESTED").when(iArtifactInfo0).getArtifactUUID();
-      DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.BAD_REQUEST;
-      byte[] byteArray0 = new byte[2];
-      DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "<B['", "<B['", byteArray0);
-      vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultImpl0);
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test16()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      vfResourceStructure0.getCatalogService();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test17()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      vfResourceStructure0.getVfModulesStructureList();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test18()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      vfResourceStructure0.getArtifactsMapByUUID();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test19()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-      
-      vfResourceStructure0.setSuccessfulDeployment();
-      boolean boolean0 = vfResourceStructure0.isDeployedSuccessfully();
-      assertTrue(boolean0);
-  }
-
-  @Test(timeout = 4000)
-  public void test20()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      vfResourceStructure0.getCatalogVnfResource();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test21()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      vfResourceStructure0.getVfModuleStructure();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test22()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      boolean boolean0 = vfResourceStructure0.isDeployedSuccessfully();
-      assertFalse(boolean0);
-  }
-
-  @Test(timeout = 4000)
-  public void test23()  throws Throwable  {
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure((INotificationData) null, iResourceInstance0);
-      vfResourceStructure0.getNotification();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test24()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      VnfResource vnfResource0 = new VnfResource();
-      vfResourceStructure0.setCatalogVnfResource(vnfResource0);
-      vfResourceStructure0.getCatalogVnfResource();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test25()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      Service service0 = new Service();
-      vfResourceStructure0.setCatalogService(service0);
-      vfResourceStructure0.getCatalogService();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-
-  @Test(timeout = 4000)
-  public void test26()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iResourceInstance0).toString();
-      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
-      vfResourceStructure0.getResourceInstance();
-      assertFalse(vfResourceStructure0.isDeployedSuccessfully());
-  }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTestscaffolding.java
deleted file mode 100644
index f78949e..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTestscaffolding.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Scaffolding file used to store all the setups needed to run 
- * tests automatically generated by EvoSuite
- * Fri Nov 25 13:29:36 GMT 2016
- */
-
-package org.openecomp.mso.asdc.installer;
-
-import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
-import org.junit.BeforeClass;
-import org.junit.Before;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.evosuite.runtime.sandbox.Sandbox;
-
-@EvoSuiteClassExclude
-public class VfResourceStructureESTestscaffolding {
-
-  @org.junit.Rule 
-  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
-
-  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
-
-  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
-
-  @BeforeClass 
-  public static void initEvoSuiteFramework() { 
-    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.installer.VfResourceStructure"; 
-    org.evosuite.runtime.GuiSupport.initialize(); 
-    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
-    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
-    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
-    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
-    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
-    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
-    initializeClasses();
-    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
-  } 
-
-  @AfterClass 
-  public static void clearEvoSuiteFramework(){ 
-    Sandbox.resetDefaultSecurityManager(); 
-    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
-  } 
-
-  @Before 
-  public void initTestCase(){ 
-    threadStopper.storeCurrentThreads();
-    threadStopper.startRecordingTime();
-    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
-    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
-    
-    org.evosuite.runtime.GuiSupport.setHeadless(); 
-    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
-    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
-  } 
-
-  @After 
-  public void doneWithTestCase(){ 
-    threadStopper.killAndJoinClientThreads();
-    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
-    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
-    resetClasses(); 
-    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
-    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
-    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
-  } 
-
-  private static void initializeClasses() {
-    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(VfResourceStructureESTestscaffolding.class.getClassLoader() ,
-      "org.openecomp.sdc.api.IDistributionClient",
-      "org.openecomp.mso.db.catalog.beans.ServiceRecipe",
-      "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning",
-      "org.openecomp.mso.asdc.installer.VfResourceStructure",
-      "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException",
-      "org.openecomp.mso.db.catalog.beans.VnfResource",
-      "org.openecomp.sdc.utils.DistributionActionResultEnum",
-      "org.openecomp.sdc.impl.DistributionClientResultImpl",
-      "org.openecomp.sdc.impl.mock.DistributionClientStubImpl",
-      "org.openecomp.sdc.impl.DistributionClientDownloadResultImpl",
-      "org.openecomp.sdc.api.consumer.IConfiguration",
-      "org.openecomp.sdc.api.notification.IVfModuleMetadata",
-      "org.openecomp.sdc.api.results.IDistributionClientResult",
-      "org.openecomp.mso.db.catalog.beans.Service",
-      "org.openecomp.sdc.api.notification.IArtifactInfo",
-      "org.openecomp.sdc.impl.mock.DistributionClientDownloadResultStubImpl",
-      "org.openecomp.sdc.api.consumer.INotificationCallback",
-      "org.openecomp.mso.asdc.installer.VfModuleStructure",
-      "org.openecomp.sdc.api.notification.INotificationData",
-      "org.openecomp.mso.asdc.installer.VfModuleArtifact",
-      "org.openecomp.sdc.api.notification.IResourceInstance",
-      "org.openecomp.sdc.impl.mock.DistributionClientResultStubImpl",
-      "org.openecomp.sdc.api.results.IDistributionClientDownloadResult",
-      "org.openecomp.sdc.api.consumer.IDistributionStatusMessage"
-    );
-  } 
-
-  private static void resetClasses() {
-    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(VfResourceStructureESTestscaffolding.class.getClassLoader());
-
-    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
-      "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException"
-    );
-  }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTest.java
index 77c70e0..2e73096 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTest.java
@@ -1,6 +1,6 @@
 /*
  * This file was automatically generated by EvoSuite
- * Fri Nov 25 13:31:27 GMT 2016
+ * Mon Mar 13 16:09:00 GMT 2017
  */
 
 package org.openecomp.mso.asdc.util;
@@ -10,737 +10,263 @@
 import static org.evosuite.shaded.org.mockito.Mockito.*;
 import static org.evosuite.runtime.MockitoExtension.*;
 import static org.evosuite.runtime.EvoAssertions.*;
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.ConcurrentModificationException;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.function.Predicate;
+import java.util.Map;
+import java.util.function.UnaryOperator;
 import org.evosuite.runtime.EvoRunner;
 import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.PrivateAccess;
 import org.evosuite.runtime.ViolatedAssumptionAnswer;
 import org.junit.runner.RunWith;
+import org.openecomp.mso.asdc.installer.IVfModuleData;
+import org.openecomp.mso.asdc.installer.VfModuleMetaData;
+import org.openecomp.mso.asdc.util.ASDCNotificationLogging;
 import org.openecomp.sdc.api.notification.IArtifactInfo;
 import org.openecomp.sdc.api.notification.INotificationData;
 import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.api.notification.IVfModuleMetadata;
 
-@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
 public class ASDCNotificationLoggingESTest extends ASDCNotificationLoggingESTestscaffolding {
 
-  @Test(timeout = 4000)
-  public void test00()  throws Throwable  {
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
-      LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
-      Integer integer0 = new Integer(2147483645);
-      Integer integer1 = new Integer(2147483645);
-      Integer integer2 = new Integer(2147483645);
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactDescription();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactName();
-      doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactType();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactURL();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactVersion();
-      doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact();
-      doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts();
-      IArtifactInfo iArtifactInfo1 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("Resource Instance Info:").when(iArtifactInfo1).getArtifactChecksum();
-      doReturn("~1xF'ZQr|qhuc{").when(iArtifactInfo1).getArtifactDescription();
-      doReturn("").when(iArtifactInfo1).getArtifactName();
-      doReturn(integer1).when(iArtifactInfo1).getArtifactTimeout();
-      doReturn("7<\"g").when(iArtifactInfo1).getArtifactType();
-      doReturn("").when(iArtifactInfo1).getArtifactURL();
-      doReturn("").when(iArtifactInfo1).getArtifactUUID();
-      doReturn("7<\"g").when(iArtifactInfo1).getArtifactVersion();
-      doReturn(iArtifactInfo0).when(iArtifactInfo1).getGeneratedArtifact();
-      doReturn(linkedList1, linkedList1).when(iArtifactInfo1).getRelatedArtifacts();
-      LinkedList<IArtifactInfo> linkedList2 = new LinkedList<IArtifactInfo>();
-      Integer integer3 = new Integer(1);
-      LinkedList<IArtifactInfo> linkedList3 = new LinkedList<IArtifactInfo>();
-      IArtifactInfo iArtifactInfo2 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn("-X^ og(1=?-*/%4", "%jgpj", (String) null).when(iArtifactInfo2).getArtifactChecksum();
-      doReturn("7<\"g", "", (String) null).when(iArtifactInfo2).getArtifactDescription();
-      doReturn("7 'W{]65Y%Vh_ynFOr", "]+O?<_o+Mx?P@|^<:|/", (String) null).when(iArtifactInfo2).getArtifactName();
-      doReturn(integer0, integer3, (Integer) null).when(iArtifactInfo2).getArtifactTimeout();
-      doReturn("]+O?<_o+Mx?P@|^<:|/", "", (String) null).when(iArtifactInfo2).getArtifactType();
-      doReturn("i]\r7Wr. <gStwjW", "Ns3ZUZX(", (String) null).when(iArtifactInfo2).getArtifactURL();
-      doReturn("7 'W{]65Y%Vh_ynFOr", "7<\"g", (String) null).when(iArtifactInfo2).getArtifactUUID();
-      doReturn("7 'W{]65Y%Vh_ynFOr", "YuS7'", (String) null).when(iArtifactInfo2).getArtifactVersion();
-      doReturn(iArtifactInfo1, (IArtifactInfo) null, (IArtifactInfo) null).when(iArtifactInfo2).getGeneratedArtifact();
-      doReturn(linkedList2, linkedList2, linkedList3, linkedList3, (List) null).when(iArtifactInfo2).getRelatedArtifacts();
-      linkedList1.add(iArtifactInfo2);
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("~1xF'ZQr|qhuc{").when(iNotificationData0).getDistributionID();
-      doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
-      doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
-      doReturn("").when(iNotificationData0).getServiceDescription();
-      doReturn("").when(iNotificationData0).getServiceInvariantUUID();
-      doReturn("").when(iNotificationData0).getServiceName();
-      doReturn("").when(iNotificationData0).getServiceUUID();
-      doReturn("TvEm!").when(iNotificationData0).getServiceVersion();
-      String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData1).getDistributionID();
-      doReturn(linkedList0, linkedList0).when(iNotificationData1).getResources();
-      doReturn(linkedList1).when(iNotificationData1).getServiceArtifacts();
-      doReturn("").when(iNotificationData1).getServiceDescription();
-      doReturn("Tz)|, ,").when(iNotificationData1).getServiceInvariantUUID();
-      doReturn("").when(iNotificationData1).getServiceName();
-      doReturn("").when(iNotificationData1).getServiceUUID();
-      doReturn("Tz)|, ,").when(iNotificationData1).getServiceVersion();
-      String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
-      assertFalse(string1.equals((Object)string0));
-  }
+    @Test(timeout = 4000)
+    public void test00()  throws Throwable  {
+        LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
+        VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+        vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", vfModuleMetaData0);
+        linkedList0.add((IVfModuleData) vfModuleMetaData0);
+        // Undeclared exception!
+        try {
+            ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
+            fail("Expecting exception: ClassCastException");
 
-  @Test(timeout = 4000)
-  public void test01()  throws Throwable  {
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      LinkedList<IVfModuleMetadata> linkedList0 = new LinkedList<IVfModuleMetadata>();
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      linkedList0.add(iVfModuleMetadata0);
-      LinkedList<Object> linkedList1 = new LinkedList<Object>();
-      Object object0 = new Object();
-      linkedList1.push(object0);
-      linkedList0.spliterator();
-      linkedList0.removeAll(linkedList1);
-      linkedList0.clear();
-      LinkedList<String> linkedList2 = new LinkedList<String>();
-      IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn((List<String>) null, (List<String>) null, linkedList2, (List<String>) null).when(iVfModuleMetadata1).getArtifacts();
-      doReturn("e.tf%6&", "e.tf%6&", "").when(iVfModuleMetadata1).getVfModuleModelDescription();
-      doReturn("", "", "").when(iVfModuleMetadata1).getVfModuleModelInvariantUUID();
-      doReturn("", "", "e.tf%6&").when(iVfModuleMetadata1).getVfModuleModelName();
-      doReturn("VfModuleMetaData:", "e.tf%6&", "BaseArtifactInfoImpl [artifactName=").when(iVfModuleMetadata1).getVfModuleModelUUID();
-      doReturn("e.tf%6&", "e.tf%6&", "e.tf%6&").when(iVfModuleMetadata1).getVfModuleModelVersion();
-      doReturn(false, false).when(iVfModuleMetadata1).isBase();
-      linkedList0.add(iVfModuleMetadata1);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      // Undeclared exception!
-      try { 
-        ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e);
-      }
-  }
+        } catch(ClassCastException e) {
+            //
+            // org.openecomp.mso.asdc.installer.VfModuleMetaData cannot be cast to java.lang.String
+            //
+            verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+        }
+    }
 
-  @Test(timeout = 4000)
-  public void test02()  throws Throwable  {
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      ASDCNotificationLogging aSDCNotificationLogging1 = new ASDCNotificationLogging();
-      LinkedList<IVfModuleMetadata> linkedList0 = new LinkedList<IVfModuleMetadata>();
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn((List<String>) null, (List<String>) null).when(iVfModuleMetadata0).getArtifacts();
-      doReturn("TTq", (String) null).when(iVfModuleMetadata0).getVfModuleModelDescription();
-      doReturn("", (String) null).when(iVfModuleMetadata0).getVfModuleModelInvariantUUID();
-      doReturn("w1e~\"rjNBjuq*0HB!3&", (String) null).when(iVfModuleMetadata0).getVfModuleModelName();
-      doReturn("+l", (String) null).when(iVfModuleMetadata0).getVfModuleModelUUID();
-      doReturn("]", (String) null).when(iVfModuleMetadata0).getVfModuleModelVersion();
-      doReturn(true, false).when(iVfModuleMetadata0).isBase();
-      linkedList0.add(iVfModuleMetadata0);
-      IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      linkedList0.removeFirstOccurrence(aSDCNotificationLogging1);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      assertEquals("{\nVfModuleMetaData:\nVfModuleModelName:NULL\nVfModuleModelVersion:NULL\nVfModuleModelUUID:NULL\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:NULL\nArtifacts UUID List:NULL\nisBase:false\n\n\n}\n", string0);
-  }
+    @Test(timeout = 4000)
+    public void test01()  throws Throwable  {
+        List<IArtifactInfo> list0 = (List<IArtifactInfo>) mock(List.class, new ViolatedAssumptionAnswer());
+        doReturn(false).when(list0).isEmpty();
+        doReturn((Iterator) null).when(list0).iterator();
+        doReturn(0).when(list0).size();
+        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
+        doReturn("rGQA").when(iNotificationData0).getDistributionID();
+        doReturn(list0).when(iNotificationData0).getServiceArtifacts();
+        doReturn("rGQA").when(iNotificationData0).getServiceDescription();
+        doReturn("").when(iNotificationData0).getServiceInvariantUUID();
+        doReturn("").when(iNotificationData0).getServiceName();
+        doReturn("rGQA").when(iNotificationData0).getServiceUUID();
+        doReturn("").when(iNotificationData0).getServiceVersion();
+        // Undeclared exception!
+        try {
+            ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
+            fail("Expecting exception: NullPointerException");
 
-  @Test(timeout = 4000)
-  public void test03()  throws Throwable  {
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      List<IResourceInstance> list0 = (List<IResourceInstance>) mock(List.class, new ViolatedAssumptionAnswer());
-      List<IArtifactInfo> list1 = (List<IArtifactInfo>) mock(List.class, new ViolatedAssumptionAnswer());
-      doReturn(false).when(list1).isEmpty();
-      doReturn((Iterator) null).when(list1).iterator();
-      doReturn(0).when(list1).size();
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData0).getDistributionID();
-      doReturn(list1).when(iNotificationData0).getServiceArtifacts();
-      doReturn("9").when(iNotificationData0).getServiceDescription();
-      doReturn("9").when(iNotificationData0).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceName();
-      doReturn("Type not recognized").when(iNotificationData0).getServiceUUID();
-      doReturn("").when(iNotificationData0).getServiceVersion();
-      // Undeclared exception!
-      try { 
-        ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-        fail("Expecting exception: NullPointerException");
-      
-      } catch(NullPointerException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e);
-      }
-  }
+        } catch(NullPointerException e) {
+            //
+            // no message in exception (getMessage() returned null)
+            //
+            verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e);
+        }
+    }
 
-  @Test(timeout = 4000)
-  public void test04()  throws Throwable  {
-      LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("(ICU8j3G)Z4Z[GAE").when(iNotificationData0).getDistributionID();
-      doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
-      doReturn((List<IArtifactInfo>) null).when(iNotificationData0).getServiceArtifacts();
-      doReturn(")&42fB6dZT&HRAb1a").when(iNotificationData0).getServiceDescription();
-      doReturn("(ICU8j3G)Z4Z[GAE").when(iNotificationData0).getServiceInvariantUUID();
-      doReturn(")&42fB6dZT&HRAb1a").when(iNotificationData0).getServiceName();
-      doReturn(")&42fB6dZT&HRAb1a").when(iNotificationData0).getServiceUUID();
-      doReturn("cHH N9Ha9YUPSpX00i").when(iNotificationData0).getServiceVersion();
-      String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      assertEquals("ASDC Notification:\nDistributionID:(ICU8j3G)Z4Z[GAE\nServiceName:)&42fB6dZT&HRAb1a\nServiceVersion:cHH N9Ha9YUPSpX00i\nServiceUUID:)&42fB6dZT&HRAb1a\nServiceInvariantUUID:(ICU8j3G)Z4Z[GAE\nServiceDescription:)&42fB6dZT&HRAb1a\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n", string0);
-  }
+    @Test(timeout = 4000)
+    public void test02()  throws Throwable  {
+        LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
+        LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
+        linkedList0.offerFirst((IResourceInstance) null);
+        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
+        doReturn("").when(iNotificationData0).getDistributionID();
+        doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
+        doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
+        doReturn("").when(iNotificationData0).getServiceDescription();
+        doReturn("]U5JAkfdX0Cs").when(iNotificationData0).getServiceInvariantUUID();
+        doReturn("jV13a").when(iNotificationData0).getServiceName();
+        doReturn("").when(iNotificationData0).getServiceUUID();
+        doReturn("jV13a").when(iNotificationData0).getServiceVersion();
+        String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
+        assertEquals("ASDC Notification:\nDistributionID:\nServiceName:jV13a\nServiceVersion:jV13a\nServiceUUID:\nServiceInvariantUUID:]U5JAkfdX0Cs\nServiceDescription:\nService Artifacts List:\nNULL\nResource Instances List:\n{\nNULL\n\n}\n\n", string0);
+    }
 
-  @Test(timeout = 4000)
-  public void test05()  throws Throwable  {
-      LinkedList<IVfModuleMetadata> linkedList0 = new LinkedList<IVfModuleMetadata>();
-      assertEquals(0, linkedList0.size());
-      
-      LinkedList<String> linkedList1 = new LinkedList<String>();
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn(linkedList1, linkedList1).when(iVfModuleMetadata0).getArtifacts();
-      doReturn(", artifactTimeout=").when(iVfModuleMetadata0).getVfModuleModelDescription();
-      doReturn(", artifactChecksum=").when(iVfModuleMetadata0).getVfModuleModelInvariantUUID();
-      doReturn(", artifactTimeout=").when(iVfModuleMetadata0).getVfModuleModelName();
-      doReturn(", artifactTimeout=").when(iVfModuleMetadata0).getVfModuleModelUUID();
-      doReturn(", artifactTimeout=").when(iVfModuleMetadata0).getVfModuleModelVersion();
-      doReturn(false).when(iVfModuleMetadata0).isBase();
-      IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      linkedList0.add(iVfModuleMetadata1);
-      linkedList1.push("dzjz-zmMzFE");
-      linkedList0.listIterator();
-      linkedList0.toArray();
-      linkedList0.add(iVfModuleMetadata0);
-      linkedList0.pollFirst();
-      String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      assertEquals("{\nVfModuleMetaData:\nVfModuleModelName:, artifactTimeout=\nVfModuleModelVersion:, artifactTimeout=\nVfModuleModelUUID:, artifactTimeout=\nVfModuleModelInvariantUUID:, artifactChecksum=\nVfModuleModelDescription:, artifactTimeout=\nArtifacts UUID List:{\ndzjz-zmMzFE\n\n}\n\nisBase:false\n\n\n}\n", string0);
-      
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      LinkedList<IResourceInstance> linkedList2 = new LinkedList<IResourceInstance>();
-      LinkedList<IResourceInstance> linkedList3 = new LinkedList<IResourceInstance>((Collection<? extends IResourceInstance>) linkedList2);
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData0).getDistributionID();
-      doReturn((List) null).when(iNotificationData0).getResources();
-      doReturn((List) null).when(iNotificationData0).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData0).getServiceDescription();
-      doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceName();
-      doReturn((String) null).when(iNotificationData0).getServiceUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceVersion();
-      String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string1);
-  }
+    @Test(timeout = 4000)
+    public void test03()  throws Throwable  {
+        LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
+        LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
+        IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
+        doReturn((List) null).when(iResourceInstance0).getArtifacts();
+        doReturn((String) null).when(iResourceInstance0).getCategory();
+        doReturn((String) null).when(iResourceInstance0).getResourceCustomizationUUID();
+        doReturn((String) null).when(iResourceInstance0).getResourceInstanceName();
+        doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID();
+        doReturn((String) null).when(iResourceInstance0).getResourceName();
+        doReturn((String) null).when(iResourceInstance0).getResourceType();
+        doReturn((String) null).when(iResourceInstance0).getResourceUUID();
+        doReturn((String) null).when(iResourceInstance0).getResourceVersion();
+        doReturn((String) null).when(iResourceInstance0).getSubcategory();
+        linkedList0.add(iResourceInstance0);
+        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
+        doReturn("").when(iNotificationData0).getDistributionID();
+        doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
+        doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
+        doReturn("").when(iNotificationData0).getServiceDescription();
+        doReturn("").when(iNotificationData0).getServiceInvariantUUID();
+        doReturn("36-s.n1@").when(iNotificationData0).getServiceName();
+        doReturn("36-s.n1@").when(iNotificationData0).getServiceUUID();
+        doReturn("").when(iNotificationData0).getServiceVersion();
+        String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
+        assertEquals("ASDC Notification:\nDistributionID:\nServiceName:36-s.n1@\nServiceVersion:\nServiceUUID:36-s.n1@\nServiceInvariantUUID:\nServiceDescription:\nService Artifacts List:\nNULL\nResource Instances List:\n{\nResource Instance Info:\nResourceInstanceName:NULL\nResourceCustomizationUUID:NULL\nResourceInvariantUUID:NULL\nResourceName:NULL\nResourceType:NULL\nResourceUUID:NULL\nResourceVersion:NULL\nCategory:NULL\nSubCategory:NULL\nResource Artifacts List:\nNULL\n\n\n}\n\n", string0);
+    }
 
-  @Test(timeout = 4000)
-  public void test06()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData0).getDistributionID();
-      doReturn((List) null).when(iNotificationData0).getResources();
-      doReturn((List) null).when(iNotificationData0).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData0).getServiceDescription();
-      doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceName();
-      doReturn((String) null).when(iNotificationData0).getServiceUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      LinkedList<IVfModuleMetadata> linkedList0 = new LinkedList<IVfModuleMetadata>();
-      List<IVfModuleMetadata> list0 = linkedList0.subList(0, 0);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      linkedList0.removeAll(list0);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      Comparator<Object> comparator0 = (Comparator<Object>) mock(Comparator.class, new ViolatedAssumptionAnswer());
-      linkedList0.sort(comparator0);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      linkedList0.offerLast(iVfModuleMetadata0);
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData1).getDistributionID();
-      doReturn((List) null).when(iNotificationData1).getResources();
-      doReturn((List) null).when(iNotificationData1).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData1).getServiceDescription();
-      doReturn((String) null).when(iNotificationData1).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData1).getServiceName();
-      doReturn((String) null).when(iNotificationData1).getServiceUUID();
-      doReturn((String) null).when(iNotificationData1).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
-      // Undeclared exception!
-      try { 
-        ASDCNotificationLogging.dumpVfModuleMetaDataList(list0);
-        fail("Expecting exception: ConcurrentModificationException");
-      
-      } catch(ConcurrentModificationException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("java.util.SubList", e);
-      }
-  }
+    @Test(timeout = 4000)
+    public void test04()  throws Throwable  {
+        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
+        doReturn((String) null).when(iNotificationData0).getDistributionID();
+        doReturn((List) null).when(iNotificationData0).getResources();
+        doReturn((List) null).when(iNotificationData0).getServiceArtifacts();
+        doReturn((String) null).when(iNotificationData0).getServiceDescription();
+        doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
+        doReturn((String) null).when(iNotificationData0).getServiceName();
+        doReturn((String) null).when(iNotificationData0).getServiceUUID();
+        doReturn((String) null).when(iNotificationData0).getServiceVersion();
+        String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
+        assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0);
+    }
 
-  @Test(timeout = 4000)
-  public void test07()  throws Throwable  {
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      ASDCNotificationLogging aSDCNotificationLogging1 = new ASDCNotificationLogging();
-      LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
-      LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("ResourceInstanceName:").when(iNotificationData0).getDistributionID();
-      doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
-      doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
-      doReturn("ResourceInstanceName:").when(iNotificationData0).getServiceDescription();
-      doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
-      doReturn("ResourceInstanceName:").when(iNotificationData0).getServiceName();
-      doReturn("pr26M0Ud8~n6#j/;g").when(iNotificationData0).getServiceUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      ASDCNotificationLogging aSDCNotificationLogging2 = new ASDCNotificationLogging();
-      INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("ResourceInstanceName:").when(iNotificationData1).getDistributionID();
-      doReturn(linkedList0, linkedList0).when(iNotificationData1).getResources();
-      doReturn(linkedList1).when(iNotificationData1).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData1).getServiceDescription();
-      doReturn("").when(iNotificationData1).getServiceInvariantUUID();
-      doReturn("pr26M0Ud8~n6#j/;g").when(iNotificationData1).getServiceName();
-      doReturn("").when(iNotificationData1).getServiceUUID();
-      doReturn("Resource Artifacts List:").when(iNotificationData1).getServiceVersion();
-      String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
-      assertEquals("ASDC Notification:\nDistributionID:ResourceInstanceName:\nServiceName:pr26M0Ud8~n6#j/;g\nServiceVersion:Resource Artifacts List:\nServiceUUID:\nServiceInvariantUUID:\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n", string0);
-      
-      ASDCNotificationLogging aSDCNotificationLogging3 = new ASDCNotificationLogging();
-      LinkedList<IVfModuleMetadata> linkedList2 = new LinkedList<IVfModuleMetadata>();
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList2);
-      LinkedList<IResourceInstance> linkedList3 = new LinkedList<IResourceInstance>();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactChecksum();
-      doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactDescription();
-      doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactName();
-      doReturn((Integer) null, (Integer) null, (Integer) null).when(iArtifactInfo0).getArtifactTimeout();
-      doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactType();
-      doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactURL();
-      doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactUUID();
-      doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactVersion();
-      doReturn((IArtifactInfo) null, (IArtifactInfo) null, (IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact();
-      doReturn((List) null, (List) null, (List) null).when(iArtifactInfo0).getRelatedArtifacts();
-      linkedList1.add(iArtifactInfo0);
-      INotificationData iNotificationData2 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("tlh7ku").when(iNotificationData2).getDistributionID();
-      doReturn(linkedList3, linkedList0).when(iNotificationData2).getResources();
-      doReturn(linkedList1).when(iNotificationData2).getServiceArtifacts();
-      doReturn("").when(iNotificationData2).getServiceDescription();
-      doReturn("").when(iNotificationData2).getServiceInvariantUUID();
-      doReturn("tlh7ku").when(iNotificationData2).getServiceName();
-      doReturn("_B4BTx//Er%IWM}et0").when(iNotificationData2).getServiceUUID();
-      doReturn("").when(iNotificationData2).getServiceVersion();
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      doReturn(linkedList1).when(iResourceInstance0).getArtifacts();
-      doReturn("").when(iResourceInstance0).getResourceInstanceName();
-      doReturn("Resource Artifacts List:").when(iResourceInstance0).getResourceInvariantUUID();
-      doReturn("Hq^8Xl<>T").when(iResourceInstance0).getResourceName();
-      doReturn((String) null).when(iResourceInstance0).getResourceType();
-      doReturn("ASDC Notification:\nDistributionID:ResourceInstanceName:\nServiceName:ResourceInstanceName:\nServiceVersion:NULL\nServiceUUID:pr26M0Ud8~n6#j/;g\nServiceInvariantUUID:NULL\nServiceDescription:ResourceInstanceName:\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n").when(iResourceInstance0).getResourceUUID();
-      doReturn("zIQ?4(U$K ").when(iResourceInstance0).getResourceVersion();
-      linkedList0.add(iResourceInstance0);
-      IResourceInstance iResourceInstance1 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      doReturn(linkedList1).when(iResourceInstance1).getArtifacts();
-      doReturn("ASDC Notification:\nDistributionID:ResourceInstanceName:\nServiceName:pr26M0Ud8~n6#j/;g\nServiceVersion:Resource Artifacts List:\nServiceUUID:\nServiceInvariantUUID:\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n").when(iResourceInstance1).getResourceInstanceName();
-      doReturn("5yNU;|<:T-ixwLB").when(iResourceInstance1).getResourceInvariantUUID();
-      doReturn("").when(iResourceInstance1).getResourceName();
-      doReturn("xguM[yK-\"").when(iResourceInstance1).getResourceType();
-      doReturn("").when(iResourceInstance1).getResourceUUID();
-      doReturn("ASDC Notification:\nDistributionID:ResourceInstanceName:\nServiceName:pr26M0Ud8~n6#j/;g\nServiceVersion:Resource Artifacts List:\nServiceUUID:\nServiceInvariantUUID:\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n").when(iResourceInstance1).getResourceVersion();
-      linkedList1.removeFirstOccurrence((Object) null);
-      linkedList0.add(iResourceInstance1);
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData2);
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList2);
-      assertEquals("\n}\n", string1);
-  }
+    @Test(timeout = 4000)
+    public void test05()  throws Throwable  {
+        LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
+        VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+        Map<String, String> map0 = vfModuleMetaData0.getProperties();
+        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
+        doReturn((List<String>) null, (List<String>) null).when(iVfModuleData0).getArtifacts();
+        doReturn(map0, map0, (Map<String, String>) null).when(iVfModuleData0).getProperties();
+        doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelDescription();
+        doReturn((String) null, "vfModuleModelName").when(iVfModuleData0).getVfModuleModelInvariantUUID();
+        doReturn("", "").when(iVfModuleData0).getVfModuleModelName();
+        doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelUUID();
+        doReturn("|:\\KD91", "vfModuleModelName").when(iVfModuleData0).getVfModuleModelVersion();
+        doReturn(false, false).when(iVfModuleData0).isBase();
+        linkedList0.add(iVfModuleData0);
+        String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
+        assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:|:\\KD91\nVfModuleModelUUID:vfModuleModelUUID\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:vfModuleModelUUID\nArtifacts UUID List:NULLProperties List:\n}\n\nisBase:false\n\n\n}\n", string0);
 
-  @Test(timeout = 4000)
-  public void test08()  throws Throwable  {
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData0).getDistributionID();
-      doReturn((List) null).when(iNotificationData0).getResources();
-      doReturn((List) null).when(iNotificationData0).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData0).getServiceDescription();
-      doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceName();
-      doReturn((String) null).when(iNotificationData0).getServiceUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData1).getDistributionID();
-      doReturn((List) null).when(iNotificationData1).getResources();
-      doReturn((List) null).when(iNotificationData1).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData1).getServiceDescription();
-      doReturn((String) null).when(iNotificationData1).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData1).getServiceName();
-      doReturn((String) null).when(iNotificationData1).getServiceUUID();
-      doReturn((String) null).when(iNotificationData1).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      INotificationData iNotificationData2 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData2).getDistributionID();
-      doReturn((List) null).when(iNotificationData2).getResources();
-      doReturn((List) null).when(iNotificationData2).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData2).getServiceDescription();
-      doReturn((String) null).when(iNotificationData2).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData2).getServiceName();
-      doReturn((String) null).when(iNotificationData2).getServiceUUID();
-      doReturn((String) null).when(iNotificationData2).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData2);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      INotificationData iNotificationData3 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData3).getDistributionID();
-      doReturn((List) null).when(iNotificationData3).getResources();
-      doReturn((List) null).when(iNotificationData3).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData3).getServiceDescription();
-      doReturn((String) null).when(iNotificationData3).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData3).getServiceName();
-      doReturn((String) null).when(iNotificationData3).getServiceUUID();
-      doReturn((String) null).when(iNotificationData3).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData3);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      INotificationData iNotificationData4 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData4).getDistributionID();
-      doReturn((List) null).when(iNotificationData4).getResources();
-      doReturn((List) null).when(iNotificationData4).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData4).getServiceDescription();
-      doReturn((String) null).when(iNotificationData4).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData4).getServiceName();
-      doReturn((String) null).when(iNotificationData4).getServiceUUID();
-      doReturn((String) null).when(iNotificationData4).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData4);
-      INotificationData iNotificationData5 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData5).getDistributionID();
-      doReturn((List) null).when(iNotificationData5).getResources();
-      doReturn((List) null).when(iNotificationData5).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData5).getServiceDescription();
-      doReturn((String) null).when(iNotificationData5).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData5).getServiceName();
-      doReturn((String) null).when(iNotificationData5).getServiceUUID();
-      doReturn((String) null).when(iNotificationData5).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData5);
-      INotificationData iNotificationData6 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData6).getDistributionID();
-      doReturn((List) null).when(iNotificationData6).getResources();
-      doReturn((List) null).when(iNotificationData6).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData6).getServiceDescription();
-      doReturn((String) null).when(iNotificationData6).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData6).getServiceName();
-      doReturn((String) null).when(iNotificationData6).getServiceUUID();
-      doReturn((String) null).when(iNotificationData6).getServiceVersion();
-      String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData6);
-      assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0);
-      
-      ASDCNotificationLogging.dumpASDCNotification((INotificationData) null);
-      String string1 = ASDCNotificationLogging.dumpASDCNotification((INotificationData) null);
-      assertEquals("NULL", string1);
-  }
+        String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
+        assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:vfModuleModelName\nVfModuleModelUUID:isBase:\nVfModuleModelInvariantUUID:vfModuleModelName\nVfModuleModelDescription:isBase:\nArtifacts UUID List:NULLNULL\nisBase:false\n\n\n}\n", string1);
+    }
 
-  @Test(timeout = 4000)
-  public void test09()  throws Throwable  {
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      LinkedList<IArtifactInfo> linkedList0 = new LinkedList<IArtifactInfo>();
-      IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactDescription();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactName();
-      doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactType();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactURL();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
-      doReturn((String) null).when(iArtifactInfo0).getArtifactVersion();
-      doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact();
-      doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts();
-      linkedList0.add(iArtifactInfo0);
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData0).getDistributionID();
-      doReturn((List<IResourceInstance>) null).when(iNotificationData0).getResources();
-      doReturn(linkedList0).when(iNotificationData0).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData0).getServiceDescription();
-      doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceName();
-      doReturn((String) null).when(iNotificationData0).getServiceUUID();
-      doReturn("(").when(iNotificationData0).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      assertNull(string0);
-  }
+    @Test(timeout = 4000)
+    public void test06()  throws Throwable  {
+        LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
+        LinkedList<IVfModuleData> linkedList1 = new LinkedList<IVfModuleData>();
+        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
+        doReturn((List) null, (List) null).when(iVfModuleData0).getArtifacts();
+        doReturn((Map) null, (Map) null).when(iVfModuleData0).getProperties();
+        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelDescription();
+        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelInvariantUUID();
+        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelName();
+        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelUUID();
+        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelVersion();
+        doReturn(false, false).when(iVfModuleData0).isBase();
+        linkedList1.add(iVfModuleData0);
+        String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1);
+        String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1);
+        assertTrue(string1.equals((Object)string0));
+        assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:NULL\nVfModuleModelVersion:NULL\nVfModuleModelUUID:NULL\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:NULL\nArtifacts UUID List:NULLNULL\nisBase:false\n\n\n}\n", string1);
+    }
 
-  @Test(timeout = 4000)
-  public void test10()  throws Throwable  {
-      LinkedList<IVfModuleMetadata> linkedList0 = new LinkedList<IVfModuleMetadata>();
-      LinkedList<IVfModuleMetadata> linkedList1 = new LinkedList<IVfModuleMetadata>();
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      linkedList1.add(iVfModuleMetadata0);
-      LinkedList<String> linkedList2 = new LinkedList<String>();
-      LinkedList<String> linkedList3 = new LinkedList<String>();
-      linkedList1.removeFirst();
-      linkedList0.addAll((Collection<? extends IVfModuleMetadata>) linkedList1);
-      LinkedList<String> linkedList4 = new LinkedList<String>();
-      LinkedList<String> linkedList5 = new LinkedList<String>();
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      LinkedList<IResourceInstance> linkedList6 = new LinkedList<IResourceInstance>();
-      LinkedList<IArtifactInfo> linkedList7 = new LinkedList<IArtifactInfo>();
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("]=ztki(=]").when(iNotificationData0).getDistributionID();
-      doReturn(linkedList6, linkedList6).when(iNotificationData0).getResources();
-      doReturn(linkedList7).when(iNotificationData0).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData0).getServiceDescription();
-      doReturn("").when(iNotificationData0).getServiceInvariantUUID();
-      doReturn("").when(iNotificationData0).getServiceName();
-      doReturn("VG).").when(iNotificationData0).getServiceUUID();
-      doReturn("").when(iNotificationData0).getServiceVersion();
-      linkedList0.spliterator();
-      linkedList0.containsAll(linkedList1);
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      LinkedList<IResourceInstance> linkedList8 = new LinkedList<IResourceInstance>();
-      INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("C'K").when(iNotificationData1).getDistributionID();
-      doReturn(linkedList6, linkedList8).when(iNotificationData1).getResources();
-      doReturn(linkedList7).when(iNotificationData1).getServiceArtifacts();
-      doReturn("NotificationDataImpl [distributionID=").when(iNotificationData1).getServiceDescription();
-      doReturn((String) null).when(iNotificationData1).getServiceInvariantUUID();
-      doReturn("B.").when(iNotificationData1).getServiceName();
-      doReturn("").when(iNotificationData1).getServiceUUID();
-      doReturn("").when(iNotificationData1).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-  }
+    @Test(timeout = 4000)
+    public void test07()  throws Throwable  {
+        LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
+        VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+        linkedList0.add((IVfModuleData) vfModuleMetaData0);
+        UnaryOperator<IVfModuleData> unaryOperator0 = (UnaryOperator<IVfModuleData>) mock(UnaryOperator.class, new ViolatedAssumptionAnswer());
+        doReturn((Object) null).when(unaryOperator0).apply(any());
+        linkedList0.replaceAll(unaryOperator0);
+        String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
+        assertEquals("VfModuleMetaData List:\n{\nNULL\n\n}\n", string0);
+    }
 
-  @Test(timeout = 4000)
-  public void test11()  throws Throwable  {
-      LinkedList<IVfModuleMetadata> linkedList0 = new LinkedList<IVfModuleMetadata>();
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      linkedList0.add(iVfModuleMetadata0);
-      linkedList0.add((IVfModuleMetadata) null);
-      LinkedList<String> linkedList1 = new LinkedList<String>();
-      IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn(linkedList1, linkedList1, linkedList1, linkedList1).when(iVfModuleMetadata1).getArtifacts();
-      doReturn("8u1XbrrMy{J2", "").when(iVfModuleMetadata1).getVfModuleModelDescription();
-      doReturn("YR/UZ7qrmvO", "8u1XbrrMy{J2").when(iVfModuleMetadata1).getVfModuleModelInvariantUUID();
-      doReturn("8u1XbrrMy{J2", ".l=(8f`8f}.9>yn").when(iVfModuleMetadata1).getVfModuleModelName();
-      doReturn("", "YR/UZ7qrmvO").when(iVfModuleMetadata1).getVfModuleModelUUID();
-      doReturn("[66/OPYLD.B%", ".l=(8f`8f}.9>yn").when(iVfModuleMetadata1).getVfModuleModelVersion();
-      doReturn(false, true).when(iVfModuleMetadata1).isBase();
-      LinkedList<IVfModuleMetadata> linkedList2 = new LinkedList<IVfModuleMetadata>();
-      linkedList2.add((IVfModuleMetadata) null);
-      linkedList2.offer((IVfModuleMetadata) null);
-      Predicate<IVfModuleMetadata> predicate0 = (Predicate<IVfModuleMetadata>) mock(Predicate.class, new ViolatedAssumptionAnswer());
-      doReturn(true, false).when(predicate0).test(any());
-      linkedList2.removeIf(predicate0);
-      linkedList0.retainAll(linkedList2);
-      LinkedList<String> linkedList3 = new LinkedList<String>();
-      IVfModuleMetadata iVfModuleMetadata2 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn(linkedList3, linkedList3, linkedList3, linkedList1).when(iVfModuleMetadata2).getArtifacts();
-      doReturn("YR/UZ7qrmvO", "8u1XbrrMy{J2").when(iVfModuleMetadata2).getVfModuleModelDescription();
-      doReturn("", "8u1XbrrMy{J2").when(iVfModuleMetadata2).getVfModuleModelInvariantUUID();
-      doReturn("[66/OPYLD.B%", "").when(iVfModuleMetadata2).getVfModuleModelName();
-      doReturn("", "[66/OPYLD.B%").when(iVfModuleMetadata2).getVfModuleModelUUID();
-      doReturn((String) null, "").when(iVfModuleMetadata2).getVfModuleModelVersion();
-      doReturn(true, false).when(iVfModuleMetadata2).isBase();
-      linkedList0.add(iVfModuleMetadata2);
-      linkedList0.push(iVfModuleMetadata1);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      ASDCNotificationLogging aSDCNotificationLogging1 = new ASDCNotificationLogging();
-      ASDCNotificationLogging aSDCNotificationLogging2 = new ASDCNotificationLogging();
-      ASDCNotificationLogging aSDCNotificationLogging3 = new ASDCNotificationLogging();
-      String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      assertEquals("{\nVfModuleMetaData:\nVfModuleModelName:.l=(8f`8f}.9>yn\nVfModuleModelVersion:.l=(8f`8f}.9>yn\nVfModuleModelUUID:YR/UZ7qrmvO\nVfModuleModelInvariantUUID:8u1XbrrMy{J2\nVfModuleModelDescription:\nArtifacts UUID List:\n}\n\nisBase:true\n\n,\nNULL\n,\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:\nVfModuleModelUUID:[66/OPYLD.B%\nVfModuleModelInvariantUUID:8u1XbrrMy{J2\nVfModuleModelDescription:8u1XbrrMy{J2\nArtifacts UUID List:\n}\n\nisBase:false\n\n\n}\n", string0);
-      
-      LinkedList<IResourceInstance> linkedList4 = new LinkedList<IResourceInstance>();
-      LinkedList<IResourceInstance> linkedList5 = new LinkedList<IResourceInstance>((Collection<? extends IResourceInstance>) linkedList4);
-      LinkedList<IArtifactInfo> linkedList6 = new LinkedList<IArtifactInfo>();
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("95y$c-.BW5V()41WR").when(iNotificationData0).getDistributionID();
-      doReturn(linkedList5, linkedList4).when(iNotificationData0).getResources();
-      doReturn(linkedList6).when(iNotificationData0).getServiceArtifacts();
-      doReturn(", artifactTimeout=").when(iNotificationData0).getServiceDescription();
-      doReturn("[66/OPYLD.B%").when(iNotificationData0).getServiceInvariantUUID();
-      doReturn("[66/OPYLD.B%").when(iNotificationData0).getServiceName();
-      doReturn(", artifactChecksum=").when(iNotificationData0).getServiceUUID();
-      doReturn("W1vX^KnIx[x").when(iNotificationData0).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      ASDCNotificationLogging aSDCNotificationLogging4 = new ASDCNotificationLogging();
-      ASDCNotificationLogging aSDCNotificationLogging5 = new ASDCNotificationLogging();
-      LinkedList<IResourceInstance> linkedList7 = new LinkedList<IResourceInstance>();
-      INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("").when(iNotificationData1).getDistributionID();
-      doReturn(linkedList4, linkedList7).when(iNotificationData1).getResources();
-      doReturn(linkedList6).when(iNotificationData1).getServiceArtifacts();
-      doReturn("3l\"ZrTP`IQ-4x]").when(iNotificationData1).getServiceDescription();
-      doReturn("").when(iNotificationData1).getServiceInvariantUUID();
-      doReturn("").when(iNotificationData1).getServiceName();
-      doReturn("").when(iNotificationData1).getServiceUUID();
-      doReturn("").when(iNotificationData1).getServiceVersion();
-      String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
-      assertEquals("ASDC Notification:\nDistributionID:\nServiceName:\nServiceVersion:\nServiceUUID:\nServiceInvariantUUID:\nServiceDescription:3l\"ZrTP`IQ-4x]\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n", string1);
-  }
+    @Test(timeout = 4000)
+    public void test08()  throws Throwable  {
+        LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
+        VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
+        linkedList0.add((IVfModuleData) vfModuleMetaData0);
+        // Undeclared exception!
+        try {
+            ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
+            fail("Expecting exception: NullPointerException");
 
-  @Test(timeout = 4000)
-  public void test12()  throws Throwable  {
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData0).getDistributionID();
-      doReturn((List) null).when(iNotificationData0).getResources();
-      doReturn((List) null).when(iNotificationData0).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData0).getServiceDescription();
-      doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceName();
-      doReturn((String) null).when(iNotificationData0).getServiceUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData1).getDistributionID();
-      doReturn((List) null).when(iNotificationData1).getResources();
-      doReturn((List) null).when(iNotificationData1).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData1).getServiceDescription();
-      doReturn((String) null).when(iNotificationData1).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData1).getServiceName();
-      doReturn((String) null).when(iNotificationData1).getServiceUUID();
-      doReturn((String) null).when(iNotificationData1).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      INotificationData iNotificationData2 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData2).getDistributionID();
-      doReturn((List) null).when(iNotificationData2).getResources();
-      doReturn((List) null).when(iNotificationData2).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData2).getServiceDescription();
-      doReturn((String) null).when(iNotificationData2).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData2).getServiceName();
-      doReturn((String) null).when(iNotificationData2).getServiceUUID();
-      doReturn((String) null).when(iNotificationData2).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData2);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      ASDCNotificationLogging aSDCNotificationLogging1 = new ASDCNotificationLogging();
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      INotificationData iNotificationData3 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData3).getDistributionID();
-      doReturn((List) null).when(iNotificationData3).getResources();
-      doReturn((List) null).when(iNotificationData3).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData3).getServiceDescription();
-      doReturn((String) null).when(iNotificationData3).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData3).getServiceName();
-      doReturn((String) null).when(iNotificationData3).getServiceUUID();
-      doReturn((String) null).when(iNotificationData3).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData3);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      ASDCNotificationLogging aSDCNotificationLogging2 = new ASDCNotificationLogging();
-      LinkedList<IVfModuleMetadata> linkedList0 = new LinkedList<IVfModuleMetadata>();
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      doReturn((List) null, (List) null, (List) null).when(iVfModuleMetadata0).getArtifacts();
-      doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelDescription();
-      doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelInvariantUUID();
-      doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelName();
-      doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelUUID();
-      doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelVersion();
-      doReturn(false, false, false).when(iVfModuleMetadata0).isBase();
-      linkedList0.add(iVfModuleMetadata0);
-      linkedList0.removeLastOccurrence("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n");
-      linkedList0.remove((Object) null);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      ASDCNotificationLogging aSDCNotificationLogging3 = new ASDCNotificationLogging();
-      String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      assertEquals("{\nVfModuleMetaData:\nVfModuleModelName:NULL\nVfModuleModelVersion:NULL\nVfModuleModelUUID:NULL\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:NULL\nArtifacts UUID List:NULL\nisBase:false\n\n\n}\n", string1);
-      assertTrue(string1.equals((Object)string0));
-      
-      ASDCNotificationLogging aSDCNotificationLogging4 = new ASDCNotificationLogging();
-      ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleMetadata>) null);
-      INotificationData iNotificationData4 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn((String) null).when(iNotificationData4).getDistributionID();
-      doReturn((List) null).when(iNotificationData4).getResources();
-      doReturn((List) null).when(iNotificationData4).getServiceArtifacts();
-      doReturn((String) null).when(iNotificationData4).getServiceDescription();
-      doReturn((String) null).when(iNotificationData4).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData4).getServiceName();
-      doReturn((String) null).when(iNotificationData4).getServiceUUID();
-      doReturn((String) null).when(iNotificationData4).getServiceVersion();
-      String string2 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData4);
-      assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string2);
-  }
+        } catch(NullPointerException e) {
+            //
+            // no message in exception (getMessage() returned null)
+            //
+            verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
+        }
+    }
 
-  @Test(timeout = 4000)
-  public void test13()  throws Throwable  {
-      ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
-      LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
-      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
-      doReturn((List) null).when(iResourceInstance0).getArtifacts();
-      doReturn((String) null).when(iResourceInstance0).getResourceInstanceName();
-      doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID();
-      doReturn((String) null).when(iResourceInstance0).getResourceName();
-      doReturn((String) null).when(iResourceInstance0).getResourceType();
-      doReturn((String) null).when(iResourceInstance0).getResourceUUID();
-      doReturn((String) null).when(iResourceInstance0).getResourceVersion();
-      linkedList0.add(iResourceInstance0);
-      LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
-      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
-      doReturn("(n,0").when(iNotificationData0).getDistributionID();
-      doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
-      doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
-      doReturn("(n,0").when(iNotificationData0).getServiceDescription();
-      doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
-      doReturn((String) null).when(iNotificationData0).getServiceName();
-      doReturn("").when(iNotificationData0).getServiceUUID();
-      doReturn("t1N;ZSJsATt:&Ug").when(iNotificationData0).getServiceVersion();
-      ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
-      LinkedList<IVfModuleMetadata> linkedList2 = new LinkedList<IVfModuleMetadata>();
-      linkedList2.clear();
-      // Undeclared exception!
-      try { 
-        linkedList2.remove();
-        fail("Expecting exception: NoSuchElementException");
-      
-      } catch(NoSuchElementException e) {
-         //
-         // no message in exception (getMessage() returned null)
-         //
-         verifyException("java.util.LinkedList", e);
-      }
-  }
+    @Test(timeout = 4000)
+    public void test09()  throws Throwable  {
+        String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null);
+        assertNull(string0);
+    }
 
-  @Test(timeout = 4000)
-  public void test14()  throws Throwable  {
-      LinkedList<IVfModuleMetadata> linkedList0 = new LinkedList<IVfModuleMetadata>();
-      ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
-      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      linkedList0.add(iVfModuleMetadata0);
-      linkedList0.remove((Object) "\n}\n");
-      IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
-      linkedList0.offerLast(iVfModuleMetadata1);
-      // Undeclared exception!
-      try { 
-        linkedList0.subList((-1), (-1));
-        fail("Expecting exception: IndexOutOfBoundsException");
-      
-      } catch(IndexOutOfBoundsException e) {
-         //
-         // fromIndex = -1
-         //
-         verifyException("java.util.SubList", e);
-      }
-  }
+    @Test(timeout = 4000)
+    public void test10()  throws Throwable  {
+        String string0 = ASDCNotificationLogging.dumpASDCNotification((INotificationData) null);
+        assertEquals("NULL", string0);
+    }
+
+    @Test(timeout = 4000)
+    public void test11()  throws Throwable  {
+        LinkedList<IArtifactInfo> linkedList0 = new LinkedList<IArtifactInfo>();
+        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
+        doReturn("io7<{~.v|%").when(iNotificationData0).getDistributionID();
+        doReturn((List<IResourceInstance>) null).when(iNotificationData0).getResources();
+        doReturn(linkedList0).when(iNotificationData0).getServiceArtifacts();
+        doReturn("io7<{~.v|%").when(iNotificationData0).getServiceDescription();
+        doReturn("io7<{~.v|%").when(iNotificationData0).getServiceInvariantUUID();
+        doReturn("io7<{~.v|%").when(iNotificationData0).getServiceName();
+        doReturn((String) null).when(iNotificationData0).getServiceUUID();
+        doReturn("io7<{~.v|%").when(iNotificationData0).getServiceVersion();
+        String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
+        assertEquals("ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0);
+
+        ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null);
+        IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
+        doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum();
+        doReturn((String) null).when(iArtifactInfo0).getArtifactDescription();
+        doReturn((String) null).when(iArtifactInfo0).getArtifactName();
+        doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout();
+        doReturn((String) null).when(iArtifactInfo0).getArtifactType();
+        doReturn((String) null).when(iArtifactInfo0).getArtifactURL();
+        doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
+        doReturn((String) null).when(iArtifactInfo0).getArtifactVersion();
+        doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact();
+        doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts();
+        linkedList0.push(iArtifactInfo0);
+        INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
+        doReturn("t2J^4~*i|btm ib&").when(iNotificationData1).getDistributionID();
+        doReturn((List<IResourceInstance>) null).when(iNotificationData1).getResources();
+        doReturn(linkedList0).when(iNotificationData1).getServiceArtifacts();
+        doReturn("N~a W7").when(iNotificationData1).getServiceDescription();
+        doReturn("N~a W7").when(iNotificationData1).getServiceInvariantUUID();
+        doReturn("/&*/=").when(iNotificationData1).getServiceName();
+        doReturn((String) null).when(iNotificationData1).getServiceUUID();
+        doReturn("ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n").when(iNotificationData1).getServiceVersion();
+        String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
+        assertEquals("ASDC Notification:\nDistributionID:t2J^4~*i|btm ib&\nServiceName:/&*/=\nServiceVersion:ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n\nServiceUUID:NULL\nServiceInvariantUUID:N~a W7\nServiceDescription:N~a W7\nService Artifacts List:\n{\nService Artifacts Info:\nArtifactName:NULL\nArtifactVersion:NULL\nArtifactType:NULL\nArtifactDescription:NULL\nArtifactTimeout:NULL\nArtifactURL:NULL\nArtifactUUID:NULL\nArtifactChecksum:NULL\nGeneratedArtifact:{NULL\n}\nRelatedArtifacts:NULL\n\n\n}\n\nResource Instances List:\nNULL\n", string1);
+    }
+
+    @Test(timeout = 4000)
+    public void test12()  throws Throwable  {
+        ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
+        Object object0 = PrivateAccess.callMethod((Class<ASDCNotificationLogging>) ASDCNotificationLogging.class, aSDCNotificationLogging0, "dumpASDCResourcesList", (Object) null, (Class<?>) INotificationData.class);
+        assertNull(object0);
+    }
 }
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTestscaffolding.java
index 1344bbe..62663e7 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTestscaffolding.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTestscaffolding.java
@@ -1,7 +1,7 @@
 /**
- * Scaffolding file used to store all the setups needed to run 
+ * Scaffolding file used to store all the setups needed to run
  * tests automatically generated by EvoSuite
- * Fri Nov 25 13:31:27 GMT 2016
+ * Mon Mar 13 15:55:23 GMT 2017
  */
 
 package org.openecomp.mso.asdc.util;
@@ -12,69 +12,70 @@
 import org.junit.After;
 import org.junit.AfterClass;
 import org.evosuite.runtime.sandbox.Sandbox;
+import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
 
 @EvoSuiteClassExclude
 public class ASDCNotificationLoggingESTestscaffolding {
 
-  @org.junit.Rule 
+  @org.junit.Rule
   public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
 
-  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+  private static final java.util.Properties defaultProperties = (java.util.Properties) System.getProperties().clone();
 
   private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
 
-  @BeforeClass 
-  public static void initEvoSuiteFramework() { 
-    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.util.ASDCNotificationLogging"; 
-    org.evosuite.runtime.GuiSupport.initialize(); 
-    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
-    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
-    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
-    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
-    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
-    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+  @BeforeClass
+  public static void initEvoSuiteFramework() {
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.util.ASDCNotificationLogging";
+    org.evosuite.runtime.GuiSupport.initialize();
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = SandboxMode.RECOMMENDED;
+    Sandbox.initializeSecurityManagerForSUT();
+    org.evosuite.runtime.classhandling.JDKClassResetter.init();
     initializeClasses();
-    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
-  } 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+  }
 
-  @AfterClass 
-  public static void clearEvoSuiteFramework(){ 
-    Sandbox.resetDefaultSecurityManager(); 
-    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
-  } 
+  @AfterClass
+  public static void clearEvoSuiteFramework(){
+    Sandbox.resetDefaultSecurityManager();
+    System.setProperties((java.util.Properties) defaultProperties.clone());
+  }
 
-  @Before 
-  public void initTestCase(){ 
+  @Before
+  public void initTestCase(){
     threadStopper.storeCurrentThreads();
     threadStopper.startRecordingTime();
-    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
-    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
-    
-    org.evosuite.runtime.GuiSupport.setHeadless(); 
-    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
-    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
-  } 
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
+    Sandbox.goingToExecuteSUTCode();
+    org.evosuite.runtime.GuiSupport.setHeadless();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime();
+    org.evosuite.runtime.agent.InstrumentingAgent.activate();
+  }
 
-  @After 
-  public void doneWithTestCase(){ 
+  @After
+  public void doneWithTestCase(){
     threadStopper.killAndJoinClientThreads();
-    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
-    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
-    resetClasses(); 
-    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
-    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
-    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
-  } 
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset();
+    resetClasses();
+    Sandbox.doneWithExecutingSUTCode();
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
+  }
 
   private static void initializeClasses() {
     org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ASDCNotificationLoggingESTestscaffolding.class.getClassLoader() ,
       "org.openecomp.sdc.api.notification.INotificationData",
+      "org.openecomp.mso.asdc.installer.VfModuleMetaData",
+      "org.openecomp.mso.asdc.installer.IVfModuleData",
       "org.openecomp.sdc.api.notification.IResourceInstance",
-      "org.openecomp.sdc.api.notification.IVfModuleMetadata",
-      "org.openecomp.mso.asdc.util.ASDCNotificationLogging",
-      "org.openecomp.sdc.api.notification.IArtifactInfo"
+      "org.openecomp.sdc.api.notification.IArtifactInfo",
+      "org.openecomp.mso.asdc.util.ASDCNotificationLogging"
     );
-  } 
+  }
 
   private static void resetClasses() {
   }
