diff options
author | xg353y <xg353y@intl.att.com> | 2017-04-11 13:30:42 +0200 |
---|---|---|
committer | xg353y <xg353y@intl.att.com> | 2017-04-11 15:34:19 +0200 |
commit | b6b7bef8bdcad15af01ac88a038dd763ce59f68f (patch) | |
tree | 399d39da23aaa37701e487df064e3e0c27709ef3 /asdc-controller | |
parent | 19340cad94eeaa1b580f7c0c99531de499e8ca14 (diff) |
[MSO-8] Update the maven dependency
Update the maven depenency for sdc-distribution-client to cooperate with the sdc changes.
Change-Id: I2da936e5c40cb68c7181bb78307192dd5655b5dc
Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'asdc-controller')
21 files changed, 1807 insertions, 1977 deletions
diff --git a/asdc-controller/WebContent/WEB-INF/web.xml b/asdc-controller/WebContent/WEB-INF/web.xml index a8ccd17fec..f9b9e9279a 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 2db751841a..7f948386a2 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 1d87ccbe21..61ca698678 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 class ASDCConfiguration implements IConfiguration { 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 @@ public class ASDCConfiguration implements IConfiguration { 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 @@ public class ASDCConfiguration implements IConfiguration { * @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 @@ public class ASDCConfiguration implements IConfiguration { return 0; } } - + @Override public boolean activateServerTLSAuth() { JsonNode masterConfigNode = getASDCControllerConfigJsonNode(); @@ -415,4 +415,12 @@ public class ASDCConfiguration implements IConfiguration { } + /** + * 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 b553100816..a0de24a9cd 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 @@ public class ASDCController { 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 @@ public class ASDCController { } private final static String UUID_PARAM = "(UUID:"; - + private IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact, String distributionId) throws ASDCDownloadException { @@ -299,7 +299,7 @@ public class ASDCController { + ")"); IDistributionClientDownloadResult downloadResult; - + try { downloadResult = distributionClient.download (artifact); if (null == downloadResult) { @@ -366,14 +366,14 @@ public class ASDCController { } - + 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 @@ public class ASDCController { } } } - - 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 @@ public class ASDCController { 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 class ASDCController { } public void treatNotification (INotificationData iNotif) { - + int noOfArtifacts = 0; for (IResourceInstance resource : iNotif.getResources ()) { noOfArtifacts += resource.getArtifacts ().size (); @@ -488,7 +492,7 @@ public class ASDCController { 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 @@ public class ASDCController { // 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 @@ public class ASDCController { } } - + 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 5e59be526f..e649a992f8 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 @@ import org.openecomp.mso.asdc.client.ASDCConfiguration; * 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 @@ public class ASDCElementInfo { * 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 @@ public class ASDCElementInfo { // 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 @@ public class ASDCElementInfo { // 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 @@ public class ASDCElementInfo { this.getElementInfoMap().put(key, value); } } - + /** * Returns an aggregated, formatted list of the expected details about an ASDC element. * (non-Javadoc) @@ -123,7 +123,7 @@ public class ASDCElementInfo { } 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 @@ public class ASDCElementInfo { * <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 @@ public class ASDCElementInfo { * <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 @@ public class ASDCElementInfo { 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 @@ public class ASDCElementInfo { * <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 0000000000..d3aa0411a9 --- /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 0000000000..284141b91d --- /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 239bc8ab99..b1e670883c 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.asdc.client.exceptions.ArtifactInstallerException; 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 @@ public final class VfModuleStructure { } } } - + 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 final class VfModuleStructure { 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 7be5e7010b..d27819bb38 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.notification.IVfModuleMetadata; 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 final class VfResourceStructure { } 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 final class VfResourceStructure { public boolean isDeployedSuccessfully() { return isDeployedSuccessfully; } - + public void setSuccessfulDeployment() { isDeployedSuccessfully = true; } @@ -155,6 +172,42 @@ public final class VfResourceStructure { 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 final class VfResourceStructure { 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 4cef0f1013..114f6f246b 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.HeatEnvironment; 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { } @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 { - try (CatalogDatabase db = new CatalogDatabase()) { + String resourceType = vfResourceStruct.getResourceInstance().getResourceType(); + String category = vfResourceStruct.getResourceInstance().getCategory(); - logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "VNFResource", + // 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { } + } + + // 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { } @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 @@ public class VfResourceInstaller implements IVfResourceInstaller { } } - + // 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { // 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { } 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { } } - + catalogDB.commit(); vfResourceStructure.setSuccessfulDeployment(); - + } catch (Exception e) { Throwable dbExceptionToCapture = e; @@ -329,12 +424,12 @@ public class VfResourceInstaller implements IVfResourceInstaller { 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { } } - + 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { } } - } - - 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { if (heatVolumeEnv != null) { vfModule.setVolEnvironmentId(heatVolumeEnv.getId()); } - + vfModule.setVnfResourceId(vnfResource.getId()); } @@ -448,53 +607,53 @@ public class VfResourceInstaller implements IVfResourceInstaller { } - + 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { // 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { 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 @@ public class VfResourceInstaller implements IVfResourceInstaller { .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 @@ public class VfResourceInstaller implements IVfResourceInstaller { .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 312613d1bc..a355f0547a 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 @@ package org.openecomp.mso.asdc.util; 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 @@ public class ASDCNotificationLogging { } 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 @@ public class ASDCNotificationLogging { 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 @@ public class ASDCNotificationLogging { 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 @@ public class ASDCNotificationLogging { } 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 23b7a80dbe..63da38d8c1 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 java.util.UUID; 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.client.exceptions.ArtifactInstallerException; 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 @@ public class ASDCElementInfoTest { 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 8dd5afe7e0..0000000000 --- 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 075970b066..0000000000 --- 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 0000000000..f87f9068f2 --- /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 0000000000..39bb3a7227 --- /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 f3c20c5eb7..e63680b4c7 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 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 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 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 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); - } - } + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); + } + } - @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); - } - } + @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 4a27df3a48..0000000000 --- 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+mW").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 f78949eecc..0000000000 --- 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 77c70e015e..2e73096337 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.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.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"); + + } 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 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"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e); + } + } - @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); - } - } + @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 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 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 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); - } - } + @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 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 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 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); - } + 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 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 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 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 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 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); - } + @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 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); - } + } 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 { - 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 test09() throws Throwable { + String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null); + assertNull(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/UZ7qrmvO", "8u1XbrrMy{J2").when(iVfModuleMetadata1).getVfModuleModelInvariantUUID(); - doReturn("8u1XbrrMy{J2", ".l=(8f`8f}.9>yn").when(iVfModuleMetadata1).getVfModuleModelName(); - doReturn("", "YR/UZ7qrmvO").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/UZ7qrmvO", "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/UZ7qrmvO\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 test10() throws Throwable { + String string0 = ASDCNotificationLogging.dumpASDCNotification((INotificationData) null); + assertEquals("NULL", string0); + } - @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); - } + @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); - @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); - } - } + 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 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 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 1344bbe45d..62663e7397 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.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 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() { } |