From b6b7bef8bdcad15af01ac88a038dd763ce59f68f Mon Sep 17 00:00:00 2001 From: xg353y Date: Tue, 11 Apr 2017 13:30:42 +0200 Subject: [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 --- .../openecomp/mso/db/catalog/CatalogDatabase.java | 1382 ++++++++++++++-- .../mso/db/catalog/HibernateUtilsCatalogDb.java | 45 + .../beans/AllottedResourceCustomization.java | 123 ++ .../mso/db/catalog/beans/HeatEnvironment.java | 18 +- .../openecomp/mso/db/catalog/beans/HeatFiles.java | 29 +- .../mso/db/catalog/beans/HeatTemplate.java | 28 +- .../org/openecomp/mso/db/catalog/beans/Model.java | 198 +++ .../mso/db/catalog/beans/ModelRecipe.java | 180 +++ .../beans/NetworkResourceCustomization.java | 140 ++ .../mso/db/catalog/beans/ServiceMacroHolder.java | 141 ++ .../mso/db/catalog/beans/ServiceRecipe.java | 42 +- .../catalog/beans/ServiceToAllottedResources.java | 67 + .../mso/db/catalog/beans/ServiceToNetworks.java | 68 + .../openecomp/mso/db/catalog/beans/VfModule.java | 89 +- .../mso/db/catalog/beans/VnfResource.java | 82 +- .../mso/db/catalog/utils/MavenLikeVersioning.java | 9 +- .../db/catalog/utils/RecordNotFoundException.java | 49 + .../AllottedResourceCustomization.hbm.xml | 59 + .../src/main/resources/HeatEnvironment.hbm.xml | 17 +- .../src/main/resources/HeatTemplate.hbm.xml | 26 +- .../src/main/resources/ModelRecipe.hbm.xml | 87 + .../src/main/resources/NetworkRecipe.hbm.xml | 18 +- .../src/main/resources/NetworkResource.hbm.xml | 16 +- .../resources/NetworkResourceCustomization.hbm.xml | 59 + mso-catalog-db/src/main/resources/Service.hbm.xml | 35 +- .../resources/ServiceToAllottedResources.hbm.xml | 41 + .../src/main/resources/ServiceToNetworks.hbm.xml | 41 + mso-catalog-db/src/main/resources/VfModule.hbm.xml | 57 +- .../src/main/resources/VnfComponentsRecipe.hbm.xml | 14 +- .../src/main/resources/VnfRecipe.hbm.xml | 22 +- .../src/main/resources/VnfResource.hbm.xml | 64 +- .../resources/hibernate-catalog-core-mysql.cfg.xml | 52 + .../main/resources/hibernate-catalog-mysql.cfg.xml | 52 - .../mso/db/catalog/CatalogDatabaseESTest.java | 246 +-- .../beans/AllottedResourceCustomizationESTest.java | 214 +++ ...ttedResourceCustomizationESTestscaffolding.java | 77 + .../mso/db/catalog/beans/ModelESTest.java | 271 ++++ .../db/catalog/beans/ModelESTestscaffolding.java | 106 ++ .../mso/db/catalog/beans/ModelRecipeESTest.java | 287 ++++ .../beans/ModelRecipeESTestscaffolding.java | 77 + .../db/catalog/beans/ServiceMacroHolderESTest.java | 261 +++ .../beans/ServiceMacroHolderESTestscaffolding.java | 97 ++ .../beans/ServiceToAllottedResourcesESTest.java | 95 ++ ...erviceToAllottedResourcesESTestscaffolding.java | 81 + .../db/catalog/beans/ServiceToNetworksESTest.java | 95 ++ .../beans/ServiceToNetworksESTestscaffolding.java | 81 + .../mso/db/catalog/beans/VfModuleESTest.java | 1662 +++++++++++--------- .../utils/RecordNotFoundExceptionESTest.java | 23 + .../RecordNotFoundExceptionESTestscaffolding.java | 81 + 49 files changed, 5917 insertions(+), 1187 deletions(-) create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/HibernateUtilsCatalogDb.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundException.java create mode 100644 mso-catalog-db/src/main/resources/AllottedResourceCustomization.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/ModelRecipe.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/NetworkResourceCustomization.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/ServiceToAllottedResources.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/ServiceToNetworks.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/hibernate-catalog-core-mysql.cfg.xml delete mode 100644 mso-catalog-db/src/main/resources/hibernate-catalog-mysql.cfg.xml create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTestscaffolding.java (limited to 'mso-catalog-db/src') diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index 70b9618265..38e711eb16 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -21,6 +21,7 @@ package org.openecomp.mso.db.catalog; import java.io.Closeable; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -35,7 +36,9 @@ import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistryBuilder; +import org.openecomp.mso.db.HibernateUtils; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioningComparator; +import org.openecomp.mso.db.catalog.utils.RecordNotFoundException; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; @@ -48,18 +51,21 @@ import org.openecomp.mso.logger.MsoLogger; */ public class CatalogDatabase implements Closeable { - protected static final String NETWORK_TYPE = "networkType"; - protected static final String ACTION = "action"; - protected static final String VNF_TYPE = "vnfType"; - protected static final String SERVICE_TYPE = "serviceType"; - protected static final String VNF_COMPONENT_TYPE = "vnfComponentType"; - protected static final String MODEL_NAME = "modelName"; - protected static final String TYPE = "type"; - protected static final String VF_MODULE_ID = "vfModuleId"; - protected static boolean initialized = false; - protected static SessionFactory sessionFactory; - protected static ServiceRegistry serviceRegistry; - protected static final String SERVICE_NAME_VERSION_ID= "serviceNameVersionId"; + protected static HibernateUtils hibernateUtils = new HibernateUtilsCatalogDb (); + + private static final String NETWORK_TYPE = "networkType"; + private static final String ACTION = "action"; + private static final String VNF_TYPE = "vnfType"; + private static final String SERVICE_TYPE = "serviceType"; + private static final String VNF_COMPONENT_TYPE = "vnfComponentType"; + private static final String MODEL_ID = "modelId"; + private static final String MODEL_NAME = "modelName"; + private static final String TYPE = "type"; + private static final String MODEL_TYPE = "modelType"; + private static final String MODEL_VERSION_ID = "modelVersionId"; + private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUuid"; + private static final String VF_MODULE_ID = "vfModuleId"; + private static final String SERVICE_NAME_VERSION_ID= "serviceNameVersionId"; protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); @@ -70,33 +76,10 @@ public class CatalogDatabase implements Closeable { private Session getSession () { - if (!initialized) { - LOGGER.debug ("Initializing Catalog Database in Hibernate"); - Configuration configuration = null; - try { - if ("MYSQL".equals (System.getProperty ("mso.db")) - || "MARIADB".equals (System.getProperty ("mso.db"))) { - configuration = new Configuration ().configure ("hibernate-catalog-mysql.cfg.xml"); - - serviceRegistry = new ServiceRegistryBuilder ().applySettings (configuration.getProperties ()).buildServiceRegistry (); - - sessionFactory = configuration.buildSessionFactory (serviceRegistry); - } else { - LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC"); - } - } catch (Exception e) { - LOGGER.error (MessageEnum.GENERAL_EXCEPTION_ARG, - "Catalog DB initialization issue: " + e.getMessage (), "", "", MsoLogger.ErrorCode.DataError, "Catalog DB initialization issue: " + e.getMessage (), e); - throw e; - } - initialized = true; - - LOGGER.debug ("Catalog Database initialization complete"); - } - - if (session == null) { + + if (session == null) { try { - session = sessionFactory.openSession (); + session = hibernateUtils.getSessionFactory ().openSession (); session.beginTransaction (); } catch (HibernateException he) { LOGGER.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Error creating Hibernate Session: " + he, "", "", MsoLogger.ErrorCode.DataError, "Error creating Hibernate Session: " + he); @@ -230,6 +213,33 @@ public class CatalogDatabase implements Closeable { return resultList.get (0); } + /** + * Fetch a Service definition by InvariantUUID + */ + public Service getServiceByInvariantUUID (String modelInvariantUUID) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with Invariant UUID " + modelInvariantUUID); + + String hql = "FROM Service WHERE modelInvariantUUID = :model_invariant_uuid"; + Query query = getSession ().createQuery (hql); + query.setParameter ("model_invariant_uuid", modelInvariantUUID); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByName", null); + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByName", null); + return resultList.get (0); + } + /** * Fetch a Service definition */ @@ -388,6 +398,33 @@ public class CatalogDatabase implements Closeable { return resultList.get (0); } + public Service getServiceByVersionAndInvariantId(String modelInvariantId, String modelVersion) throws Exception { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with modelInvariantId: " + modelInvariantId + " and modelVersion: " + modelVersion); + + String hql = "FROM Service WHERE modelInvariantUUID = :MODEL_INVARIANT_UUID AND version = :VERSION_STR"; + Query query = getSession ().createQuery (hql); + query.setParameter ("MODEL_INVARIANT_UUID", modelInvariantId); + query.setParameter("VERSION_STR", modelVersion); + + Service result = null; + try { + result = (Service) query.uniqueResult(); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelInvariantId='" + modelInvariantId + "', modelVersion='" + modelVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelInvariantId=" + modelInvariantId + " and modelVersion=" + modelVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelInvariantId=" + modelInvariantId); + throw new Exception("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelInvariantId='" + modelInvariantId + "', modelVersion='" + modelVersion + "'"); + } + // See if something came back. + if (result==null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByVersionAndInvariantId", null); + return null; + } + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByVersionAndInvariantId", null); + return result; + } + /** * Return a Service recipe that matches a given SERVICE_NAME_VERSION_ID * (MODEL_VERSION_ID) and ACTION @@ -439,10 +476,15 @@ public class CatalogDatabase implements Closeable { * @return ServiceRecipe object or null if none found */ public ServiceRecipe getServiceRecipe (int serviceId, String action) { - - StringBuilder hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceId = :serviceId AND action = :action "); - - + + StringBuilder hql = null; + + if(action == null){ + hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceId = :serviceId"); + }else { + hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceId = :serviceId AND action = :action "); + } + long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - get Service recipe with serviceId " + Integer.toString(serviceId) + " and action " @@ -452,7 +494,10 @@ public class CatalogDatabase implements Closeable { Query query = getSession ().createQuery (hql.toString ()); query.setParameter ("serviceId", serviceId); query.setParameter (ACTION, action); - + if(action != null){ + query.setParameter (ACTION, action); + } + @SuppressWarnings("unchecked") List resultList = query.list (); @@ -468,7 +513,33 @@ public class CatalogDatabase implements Closeable { return resultList.get (0); } - + public List getServiceRecipes (int serviceId) { + + StringBuilder hql = null; + + hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceId = :serviceId"); + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Service recipe with serviceId " + Integer.toString(serviceId)); + + Query query = getSession ().createQuery (hql.toString ()); + query.setParameter ("serviceId", serviceId); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service recipe not found", "CatalogDB", "getServiceRecipes", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipes", null); + return resultList; + } + /** * Return the VNF component data - queried by the VNFs ID and the component type. * @@ -477,10 +548,10 @@ public class CatalogDatabase implements Closeable { * @return VnfComponent object or null if none found */ public VnfComponent getVnfComponent (int vnfId, String type) { - + long startTime = System.currentTimeMillis(); LOGGER.debug ("Catalog database - get VnfComponent where vnfId="+ vnfId+ " AND componentType="+ type); - + String hql = "FROM VnfComponent WHERE vnfId = :vnf_id AND componentType = :type"; Query query = getSession ().createQuery (hql); query.setParameter ("vnf_id", vnfId); @@ -488,7 +559,7 @@ public class CatalogDatabase implements Closeable { VnfComponent result = null; try { - result = (VnfComponent) query.uniqueResult(); + result = (VnfComponent) query.uniqueResult(); } catch (org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: vnf_id='" + vnfId + "', componentType='" + type + "'"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vnf_id=" + vnfId + " and componentType=" + type, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for vnf_id=" + vnfId); @@ -583,6 +654,47 @@ public class CatalogDatabase implements Closeable { return resource; } + /** + * Return the newest version of a specific VNF resource (queried by modelCustomizationId). + * + * @param vnfType + * @param version + * @return VnfResource object or null if none found + */ + public VnfResource getVnfResourceByModelCustomizationId (String modelCustomizationId, String serviceVersion) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get VNF resource with modelCustomizationId " + modelCustomizationId); + + String hql = "FROM VnfResource WHERE modelCustomizationUuid = :modelCustomizationId and version = :serviceVersion"; + Query query = getSession ().createQuery (hql); + query.setParameter ("modelCustomizationId", modelCustomizationId); + query.setParameter ("serviceVersion", serviceVersion); + + VnfResource resource = null; + try { + resource = (VnfResource) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelCustomizationUuid='" + modelCustomizationId + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelCustomizationUuid=" + modelCustomizationId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelCustomizationId=" + modelCustomizationId); + resource = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: modelCustomizationId='" + modelCustomizationId + "', asdc_service_model_version='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for modelCustomizationId=" + modelCustomizationId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for modelCustomizationId=" + modelCustomizationId); + resource = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: modelCustomizationId='" + modelCustomizationId + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for modelCustomizationId=" + modelCustomizationId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for modelCustomizationId=" + modelCustomizationId); + resource = null; + } + if (resource == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVnfResource", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResource", null); + } + return resource; + } + /** * Return the newest version of a specific VNF resource (queried by ID). * @@ -791,7 +903,7 @@ public class CatalogDatabase implements Closeable { * Return a VNF recipe that matches a given VF_MODULE_ID and ACTION * * @param vfModuleId - * @param action + * @param action * @return VnfRecipe object or null if none found */ public VnfRecipe getVnfRecipeByVfModuleId (String vnfType, String vfModuleId, String action) { @@ -819,7 +931,39 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF Recipe Entry found", "CatalogDB", "getVnfRecipeByVfModuleId", null); return resultList.get (0); } - + + public VfModule getVfModuleTypeByUuid(String modelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get vfModuleTypeByUuid with uuid=" + modelCustomizationUuid); + + String hql = "FROM VfModule WHERE modelCustomizationUuid = :modelCustomizationUuid"; + Query query = getSession().createQuery(hql); + query.setParameter("modelCustomizationUuid", modelCustomizationUuid); + + VfModule module = null; + try { + module = (VfModule) query.uniqueResult(); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelCustomizationUuid==" + modelCustomizationUuid); + module = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for modelCustomizationUuid=" + modelCustomizationUuid); + module = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for modelCustomizationUuid=" + modelCustomizationUuid); + module = null; + } + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleTypeByUuid", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleTypeByUuid", null); + } + return module; + } + public VfModule getVfModuleType(String type) { long startTime = System.currentTimeMillis(); LOGGER.debug("Catalog database - get vfModuleType with type " + type); @@ -866,15 +1010,752 @@ public class CatalogDatabase implements Closeable { LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for type=" + type + " and version=" + version, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for type=" + type); module = null; } - if (module == null) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleType", null); - } else { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleType", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + } + return module; + } + + public VnfResource getVnfResourceByServiceUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleType with serviceModelInvariantUuid " + serviceModelInvariantUuid); + + String hql = "FROM VnfResource WHERE serviceModelInvariantUuid = :serviceModelInvariantUuid"; + Query query = getSession().createQuery(hql); + query.setParameter ("serviceModelInvariantUuid", serviceModelInvariantUuid); + VnfResource vnfResource = null; + try { + vnfResource = (VnfResource) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: serviceModelInvariantUuid='" + serviceModelInvariantUuid); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for serviceModelInvariantUuid==" + serviceModelInvariantUuid); + vnfResource = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: serviceModelInvariantUuid='" + serviceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + vnfResource = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: serviceModelInvariantUuid='" + serviceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + vnfResource = null; + } + if (vnfResource == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleType", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + } + return vnfResource; + } + + public VnfResource getVnfResourceByVnfUuid(String vnfResourceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleType with vnfResourceModelInvariantUuid " + vnfResourceModelInvariantUuid); + + String hql = "FROM VnfResource WHERE vnfResourceModelInvariantUuid = :vnfResourceModelInvariantUuid"; + Query query = getSession().createQuery(hql); + query.setParameter ("vnfResourceModelInvariantUuid", vnfResourceModelInvariantUuid); + VnfResource vnfResource = null; + try { + vnfResource = (VnfResource) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: vnfResourceModelInvariantUuid='" + vnfResourceModelInvariantUuid); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for vnfResourceModelInvariantUuid==" + vnfResourceModelInvariantUuid); + vnfResource = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: vnfResourceModelInvariantUuid='" + vnfResourceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid); + vnfResource = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: vnfResourceModelInvariantUuid='" + vnfResourceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid); + vnfResource = null; + } + if (vnfResource == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleType", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + } + return vnfResource; + } + + public VnfResource getVnfResourceByType(String vnfType) { + return this.getVnfResource(vnfType); + } + + public VfModule getVfModuleByModelInvariantUuid(String vfModuleModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleTypeByUuid with uuid " + vfModuleModelInvariantUuid); + + String hql = "FROM VfModule WHERE vfModuleModelInvariantUuid = :vfModuleModelInvariantUuid "; + Query query = getSession().createQuery(hql); + query.setParameter ("vfModuleModelInvariantUuid", vfModuleModelInvariantUuid); + VfModule module = null; + try { + module = (VfModule) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: vfModuleModelInvariantUuid='" + vfModuleModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid , "", "", MsoLogger.ErrorCode.DataError, "Non unique result for vfModuleModelInvariantUuid==" + vfModuleModelInvariantUuid); + module = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: vfModuleModelInvariantUuid='" + vfModuleModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid); + module = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: vfModuleModelInvariantUuid='" + vfModuleModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid); + module = null; + } + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleByModelInvariantUuid", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleByModelInvariantUuid", null); + } + return module; + } + + public VfModule getVfModuleByModelCustomizationUuid(String modelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleTypeByModelCustomizationUuid with uuid " + modelCustomizationUuid); + + String hql = "FROM VfModule WHERE modelCustomizationUuid = :modelCustomizationUuid "; + Query query = getSession().createQuery(hql); + query.setParameter ("modelCustomizationUuid", modelCustomizationUuid); + VfModule module = null; + try { + module = (VfModule) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vfModuleModelInvariantUuid=" + modelCustomizationUuid , "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelCustomizationUuid==" + modelCustomizationUuid); + module = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for modelCustomizationUuid=" + modelCustomizationUuid); + module = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for modelCustomizationUuid=" + modelCustomizationUuid); + module = null; + } + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleByModelCustomizationUuid", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleByModelCustomizationUuid", null); + } + return module; + } + + public VfModule getVfModuleByType(String vfModuleType) { + return this.getVfModuleType(vfModuleType); + } + + public List getVfModulesForVnfResource(VnfResource vnfResource) { + if (vnfResource == null) + return null; + int vnfResourceId = vnfResource.getId(); + + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - getVfModulesForVnfResource - vnfResource: " + vnfResource.toString()); + + return this.getVfModulesForVnfResource(vnfResourceId); + + } + + public List getVfModulesForVnfResource(int vnfResourceId) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - getVfModulesForVnfResource - vnfResourceId: " + vnfResourceId); + StringBuilder hql = new StringBuilder("FROM VfModule where vnfResourceId = :vnfResourceId"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("vnfResourceId", vnfResourceId); + List resultList = null; + try { + resultList = query.list(); + if (resultList != null) + LOGGER.debug("\tQuery found " + resultList.size() + " records."); + else + LOGGER.debug("\tQuery found no records."); + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - getVfModulesForVnfResource - while searching for: vnfResourceId='" + vnfResourceId + " " + he.getMessage()); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception - getVfModulesForVnfResource - searching for vnfResourceId=" + vnfResourceId, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vnfResourceId=" + vnfResourceId); + } catch (Exception e) { + LOGGER.debug("Exception - getVfModulesForVnfResource - while searching for: vnfResourceId='" + vnfResourceId + " " + e.getMessage()); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception - getVfModulesForVnfResource - searching for vnfResourceId=" + vnfResourceId, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vnfResourceId=" + vnfResourceId); + } + if (resultList == null) { + resultList = new ArrayList(); + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModulesForVnfResource", null); + return resultList; + } + + public Service getServiceByUuid (String serviceModelInvariantUuid) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with ModelInvariantUuid " + serviceModelInvariantUuid); + + String hql = "FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"; + Query query = getSession ().createQuery (hql); + query.setParameter ("serviceModelInvariantUuid", serviceModelInvariantUuid); + + Service service = null; + try { + service = (Service) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: serviceModelInvariantUuid='" + serviceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + return null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: serviceName='" + serviceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + return null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: serviceModelInvariantUuid='" + serviceModelInvariantUuid); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + return null; + } + if (service == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getService", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getService", null); + } + + return service; + } + + public NetworkResource getNetworkResourceById(Integer id) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - getNetworkResource with id " + id); + + String hql = "FROM NetworkResource WHERE id = :id"; + Query query = getSession ().createQuery (hql); + query.setParameter ("id", id); + + NetworkResource networkResource = null; + try { + networkResource = (NetworkResource) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: NETWORK_RESOURCE.id='" + id + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for NETWORK_RESOURCE.id=" + id, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for NETWORK_RESOURCE.id=" + id); + return null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: NETWORK_RESOURCE.id='" + id + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for NETWORK_RESOURCE.id=" + id, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for NETWORK_RESOURCE.id=" + id); + return null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: NETWORK_RESOURCE.id='" + id); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for NETWORK_RESOURCE.id=" + id, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for NETWORK_RESOURCE.id=" + id); + return null; + } + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkResourceById", null); + return networkResource; + + } + + // 1702 API Spec - Query for all networks in a Service: + public List getAllNetworksByServiceModelUuid(String serviceModelUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getServiceNetworksByServiceModelUuid - " + serviceModelUuid); + + // This is a 2-step process (3 really) - 1) query ServiceToNetworks, 2) query NetworkResourceCustomization, 3) populate the networkType + + StringBuilder hql1 = new StringBuilder("FROM ServiceToNetworks WHERE serviceModelUuid = :serviceModelUuid"); + Query query = getSession().createQuery(hql1.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); + @SuppressWarnings("unchecked") + List resultList1 = query.list(); + if (resultList1 == null || resultList1.size() < 1) { + LOGGER.debug("Found no matches to the query - FROM ServiceToNetworks WHERE serviceModelUuid = " + serviceModelUuid); + return null; + } + LOGGER.debug("Found " + resultList1.size() + " entries in ServiceToNetworks with smu=" + serviceModelUuid); + + ArrayList masterList = new ArrayList(); + for (ServiceToNetworks stn : resultList1) { + String networkModelCustomizationUuid = stn.getNetworkModelCustomizationUuid(); + LOGGER.debug("Now searching for NetworkResourceCustomization for " + networkModelCustomizationUuid); + List resultSet = this.getAllNetworksByNetworkModelCustomizationUuid(networkModelCustomizationUuid); + for (NetworkResourceCustomization nrc : resultSet) { + masterList.add(nrc); + } + } + LOGGER.debug("Returning " + masterList.size() + " NRC records"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllNetworksByServiceModelUuid", null); + return masterList; + + } + public List getAllNetworksByServiceModelInvariantUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getServiceNetworksByServiceModelInvariantUuid - " + serviceModelInvariantUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Could not find Service for " + serviceModelInvariantUuid); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceNameVersionId = service.getServiceNameVersionId(); + LOGGER.debug("The highest version for the Service " + serviceModelInvariantUuid + " is " + serviceNameVersionId); + + // Service.serviceNameVersionId == ServiceToNetworks.serviceModelUuid + return this.getAllNetworksByServiceModelUuid(serviceNameVersionId); + } + public List getAllNetworksByServiceModelInvariantUuid(String serviceModelInvariantUuid, String serviceModelVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getServiceNetworksByServiceModelInvariantUuid - " + serviceModelInvariantUuid + ", version=" + serviceModelVersion); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid and version = :serviceModelVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + query.setParameter("serviceModelVersion", serviceModelVersion); + + //TODO + //can fix this later - no time - could do a unique query here - but this should work + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("No Service found with smu=" + serviceModelInvariantUuid + " and smv=" + serviceModelVersion); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceNameVersionId = service.getServiceNameVersionId(); + + // Service.serviceNameVersionId == ServiceToNetworks.serviceModelUuid + return this.getAllNetworksByServiceModelUuid(serviceNameVersionId); + + } + public List getAllNetworksByNetworkModelCustomizationUuid(String networkModelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllNetworksByNetworkModelCustomizationUuid - " + networkModelCustomizationUuid); + + StringBuilder hql = new StringBuilder("FROM NetworkResourceCustomization WHERE modelCustomizationUuid = :networkModelCustomizationUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("networkModelCustomizationUuid", networkModelCustomizationUuid); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + this.populateNetworkResourceType(resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllNetworksByNetworkModelCustomizationUuid", null); + return resultList; + } + public List getAllNetworksByNetworkType(String networkType) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getServiceNetworksByNetworkType - " + networkType); + + NetworkResource nr = this.getNetworkResource(networkType); + if (nr == null) { + return new ArrayList(); + } + Integer networkResourceId = nr.getId(); + + LOGGER.debug("Now searching for NRC's with networkResourceId = " + networkResourceId); + StringBuilder hql = new StringBuilder("FROM NetworkResourceCustomization WHERE networkResourceId = :networkResourceId"); + + Query query = getSession().createQuery(hql.toString()); + query.setParameter("networkResourceId", networkResourceId); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList != null && resultList.size() > 0) { + LOGGER.debug("Found " + resultList.size() + " results"); + for (NetworkResourceCustomization nrc : resultList) { + nrc.setNetworkType(networkType); + nrc.setNetworkResource(nr); + } + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllNetworksByNetworkType", null); + + return resultList; + } + + //1702 API Spec cont'd - Query for all VnfResources in a Service: + public List getAllVnfsByServiceModelUuid(String serviceModelUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceModelUuid - " + serviceModelUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE serviceNameVersionId = :serviceModelUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceModelInvariantUuid = service.getModelInvariantUUID(); + String serviceModelVersion = service.getVersion(); + + return this.getAllVnfsByServiceModelInvariantUuid(serviceModelInvariantUuid, serviceModelVersion); + + } + public List getAllVnfsByServiceModelInvariantUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceModelInvariantUuid - " + serviceModelInvariantUuid); + + StringBuilder hqlService = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"); + Query query = getSession().createQuery(hqlService.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + Service service = resultList.get(0); + //now just call the method that takes the version - the service object will have the highest version + return this.getAllVnfsByServiceModelInvariantUuid(serviceModelInvariantUuid, service.getVersion()); + } + public List getAllVnfsByServiceModelInvariantUuid(String serviceModelInvariantUuid, String serviceModelVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceModelInvariantUuid - " + serviceModelInvariantUuid + ", version=" + serviceModelVersion); + + StringBuilder hql = new StringBuilder("FROM VnfResource WHERE serviceModelInvariantUUID = :serviceModelInvariantUuid and version = :serviceModelVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + query.setParameter("serviceModelVersion", serviceModelVersion); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + return null; + } + // so we have a list of VnfResource objects - but we need to add each one's VfModule objects + for (VnfResource vnfResource : resultList) { + List vfModules = this.getVfModulesForVnfResource(vnfResource); + if (vfModules != null && !vfModules.isEmpty()) { + for (VfModule vfm : vfModules) { + vnfResource.addVfModule(vfm); + } + } + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllVnfsByServiceModelInvariantUuid", null); + return resultList; + + } + public List getAllVnfsByServiceName(String serviceName, String serviceVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceName - " + serviceName + ", version=" + serviceVersion); + if (serviceVersion == null || serviceVersion.equals("")) { + return this.getAllVnfsByServiceName(serviceName); + } + + StringBuilder hql = new StringBuilder("FROM Service WHERE serviceName = :serviceName and version = :serviceVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceName", serviceName); + query.setParameter("serviceVersion", serviceVersion); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + return null; + } + + Service service = resultList.get(0); + + return this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + } + public List getAllVnfsByServiceName(String serviceName) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceName - " + serviceName); + + StringBuilder hql = new StringBuilder("FROM Service WHERE serviceName = :serviceName"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceName", serviceName); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + Service service = resultList.get(0); + + return this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + } + public List getAllVnfsByVnfModelCustomizationUuid(String vnfModelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByVnfModelCustomizationUuid - " + vnfModelCustomizationUuid); + + StringBuilder hql = new StringBuilder("FROM VnfResource WHERE modelCustomizationUuid = :vnfModelCustomizationUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("vnfModelCustomizationUuid", vnfModelCustomizationUuid); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + LOGGER.debug("Found no records matching " + vnfModelCustomizationUuid); + return null; + } + // so we have a list of VnfResource objects - but we need to add each one's VfModule objects + for (VnfResource vnfResource : resultList) { + LOGGER.debug("Finding vfModules for vnfResource.id=" + vnfResource.getId()); + List vfModules = this.getVfModulesForVnfResource(vnfResource); + if (vfModules != null && !vfModules.isEmpty()) { + LOGGER.debug("\tFound " + vfModules.size() + " vf modules"); + for (VfModule vfm : vfModules) { + vnfResource.addVfModule(vfm); + } + } + } + LOGGER.debug("Returning " + resultList + " vnf modules"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllVnfsByVnfModelCustomizationUuid", null); + return resultList; + } + + //1702 API Spec cont'd - Query for all allotted resources in a Service + + public List getAllAllottedResourcesByServiceModelUuid(String serviceModelUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllAllottedResourcesByServiceModelUuid - " + serviceModelUuid); + + // This is a 2-step process (3 really) - 1) query ServiceToAllottedResources, 2) query AllottedResourceCustomization + + StringBuilder hql1 = new StringBuilder("FROM ServiceToAllottedResources WHERE serviceModelUuid = :serviceModelUuid"); + Query query = getSession().createQuery(hql1.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); + @SuppressWarnings("unchecked") + List resultList1 = query.list(); + if (resultList1 == null || resultList1.size() < 1) { + LOGGER.debug("Found no matches to the query " + hql1.toString()); + return null; + } + LOGGER.debug("Found " + resultList1.size() + " entries in ServiceToAllottedResources with smu=" + serviceModelUuid); + + ArrayList masterList = new ArrayList(); + for (ServiceToAllottedResources star : resultList1) { + String arModelCustomizationUuid = star.getArModelCustomizationUuid(); + LOGGER.debug("Now searching for AllottedResourceCustomization for " + arModelCustomizationUuid); + List resultSet = this.getAllAllottedResourcesByArModelCustomizationUuid(arModelCustomizationUuid); + for (AllottedResourceCustomization arc : resultSet) { + masterList.add(arc); + } + } + LOGGER.debug("Returning " + masterList.size() + " ARC records"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllAllottedResourcesByServiceModelUuid", null); + return masterList; + } + + public List getAllAllottedResourcesByServiceModelInvariantUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllAllottedResourcesByServiceModelInvariantUuid - " + serviceModelInvariantUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Could not find Service for " + serviceModelInvariantUuid); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceNameVersionId = service.getServiceNameVersionId(); + LOGGER.debug("The highest version for the Service " + serviceModelInvariantUuid + " is " + serviceNameVersionId); + + // Service.serviceNameVersionId == ServiceToAllottedResources.serviceModelUuid + return this.getAllAllottedResourcesByServiceModelUuid(serviceNameVersionId); + } + + public List getAllAllottedResourcesByServiceModelInvariantUuid(String serviceModelInvariantUuid, String serviceModelVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllAllottedResourcesByServiceModelInvariantUuid - " + serviceModelInvariantUuid + ", version=" + serviceModelVersion); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid and version = :serviceModelVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + query.setParameter("serviceModelVersion", serviceModelVersion); + + //TODO + //can fix this later - no time - could do a unique query here - but this should work + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("No Service found with smu=" + serviceModelInvariantUuid + " and smv=" + serviceModelVersion); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceNameVersionId = service.getServiceNameVersionId(); + + // Service.serviceNameVersionId == ServiceToNetworks.serviceModelUuid + return this.getAllAllottedResourcesByServiceModelUuid(serviceNameVersionId); + } + + public List getAllAllottedResourcesByArModelCustomizationUuid(String arModelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllAllottedResourcesByArModelCustomizationUuid - " + arModelCustomizationUuid); + + StringBuilder hql = new StringBuilder("FROM AllottedResourceCustomization WHERE modelCustomizationUuid = :arModelCustomizationUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("arModelCustomizationUuid", arModelCustomizationUuid); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllAllottedResourcesByArModelCustomizationUuid", null); + return resultList; + } + + //1702 API Spec cont'd - Query for all resources in a Service: + public ServiceMacroHolder getAllResourcesByServiceModelUuid(String serviceModelUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllResourcesByServiceModelUuid - " + serviceModelUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE serviceNameVersionId = :serviceModelUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Unable to find a Service with serviceModelUuid=" + serviceModelUuid); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + ServiceMacroHolder smh = new ServiceMacroHolder(service); + ArrayList nrcList = (ArrayList) this.getAllNetworksByServiceModelUuid(serviceModelUuid); + smh.setNetworkResourceCustomization(nrcList); + ArrayList arcList = (ArrayList) this.getAllAllottedResourcesByServiceModelUuid(serviceModelUuid); + smh.setAllottedResourceCustomization(arcList); + ArrayList vnfList = (ArrayList) this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + smh.setVnfResources(vnfList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllResourcesByServiceModelUuid", null); + return smh; + } + public ServiceMacroHolder getAllResourcesByServiceModelInvariantUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllResourcesByServiceModelInvariantUuid - " + serviceModelInvariantUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Unable to find a Service with serviceModelInvariantUuid=" + serviceModelInvariantUuid); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + ServiceMacroHolder smh = new ServiceMacroHolder(service); + ArrayList nrcList = (ArrayList) this.getAllNetworksByServiceModelUuid(service.getServiceNameVersionId()); + smh.setNetworkResourceCustomization(nrcList); + ArrayList arcList = (ArrayList) this.getAllAllottedResourcesByServiceModelUuid(service.getServiceNameVersionId()); + smh.setAllottedResourceCustomization(arcList); + ArrayList vnfList = (ArrayList) this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + smh.setVnfResources(vnfList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllResourcesByServiceModelInvariantUuid", null); + return smh; + + } + public ServiceMacroHolder getAllResourcesByServiceModelInvariantUuid(String serviceModelInvariantUuid, String serviceModelVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllResourcesByServiceModelInvariantUuid - " + serviceModelInvariantUuid + ", version=" + serviceModelVersion); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid and version = :serviceModelVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + query.setParameter("serviceModelVersion", serviceModelVersion); + //TODO make this a unique query + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Unable to find a Service with serviceModelInvariantUuid=" + serviceModelInvariantUuid + " and serviceModelVersion=" + serviceModelVersion); + return null; } - return module; + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + ServiceMacroHolder smh = new ServiceMacroHolder(service); + ArrayList nrcList = (ArrayList) this.getAllNetworksByServiceModelUuid(service.getServiceNameVersionId()); + smh.setNetworkResourceCustomization(nrcList); + ArrayList arcList = (ArrayList) this.getAllAllottedResourcesByServiceModelUuid(service.getServiceNameVersionId()); + smh.setAllottedResourceCustomization(arcList); + ArrayList vnfList = (ArrayList) this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + smh.setVnfResources(vnfList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllResourcesByServiceModelUuid with version", null); + return smh; } - - + + private void populateNetworkResourceType(List resultList) { + HashMap networkResources = new HashMap(); + + for (NetworkResourceCustomization nrc : resultList) { + Integer network_id = nrc.getNetworkResourceId(); + if (network_id == null) { + nrc.setNetworkResource(null); + nrc.setNetworkType("UNKNOWN_NETWORK_ID_NULL"); + continue; + } + if (networkResources.containsKey(network_id)) { + nrc.setNetworkResource(networkResources.get(network_id)); + nrc.setNetworkType(networkResources.get(network_id).getNetworkType()); + } else { + NetworkResource nr = this.getNetworkResourceById(network_id); + if (nr == null) { + nrc.setNetworkType("INVALID_NETWORK_TYPE_ID_NOT_FOUND"); + } else { + nrc.setNetworkType(nr.getNetworkType()); + nrc.setNetworkResource(nr); + networkResources.put(network_id, nr); + } + } + } + } + /** * Return a VNF recipe that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, and ACTION * first query VF_MODULE table by type, and then use the ID to query @@ -936,33 +1817,116 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVfModuleRecipe", null); return resultList1.get (0); } - + /** - * Return a VNF COMPONENTSrecipe that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, + * Return a VNF Module List that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION - * first query VF_MODULE table by type, and then use the ID to query - * VNF_COMPONENTS_RECIPE by VF_MODULE_ID and ACTION + * + * @param vnfModuleType + * @parm modelCustomizationUuid + * @param asdcServiceModelVersion + * @param modelVersion + * @param action + * @return VfModule list + */ + public List getVfModule (String vfModuleType, String modelCustomizationUuid, String asdcServiceModelVersion, String modelVersion, String action) { + StringBuilder hql; + Query query; + if(modelCustomizationUuid != null){ + hql = new StringBuilder ("FROM VfModule WHERE modelCustomizationUuid = :modelCustomizationUuid AND version = :version"); + + LOGGER.debug ("Catalog database - get VF MODULE with type " + vfModuleType + ", asdcServiceModelVersion " + asdcServiceModelVersion + ", modelVersion " + modelVersion); + + query = getSession ().createQuery (hql.toString ()); + query.setParameter ("modelCustomizationUuid", modelCustomizationUuid); + query.setParameter ("version", asdcServiceModelVersion); + }else{ + hql = new StringBuilder ("FROM VfModule WHERE type = :type AND version = :version AND modelVersion = :modelVersion"); + + LOGGER.debug ("Catalog database - get VF MODULE with type " + vfModuleType + ", asdcServiceModelVersion " + asdcServiceModelVersion + ", modelVersion " + modelVersion); + + query = getSession ().createQuery (hql.toString ()); + query.setParameter (TYPE, vfModuleType); + query.setParameter ("version", asdcServiceModelVersion); + query.setParameter ("modelVersion", modelVersion); + } + + @SuppressWarnings("unchecked") + List resultList = query.list (); + return resultList; + } + + /** + * Return a VNF COMPONENTSrecipe that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, + * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION + * first query VF_MODULE table by type, and then use the ID to query + * VNF_COMPONENTS_RECIPE by VF_MODULE_ID and ACTION * * @param vnfType * @parm vfModuleModelName - * @param action + * @param action * @return VnfRecipe object or null if none found */ - public VnfComponentsRecipe getVnfComponentsRecipe (String vnfType, String vfModuleModelName, String asdcServiceModelVersion, String modelVersion, String action) { - String vfModuleType = vnfType + "::" + vfModuleModelName; - - StringBuilder hql = new StringBuilder ("FROM VfModule WHERE type = :type AND version = :version AND modelVersion = :modelVersion"); - + public VnfComponentsRecipe getVnfComponentsRecipe (String vnfType, String vfModuleModelName, String modelCustomizationUuid, String asdcServiceModelVersion, String modelVersion, String action) { + String vfModuleType = vnfType + "::" + vfModuleModelName; long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get VF MODULE with type " + vfModuleType + ", asdcServiceModelVersion " + asdcServiceModelVersion + ", modelVersion " + modelVersion); - - Query query = getSession ().createQuery (hql.toString ()); - query.setParameter (TYPE, vfModuleType); - query.setParameter ("version", asdcServiceModelVersion); - query.setParameter ("modelVersion", modelVersion); - + List resultList = getVfModule(vfModuleType, modelCustomizationUuid, asdcServiceModelVersion, modelVersion, action); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF Module Entry not found", "CatalogDB", "getVnfComponentsRecipe", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + VfModule vfMod = resultList.get(0); + + int id = vfMod.getId(); + String vfModuleId = Integer.toString(id); + + StringBuilder hql1 = new StringBuilder ("FROM VnfComponentsRecipe WHERE vfModuleId = :vfModuleId AND action = :action "); + + LOGGER.debug ("Catalog database - get Vnf Components recipe with vf module id " + vfModuleId + + " and action " + + action); + + Query query1 = getSession ().createQuery (hql1.toString ()); + query1.setParameter (VF_MODULE_ID, vfModuleId); + query1.setParameter (ACTION, action); + @SuppressWarnings("unchecked") - List resultList = query.list (); + List resultList1 = query1.list (); + + if (resultList1.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfComponentsRecipe", null); + return null; + } + + Collections.sort (resultList1, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList1); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVnfComponentsRecipe", null); + if (resultList1.size() > 1 && (!resultList1. get (0).getOrchestrationUri().equals(resultList1.get (1).getOrchestrationUri ()))) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Different ORCHESTRATION URIs found for same VERSION and ID. No result returned.", "CatalogDB", "getVnfComponentsRecipe", null); + return null; + } + return resultList1.get (0); + } + + /** + * Return a VNF COMPONENTSrecipe that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, + * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION + * first query VF_MODULE table by type, and then use the ID to query + * VNF_COMPONENTS_RECIPE by VF_MODULE_ID and ACTION + * + * @param vnfType + * @parm vfModuleModelName + * @param action + * @return VnfRecipe object or null if none found + */ + public VnfComponentsRecipe getVnfComponentsRecipeByVfModule(List resultList, String action) { + long startTime = System.currentTimeMillis (); if (resultList.isEmpty ()) { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF Module Entry not found", "CatalogDB", "getVnfComponentsRecipe", null); @@ -1000,8 +1964,8 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVnfComponentsRecipe", null); if (resultList1.size() > 1 && (!resultList1. get (0).getOrchestrationUri().equals(resultList1.get (1).getOrchestrationUri ()))) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Different ORCHESTRATION URIs found for same VERSION and ID. No result returned.", "CatalogDB", "getVnfComponentsRecipe", null); - return null; + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Different ORCHESTRATION URIs found for same VERSION and ID. No result returned.", "CatalogDB", "getVnfComponentsRecipe", null); + return null; } return resultList1.get (0); } @@ -1472,21 +2436,116 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVnfResource", null); } } - + + public void saveAllottedResourceCustomization (AllottedResourceCustomization resourceCustomization) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save Allotted Resource with Name " + resourceCustomization.getModelName()); + try { + List allottedResourcesList = getAllAllottedResourcesByArModelCustomizationUuid(resourceCustomization.getModelCustomizationUuid()); + + if(allottedResourcesList.size() == 0){ + this.getSession ().save(resourceCustomization); + } + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateAllottedResourceCustomization", null); + } + } + + public void saveNetworkResourceCustomization (NetworkResourceCustomization networkResourceCustomization) throws RecordNotFoundException { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save Network Resource Customization with Network Name " + networkResourceCustomization.getModelName()); + try { + // Check if NetworkResourceCustomzation record already exists. If so, skip saving it. + List networkResourceCustomizationList = getAllNetworksByNetworkModelCustomizationUuid(networkResourceCustomization.getModelCustomizationUuid()); + // Do any matching customization records exist? + if(networkResourceCustomizationList.size() == 0){ + + // Retreive the record from the Network_Resource table associated to the Customization record based on ModelName + NetworkResource networkResource = getNetworkResource(networkResourceCustomization.getModelName()); + + if(networkResource == null){ + throw new RecordNotFoundException("No record found in NETWORK_RESOURCE table for model name " + networkResourceCustomization.getModelName()); + } + + networkResourceCustomization.setNetworkResourceId(networkResource.getId()); + + this.getSession ().save(networkResourceCustomization); + } + + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveNetworkResourceCustomization", null); + } + } + + public void saveServiceToNetworks (ServiceToNetworks serviceToNetworks) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save to ServiceToNetworks table with NetworkModelCustomizationUUID of " + serviceToNetworks.getNetworkModelCustomizationUuid() + " and ServiceModelUUID of " + serviceToNetworks.getServiceModelUuid()); + try { + this.getSession ().save(serviceToNetworks); + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveNetworkResourceCustomization", null); + } + } + + public void saveServiceToAllottedResources (ServiceToAllottedResources serviceToAllottedResources) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save to serviceToAllottedResources table with ARModelCustomizationUUID of " + serviceToAllottedResources.getArModelCustomizationUuid() + " and ServiceModelUUID of " + serviceToAllottedResources.getServiceModelUuid()); + try { + this.getSession ().save(serviceToAllottedResources); + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveServiceToAllottedResources", null); + } + } + public void saveService (Service service) { long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - save Service with ServiceName/Version/serviceUUID(SERVICE_NAME_VERSION_ID)" + service.getServiceName()+"/"+service.getServiceVersion()+"/"+service.getServiceNameVersionId()); + LOGGER.debug ("Catalog database - save Service with ServiceName/Version/serviceUUID(SERVICE_NAME_VERSION_ID)" + service.getServiceName()+"/"+service.getVersion()+"/"+service.getServiceNameVersionId()); try { - Service serviceDB = this.getServiceByUUID(service.getServiceNameVersionId()); + Service serviceInvariantDB = null; + // Retrieve existing service record by nameVersionId + Service serviceDB = this.getServiceByUUID(service.getServiceNameVersionId()); if (serviceDB == null) { - this.getSession ().save (service); + // Check to see if a record with the same modelInvariantId already exists. This tells us that a previous version exists and we can copy its recipe Record for the new service record. + serviceInvariantDB = this.getServiceByInvariantUUID(service.getModelInvariantUUID()); + // Save the new Service record + this.getSession ().save (service); } - + + if(serviceInvariantDB != null){ // existing modelInvariantId was found. + // copy the recipe record with the matching invariant id. We will duplicate this for the new service record + List serviceRecipes = getServiceRecipes(serviceInvariantDB.getId()); + + if(serviceRecipes != null && serviceRecipes.size() > 0){ + for(ServiceRecipe serviceRecipe : serviceRecipes){ + if(serviceRecipe != null){ + // Fetch the service record that we just added. We do this so we can extract its Id column value, this will be the foreign key we use in the service recipe table. + Service newService = this.getServiceByUUID(service.getServiceNameVersionId()); + // Create a new ServiceRecipe record based on the existing one we just copied from the DB. + ServiceRecipe newServiceRecipe = new ServiceRecipe(); + newServiceRecipe.setAction(serviceRecipe.getAction()); + newServiceRecipe.setDescription(serviceRecipe.getDescription()); + newServiceRecipe.setOrchestrationUri(serviceRecipe.getOrchestrationUri()); + newServiceRecipe.setRecipeTimeout(serviceRecipe.getRecipeTimeout()); + newServiceRecipe.setServiceParamXSD(serviceRecipe.getServiceParamXSD()); + newServiceRecipe.setServiceId(newService.getId()); + newServiceRecipe.setVersion(serviceRecipe.getVersion()); + // Save the new recipe record in the service_recipe table and associate it to the new service record that we just added. + this.getSession ().save (newServiceRecipe); + } + } + } + + } + } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateService", null); } } - + public void saveOrUpdateVfModule (VfModule vfModule) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - save VNF Module with VF Model Name " + vfModule.getModelName()); @@ -1497,9 +2556,9 @@ public class CatalogDatabase implements Closeable { } else { this.getSession ().save (vfModule); } - + } finally { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVfModule", null); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVfModule", null); } } @@ -1511,21 +2570,21 @@ public class CatalogDatabase implements Closeable { HeatNestedTemplate nestedTemplate = new HeatNestedTemplate (); nestedTemplate.setParentTemplateId (parentTemplateId); nestedTemplate.setChildTemplateId (childTemplateId); - + return (HeatNestedTemplate)session.get (HeatNestedTemplate.class,nestedTemplate); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNestedHeatTemplate", null); } } - + public void saveNestedHeatTemplate (int parentTemplateId, HeatTemplate childTemplate, String yamlFile) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - save nested Heat template with name " + childTemplate.getTemplateName ()); try { - + saveHeatTemplate(childTemplate, childTemplate.getParameters()); - if (getNestedHeatTemplate(parentTemplateId,childTemplate.getId()) == null) { + if (getNestedHeatTemplate(parentTemplateId,childTemplate.getId()) == null) { HeatNestedTemplate nestedTemplate = new HeatNestedTemplate (); nestedTemplate.setParentTemplateId (parentTemplateId); nestedTemplate.setChildTemplateId (childTemplate.getId ()); @@ -1536,7 +2595,7 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveNestedHeatTemplate", null); } } - + public HeatFiles getHeatFiles(int vnfResourceId,String fileName,String asdcResourceName, String version) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - getHeatFiles with name " + fileName @@ -1571,8 +2630,8 @@ public class CatalogDatabase implements Closeable { LOGGER.debug("Generic Exception - while searching for: fileName='" + fileName + "', vnfResourceId='" + vnfResourceId + "' and asdcResourceName=" + asdcResourceName + " and version=" + version); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for fileName=" + fileName + " and vnfResourceId=" + vnfResourceId + " and asdcResourceName=" + asdcResourceName + " and version=" + version, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for fileName=" + fileName); heatFilesResult = null; - } - + } + // See if something came back. if (heatFilesResult == null) { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. HeatFiles not found", "CatalogDB", "getHeatFiles", null); @@ -1582,7 +2641,7 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatFiles", null); return heatFilesResult; } - + public void saveHeatFiles (HeatFiles childFile) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - save Heat File with name " @@ -1593,7 +2652,7 @@ public class CatalogDatabase implements Closeable { // asdc_heat_files_save this.getSession ().save (childFile); - + } else { /* replaced 'heatFiles' by 'childFile' Based on following comment: @@ -1606,7 +2665,7 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveHeatFiles", null); } } - + public void saveVfModuleToHeatFiles (int parentVfModuleId, HeatFiles childFile) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - save Heat File to VFmodule link " @@ -1616,14 +2675,14 @@ public class CatalogDatabase implements Closeable { VfModuleToHeatFiles vfModuleToHeatFile = new VfModuleToHeatFiles (); vfModuleToHeatFile.setVfModuleId(parentVfModuleId); vfModuleToHeatFile.setHeatFilesId(childFile.getId()); - + session.save (vfModuleToHeatFile); - + } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveVfModuleToHeatFiles", null); } } - + /** * Return a Network recipe that matches a given NETWORK_TYPE, ACTION, and, if specified, SERVICE_TYPE @@ -1662,21 +2721,21 @@ public class CatalogDatabase implements Closeable { if (resultList.isEmpty ()) { return null; } - + Collections.sort (resultList, new MavenLikeVersioningComparator ()); Collections.reverse (resultList); - + return resultList.get (0); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkRecipe", null); } } - + /** * Return a Network recipe that matches a given NETWORK_TYPE and ACTION * * @param networkType - * @param action + * @param action * @return NetworkRecipe object or null if none found */ public NetworkRecipe getNetworkRecipe (String networkType, String action) { @@ -1689,27 +2748,61 @@ public class CatalogDatabase implements Closeable { try { String hql = "FROM NetworkRecipe WHERE networkType = :networkType AND action = :action"; - + Query query = getSession ().createQuery (hql); query.setParameter (NETWORK_TYPE, networkType); query.setParameter (ACTION, action); - + @SuppressWarnings("unchecked") List resultList = query.list (); if (resultList.isEmpty ()) { return null; } - + Collections.sort (resultList, new MavenLikeVersioningComparator ()); Collections.reverse (resultList); - + return resultList.get (0); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkRecipe", null); } } + /** + * Return a Network Resource that matches the Network Customization defined by given MODEL_CUSTOMIZATION_UUID + * + * @param networkType + * @param action + * @param serviceType + * @return NetworkRecipe object or null if none found + */ + public NetworkResource getNetworkResourceByModelCustUuid(String modelCustomizationUuid) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get network resource with modelCustomizationUuid " + modelCustomizationUuid); + + try { + String hql = "select n FROM NetworkResource n, NetworkResourceCustomization c WHERE n.id=c.networkResourceId and c.modelCustomizationUuid = :modelCustomizationUuid"; + Query query = getSession ().createQuery (hql); + query.setParameter (MODEL_CUSTOMIZATION_UUID, modelCustomizationUuid); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + return resultList.get (0); + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkResourceBySvcNtwkRsrc", null); + } + } + /** * Return a VnfComponents recipe that matches a given VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, and, if specified, * SERVICE_TYPE @@ -1757,24 +2850,24 @@ public class CatalogDatabase implements Closeable { } Collections.sort (resultList, new MavenLikeVersioningComparator ()); Collections.reverse (resultList); - + return resultList.get (0); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfComponentsRecipe", null); } } - + /** * Return a VnfComponents recipe that matches a given VF_MODULE_ID, VNF_COMPONENT_TYPE, ACTION * * @param vfModuleId * @param vnfComponentType - * @param action + * @param action * @return VnfComponentsRecipe object or null if none found */ public VnfComponentsRecipe getVnfComponentsRecipeByVfModuleId (String vfModuleId, String vnfComponentType, - String action) { + String action) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - get Vnf Component recipe with vfModuleId " + vfModuleId @@ -1786,12 +2879,12 @@ public class CatalogDatabase implements Closeable { try { String hql; hql = "FROM VnfComponentsRecipe WHERE vfModuleId = :vfModuleId AND vnfComponentType = :vnfComponentType AND action = :action "; - + Query query = getSession ().createQuery (hql); query.setParameter (VF_MODULE_ID, vfModuleId); query.setParameter (VNF_COMPONENT_TYPE, vnfComponentType); query.setParameter (ACTION, action); - + @SuppressWarnings("unchecked") List resultList = query.list (); @@ -1800,7 +2893,7 @@ public class CatalogDatabase implements Closeable { } Collections.sort (resultList, new MavenLikeVersioningComparator ()); Collections.reverse (resultList); - + return resultList.get (0); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfComponentsRecipeByVfModuleId", null); @@ -1863,6 +2956,71 @@ public class CatalogDatabase implements Closeable { } } + /** + * Return a Model recipe that matches a given MODEL_TYPE, MODEL_VERSION_ID, ACTION + * Note: This method is not currently used but was retained in the event the + * architecture moves back to a MODEL/MODEL_RECIPE structure. + * + * @param modelType + * @param modelVersionId + * @param action + * @return ModelRecipe object or null if none found + */ + public ModelRecipe getModelRecipe(String modelType, + String modelVersionId, + String action) { + + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get Model recipe with modelType=" + modelType + + " and modeVersionId=" + modelVersionId + + " and action=" + action); + + try { + String hql; + // TBD - at some point it would be desirable to figure out how to do a HQL JOIN across + // the MODEL and MODEL_RECIPE tables in HQL instead of 2 separate queries. + // There seems to be 2 issues: formatting a hql query that executes successfully + // and then being able to generate a result that will fit into the ModelRecipe class. + + // 1st query to get the Model record for the given MODEL_TYPE and MODEL_VERSION_ID + hql = "FROM Model WHERE modelType = :modelType AND modelVersionId = :modelVersionId"; + Query query = getSession().createQuery(hql); + query.setParameter(MODEL_TYPE, modelType); + query.setParameter(MODEL_VERSION_ID, modelVersionId); + + @SuppressWarnings("unchecked") + List modelResultList = query.list(); + if (modelResultList.isEmpty()) { + LOGGER.debug("Catalog database - modelResultList is null"); + return null; + } + Collections.sort(modelResultList, new MavenLikeVersioningComparator()); + Collections.reverse(modelResultList); + LOGGER.debug("Catalog database - modelResultList contains " + modelResultList.get(0).toString()); + + // 2nd query to get the ModelRecipe record corresponding to the Model from the 1st query + hql = "FROM ModelRecipe WHERE modelId = :modelId AND action = :action"; + query = getSession().createQuery(hql); + // The MODEL table 'id' field maps to the MODEL_RECIPE table 'MODEL_ID' field + query.setParameter(MODEL_ID, modelResultList.get(0).getId()); + query.setParameter(ACTION, action); + + @SuppressWarnings("unchecked") + List recipeResultList = query.list(); + if (recipeResultList.isEmpty()) { + LOGGER.debug("Catalog database - recipeResultList is null"); + return null; + } + Collections.sort(recipeResultList, new MavenLikeVersioningComparator()); + Collections.reverse(recipeResultList); + LOGGER.debug("Catalog database - recipeResultList contains " + recipeResultList.get(0).toString()); + + return recipeResultList.get(0); + } finally { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getModelRecipe", null); + } + } + /** * Verify the health of the DB. diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/HibernateUtilsCatalogDb.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/HibernateUtilsCatalogDb.java new file mode 100644 index 0000000000..c4069be443 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/HibernateUtilsCatalogDb.java @@ -0,0 +1,45 @@ +/*- + * ============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.db.catalog; + +import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import java.net.URL; + +public class HibernateUtilsCatalogDb extends HibernateUtils { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); + + @Override + protected URL getHibernateConfigFile() { + try { + if ("MYSQL".equals (System.getProperty ("mso.db")) || "MARIADB".equals(System.getProperty("mso.db"))) { + return this.getClass().getClassLoader().getResource("hibernate-catalog-core-mysql.cfg.xml"); + } else { + LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError , "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC"); + return null; + } + } catch (Exception ex) { + LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, ex.getMessage (), "", "", MsoLogger.ErrorCode.DataError , "Problem in getting DB connection type", ex); + return null; + } + } +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java new file mode 100644 index 0000000000..21cef1ea9f --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java @@ -0,0 +1,123 @@ +/*- + * ============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.db.catalog.beans; + +import java.sql.Timestamp; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class AllottedResourceCustomization extends MavenLikeVersioning { + + private String modelCustomizationUuid; + private String modelUuid; + private String modelInvariantUuid; + private String modelVersion = null; // duplicate of version kept in parent class + private String modelName; + private String description; + private Timestamp created; + private String modelInstanceName; + + public AllottedResourceCustomization() { + super(); + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getModelUuid() { + return this.modelUuid; + } + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + public String getModelInvariantUuid() { + return this.modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelName() { + return this.modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getDescription() { + return this.description; + } + public void setDescription(String description) { + this.description = description; + } + + public Timestamp getCreated() { + return this.created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + + public String getModelInstanceName() { + return this.modelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + public String getModelVersion() { + return this.modelVersion; + } + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append("modelName="); + sb.append(this.modelName); + sb.append(",modelVersion="); + sb.append(this.modelVersion); + sb.append(",version="); + sb.append(this.version); + sb.append(",modelUuid="); + sb.append(this.modelUuid); + sb.append(",modelInvariantUuid="); + sb.append(this.modelInvariantUuid); + sb.append(",modelCustomizationUuid="); + sb.append(this.modelCustomizationUuid); + sb.append(",modelInstanceName="); + sb.append(this.modelInstanceName); + sb.append(",description="); + sb.append(this.description); + sb.append(",modelInstanceName="); + sb.append(this.modelInstanceName); + sb.append(",created="); + sb.append(this.created); + + return sb.toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java index 69db27e989..a920375bcd 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.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,9 +35,10 @@ public class HeatEnvironment extends MavenLikeVersioning { private String asdcUuid; private String asdcResourceName; private String asdcLabel; + private String artifactChecksum; private Timestamp created; - + public HeatEnvironment() {} public int getId() { @@ -92,8 +93,15 @@ public class HeatEnvironment extends MavenLikeVersioning { this.asdcLabel = asdcLabel; } + public String getArtifactChecksum() { + return artifactChecksum; + } - /** + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + /** * @return the asdcResourceName */ public String getAsdcResourceName () { @@ -115,7 +123,7 @@ public class HeatEnvironment extends MavenLikeVersioning { public void setCreated(Timestamp created) { this.created = created; } - + @Override public String toString () { StringBuffer sb = new StringBuffer(); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java index a1b6f228e1..d379c2471a 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.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. @@ -36,38 +36,39 @@ public class HeatFiles extends MavenLikeVersioning { private String asdcUuid; private String asdcLabel; private String asdcResourceName; - + private String artifactChecksum; + public HeatFiles() {} - + public int getId() { return this.id; } - + public void setId(int id) { this.id = id; } - + public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } - + public String getFileName() { return this.fileName; } public void setFileName(String fileName) { this.fileName = fileName; } - + public String getFileBody() { return this.fileBody; } public void setFileBody(String fileBody) { this.fileBody = fileBody; } - + public int getVnfResourceId() { return this.vnfResourceId; } @@ -82,7 +83,7 @@ public class HeatFiles extends MavenLikeVersioning { public void setCreated(Timestamp created) { this.created = created; } - + public String getAsdcUuid() { return this.asdcUuid; } @@ -103,6 +104,14 @@ public class HeatFiles extends MavenLikeVersioning { this.asdcResourceName = asdcResourceName; } + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + @Override public String toString () { StringBuffer sb = new StringBuffer(); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java index a80fa598b9..5762837bfb 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.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. @@ -46,9 +46,10 @@ public class HeatTemplate extends MavenLikeVersioning { private String asdcUuid; private String asdcResourceName; private String asdcLabel; - + private String artifactChecksum; + private Timestamp created; - + public enum TemplateStatus { PARENT, CHILD, PARENT_COMPLETE } @@ -103,7 +104,7 @@ public class HeatTemplate extends MavenLikeVersioning { public void setParameters (Set parameters) { this.parameters = parameters; } - + public String getDescription() { return description; } @@ -131,7 +132,7 @@ public class HeatTemplate extends MavenLikeVersioning { } catch (Exception e) { LOGGER.debug ("Error reading template file " + templatePath, e); } - + return body; } @@ -150,7 +151,7 @@ public class HeatTemplate extends MavenLikeVersioning { public void setAsdcUuid(String asdcUuidp) { this.asdcUuid = asdcUuidp; } - + public String getAsdcResourceName() { return asdcResourceName; } @@ -164,8 +165,15 @@ public class HeatTemplate extends MavenLikeVersioning { public void setAsdcLabel(String asdcLabel) { this.asdcLabel = asdcLabel; } - - public Timestamp getCreated() { + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + public Timestamp getCreated() { return created; } @@ -197,7 +205,7 @@ public class HeatTemplate extends MavenLikeVersioning { sb.append (",created="); sb.append (DateFormat.getInstance().format(created)); } - + if (parameters != null && !parameters.isEmpty ()) { sb.append (",params=["); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java new file mode 100644 index 0000000000..51153c912b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java @@ -0,0 +1,198 @@ +/*- + * ============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.db.catalog.beans; + + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.util.Map; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class Model extends MavenLikeVersioning { + private int id; + private String modelCustomizationId; + private String modelCustomizationName; + private String modelInvariantId; + private String modelName; + private String modelType; + private String modelVersion; + private String modelVersionId; + private Timestamp created; + private Map recipes; + + /** + * @return the id + */ + public int getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + + /** + * @return the modelCustomizationId + */ + public String getModelCustomizationId() { + return modelCustomizationId; + } + + /** + * @param modelCustomizationId the modelCustomizationId to set + */ + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + /** + * @return the modelCustomizationName + */ + public String getModelCustomizationName() { + return modelCustomizationName; + } + + /** + * @param modelCustomizationName the modelCustomizationName to set + */ + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + /** + * @return the modelInvariantId + */ + public String getModelInvariantId() { + return modelInvariantId; + } + + /** + * @param modelInvariantId the modelInvariantId to set + */ + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + /** + * @return the modelName + */ + public String getModelName() { + return modelName; + } + + /** + * @param modelName the modelName to set + */ + public void setModelName(String modelName) { + this.modelName = modelName; + } + + /** + * @return the modelType + */ + public String getModelType() { + return modelType; + } + + /** + * @param modelType the modelType to set + */ + public void setModelType(String modelType) { + this.modelType = modelType; + } + + /** + * @return the modelVersion + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * @param modelVersion the modelVersion to set + */ + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + /** + * @return the modelVersionId + */ + public String getModelVersionId() { + return modelVersionId; + } + + /** + * @param modelVersionId the modelVersionId to set + */ + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + /** + * @return the created + */ + public Timestamp getCreated() { + return created; + } + + /** + * @param created the created to set + */ + public void setCreated(Timestamp created) { + this.created = created; + } + + /** + * @return the recipes + */ + public Map getRecipes() { + return recipes; + } + + /** + * @param recipes the recipes to set + */ + public void setRecipes(Map recipes) { + this.recipes = recipes; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Model: "); + sb.append("modelCustomizationId=" + modelCustomizationId); + sb.append(",modelCustomizationName=" + modelCustomizationName); + sb.append(",modelInvariantId=" + modelInvariantId); + sb.append(",modelName=" + modelName); + sb.append(",modelType=" + modelType); + sb.append(",modelVersion=" + modelVersion); + sb.append(",modelVersionId=" + modelVersionId); + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java new file mode 100644 index 0000000000..83fb773a8c --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java @@ -0,0 +1,180 @@ +/*- + * ============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.db.catalog.beans; + + +import java.sql.Timestamp; +import java.text.DateFormat; +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class ModelRecipe extends MavenLikeVersioning { + private int id; + private Integer modelId; + private String action; + private String schemaVersion; + private String description; + private String orchestrationUri; + private String modelParamXSD; + private Integer recipeTimeout; + private Timestamp created; + + /** + * @return the id + */ + public int getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + + /** + * @return the modelId + */ + public Integer getModelId() { + return modelId; + } + + /** + * @param modelId the modelId to set + */ + public void setModelId(Integer modelId) { + this.modelId = modelId; + } + + /** + * @return the action + */ + public String getAction() { + return action; + } + + /** + * @param action the action to set + */ + public void setAction(String action) { + this.action = action; + } + + /** + * @return the versionStr + */ + public String getSchemaVersion() { + return schemaVersion; + } + + /** + * @param versionStr the versionStr to set + */ + public void setSchemaVersion(String schemaVersion) { + this.schemaVersion = schemaVersion; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the orchestrationUri + */ + public String getOrchestrationUri() { + return orchestrationUri; + } + + /** + * @param orchestrationUri the orchestrationUri to set + */ + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + /** + * @return the modelParamXSD + */ + public String getModelParamXSD() { + return modelParamXSD; + } + + /** + * @param modelParamXSD the modelParamXSD to set + */ + public void setModelParamXSD(String modelParamXSD) { + this.modelParamXSD = modelParamXSD; + } + + /** + * @return the recipeTimeout + */ + public Integer getRecipeTimeout() { + return recipeTimeout; + } + + /** + * @param recipeTimeout the recipeTimeout to set + */ + public void setRecipeTimeout(Integer recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + /** + * @return the created + */ + public Timestamp getCreated() { + return created; + } + + /** + * @param created the created to set + */ + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ModelRecipe: "); + sb.append("modelId=" + modelId.toString()); + sb.append(",action=" + action); + sb.append(",schemaVersion=" + schemaVersion); + sb.append(",orchestrationUri=" + orchestrationUri); + sb.append(",modelParamXSD=" + modelParamXSD); + sb.append(",recipeTimeout=" + recipeTimeout.toString()); + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java new file mode 100644 index 0000000000..0c49f1b1a4 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java @@ -0,0 +1,140 @@ +/*- + * ============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.db.catalog.beans; + +import java.sql.Timestamp; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class NetworkResourceCustomization extends MavenLikeVersioning{ + + private String modelCustomizationUuid; + private String modelName; + private String modelInstanceName; + private String modelUuid; + private String modelVersion; + private String modelInvariantUuid; + private int networkResourceId = 0; + private Timestamp created; + + // These fields are not in the table directly - but I'm adding them here for storage in the objects we're dealing with + private NetworkResource networkResource = null; + private String networkType = null; + + public NetworkResourceCustomization() { + super(); + } + + public int getNetworkResourceId() { + return this.networkResourceId; + } + public void setNetworkResourceId(int networkResourceId) { + this.networkResourceId = networkResourceId; + } + + public String getModelUuid() { + return this.modelUuid; + } + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + public String getModelInvariantUuid() { + return this.modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelVersion() { + return this.modelVersion; + } + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getModelInstanceName() { + return this.modelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getModelName() { + return this.modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public NetworkResource getNetworkResource() { + return this.networkResource; + } + public void setNetworkResource(NetworkResource networkResource) { + this.networkResource = networkResource; + } + + public String getNetworkType() { + return this.networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + public Timestamp getCreated() { + return this.created; + } + public void setCreated(Timestamp timestamp) { + this.created = timestamp; + } + + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append("modelName="); + sb.append(this.modelName); + sb.append("modelUuid="); + sb.append(this.modelUuid); + sb.append("modelUuid="); + sb.append(this.modelUuid); + sb.append("modelInvariantUuid="); + sb.append(this.modelInvariantUuid); + sb.append("modelVersion="); + sb.append(this.modelVersion); + sb.append("modelCustomizationUuid="); + sb.append(this.modelCustomizationUuid); + sb.append("modelInstanceName="); + sb.append(this.modelInstanceName); + sb.append("networkResourceId="); + sb.append(this.networkResourceId); + sb.append("networkType="); + sb.append(this.networkType); + + return sb.toString(); + } + +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java new file mode 100644 index 0000000000..01369c4ecd --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java @@ -0,0 +1,141 @@ +/*- + * ============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.db.catalog.beans; + +import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.db.catalog.beans.VfModule; +import java.util.ArrayList; + +/* + * A simple holder for Service and its associated elements: + * VnfResource, 1-n VfModule, Network TBD + */ + +public class ServiceMacroHolder { + + private Service service; + private ArrayList vnfResources; + private ArrayList networkResourceCustomizations; + private ArrayList allottedResourceCustomizations; + + public ServiceMacroHolder() { + super(); + this.service = null; + this.vnfResources = new ArrayList(); + this.networkResourceCustomizations = new ArrayList(); + this.allottedResourceCustomizations = new ArrayList(); + } + public ServiceMacroHolder(Service service) { + this(); + this.service = service; + } + + public Service getService() { + return this.service; + } + public void setService(Service service) { + this.service = service; + } + + public void setVnfResources(ArrayList vnfResources) { + this.vnfResources = vnfResources; + } + public ArrayList getVnfResources() { + return this.vnfResources; + } + public void addVnfResource(VnfResource vr) { + if (vr != null) { + if (this.vnfResources != null) { + this.vnfResources.add(vr); + } else { + this.vnfResources = new ArrayList(); + this.vnfResources.add(vr); + } + } + } + + public void setNetworkResourceCustomization(ArrayList networkResourceCustomizations) { + this.networkResourceCustomizations = networkResourceCustomizations; + } + public ArrayList getNetworkResourceCustomization() { + return this.networkResourceCustomizations; + } + public void addNetworkResourceCustomization(NetworkResourceCustomization nrc) { + if (this.networkResourceCustomizations != null) { + this.networkResourceCustomizations.add(nrc); + } else { + this.networkResourceCustomizations = new ArrayList(); + this.networkResourceCustomizations.add(nrc); + } + } + + public void setAllottedResourceCustomization(ArrayList allottedResourceCustomizations) { + this.allottedResourceCustomizations = allottedResourceCustomizations; + } + public ArrayList getAllottedResourceCustomization() { + return this.allottedResourceCustomizations; + } + public void addAllottedResourceCustomization(AllottedResourceCustomization arc) { + if (this.allottedResourceCustomizations != null) { + this.allottedResourceCustomizations.add(arc); + } else { + this.allottedResourceCustomizations = new ArrayList(); + this.allottedResourceCustomizations.add(arc); + } + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ServicePlus: "); + if (this.service != null) { + sb.append("service: " + this.service.toString()); + } else { + sb.append("service: null"); + } + if (this.vnfResources != null && this.vnfResources.size() > 0) { + int i=0; + sb.append("VnfResources: "); + for (VnfResource vr : this.vnfResources) { + sb.append(", vnfResource[" + i++ + "]:" + vr.toString()); + } + } else { + sb.append("none"); + } + if (this.networkResourceCustomizations != null && this.networkResourceCustomizations.size() > 0) { + int i=0; + sb.append("NetworkResourceCustomizations:"); + for (NetworkResourceCustomization nrc : this.networkResourceCustomizations) { + sb.append("NRC[" + i++ + "]: " + nrc.toString()); + } + } + if (this.allottedResourceCustomizations != null && this.allottedResourceCustomizations.size() > 0) { + int i=0; + sb.append("AllottedResourceCustomizations:"); + for (AllottedResourceCustomization arc : this.allottedResourceCustomizations) { + sb.append("ARC[" + i++ + "]: " + arc.toString()); + } + } + + return sb.toString(); + } + + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java index 53ec3ba278..cc203ff98d 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,6 +26,9 @@ package org.openecomp.mso.db.catalog.beans; import java.sql.Timestamp; import java.text.DateFormat; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; +import java.util.Date; +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; +import org.openecomp.mso.logger.MsoLogger; public class ServiceRecipe extends MavenLikeVersioning { private int id; @@ -36,9 +39,38 @@ public class ServiceRecipe extends MavenLikeVersioning { private String serviceParamXSD; private int recipeTimeout; private Integer serviceTimeoutInterim; - + private Timestamp created; - + + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); + + // This 'default' CTR is now needed for backward compatibility since a new CTR was added below + public ServiceRecipe() { + super(); + } + + // This CTR is needed by the HQL SELECT JOIN between the SERVICE and SERVICE_RECIPE tables + // in CatalogDatabase::getServiceRecipe() + public ServiceRecipe(int id, int serviceId, String action, + String description, String orchestrationUri, + String serviceParamXSD, int recipeTimeout, + int serviceTimeoutInterim, Date created) { + super(); + LOGGER.debug("ServiceRecipe id=" + id + ", serviceId=" + serviceId + ", action=" + action + ", description=" + description + + ", orchestrationUri=" + orchestrationUri + ", serviceParamXSD=" + serviceParamXSD + + ", recipeTimeout=" + recipeTimeout + ", serviceTimeoutInterim=" + serviceTimeoutInterim + ", created=" + created); + this.id = id; + this.serviceId = serviceId; + this.action = action; + this.description = description; + this.orchestrationUri = orchestrationUri; + this.serviceParamXSD = serviceParamXSD; + this.recipeTimeout = recipeTimeout; + this.serviceTimeoutInterim = serviceTimeoutInterim; + long date = created.getTime(); + this.created = new Timestamp(date); + } public int getId() { return id; @@ -96,7 +128,7 @@ public class ServiceRecipe extends MavenLikeVersioning { public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) { this.serviceTimeoutInterim = serviceTimeoutInterim; } - + public Timestamp getCreated() { return created; } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java new file mode 100644 index 0000000000..1fc93be6f5 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java @@ -0,0 +1,67 @@ +/*- + * ============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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; + +public class ServiceToAllottedResources implements Serializable { + + private String serviceModelUuid; + private String arModelCustomizationUuid; + private Timestamp created; + + public static final long serialVersionUID = -1322322139926390329L; + + public ServiceToAllottedResources() { + super(); + } + + public String getServiceModelUuid() { + return this.serviceModelUuid; + } + public void setServiceModelUuid(String serviceModelUuid) { + this.serviceModelUuid = serviceModelUuid; + } + public String getArModelCustomizationUuid() { + return this.arModelCustomizationUuid; + } + public void setArModelCustomizationUuid(String arModelCustomizationUuid) { + this.arModelCustomizationUuid = arModelCustomizationUuid; + } + public Timestamp getCreated() { + return this.created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("serviceModelUuid="); + sb.append(this.serviceModelUuid); + sb.append("arModelCustomizationUuid="); + sb.append(this.arModelCustomizationUuid); + + return sb.toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java new file mode 100644 index 0000000000..5ea171e93b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java @@ -0,0 +1,68 @@ +/*- + * ============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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; + +public class ServiceToNetworks implements Serializable { + + // This maps to SERVICE.SERVICE_NAME_VERSION_ID / Service.serviceNameVersionId in SERVICE/Service table + private String serviceModelUuid; + // This maps to NETWORK_RESOURCE_CUSTOMIZATION.MODEL_CUSTOMIZATION_UUID / NetworkResourceCustomization.ModelCustomizationUuid + private String networkModelCustomizationUuid; + private Timestamp created; + public static final long serialVersionUID = -1322322139926390329L; + + public ServiceToNetworks() { + super(); + } + + public String getServiceModelUuid() { + return this.serviceModelUuid; + } + public void setServiceModelUuid(String serviceModelUuid) { + this.serviceModelUuid = serviceModelUuid; + } + + public String getNetworkModelCustomizationUuid() { + return this.networkModelCustomizationUuid; + } + public void setNetworkModelCustomizationUuid(String networkCustomizationUuid) { + this.networkModelCustomizationUuid = networkCustomizationUuid; + } + + public Timestamp getCreated() { + return this.created; + } + public void setCreated(Timestamp timestamp) { + this.created = timestamp; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ServiceToNetworks mapping: "); + sb.append("serviceModelUuid=" + this.serviceModelUuid); + sb.append(",networkModelCustomizationUuid=" + networkModelCustomizationUuid); + return sb.toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java index 505b3bba9a..a551ef864e 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.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. @@ -28,7 +28,7 @@ import java.text.DateFormat; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; public class VfModule extends MavenLikeVersioning { - + private int id; private Integer vnfResourceId; private String type; @@ -40,35 +40,40 @@ public class VfModule extends MavenLikeVersioning { private Integer volEnvironmentId; private String description; private String asdcUuid; - private Timestamp created; + private Timestamp created; private String modelInvariantUuid; private String modelVersion; - + private String modelCustomizationUuid = null; + private Integer minInstances; + private Integer maxInstances; + private Integer initialCount; + private String label; + public VfModule() { super(); } - + public int getId(){ return this.id; } public void setId(int id) { this.id = id; } - + public Integer getVnfResourceId() { return this.vnfResourceId; } public void setVnfResourceId(Integer vnfResourceId) { this.vnfResourceId = vnfResourceId; } - + public String getModelName() { return this.modelName; } public void setModelName(String modelName) { this.modelName = modelName; } - + public String getType() { return type; } @@ -90,14 +95,14 @@ public class VfModule extends MavenLikeVersioning { return true; } } - + public Integer getTemplateId() { return this.templateId; } public void setTemplateId(Integer templateId) { this.templateId = templateId; } - + public Integer getEnvironmentId() { return this.environmentId; } @@ -111,21 +116,21 @@ public class VfModule extends MavenLikeVersioning { public void setVolTemplateId(Integer volTemplateId) { this.volTemplateId = volTemplateId; } - + public Integer getVolEnvironmentId() { return this.volEnvironmentId; } public void setVolEnvironmentId(Integer volEnvironmentId) { this.volEnvironmentId = volEnvironmentId; } - + public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } - + public String getAsdcUuid() { return asdcUuid; } @@ -133,7 +138,7 @@ public class VfModule extends MavenLikeVersioning { public void setAsdcUuid(String asdcUuidp) { this.asdcUuid = asdcUuidp; } - + public Timestamp getCreated() { return created; } @@ -147,19 +152,49 @@ public class VfModule extends MavenLikeVersioning { public void setModelInvariantUuid(String modelInvariantUuid) { this.modelInvariantUuid = modelInvariantUuid; } - - + + public String getModelVersion() { return this.modelVersion; } public void setModelVersion(String modelVersion) { this.modelVersion = modelVersion; } - - @Override + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public Integer getMinInstances() { + return this.minInstances; + } + public void setMinInstances(Integer minInstances) { + this.minInstances = minInstances; + } + public Integer getMaxInstances() { + return this.maxInstances; + } + public void setMaxInstances(Integer maxInstances) { + this.maxInstances = maxInstances; + } + public Integer getInitialCount() { + return this.initialCount; + } + public void setInitialCount(Integer initialCount) { + this.initialCount = initialCount; + } + public String getLabel() { + return this.label; + } + public void setLabel(String label) { + this.label = label; + } + + @Override public String toString () { StringBuffer buf = new StringBuffer(); - + buf.append("VF="); buf.append(this.type); buf.append(",modelName="); @@ -184,12 +219,22 @@ public class VfModule extends MavenLikeVersioning { buf.append(asdcUuid); buf.append(",modelVersion="); buf.append(this.modelVersion); - + buf.append(",modelCustomizationUuid="); + buf.append(this.modelCustomizationUuid); + buf.append(",minInstances="); + buf.append(this.minInstances); + buf.append(",maxInstances="); + buf.append(this.maxInstances); + buf.append(",initialCount="); + buf.append(this.initialCount); + buf.append(",label="); + buf.append(this.label); + if (this.created != null) { buf.append (",created="); buf.append (DateFormat.getInstance().format(this.created)); } return buf.toString(); } - + } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java index 60c7ef216e..72f143dcc0 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.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. @@ -23,6 +23,7 @@ package org.openecomp.mso.db.catalog.beans; import java.sql.Timestamp; import java.text.DateFormat; +import java.util.ArrayList; import java.util.Map; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; @@ -31,30 +32,35 @@ public class VnfResource extends MavenLikeVersioning { private int id; private String vnfType; - + private String orchestrationMode = null; private String description = null; private Integer templateId; private Integer environmentId = null; - + private Map heatFiles; - + private String asdcUuid; - private Timestamp created; - + private Timestamp created; + private String aicVersionMin = null; private String aicVersionMax = null; - + private String modelInvariantUuid = null; private String modelVersion = null; private String modelCustomizationName = null; - + private String modelName = null; private String serviceModelInvariantUUID = null; - + private String modelCustomizationUuid = null; + + private ArrayList vfModules; + public VnfResource () { + super(); + this.vfModules = new ArrayList(); } public int getId () { @@ -104,7 +110,7 @@ public class VnfResource extends MavenLikeVersioning { public void setEnvironmentId (Integer environmentId) { this.environmentId = environmentId; } - + public Map getHeatFiles () { return this.heatFiles; } @@ -120,7 +126,7 @@ public class VnfResource extends MavenLikeVersioning { public void setAsdcUuid(String asdcUuidp) { this.asdcUuid = asdcUuidp; } - + public Timestamp getCreated() { return created; } @@ -128,38 +134,38 @@ public class VnfResource extends MavenLikeVersioning { public void setCreated(Timestamp created) { this.created = created; } - + public String getAicVersionMin() { return this.aicVersionMin; } - + public void setAicVersionMin(String aicVersionMin) { this.aicVersionMin = aicVersionMin; } - + public String getAicVersionMax() { return this.aicVersionMax; } - + public void setAicVersionMax(String aicVersionMax) { this.aicVersionMax = aicVersionMax; } - + public String getModelInvariantUuid() { return this.modelInvariantUuid; } - + public void setModelInvariantUuid(String modelInvariantUuid) { this.modelInvariantUuid = modelInvariantUuid; } - + public String getModelVersion() { return this.modelVersion; } public void setModelVersion(String modelVersion) { this.modelVersion = modelVersion; } - + public String getModelCustomizationName() { return modelCustomizationName; } @@ -184,6 +190,29 @@ public class VnfResource extends MavenLikeVersioning { this.serviceModelInvariantUUID = serviceModelInvariantUUID; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public ArrayList getVfModules() { + return this.vfModules; + } + public void setVfModules(ArrayList vfModules) { + this.vfModules = vfModules; + } + public void addVfModule(VfModule vfm) { + if (vfm != null) { + if (this.vfModules != null) { + this.vfModules.add(vfm); + } else { + this.vfModules = new ArrayList(); + this.vfModules.add(vfm); + } + } + } @Override public String toString () { StringBuffer buf = new StringBuffer(); @@ -214,11 +243,22 @@ public class VnfResource extends MavenLikeVersioning { buf.append(this.modelName); buf.append(",serviceModelInvariantUUID="); buf.append(this.serviceModelInvariantUUID); - + buf.append(",modelCustomizationUuid="); + buf.append(this.modelCustomizationUuid); + if (created != null) { buf.append(",created="); buf.append(DateFormat.getInstance().format(created)); } + if (this.vfModules != null && this.vfModules.size() > 0) { + buf.append("VfModules:"); + int i=0; + for (VfModule vfm : this.vfModules) { + buf.append("vfModule[" + i++ + "]:" + vfm.toString()); + } + } else { + buf.append("VfModules: NONE"); + } return buf.toString(); } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java index c617a4a6f4..73a9f8eb00 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.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. @@ -21,15 +21,16 @@ package org.openecomp.mso.db.catalog.utils; +import java.io.Serializable; /** * This class is the base class for object that requires a Version in Catalog DB. * The version is built on a string as ASDC provides a number like 1.2 or 2.0 ... * This class supports also 1.2.3.4... (Maven like version) - * + * * */ -public class MavenLikeVersioning { +public class MavenLikeVersioning implements Serializable { protected String version; diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundException.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundException.java new file mode 100644 index 0000000000..d7f791005a --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundException.java @@ -0,0 +1,49 @@ +/*- + * ============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.db.catalog.utils; + +/* +* Exception of the ASDC controller. +*/ +public class RecordNotFoundException extends Exception { + + /** + * serialization id. + */ + private static final long serialVersionUID = 8425657297510362736L; + + /** + * @param message The message to dump + * @param cause The Throwable cause object + */ + public RecordNotFoundException(final String message) { + super (message); + + } + + /** + * @param message The message to dump + * @param cause The Throwable cause object + */ + public RecordNotFoundException(final String message, final Throwable cause) { + super (message, cause); + + } +} diff --git a/mso-catalog-db/src/main/resources/AllottedResourceCustomization.hbm.xml b/mso-catalog-db/src/main/resources/AllottedResourceCustomization.hbm.xml new file mode 100644 index 0000000000..4a039a45c4 --- /dev/null +++ b/mso-catalog-db/src/main/resources/AllottedResourceCustomization.hbm.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml b/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml index 992e5d467a..8e86c584d5 100644 --- a/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml +++ b/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml @@ -8,9 +8,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. @@ -27,7 +27,7 @@ This class describes a HEAT Environment - + @@ -41,6 +41,9 @@ + + + @@ -49,10 +52,10 @@ - - - - + + + + diff --git a/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml b/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml index 9bc6fb1414..b77656896e 100644 --- a/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml +++ b/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml @@ -8,9 +8,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,11 +26,11 @@ This class describes a HEAT template - + - + @@ -41,21 +41,25 @@ + + + - + - - - + + + + @@ -64,14 +68,14 @@ - + - + This class describes an input parameter to a heat template - + diff --git a/mso-catalog-db/src/main/resources/ModelRecipe.hbm.xml b/mso-catalog-db/src/main/resources/ModelRecipe.hbm.xml new file mode 100644 index 0000000000..e59bb5c23b --- /dev/null +++ b/mso-catalog-db/src/main/resources/ModelRecipe.hbm.xml @@ -0,0 +1,87 @@ + + + + + + + + This class describes a Model that may be orchestrated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This class describes a Model recipe + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml b/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml index bdd16d37e6..28589ea639 100644 --- a/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml +++ b/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml @@ -8,9 +8,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ This class describes a Network recipe - + @@ -41,21 +41,21 @@ - + - - - - + + + + - + diff --git a/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml b/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml index b3b657aa9f..931db68406 100644 --- a/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml +++ b/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml @@ -8,9 +8,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ This class describes a Network Resource - + @@ -40,16 +40,18 @@ + + + - + - + - - + diff --git a/mso-catalog-db/src/main/resources/NetworkResourceCustomization.hbm.xml b/mso-catalog-db/src/main/resources/NetworkResourceCustomization.hbm.xml new file mode 100644 index 0000000000..401bca1f8d --- /dev/null +++ b/mso-catalog-db/src/main/resources/NetworkResourceCustomization.hbm.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/Service.hbm.xml b/mso-catalog-db/src/main/resources/Service.hbm.xml index 4e43413f47..f6049961fd 100644 --- a/mso-catalog-db/src/main/resources/Service.hbm.xml +++ b/mso-catalog-db/src/main/resources/Service.hbm.xml @@ -8,9 +8,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,16 +26,23 @@ This class describes a Service that may be orchestrated - + - - - + + + + + + + + + + + - - + @@ -44,32 +51,34 @@ - + - + This class describes a Service recipe - + - + - + + + diff --git a/mso-catalog-db/src/main/resources/ServiceToAllottedResources.hbm.xml b/mso-catalog-db/src/main/resources/ServiceToAllottedResources.hbm.xml new file mode 100644 index 0000000000..1d471ca193 --- /dev/null +++ b/mso-catalog-db/src/main/resources/ServiceToAllottedResources.hbm.xml @@ -0,0 +1,41 @@ + + + + + + + This class describes a Service to Allotted Resource Customization relationship + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/ServiceToNetworks.hbm.xml b/mso-catalog-db/src/main/resources/ServiceToNetworks.hbm.xml new file mode 100644 index 0000000000..1c96f7ba95 --- /dev/null +++ b/mso-catalog-db/src/main/resources/ServiceToNetworks.hbm.xml @@ -0,0 +1,41 @@ + + + + + + + This class describes a Service to a Network Resource Customization relationship + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/VfModule.hbm.xml b/mso-catalog-db/src/main/resources/VfModule.hbm.xml index 1ccc48daf6..1631057bfd 100644 --- a/mso-catalog-db/src/main/resources/VfModule.hbm.xml +++ b/mso-catalog-db/src/main/resources/VfModule.hbm.xml @@ -8,9 +8,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. @@ -27,55 +27,66 @@ - + + + + + + - + - + + + - - - - - - - - - - - - - - - + - + + + + - + + + + - + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml b/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml index e0ef0d2bc2..6297e1c52f 100644 --- a/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml +++ b/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml @@ -8,9 +8,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,20 +26,22 @@ This class describes a VNF Components Recipe - + - - + + - + + + diff --git a/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml b/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml index ea2b39e861..4c471edfee 100644 --- a/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml +++ b/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml @@ -8,9 +8,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,13 +26,13 @@ This class describes a VNF Recipe - + - + @@ -42,23 +42,23 @@ - + - + - + - + - + - + - + diff --git a/mso-catalog-db/src/main/resources/VnfResource.hbm.xml b/mso-catalog-db/src/main/resources/VnfResource.hbm.xml index 4c9e3b59e3..2fc47009d7 100644 --- a/mso-catalog-db/src/main/resources/VnfResource.hbm.xml +++ b/mso-catalog-db/src/main/resources/VnfResource.hbm.xml @@ -8,9 +8,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ This class describes a VNF Resource - + @@ -37,14 +37,20 @@ + + + + + + - + @@ -69,66 +75,62 @@ - - - - - - - + + + - + - + This class describes a HEAT Template File - + - + + + - + - + + + + - - - - - - - + + + + - - - - - - + + + + - + diff --git a/mso-catalog-db/src/main/resources/hibernate-catalog-core-mysql.cfg.xml b/mso-catalog-db/src/main/resources/hibernate-catalog-core-mysql.cfg.xml new file mode 100644 index 0000000000..306dfc6d0b --- /dev/null +++ b/mso-catalog-db/src/main/resources/hibernate-catalog-core-mysql.cfg.xml @@ -0,0 +1,52 @@ + + + + + + + + + + org.hibernate.dialect.MySQL5Dialect + false + true + java:jboss/datasources/mso-catalog + 5 + 50 + 1800 + 50 + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/hibernate-catalog-mysql.cfg.xml b/mso-catalog-db/src/main/resources/hibernate-catalog-mysql.cfg.xml deleted file mode 100644 index 306dfc6d0b..0000000000 --- a/mso-catalog-db/src/main/resources/hibernate-catalog-mysql.cfg.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - org.hibernate.dialect.MySQL5Dialect - false - true - java:jboss/datasources/mso-catalog - 5 - 50 - 1800 - 50 - - - - - - - - - - - - - - - - - diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java index bfd4aa8e09..b577afef66 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java @@ -39,7 +39,7 @@ import org.hibernate.Query; import org.hibernate.Session; import org.junit.runner.RunWith; -@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 CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { @Test(timeout = 4000) @@ -65,10 +65,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); // Undeclared exception! - try { + try { catalogDatabase0.getHeatTemplate((String) null); fail("Expecting exception: ClassCastException"); - + } catch(ClassCastException e) { // // org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles$$EnhancerByMockitoWithCGLIB$$309d9392 cannot be cast to org.openecomp.mso.db.catalog.beans.HeatTemplate @@ -89,10 +89,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.getVfModuleType((String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -143,10 +143,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { catalogDatabase0.saveHeatFiles(heatFiles0); Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -190,10 +190,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); doReturn(iterator0).when(set0).iterator(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -214,10 +214,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getService(hashMap0, "Successfully. No template found"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -234,10 +234,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getNestedTemplates(2377); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -256,10 +256,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipe("Generic exception searching for vnf_id=", (String) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -287,10 +287,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); catalogDatabase0.getVnfComponent(187, ""); // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment((-1)); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -299,10 +299,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test08() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getNetworkRecipe("735uWxa&iIbU.4]O$", ",hpGX76\"X~ow4", (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -322,10 +322,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipeByVfModuleId("", "(3", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -343,10 +343,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); // Undeclared exception! - try { - catalogDatabase0.getVnfComponentsRecipe("B4@1", "v@(U", "", (String) null, ""); + try { + catalogDatabase0.getVnfComponentsRecipe("B4@1", "v@(U", "", (String) null, "", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -363,10 +363,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getService((String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -383,10 +383,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getVfModuleModelName("", "RiY"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -406,10 +406,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { VnfRecipe vnfRecipe0 = mock(VnfRecipe.class, new ViolatedAssumptionAnswer()); Service service0 = new Service(); // Undeclared exception! - try { + try { catalogDatabase0.saveService(service0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -426,10 +426,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getNetworkRecipe("735uWxa&iIbU.4]O$", ",hpGX76\"X~ow4", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -444,10 +444,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); VnfResource vnfResource0 = mock(VnfResource.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.saveService((Service) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -463,10 +463,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { HeatTemplate heatTemplate0 = new HeatTemplate(); LinkedHashSet linkedHashSet0 = new LinkedHashSet(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate((HeatTemplate) null, (Set) linkedHashSet0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -482,10 +482,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((-1)).when(vnfResource0).getId(); doReturn("#5|%>JWRPJfP)S@").when(vnfResource0).getVnfType(); // Undeclared exception! - try { + try { catalogDatabase0.saveOrUpdateVnfResource(vnfResource0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -500,10 +500,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MsoLogger.StatusCode.values(); CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.saveVnfRecipe((VnfRecipe) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -520,10 +520,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((String) null, (String) null).when(service0).getServiceNameVersionId(); doReturn((String) null).when(service0).getServiceVersion(); // Undeclared exception! - try { + try { catalogDatabase0.saveService(service0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -542,10 +542,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); HeatEnvironment heatEnvironment0 = new HeatEnvironment(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatEnvironment(heatEnvironment0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -559,10 +559,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum0 = MessageEnum.APIH_GENERAL_METRICS; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatEnvironment((HeatEnvironment) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -575,10 +575,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test22() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfRecipe((String) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -592,10 +592,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MsoLogger.ErrorCode.values(); CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.rollback(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -608,10 +608,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test24() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getAllHeatTemplates(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -624,10 +624,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test25() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatFilesForVfModule((-1539)); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -640,10 +640,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test26() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment(0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -656,10 +656,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test27() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getAllHeatEnvironment(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -672,10 +672,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test28() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.commit(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -691,10 +691,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { heatFiles0.setVersion("E0)WE F/LaV~i2U01"); heatFiles0.setFileName("uIZl|"); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatFiles(heatFiles0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -707,10 +707,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test30() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.saveVnfComponentsRecipe((VnfComponentsRecipe) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -726,10 +726,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum2 = MessageEnum.NO_PROPERTIES; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.healthCheck(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -743,10 +743,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); catalogDatabase0.close(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatTemplate(1197); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -759,10 +759,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test33() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getAllNetworkResources(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -775,10 +775,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test34() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipe("Ikrt3T$WS\"UMs#Q", "Ikrt3T$WS\"UMs#Q", "Ikrt3T$WS\"UMs#Q", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -791,10 +791,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test35() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatTemplate((String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -807,10 +807,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test36() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponent(1987, "R$9=*_j3~I=:_"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -823,10 +823,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test37() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatFiles(0, "r#j>oJCQI5r'@)jSH", "K6#W1{s", "vRm"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -839,10 +839,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test38() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfResourcesByRole(""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -856,10 +856,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum0 = MessageEnum.RA_ASYNC_DELETE_VNF; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getAllVnfResources(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -891,10 +891,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); catalogDatabase0.getHeatTemplate((String) null); // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment(148); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -936,10 +936,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { catalogDatabase0.saveHeatFiles(heatFiles0); Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -978,10 +978,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -999,10 +999,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn(query0).when(session1).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment((-1)); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -1017,10 +1017,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string2 = "U`9Z8:QQUr-c(T@_/)"; String string3 = "$q')fpKG]Q&i\"'{x"; // Undeclared exception! - try { + try { catalogDatabase0.getNetworkResource("FT>Ri6U\"Ks<.H/g["); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1034,10 +1034,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); int int0 = 1030; // Undeclared exception! - try { + try { catalogDatabase0.getAllVfModules(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1051,10 +1051,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MsoLogger.ResponseCode msoLogger_ResponseCode0 = MsoLogger.ResponseCode.DataNotFound; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVfModuleType("serviceVersion", "serviceVersion"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1068,10 +1068,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MsoLogger.ResponseCode msoLogger_ResponseCode0 = MsoLogger.ResponseCode.Conflict; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getNestedTemplates(2377); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1088,10 +1088,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); String string0 = null; // Undeclared exception! - try { + try { catalogDatabase0.getVnfResource((String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1105,10 +1105,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); String string0 = ", description="; // Undeclared exception! - try { + try { catalogDatabase0.getServiceRecipe((-1319), ", description="); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1124,10 +1124,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string1 = "735uWxa&iIbU.4]O$"; String string2 = "APIH_ERROR_FROM_BPEL_SERVER"; // Undeclared exception! - try { + try { catalogDatabase0.getNetworkRecipe("735uWxa&iIbU.4]O$", ",hpGX76\"X~ow4", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1142,10 +1142,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string0 = ",hpGX76\"X~ow4"; String string1 = "APIH_ERROR_FROM_BPEL_SERVER"; // Undeclared exception! - try { + try { catalogDatabase0.getNetworkRecipe("", ",hpGX76\"X~ow4"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1162,10 +1162,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string2 = ""; String string3 = null; // Undeclared exception! - try { + try { catalogDatabase0.getVnfResource((String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1180,10 +1180,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string0 = "Ikrt3T$WS\"UMs#Q"; String string1 = null; // Undeclared exception! - try { + try { catalogDatabase0.getServiceByUUID("Ikrt3T$WS\"UMs#Q"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1197,10 +1197,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); String string0 = "v@(U"; // Undeclared exception! - try { - catalogDatabase0.getVnfComponentsRecipe("!4@@1", "v@(U", "", (String) null, ""); + try { + catalogDatabase0.getVnfComponentsRecipe("!4@@1", "v@(U", "", (String) null, "", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1217,10 +1217,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); HashMap hashMap0 = new HashMap(); // Undeclared exception! - try { + try { catalogDatabase0.getService(hashMap0, "Successfully. No template found"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1235,10 +1235,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum1 = MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipeByVfModuleId("", "(3", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1255,10 +1255,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string0 = ""; String string1 = "RiY"; // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment("", "RiY", "RiY"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1275,10 +1275,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { HeatTemplate heatTemplate0 = new HeatTemplate(); LinkedHashSet linkedHashSet0 = new LinkedHashSet(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, (Set) linkedHashSet0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1293,10 +1293,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum1 = MessageEnum.RA_SEND_REQUEST_SDNC; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipe("Generic exception searching for vnf_id=", (String) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTest.java new file mode 100644 index 0000000000..2f0a1c85ae --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTest.java @@ -0,0 +1,214 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:34:38 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import java.sql.Timestamp; +import java.time.Instant; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.mock.java.time.MockInstant; +import org.junit.runner.RunWith; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class AllottedResourceCustomizationESTest extends AllottedResourceCustomizationESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + allottedResourceCustomization0.setModelVersion("T2 hashMap0 = new HashMap(); + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + hashMap0.putIfAbsent("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", serviceRecipe0); + model0.setRecipes(hashMap0); + Map map0 = model0.getRecipes(); + assertEquals(1, map0.size()); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + Model model0 = new Model(); + model0.setModelVersionId("9WI;kp?]"); + String string0 = model0.getModelVersionId(); + assertEquals("9WI;kp?]", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + Model model0 = new Model(); + model0.setModelVersion("_Y+vZ)59ie"); + String string0 = model0.getModelVersion(); + assertEquals("_Y+vZ)59ie", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + Model model0 = new Model(); + model0.setModelType("{!]r;T"); + String string0 = model0.getModelType(); + assertEquals("{!]r;T", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + Model model0 = new Model(); + model0.setModelName(", description="); + String string0 = model0.getModelName(); + assertEquals(", description=", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + Model model0 = new Model(); + model0.setModelInvariantId(".m"); + String string0 = model0.getModelInvariantId(); + assertEquals(".m", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + Model model0 = new Model(); + model0.setModelCustomizationName("| map0 = model0.getRecipes(); + assertNull(map0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelCustomizationName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + Model model0 = new Model(); + model0.setModelVersion(""); + String string0 = model0.getModelVersion(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + Model model0 = new Model(); + model0.setModelVersionId(""); + String string0 = model0.getModelVersionId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + Model model0 = new Model(); + model0.setModelInvariantId(""); + String string0 = model0.getModelInvariantId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + Model model0 = new Model(); + model0.setModelName(""); + String string0 = model0.getModelName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + Model model0 = new Model(); + model0.setModelCustomizationName(""); + String string0 = model0.getModelCustomizationName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + Model model0 = new Model(); + Timestamp timestamp0 = new Timestamp(0L); + model0.setCreated(timestamp0); + String string0 = model0.toString(); + assertEquals("Model: modelCustomizationId=null,modelCustomizationName=null,modelInvariantId=null,modelName=null,modelType=null,modelVersion=null,modelVersionId=null,created=1/1/70 12:00 AM", string0); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + Model model0 = new Model(); + int int0 = model0.getId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + Model model0 = new Model(); + HashMap hashMap0 = new HashMap(); + model0.setRecipes(hashMap0); + Map map0 = model0.getRecipes(); + assertTrue(map0.isEmpty()); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelVersionId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelCustomizationId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelVersion(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + Model model0 = new Model(); + Timestamp timestamp0 = model0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + Model model0 = new Model(); + model0.setId(2803); + int int0 = model0.getId(); + assertEquals(2803, int0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTestscaffolding.java new file mode 100644 index 0000000000..d9576e0681 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTestscaffolding.java @@ -0,0 +1,106 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Wed Feb 22 09:32:26 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 ModelESTestscaffolding { + + @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.db.catalog.beans.Model"; + 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(ModelESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.logger.MessageEnum", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.db.catalog.beans.Model", + "com.att.eelf.configuration.EELFManager", + "com.att.eelf.configuration.EELFLogger", + "com.att.eelf.i18n.EELFMsgs", + "org.openecomp.mso.entity.MsoRequest", + "com.att.eelf.configuration.EELFLogger$Level", + "org.openecomp.mso.db.catalog.beans.ServiceRecipe", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "com.att.eelf.configuration.SLF4jWrapper", + "com.att.eelf.i18n.EELFResourceManager", + "org.openecomp.mso.logger.MsoLogger", + "org.openecomp.mso.logger.MsoLogger$ErrorCode" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ModelESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFLogger$Level", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.db.catalog.beans.ServiceRecipe" + ); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTest.java new file mode 100644 index 0000000000..d148e94246 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTest.java @@ -0,0 +1,287 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:32:08 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ModelRecipeESTest extends ModelRecipeESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setSchemaVersion("594t4m7A7,kaNK"); + String string0 = modelRecipe0.getSchemaVersion(); + assertEquals("594t4m7A7,kaNK", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer(0); + modelRecipe0.setRecipeTimeout(integer0); + Integer integer1 = modelRecipe0.getRecipeTimeout(); + assertEquals(0, (int)integer1); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer(1303); + modelRecipe0.setRecipeTimeout(integer0); + Integer integer1 = modelRecipe0.getRecipeTimeout(); + assertEquals(1303, (int)integer1); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer((-8)); + modelRecipe0.setRecipeTimeout(integer0); + Integer integer1 = modelRecipe0.getRecipeTimeout(); + assertEquals((-8), (int)integer1); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setOrchestrationUri("+"); + String string0 = modelRecipe0.getOrchestrationUri(); + assertEquals("+", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setModelParamXSD(""); + String string0 = modelRecipe0.getModelParamXSD(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer(1); + modelRecipe0.setModelId(integer0); + Integer integer1 = modelRecipe0.getModelId(); + assertEquals(1, (int)integer1); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer((-8)); + modelRecipe0.setModelId(integer0); + Integer integer1 = modelRecipe0.getModelId(); + assertEquals((-8), (int)integer1); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setId(2372); + int int0 = modelRecipe0.getId(); + assertEquals(2372, int0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setId((-438)); + int int0 = modelRecipe0.getId(); + assertEquals((-438), int0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setDescription("D|`) null); + ArrayList arrayList0 = serviceMacroHolder0.getVnfResources(); + assertNull(arrayList0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + VnfResource vnfResource0 = new VnfResource(); + serviceMacroHolder0.addVnfResource(vnfResource0); + ArrayList arrayList0 = serviceMacroHolder0.getVnfResources(); + assertEquals(1, arrayList0.size()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + Service service0 = serviceMacroHolder0.getService(); + assertNull(service0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + service0.setId(1124); + Service service1 = serviceMacroHolder0.getService(); + assertNull(service1.getServiceNameVersionId()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + service0.setId((-760)); + Service service1 = serviceMacroHolder0.getService(); + assertNull(service1.getServiceNameVersionId()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + serviceMacroHolder0.addNetworkResourceCustomization(networkResourceCustomization0); + ArrayList arrayList0 = serviceMacroHolder0.getNetworkResourceCustomization(); + assertFalse(arrayList0.isEmpty()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setAllottedResourceCustomization((ArrayList) null); + ArrayList arrayList0 = serviceMacroHolder0.getAllottedResourceCustomization(); + assertNull(arrayList0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + serviceMacroHolder0.addAllottedResourceCustomization(allottedResourceCustomization0); + ArrayList arrayList0 = serviceMacroHolder0.getAllottedResourceCustomization(); + assertFalse(arrayList0.isEmpty()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setAllottedResourceCustomization((ArrayList) null); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnone", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setNetworkResourceCustomization((ArrayList) null); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnone", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + Service service0 = mock(Service.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(service0).toString(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + ArrayList arrayList0 = new ArrayList(); + arrayList0.add((Object) serviceMacroHolder0); + PrivateAccess.setVariable((Class) ServiceMacroHolder.class, serviceMacroHolder0, "vnfResources", (Object) arrayList0); + // Undeclared exception! + try { + serviceMacroHolder0.toString(); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // org.openecomp.mso.db.catalog.beans.ServiceMacroHolder cannot be cast to org.openecomp.mso.db.catalog.beans.VnfResource + // + verifyException("org.openecomp.mso.db.catalog.beans.ServiceMacroHolder", e); + } + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setVnfResources((ArrayList) null); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnone", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + // Undeclared exception! + try { + serviceMacroHolder0.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.beans.Service", e); + } + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + serviceMacroHolder0.addAllottedResourceCustomization(allottedResourceCustomization0); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnoneAllottedResourceCustomizations:ARC[0]: modelName=null,modelVersion=null,version=null,modelUuid=null,modelInvariantUuid=null,modelCustomizationUuid=null,modelInstanceName=null,description=null,modelInstanceName=null,created=null", string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + serviceMacroHolder0.addNetworkResourceCustomization(networkResourceCustomization0); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnoneNetworkResourceCustomizations:NRC[0]: modelName=nullmodelUuid=nullmodelUuid=nullmodelInvariantUuid=nullmodelVersion=nullmodelCustomizationUuid=nullmodelInstanceName=nullnetworkResourceId=0networkType=null", string0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + serviceMacroHolder0.setNetworkResourceCustomization((ArrayList) null); + serviceMacroHolder0.addNetworkResourceCustomization(networkResourceCustomization0); + assertNull(networkResourceCustomization0.getModelInstanceName()); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setVnfResources((ArrayList) null); + VnfResource vnfResource0 = new VnfResource(); + serviceMacroHolder0.addVnfResource(vnfResource0); + assertNull(vnfResource0.getModelCustomizationUuid()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + VnfResource vnfResource0 = new VnfResource(); + serviceMacroHolder0.addVnfResource(vnfResource0); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullVnfResources: , vnfResource[0]:VNF=null,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=null,modelName=null,serviceModelInvariantUUID=null,modelCustomizationUuid=nullVfModules: NONE", string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.addVnfResource((VnfResource) null); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + serviceMacroHolder0.setNetworkResourceCustomization((ArrayList) null); + ArrayList arrayList0 = serviceMacroHolder0.getNetworkResourceCustomization(); + assertNull(arrayList0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + Service service1 = serviceMacroHolder0.getService(); + assertNull(service1.getModelInvariantUUID()); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + ArrayList arrayList0 = serviceMacroHolder0.getNetworkResourceCustomization(); + assertEquals(0, arrayList0.size()); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setAllottedResourceCustomization((ArrayList) null); + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + serviceMacroHolder0.addAllottedResourceCustomization(allottedResourceCustomization0); + assertNull(allottedResourceCustomization0.getVersion()); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + Service service0 = new Service(); + serviceMacroHolder0.setService(service0); + assertNull(service0.getModelInvariantUUID()); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + ArrayList arrayList0 = serviceMacroHolder0.getAllottedResourceCustomization(); + assertEquals(0, arrayList0.size()); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + ArrayList arrayList0 = serviceMacroHolder0.getVnfResources(); + assertTrue(arrayList0.isEmpty()); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTestscaffolding.java new file mode 100644 index 0000000000..43ccd7b728 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTestscaffolding.java @@ -0,0 +1,97 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Tue Feb 21 15:49:25 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 ServiceMacroHolderESTestscaffolding { + + @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.db.catalog.beans.ServiceMacroHolder"; + 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(ServiceMacroHolderESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.VfModule", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.openecomp.mso.db.catalog.beans.Service", + "org.openecomp.mso.db.catalog.beans.NetworkResource", + "org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.db.catalog.beans.VnfResource", + "org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization", + "org.openecomp.mso.db.catalog.beans.ServiceMacroHolder" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ServiceMacroHolderESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFLogger$Level", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.db.catalog.beans.ServiceRecipe" + ); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTest.java new file mode 100644 index 0000000000..84fbcb5391 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTest.java @@ -0,0 +1,95 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:33:37 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ServiceToAllottedResourcesESTest extends ServiceToAllottedResourcesESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + serviceToAllottedResources0.setServiceModelUuid("serviceModelUuid=nullarModelCustomizationUuid=null"); + String string0 = serviceToAllottedResources0.getServiceModelUuid(); + assertEquals("serviceModelUuid=nullarModelCustomizationUuid=null", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + Timestamp timestamp0 = new Timestamp(0L); + serviceToAllottedResources0.setCreated(timestamp0); + Timestamp timestamp1 = serviceToAllottedResources0.getCreated(); + assertEquals("1970-01-01 00:00:00.0", timestamp1.toString()); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + serviceToAllottedResources0.setArModelCustomizationUuid("D7q@"); + String string0 = serviceToAllottedResources0.getArModelCustomizationUuid(); + assertEquals("D7q@", string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + serviceToAllottedResources0.setArModelCustomizationUuid(""); + String string0 = serviceToAllottedResources0.getArModelCustomizationUuid(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + String string0 = serviceToAllottedResources0.toString(); + assertEquals("serviceModelUuid=nullarModelCustomizationUuid=null", string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + serviceToAllottedResources0.setServiceModelUuid(""); + String string0 = serviceToAllottedResources0.getServiceModelUuid(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + Timestamp timestamp0 = new Timestamp((-683L)); + serviceToAllottedResources0.setCreated(timestamp0); + Timestamp timestamp1 = serviceToAllottedResources0.getCreated(); + assertEquals("1969-12-31 23:59:59.317", timestamp1.toString()); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + String string0 = serviceToAllottedResources0.getServiceModelUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + String string0 = serviceToAllottedResources0.getArModelCustomizationUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test9() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + Timestamp timestamp0 = serviceToAllottedResources0.getCreated(); + assertNull(timestamp0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTestscaffolding.java new file mode 100644 index 0000000000..14ff62fb02 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTestscaffolding.java @@ -0,0 +1,81 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Wed Feb 22 09:33:37 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 ServiceToAllottedResourcesESTestscaffolding { + + @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.db.catalog.beans.ServiceToAllottedResources"; + 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(ServiceToAllottedResourcesESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ServiceToAllottedResourcesESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources" + ); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTest.java new file mode 100644 index 0000000000..aa2ba2a488 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTest.java @@ -0,0 +1,95 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:34:56 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ServiceToNetworksESTest extends ServiceToNetworksESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + serviceToNetworks0.setServiceModelUuid("XcrRZj-Y)7"); + String string0 = serviceToNetworks0.getServiceModelUuid(); + assertEquals("XcrRZj-Y)7", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + serviceToNetworks0.setNetworkModelCustomizationUuid("XcrRZj-Y)7"); + String string0 = serviceToNetworks0.getNetworkModelCustomizationUuid(); + assertEquals("XcrRZj-Y)7", string0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + Timestamp timestamp0 = new Timestamp(4701L); + serviceToNetworks0.setCreated(timestamp0); + Timestamp timestamp1 = serviceToNetworks0.getCreated(); + assertEquals(701000000, timestamp1.getNanos()); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + Timestamp timestamp0 = serviceToNetworks0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + String string0 = serviceToNetworks0.getNetworkModelCustomizationUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + String string0 = serviceToNetworks0.getServiceModelUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + String string0 = serviceToNetworks0.toString(); + assertEquals("ServiceToNetworks mapping: serviceModelUuid=null,networkModelCustomizationUuid=null", string0); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + Timestamp timestamp0 = new Timestamp(0L); + serviceToNetworks0.setCreated(timestamp0); + Timestamp timestamp1 = serviceToNetworks0.getCreated(); + assertEquals(0, timestamp1.getNanos()); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + serviceToNetworks0.setNetworkModelCustomizationUuid(""); + String string0 = serviceToNetworks0.getNetworkModelCustomizationUuid(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test9() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + serviceToNetworks0.setServiceModelUuid(""); + String string0 = serviceToNetworks0.getServiceModelUuid(); + assertEquals("", string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTestscaffolding.java new file mode 100644 index 0000000000..ba0c5d7d5b --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTestscaffolding.java @@ -0,0 +1,81 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Wed Feb 22 09:34:56 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 ServiceToNetworksESTestscaffolding { + + @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.db.catalog.beans.ServiceToNetworks"; + 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(ServiceToNetworksESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.ServiceToNetworks" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ServiceToNetworksESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.db.catalog.beans.ServiceToNetworks" + ); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java index 1a1c6ea2c2..1ab15a22fb 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java @@ -1,6 +1,6 @@ /* * This file was automatically generated by EvoSuite - * Mon Nov 14 08:19:11 GMT 2016 + * Tue Feb 21 15:51:08 GMT 2017 */ package org.openecomp.mso.db.catalog.beans; @@ -8,719 +8,971 @@ package org.openecomp.mso.db.catalog.beans; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; - import java.sql.Timestamp; import java.time.Instant; +import java.time.temporal.ChronoField; +import java.time.temporal.ChronoUnit; +import java.time.temporal.TemporalField; +import java.time.temporal.UnsupportedTemporalTypeException; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.PrivateAccess; import org.evosuite.runtime.System; import org.evosuite.runtime.mock.java.time.MockInstant; +import org.evosuite.runtime.mock.java.util.MockDate; import org.junit.runner.RunWith; +import org.openecomp.mso.db.catalog.beans.VfModule; -@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 VfModuleESTest extends VfModuleESTestscaffolding { - @Test(timeout = 4000) - public void test00() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelVersion("EzJ)~3C++"); - Integer integer0 = new Integer((-1)); - vfModule0.setVnfResourceId(integer0); - vfModule0.getModelInvariantUuid(); - vfModule0.getModelInvariantUuid(); - VfModule vfModule1 = new VfModule(); - vfModule1.setDescription(""); - vfModule1.setIsBase((-1)); - Integer integer1 = new Integer((-289)); - vfModule1.setTemplateId(integer1); - vfModule1.getTemplateId(); - vfModule1.setModelName("Yp{,,+-pFJp!Ym6r^"); - vfModule1.getDescription(); - vfModule0.setId((-1)); - vfModule0.setId((-4103)); - vfModule0.getId(); - vfModule1.getVnfResourceId(); - vfModule1.setTemplateId((Integer) null); - Timestamp timestamp0 = new Timestamp((-3970L)); - vfModule0.setCreated(timestamp0); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.isTheSameVersion("1&T-qG"); - Integer integer0 = new Integer((-385)); - Integer integer1 = Integer.valueOf((-385)); - Integer.toUnsignedString((-1)); - Integer.getInteger("", integer1); - vfModule0.setVolTemplateId(integer0); - vfModule0.setModelInvariantUuid("1&T-qG"); - vfModule0.toString(); - vfModule0.getIsBase(); - vfModule0.setModelVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=-385,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setType("wO"); - vfModule0.getType(); - vfModule0.isBase(); - vfModule0.getIsBase(); - vfModule0.setAsdcUuid("VF="); - vfModule0.getModelVersion(); - vfModule0.setId(1); - vfModule0.setModelName("VF="); - vfModule0.getVolEnvironmentId(); - vfModule0.setVolTemplateId((Integer) null); - vfModule0.setAsdcUuid(""); - vfModule0.setModelVersion("1&T-qG"); - vfModule0.isBase(); - vfModule0.getEnvironmentId(); - vfModule0.toString(); - vfModule0.getDescription(); - vfModule0.setType(""); - vfModule0.setVnfResourceId(integer1); - System.setCurrentTimeMillis((-1L)); - vfModule0.getVnfResourceId(); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - System.setCurrentTimeMillis(1L); - VfModule vfModule0 = new VfModule(); - vfModule0.setModelInvariantUuid("57f9"); - vfModule0.setModelName(""); - vfModule0.getDescription(); - vfModule0.toString(); - vfModule0.setType(""); - vfModule0.getDescription(); - vfModule0.getCreated(); - vfModule0.setCreated((Timestamp) null); - Integer integer0 = new Integer(2109); - Integer integer1 = new Integer(1); - Integer.getInteger("D}'htOb?", integer1); - vfModule0.setVolEnvironmentId(integer0); - vfModule0.getVnfResourceId(); - vfModule0.getModelName(); - System.setCurrentTimeMillis(0L); - vfModule0.getModelName(); - vfModule0.getCreated(); - vfModule0.getModelName(); - vfModule0.getDescription(); - vfModule0.getDescription(); - vfModule0.getModelName(); - vfModule0.toString(); - vfModule0.getCreated(); - System.setCurrentTimeMillis(1L); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setId(600); - vfModule0.toString(); - Integer integer0 = new Integer((-1)); - Integer.divideUnsigned((-1), 1); - Integer.min((-1), 1); - Integer.max(2123, 600); - Integer integer1 = new Integer(2123); - vfModule0.setEnvironmentId(integer1); - vfModule0.setEnvironmentId(integer0); - vfModule0.isMoreRecentThan(",volEnvtId="); - vfModule0.getId(); - Integer.compareUnsigned(467, (-1)); - vfModule0.setEnvironmentId(integer0); - VfModule vfModule1 = new VfModule(); - vfModule1.isMoreRecentThan("VF=null,modelName=null,version=null,id=600,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule1.toString(); - VfModule vfModule2 = new VfModule(); - vfModule0.getEnvironmentId(); - vfModule2.getDescription(); - vfModule2.setDescription((String) null); - vfModule2.setModelVersion(", description="); - vfModule2.toString(); - vfModule1.getModelInvariantUuid(); - vfModule1.toString(); - vfModule1.getEnvironmentId(); - vfModule0.setAsdcUuid(""); - vfModule0.setDescription((String) null); - vfModule0.getIsBase(); - vfModule0.getAsdcUuid(); - vfModule0.getCreated(); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.getDescription(); - Integer integer0 = new Integer(0); - vfModule0.setVolTemplateId(integer0); - vfModule0.setVersion((String) null); - vfModule0.getDescription(); - vfModule0.setAsdcUuid((String) null); - Integer integer1 = new Integer(0); - Integer.getInteger((String) null); - vfModule0.setVnfResourceId(integer1); - vfModule0.setIsBase(1); - vfModule0.getVolEnvironmentId(); - vfModule0.setId(0); - vfModule0.getModelInvariantUuid(); - vfModule0.getEnvironmentId(); - vfModule0.getIsBase(); - vfModule0.setTemplateId(integer1); - vfModule0.getCreated(); - vfModule0.getId(); - vfModule0.getCreated(); - vfModule0.getId(); - vfModule0.setModelInvariantUuid((String) null); - vfModule0.getAsdcUuid(); - vfModule0.getVnfResourceId(); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.getDescription(); - Integer integer0 = new Integer(0); - Integer.divideUnsigned(1, 659); - vfModule0.setVolTemplateId(integer0); - vfModule0.setVersion((String) null); - vfModule0.getDescription(); - vfModule0.setAsdcUuid((String) null); - Integer integer1 = new Integer(0); - Integer.getInteger((String) null); - vfModule0.setVnfResourceId(integer1); - vfModule0.setIsBase(1); - vfModule0.getVolEnvironmentId(); - vfModule0.setId(0); - vfModule0.getModelInvariantUuid(); - vfModule0.getEnvironmentId(); - vfModule0.getIsBase(); - vfModule0.setTemplateId(integer1); - vfModule0.getCreated(); - vfModule0.getId(); - vfModule0.getCreated(); - vfModule0.getId(); - vfModule0.setModelInvariantUuid((String) null); - vfModule0.getAsdcUuid(); - System.setCurrentTimeMillis((-1L)); - vfModule0.getTemplateId(); - vfModule0.getDescription(); - vfModule0.getAsdcUuid(); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.getVolEnvironmentId(); - vfModule0.setEnvironmentId((Integer) null); - assertNull(vfModule0.getModelVersion()); - - Integer integer0 = new Integer(1); - Integer.getInteger((String) null, (Integer) null); - vfModule0.setEnvironmentId(integer0); - vfModule0.setModelVersion((String) null); - vfModule0.setId(171); - vfModule0.toString(); - vfModule0.getEnvironmentId(); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = Integer.valueOf((-2041)); - Integer.compareUnsigned((-2041), (-1)); - vfModule0.setTemplateId(integer0); - vfModule0.setIsBase(3154); - vfModule0.setModelInvariantUuid(""); - vfModule0.setDescription("nPVyq+_;@IZP:L"); - vfModule0.setId(883); - vfModule0.toString(); - vfModule0.setIsBase((-2041)); - vfModule0.getTemplateId(); - vfModule0.getModelName(); - vfModule0.getVnfResourceId(); - vfModule0.toString(); - vfModule0.isBase(); - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setIsBase(0); - vfModule0.isMoreRecentThan("."); - vfModule0.toString(); - vfModule0.setIsBase((-1465)); - vfModule0.setModelInvariantUuid("u5L"); - vfModule0.getIsBase(); - vfModule0.setId(0); - vfModule0.getVolEnvironmentId(); - System.setCurrentTimeMillis((-1465)); - vfModule0.setModelVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setVersion(""); - vfModule0.toString(); - vfModule0.getAsdcUuid(); - vfModule0.getEnvironmentId(); - vfModule0.setVolEnvironmentId((Integer) null); - vfModule0.getVnfResourceId(); - vfModule0.getDescription(); - vfModule0.getVolEnvironmentId(); - vfModule0.getCreated(); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.isMoreRecentThan("zL"); - vfModule0.getType(); - vfModule0.setModelName((String) null); - Integer integer0 = new Integer(0); - Integer.getInteger("zL", (Integer) null); - vfModule0.setType(""); - Integer.sum(34, 34); - Integer.min(0, 2510); - Integer.divideUnsigned(0, (-1)); - Integer.compare(0, 0); - vfModule0.setVolEnvironmentId(integer0); - vfModule0.setCreated((Timestamp) null); - vfModule0.getCreated(); - vfModule0.getIsBase(); - vfModule0.setAsdcUuid(""); - vfModule0.setId(0); - vfModule0.getModelVersion(); - vfModule0.setCreated((Timestamp) null); - vfModule0.setModelVersion((String) null); - vfModule0.getEnvironmentId(); - vfModule0.getVolEnvironmentId(); - vfModule0.getType(); - vfModule0.setAsdcUuid((String) null); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelInvariantUuid(""); - vfModule0.setType(",modelName="); - vfModule0.setModelVersion(""); - vfModule0.setModelName("+cQA/1wAo}o/T7,S"); - vfModule0.getVolTemplateId(); - vfModule0.getVolEnvironmentId(); - vfModule0.getVolTemplateId(); - vfModule0.getModelInvariantUuid(); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer((-495)); - Integer.getInteger("M0@M@T", (-495)); - vfModule0.setVolEnvironmentId(integer0); - vfModule0.setId(892); - vfModule0.getTemplateId(); - vfModule0.toString(); - vfModule0.getVolEnvironmentId(); - vfModule0.setDescription("M0@M@T"); - vfModule0.getTemplateId(); - } - - @Test(timeout = 4000) - public void test12() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer(2707); - Integer integer1 = new Integer((-1)); - Integer.getInteger("", integer1); - vfModule0.setVolEnvironmentId(integer0); - vfModule0.getModelName(); - vfModule0.isMoreRecentThan(""); - vfModule0.getAsdcUuid(); - vfModule0.isMoreRecentThan((String) null); - vfModule0.getVnfResourceId(); - vfModule0.toString(); - vfModule0.getCreated(); - vfModule0.getVolEnvironmentId(); - vfModule0.getModelName(); - vfModule0.getVnfResourceId(); - vfModule0.getVnfResourceId(); - vfModule0.getModelName(); - vfModule0.getAsdcUuid(); - vfModule0.getCreated(); - } - - @Test(timeout = 4000) - public void test13() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.isMoreRecentThan((String) null); - vfModule0.getCreated(); - vfModule0.setVolEnvironmentId((Integer) null); - vfModule0.getVnfResourceId(); - Integer integer0 = new Integer(2983); - vfModule0.isTheSameVersion((String) null); - vfModule0.setDescription(")b,;fs\"&l\"#:Z"); - Integer.min(296, 0); - vfModule0.setTemplateId(integer0); - vfModule0.setType(")b,;fs\"&l\"#:Z"); - vfModule0.setModelInvariantUuid(")b,;fs\"&l\"#:Z"); - vfModule0.getId(); - vfModule0.setModelVersion(""); - vfModule0.getTemplateId(); - vfModule0.getModelVersion(); - vfModule0.setIsBase(2983); - Integer integer1 = new Integer(0); - try { - Integer.decode("X&-4c&g>;lQ`"); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // For input string: \"X&-4c&g>;lQ`\" - // - verifyException("java.lang.NumberFormatException", e); - } - } - - @Test(timeout = 4000) - public void test14() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.toString(); - vfModule0.isMoreRecentThan("ql"); - vfModule0.toString(); - vfModule0.isMoreRecentThan("v;ese"); - vfModule0.getCreated(); - Integer integer0 = new Integer(0); - Integer.getInteger("v;ese", 0); - vfModule0.setVolTemplateId(integer0); - vfModule0.isBase(); - vfModule0.getIsBase(); - vfModule0.setAsdcUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.getId(); - vfModule0.getTemplateId(); - vfModule0.getVolTemplateId(); - vfModule0.getAsdcUuid(); - vfModule0.setId(0); - Integer integer1 = new Integer(0); - try { - Integer.parseUnsignedInt("ql", (-122)); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // radix -122 less than Character.MIN_RADIX - // - verifyException("java.lang.Integer", e); - } - } - - @Test(timeout = 4000) - public void test15() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer((-1847)); - vfModule0.setTemplateId(integer0); - vfModule0.setVolTemplateId(integer0); - vfModule0.getVolTemplateId(); - try { - Integer.decode(""); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // Zero length string - // - verifyException("java.lang.Integer", e); - } - } - - @Test(timeout = 4000) - public void test16() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer(1); - vfModule0.setVolTemplateId(integer0); - vfModule0.setType(""); - vfModule0.setDescription(""); - vfModule0.getVolTemplateId(); - vfModule0.getTemplateId(); - vfModule0.setModelInvariantUuid(""); - vfModule0.getType(); - vfModule0.setVersion(""); - vfModule0.getEnvironmentId(); - try { - Integer.decode(""); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // Zero length string - // - verifyException("java.lang.Integer", e); - } - } - - @Test(timeout = 4000) - public void test17() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = Integer.valueOf(797); - vfModule0.setVnfResourceId(integer0); - vfModule0.isMoreRecentThan("xApm&c~GA&l*X$"); - vfModule0.getVnfResourceId(); - vfModule0.getModelInvariantUuid(); - } - - @Test(timeout = 4000) - public void test18() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelVersion(""); - Integer integer0 = new Integer(1170); - vfModule0.setVnfResourceId(integer0); - vfModule0.getCreated(); - vfModule0.setVolTemplateId(integer0); - vfModule0.setType(""); - vfModule0.setDescription(""); - vfModule0.getVnfResourceId(); - VfModule vfModule1 = new VfModule(); - vfModule1.setId((-1424)); - vfModule1.getVolTemplateId(); - vfModule1.getModelVersion(); - vfModule0.getId(); - vfModule0.setAsdcUuid(""); - } - - @Test(timeout = 4000) - public void test19() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer((-1483)); - Integer.toUnsignedString((-1742)); - Integer.toUnsignedString(0); - Integer.getInteger("", (-1483)); - vfModule0.setModelVersion("."); - Integer.divideUnsigned(0, 1371); - vfModule0.setVolTemplateId(integer0); - Integer.compare(1783, (-1404)); - vfModule0.setEnvironmentId(integer0); - vfModule0.setVersion(""); - vfModule0.getModelVersion(); - vfModule0.getId(); - } - - @Test(timeout = 4000) - public void test20() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.getId(); - vfModule0.setDescription("JZ)_Y_-H SVr5xC"); - Integer integer0 = new Integer(1266); - Integer.remainderUnsigned(0, 1266); - vfModule0.setEnvironmentId(integer0); - vfModule0.getModelInvariantUuid(); - vfModule0.setDescription((String) null); - vfModule0.getEnvironmentId(); - vfModule0.getModelName(); - vfModule0.getIsBase(); - } - - @Test(timeout = 4000) - public void test21() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelInvariantUuid(",version="); - vfModule0.toString(); - vfModule0.toString(); - vfModule0.toString(); - vfModule0.isTheSameVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setId(1438); - vfModule0.getVolTemplateId(); - Instant instant0 = MockInstant.ofEpochMilli(1438); - Timestamp timestamp0 = Timestamp.from(instant0); - timestamp0.clone(); - vfModule0.setCreated(timestamp0); - vfModule0.setDescription(",version="); - vfModule0.getTemplateId(); - vfModule0.getId(); - } - - @Test(timeout = 4000) - public void test22() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelVersion("EzJ)~3C++"); - Integer integer0 = new Integer((-1)); - vfModule0.setVnfResourceId(integer0); - vfModule0.getModelInvariantUuid(); - vfModule0.getModelInvariantUuid(); - VfModule vfModule1 = new VfModule(); - vfModule1.setIsBase((-1)); - Integer integer1 = new Integer((-289)); - vfModule1.setTemplateId(integer1); - vfModule1.getTemplateId(); - vfModule1.setModelName("Yp{,,+-pFJp!Ym6r^"); - vfModule1.getDescription(); - vfModule0.setId((-1)); - vfModule0.setId((-4103)); - vfModule0.getId(); - vfModule1.getVnfResourceId(); - vfModule1.setTemplateId((Integer) null); - Timestamp timestamp0 = new Timestamp((-3970L)); - vfModule0.setCreated(timestamp0); - } - - @Test(timeout = 4000) - public void test23() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.isTheSameVersion(", description="); - vfModule0.setType(""); - Integer integer0 = new Integer(0); - Integer.max(0, 0); - Integer.min(0, 0); - vfModule0.setEnvironmentId(integer0); - vfModule0.setDescription("Kx6@ Rh^oX; 9s(c&>|"); - vfModule0.setId((-2750)); - vfModule0.setType((String) null); - vfModule0.getDescription(); - vfModule0.setId(0); - } - - @Test(timeout = 4000) - public void test24() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setType("}f"); - vfModule0.setModelName("?2n6Dj"); - vfModule0.toString(); - vfModule0.getModelName(); - vfModule0.setAsdcUuid("?2n6Dj"); - vfModule0.getId(); - vfModule0.isTheSameVersion(""); - vfModule0.getAsdcUuid(); - vfModule0.getVolTemplateId(); - try { - Integer.parseUnsignedInt("6pu", 0); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // radix 0 less than Character.MIN_RADIX - // - verifyException("java.lang.Integer", e); - } - } - - @Test(timeout = 4000) - public void test25() throws Throwable { - VfModule vfModule0 = new VfModule(); - Timestamp timestamp0 = new Timestamp(0L); - timestamp0.clone(); - timestamp0.setNanos(3848); - vfModule0.setCreated(timestamp0); - vfModule0.getVolTemplateId(); - Timestamp timestamp1 = vfModule0.getCreated(); - timestamp1.toInstant(); - Integer integer0 = new Integer(719); - timestamp1.setNanos(3848); - try { - Integer.parseUnsignedInt("1\t`FE9f:0z]~"); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // For input string: \"1\t`FE9f:0z]~\" - // - verifyException("java.lang.NumberFormatException", e); - } - } - - @Test(timeout = 4000) - public void test26() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer(2069); - Integer.compare(0, 0); - Integer.min(2661, 2661); - Integer.max(2069, 2069); - vfModule0.setVnfResourceId(integer0); - vfModule0.setDescription(",id="); - vfModule0.isTheSameVersion(",id="); - vfModule0.isMoreRecentThan(",id="); - vfModule0.getEnvironmentId(); - vfModule0.setType("h4:pQoD8*M"); - vfModule0.getType(); - vfModule0.getType(); - } - - @Test(timeout = 4000) - public void test27() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer(0); - vfModule0.setEnvironmentId(integer0); - vfModule0.setModelInvariantUuid("H'CQI+Q^^WoGt^Q2X]"); - vfModule0.toString(); - vfModule0.getModelInvariantUuid(); - Integer integer1 = vfModule0.getEnvironmentId(); - vfModule0.setVersion(""); - Integer.getInteger("", integer0); - Integer.getInteger("", integer0); - vfModule0.setVnfResourceId(integer1); - } - - @Test(timeout = 4000) - public void test28() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.toString(); - vfModule0.setModelVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setDescription("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setId(0); - vfModule0.getModelName(); - vfModule0.getAsdcUuid(); - Timestamp timestamp0 = new Timestamp((long) 0); - timestamp0.toLocalDateTime(); - vfModule0.setCreated(timestamp0); - vfModule0.getVolTemplateId(); - int int0 = vfModule0.getId(); - vfModule0.getTemplateId(); - vfModule0.setModelInvariantUuid((String) null); - vfModule0.setType("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - Timestamp timestamp1 = vfModule0.getCreated(); - vfModule0.setDescription((String) null); - vfModule0.setCreated(timestamp1); - vfModule0.setVolTemplateId((Integer) null); - vfModule0.getTemplateId(); - int int1 = vfModule0.getIsBase(); - assertTrue(int1 == int0); - - vfModule0.setModelVersion((String) null); - boolean boolean0 = vfModule0.isBase(); - assertFalse(boolean0); - - vfModule0.setVolEnvironmentId((Integer) null); - vfModule0.setModelInvariantUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.getDescription(); - String string0 = vfModule0.toString(); - assertEquals("VF=VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,created=1/1/70 12:00 AM", string0); - } - - @Test(timeout = 4000) - public void test29() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setIsBase(1); - vfModule0.getVnfResourceId(); - vfModule0.getEnvironmentId(); - vfModule0.toString(); - vfModule0.isBase(); - Integer integer0 = new Integer(0); - vfModule0.getCreated(); - vfModule0.setAsdcUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.getCreated(); - PrivateAccess.setVariable((Class) VfModule.class, vfModule0, "asdcUuid", (Object) "VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - assertEquals(1, vfModule0.getIsBase()); - } - - @Test(timeout = 4000) - public void test30() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.toString(); - vfModule0.getModelVersion(); - String string0 = vfModule0.getType(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test31() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer((-1)); - vfModule0.setVnfResourceId(integer0); - vfModule0.getModelInvariantUuid(); - vfModule0.setTemplateId(integer0); - vfModule0.setModelName((String) null); - Timestamp timestamp0 = vfModule0.getCreated(); - assertNull(timestamp0); - } + @Test(timeout = 4000) + public void test00() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setIsBase(1684); + vfModule0.getMinInstances(); + vfModule0.setMaxInstances((Integer) null); + vfModule0.isBase(); + vfModule0.setVolTemplateId((Integer) null); + vfModule0.setModelVersion("p(>v(f\"rnCo"); + vfModule0.getIsBase(); + vfModule0.getModelInvariantUuid(); + vfModule0.setModelVersion("a,U*#FCv(}H+aG}"); + vfModule0.getVolTemplateId(); + vfModule0.getMinInstances(); + vfModule0.toString(); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VfModule vfModule0 = new VfModule(); + Instant instant0 = MockInstant.now(); + Timestamp timestamp0 = Timestamp.from(instant0); + vfModule0.setCreated(timestamp0); + vfModule0.setLabel("7."); + vfModule0.isBase(); + vfModule0.getId(); + vfModule0.getLabel(); + vfModule0.toString(); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = Integer.valueOf((-3299)); + vfModule0.getEnvironmentId(); + Integer.toUnsignedString((-697)); + vfModule0.setMinInstances((Integer) null); + vfModule0.setMaxInstances(integer0); + Integer integer1 = new Integer(5932); + Integer integer2 = Integer.getInteger("DZ>}qM>", integer1); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.setTemplateId(integer2); + Integer.toUnsignedString(5932); + vfModule0.getVolTemplateId(); + vfModule0.setTemplateId((Integer) null); + Integer.divideUnsigned((-3299), (-3299)); + vfModule0.setEnvironmentId((Integer) null); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setMinInstances(integer1); + vfModule0.setIsBase((-3299)); + vfModule0.setIsBase((-745)); + vfModule0.setModelVersion("5932"); + vfModule0.getVolTemplateId(); + vfModule0.getVolEnvironmentId(); + vfModule0.getMinInstances(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + vfModule0.setVolTemplateId(integer0); + vfModule0.getVolTemplateId(); + Integer integer1 = vfModule0.getVolTemplateId(); + vfModule0.setVolTemplateId(integer1); + vfModule0.setIsBase(863); + Integer integer2 = new Integer(1554); + vfModule0.setVnfResourceId(integer2); + vfModule0.setIsBase(780); + vfModule0.setMaxInstances(integer2); + vfModule0.getEnvironmentId(); + vfModule0.getVolEnvironmentId(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + VfModule vfModule0 = new VfModule(); + Timestamp timestamp0 = new Timestamp((-2168L)); + vfModule0.setCreated(timestamp0); + vfModule0.setId((-1)); + vfModule0.getEnvironmentId(); + vfModule0.setCreated(timestamp0); + vfModule0.setVolTemplateId((Integer) null); + vfModule0.setLabel("."); + vfModule0.getModelName(); + vfModule0.getCreated(); + vfModule0.getTemplateId(); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.isMoreRecentThan(""); + vfModule0.setLabel(""); + Integer integer0 = new Integer(1183); + vfModule0.setMaxInstances(integer0); + Integer.compare(1183, 1183); + vfModule0.setTemplateId(integer0); + vfModule0.getLabel(); + vfModule0.getDescription(); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + Integer.compare(1, 0); + vfModule0.setMaxInstances(integer0); + vfModule0.getVolEnvironmentId(); + Integer.sum(0, 1); + vfModule0.setVolTemplateId((Integer) null); + vfModule0.setMaxInstances((Integer) null); + vfModule0.setModelVersion(""); + vfModule0.setIsBase((-1435)); + vfModule0.setVnfResourceId((Integer) null); + vfModule0.getVnfResourceId(); + vfModule0.setIsBase((-3635)); + vfModule0.getDescription(); + vfModule0.getAsdcUuid(); + Integer integer1 = new Integer((-3635)); + Integer integer2 = new Integer(1); + Integer.getInteger(".", integer2); + vfModule0.setVolTemplateId(integer1); + vfModule0.getVnfResourceId(); + vfModule0.getModelVersion(); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setIsBase(597); + vfModule0.setId(662); + Integer integer0 = Integer.valueOf(597); + Integer.compare((-1), 0); + Integer.divideUnsigned(597, (-3368)); + vfModule0.setVolTemplateId(integer0); + Integer.getInteger(",modelCustomizationUuid=", 0); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.setId(0); + vfModule0.getVnfResourceId(); + Integer integer1 = new Integer(0); + vfModule0.setMaxInstances(integer1); + vfModule0.getMaxInstances(); + vfModule0.setModelName(""); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + vfModule0.setInitialCount(integer0); + Integer integer1 = new Integer((-2063)); + vfModule0.setVolTemplateId(integer1); + vfModule0.getModelVersion(); + Integer integer2 = new Integer(0); + vfModule0.setInitialCount(integer2); + vfModule0.getLabel(); + vfModule0.setTemplateId(integer0); + Integer integer3 = vfModule0.getInitialCount(); + vfModule0.setMaxInstances(integer3); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setModelInvariantUuid(""); + vfModule0.setDescription(",templateId="); + Timestamp timestamp0 = new Timestamp((-1360L)); + MockDate mockDate0 = new MockDate(0, 0, (-1723), (-3154), (-1723)); + vfModule0.setId((-1158)); + mockDate0.setTime(0L); + timestamp0.after(mockDate0); + vfModule0.setCreated(timestamp0); + vfModule0.setType("."); + vfModule0.getId(); + Integer integer0 = new Integer((-1158)); + vfModule0.setVnfResourceId(integer0); + vfModule0.isBase(); + vfModule0.setMinInstances((Integer) null); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.isTheSameVersion(""); + vfModule0.setMaxInstances((Integer) null); + vfModule0.setId((-2621)); + vfModule0.setModelVersion(""); + vfModule0.setAsdcUuid("."); + Integer integer0 = new Integer((-2621)); + vfModule0.isTheSameVersion(""); + vfModule0.setTemplateId(integer0); + vfModule0.getTemplateId(); + vfModule0.getModelVersion(); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.toString(); + vfModule0.setType("\"~J0_gjDe]"); + vfModule0.getModelCustomizationUuid(); + vfModule0.toString(); + vfModule0.getTemplateId(); + vfModule0.getMaxInstances(); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getModelName(); + vfModule0.setModelName("uQAnJq?Z"); + vfModule0.getTemplateId(); + vfModule0.setModelCustomizationUuid(""); + vfModule0.getModelCustomizationUuid(); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getInitialCount(); + vfModule0.setMinInstances((Integer) null); + vfModule0.isBase(); + vfModule0.getVolEnvironmentId(); + Integer integer0 = new Integer((-414)); + vfModule0.setMaxInstances(integer0); + vfModule0.getVolEnvironmentId(); + vfModule0.getMaxInstances(); + System.setCurrentTimeMillis(0L); + vfModule0.getMaxInstances(); + vfModule0.getTemplateId(); + vfModule0.getInitialCount(); + vfModule0.getEnvironmentId(); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setAsdcUuid(",created="); + Integer integer0 = new Integer(0); + vfModule0.setVnfResourceId(integer0); + Integer.getInteger(",created=", (Integer) null); + vfModule0.setDescription(",label="); + vfModule0.setLabel("."); + vfModule0.getModelName(); + vfModule0.setId(0); + Integer.max(0, 0); + vfModule0.setMinInstances(integer0); + vfModule0.setMaxInstances((Integer) null); + vfModule0.getCreated(); + vfModule0.getMaxInstances(); + vfModule0.getAsdcUuid(); + vfModule0.getDescription(); + vfModule0.getMaxInstances(); + Integer integer1 = new Integer(0); + vfModule0.setMaxInstances(integer1); + vfModule0.toString(); + vfModule0.setCreated((Timestamp) null); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setModelCustomizationUuid(",modelVersion="); + Integer integer0 = new Integer((-4139)); + vfModule0.setInitialCount(integer0); + Integer integer1 = new Integer((-789)); + Integer.sum((-4139), (-2408)); + Integer.toUnsignedString((-1850)); + Integer.sum(958, (-176)); + Integer.getInteger(",modelVersion=", integer0); + Integer.remainderUnsigned((-789), (-789)); + vfModule0.setAsdcUuid("Y?ht4"); + vfModule0.setEnvironmentId(integer1); + vfModule0.getEnvironmentId(); + System.setCurrentTimeMillis(0L); + System.setCurrentTimeMillis((-2179L)); + vfModule0.getMinInstances(); + vfModule0.getVolTemplateId(); + vfModule0.isBase(); + vfModule0.isBase(); + vfModule0.isBase(); + vfModule0.getVnfResourceId(); + vfModule0.getCreated(); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(714); + vfModule0.setEnvironmentId(integer0); + vfModule0.setInitialCount((Integer) null); + vfModule0.toString(); + vfModule0.setDescription("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=714,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.setModelVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=714,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.setInitialCount((Integer) null); + vfModule0.setIsBase(1549); + vfModule0.setMinInstances((Integer) null); + vfModule0.getModelCustomizationUuid(); + Integer integer1 = vfModule0.getEnvironmentId(); + vfModule0.setAsdcUuid("."); + vfModule0.getVolEnvironmentId(); + vfModule0.getLabel(); + Integer.remainderUnsigned(1544, 1549); + Integer.sum((-277), (-277)); + vfModule0.setMaxInstances(integer1); + vfModule0.getVolTemplateId(); + vfModule0.getIsBase(); + vfModule0.getInitialCount(); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setId(0); + vfModule0.setDescription("sh;.zWRp.C?-rn"); + vfModule0.setModelInvariantUuid(",label="); + vfModule0.getLabel(); + vfModule0.getModelInvariantUuid(); + Timestamp timestamp0 = new Timestamp((long) 0); + vfModule0.setCreated(timestamp0); + vfModule0.setDescription(""); + vfModule0.setModelInvariantUuid((String) null); + vfModule0.getDescription(); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.toString(); + vfModule0.getDescription(); + vfModule0.setAsdcUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.getModelName(); + Integer integer0 = new Integer(0); + Integer.toUnsignedString(378); + Integer.sum(0, 0); + vfModule0.setMaxInstances(integer0); + vfModule0.setModelInvariantUuid((String) null); + vfModule0.setType("}^`%'{@?s`OiaLz"); + vfModule0.setInitialCount(integer0); + vfModule0.getType(); + vfModule0.setAsdcUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + VfModule vfModule1 = new VfModule(); + vfModule0.setType("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.toString(); + vfModule0.getId(); + vfModule1.setVnfResourceId(integer0); + vfModule0.getDescription(); + vfModule0.getType(); + vfModule0.getVolEnvironmentId(); + vfModule0.getTemplateId(); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setId(2389); + vfModule0.setModelCustomizationUuid(""); + vfModule0.isTheSameVersion(""); + vfModule0.getVolTemplateId(); + vfModule0.getLabel(); + vfModule0.setInitialCount((Integer) null); + vfModule0.getCreated(); + vfModule0.setAsdcUuid(""); + vfModule0.getAsdcUuid(); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(1268); + vfModule0.setInitialCount(integer0); + Integer integer1 = new Integer(0); + Integer.compare(1268, 1); + vfModule0.setEnvironmentId(integer1); + vfModule0.setVersion(""); + vfModule0.getEnvironmentId(); + vfModule0.getVnfResourceId(); + vfModule0.getType(); + vfModule0.getIsBase(); + vfModule0.getCreated(); + ChronoUnit chronoUnit0 = ChronoUnit.MINUTES; + // Undeclared exception! + try { + MockInstant.truncatedTo((Instant) null, chronoUnit0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.evosuite.runtime.mock.java.time.MockInstant", e); + } + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setTemplateId((Integer) null); + Integer integer0 = new Integer(2617); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.setEnvironmentId((Integer) null); + vfModule0.setType(""); + vfModule0.toString(); + VfModule vfModule1 = new VfModule(); + vfModule0.toString(); + vfModule0.isMoreRecentThan(""); + vfModule0.getModelName(); + vfModule1.getLabel(); + Integer integer1 = new Integer(321); + vfModule1.setVolTemplateId(integer1); + vfModule1.getVnfResourceId(); + vfModule0.getVolTemplateId(); + vfModule0.getVnfResourceId(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getLabel(); + Integer integer0 = new Integer(0); + vfModule0.setEnvironmentId(integer0); + vfModule0.isMoreRecentThan("!X"); + vfModule0.setIsBase(0); + vfModule0.setId(4322); + vfModule0.getMaxInstances(); + vfModule0.setAsdcUuid(""); + vfModule0.getDescription(); + vfModule0.setDescription((String) null); + vfModule0.setIsBase(0); + vfModule0.setAsdcUuid((String) null); + vfModule0.setId(4322); + Integer.min(4322, (-1)); + vfModule0.getDescription(); + Integer.divideUnsigned((-2839), 4322); + vfModule0.getIsBase(); + vfModule0.setInitialCount(integer0); + vfModule0.toString(); + vfModule0.getModelName(); + vfModule0.getVolEnvironmentId(); + vfModule0.setAsdcUuid(""); + vfModule0.getId(); + VfModule vfModule1 = new VfModule(); + vfModule1.getTemplateId(); + Integer integer1 = new Integer(4322); + vfModule1.setMinInstances(integer1); + vfModule0.getId(); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getAsdcUuid(); + vfModule0.getModelVersion(); + vfModule0.setModelName((String) null); + vfModule0.getVolEnvironmentId(); + vfModule0.getIsBase(); + Integer integer0 = new Integer((-1)); + vfModule0.setEnvironmentId(integer0); + vfModule0.setMinInstances(integer0); + vfModule0.getVolTemplateId(); + vfModule0.setModelVersion((String) null); + VfModule vfModule1 = new VfModule(); + vfModule1.setId(0); + vfModule1.setModelInvariantUuid((String) null); + vfModule1.getModelInvariantUuid(); + vfModule1.getModelName(); + vfModule1.setVolEnvironmentId(integer0); + vfModule1.getMinInstances(); + vfModule0.setModelName(""); + Integer.getInteger(""); + vfModule0.setTemplateId((Integer) null); + vfModule0.getModelName(); + Integer integer1 = new Integer((-1)); + vfModule0.setVolEnvironmentId(integer1); + vfModule1.getVnfResourceId(); + Integer integer2 = vfModule1.getVolEnvironmentId(); + vfModule0.setVolEnvironmentId(integer2); + vfModule1.setMinInstances((Integer) null); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.toString(); + vfModule0.setModelVersion("LBV90^6*"); + vfModule0.setDescription("LBV90^6*"); + vfModule0.getVnfResourceId(); + vfModule0.setTemplateId((Integer) null); + vfModule0.isBase(); + vfModule0.setIsBase((-531)); + Integer integer0 = new Integer(2646); + vfModule0.setVolEnvironmentId(integer0); + Integer integer1 = new Integer((-531)); + Integer.divideUnsigned((-531), 2646); + Integer.compare((-1), (-531)); + Integer.toUnsignedLong((-1)); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setVolEnvironmentId(integer1); + vfModule0.setTemplateId((Integer) null); + vfModule0.getVolEnvironmentId(); + vfModule0.setModelName("LBV90^6*"); + vfModule0.getTemplateId(); + vfModule0.getModelName(); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(2752); + vfModule0.setVolEnvironmentId(integer0); + Integer integer1 = vfModule0.getVolEnvironmentId(); + vfModule0.setVnfResourceId(integer1); + vfModule0.getModelVersion(); + vfModule0.setModelVersion((String) null); + vfModule0.getMinInstances(); + vfModule0.getAsdcUuid(); + Integer integer2 = new Integer((-672)); + Instant instant0 = MockInstant.now(); + ChronoField chronoField0 = ChronoField.EPOCH_DAY; + // Undeclared exception! + try { + MockInstant.with(instant0, (TemporalField) chronoField0, 1268L); + fail("Expecting exception: UnsupportedTemporalTypeException"); + + } catch(UnsupportedTemporalTypeException e) { + // + // Unsupported field: EpochDay + // + verifyException("java.time.Instant", e); + } + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getMinInstances(); + Integer integer0 = new Integer(397); + vfModule0.setInitialCount(integer0); + vfModule0.setMaxInstances((Integer) null); + vfModule0.isBase(); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setModelVersion("p(>v(f\"rnCo"); + vfModule0.setMinInstances((Integer) null); + vfModule0.setModelVersion("*"); + vfModule0.getIsBase(); + vfModule0.getModelInvariantUuid(); + vfModule0.setIsBase((-1066)); + vfModule0.getInitialCount(); + vfModule0.toString(); + vfModule0.getVolTemplateId(); + vfModule0.getCreated(); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getTemplateId(); + Instant instant0 = MockInstant.ofEpochSecond(1L); + Timestamp timestamp0 = Timestamp.from(instant0); + vfModule0.setCreated(timestamp0); + vfModule0.getCreated(); + vfModule0.getTemplateId(); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + vfModule0.setTemplateId(integer0); + vfModule0.setModelVersion(""); + vfModule0.getModelName(); + vfModule0.setId(0); + vfModule0.setModelVersion("wk~z+v"); + Integer integer1 = new Integer(0); + Integer.getInteger((String) null, 0); + vfModule0.setEnvironmentId(integer1); + vfModule0.getTemplateId(); + vfModule0.setModelName("a("); + Integer integer2 = vfModule0.getTemplateId(); + vfModule0.setMinInstances(integer2); + vfModule0.setModelCustomizationUuid("01*}(,sCh"); + vfModule0.getModelCustomizationUuid(); + vfModule0.getVolEnvironmentId(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(4222); + vfModule0.setEnvironmentId(integer0); + vfModule0.getModelName(); + vfModule0.setAsdcUuid((String) null); + vfModule0.setModelCustomizationUuid((String) null); + vfModule0.setType(",minInstances="); + vfModule0.setVnfResourceId(integer0); + vfModule0.getEnvironmentId(); + vfModule0.getMaxInstances(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test33() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + Integer integer1 = new Integer(1244); + Integer.compareUnsigned(0, 1549); + Integer.getInteger("", integer1); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.getCreated(); + vfModule0.getVolEnvironmentId(); + System.setCurrentTimeMillis(1856L); + vfModule0.getVolTemplateId(); + } + + @Test(timeout = 4000) + public void test34() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getModelName(); + Integer integer0 = new Integer(0); + vfModule0.setVnfResourceId(integer0); + vfModule0.setId(0); + vfModule0.setModelVersion((String) null); + Integer integer1 = new Integer(0); + Integer.getInteger((String) null, 0); + vfModule0.setEnvironmentId(integer1); + vfModule0.getTemplateId(); + vfModule0.setModelName((String) null); + vfModule0.setMinInstances(integer1); + vfModule0.setModelCustomizationUuid("01*}(,sCh"); + vfModule0.getCreated(); + vfModule0.getVnfResourceId(); + vfModule0.getVolTemplateId(); + } + + @Test(timeout = 4000) + public void test35() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getInitialCount(); + Integer integer0 = new Integer((-1066)); + vfModule0.getVolEnvironmentId(); + Integer.getInteger("", (Integer) null); + Integer.getInteger(",envtId=", (-1066)); + vfModule0.setMinInstances(integer0); + vfModule0.toString(); + vfModule0.setVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=-1066,maxInstances=null,initialCount=null,label=null"); + vfModule0.getVolTemplateId(); + vfModule0.getVolTemplateId(); + vfModule0.getVnfResourceId(); + vfModule0.getMinInstances(); + vfModule0.getVolTemplateId(); + vfModule0.setVersion(""); + vfModule0.getVnfResourceId(); + System.setCurrentTimeMillis((-1066)); + vfModule0.setModelCustomizationUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=-1066,maxInstances=null,initialCount=null,label=null"); + vfModule0.getCreated(); + vfModule0.getCreated(); + System.setCurrentTimeMillis((-1066)); + } + + @Test(timeout = 4000) + public void test36() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getEnvironmentId(); + vfModule0.setVolEnvironmentId((Integer) null); + int int0 = vfModule0.getId(); + assertEquals(0, int0); + + vfModule0.getVolTemplateId(); + String string0 = vfModule0.toString(); + assertEquals("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null", string0); + } + + @Test(timeout = 4000) + public void test37() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.isTheSameVersion("X+]2+]y^$6"); + vfModule0.getTemplateId(); + vfModule0.getId(); + Integer.toUnsignedString(0); + vfModule0.getLabel(); + Integer.remainderUnsigned((-472), 1579); + Integer integer0 = new Integer((-1701)); + Integer.compare((-1701), (-1)); + Integer.getInteger("0", integer0); + vfModule0.setEnvironmentId((Integer) null); + vfModule0.setModelInvariantUuid((String) null); + vfModule0.getAsdcUuid(); + Integer integer1 = new Integer((-1701)); + vfModule0.setVnfResourceId((Integer) null); + vfModule0.getIsBase(); + Integer.compareUnsigned(1, 0); + vfModule0.getType(); + vfModule0.getVnfResourceId(); + vfModule0.setInitialCount(integer1); + vfModule0.setDescription(""); + vfModule0.getEnvironmentId(); + vfModule0.setInitialCount(integer1); + vfModule0.setId(1946); + vfModule0.getCreated(); + vfModule0.getInitialCount(); + vfModule0.getVnfResourceId(); + vfModule0.getCreated(); + assertEquals(1946, vfModule0.getId()); + } + + @Test(timeout = 4000) + public void test38() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getMaxInstances(); + Integer integer0 = new Integer(550); + vfModule0.setMinInstances(integer0); + Integer integer1 = new Integer(275); + Integer.max(0, 0); + vfModule0.setInitialCount(integer1); + vfModule0.setIsBase(275); + vfModule0.getEnvironmentId(); + Integer.compare(275, 275); + vfModule0.setMinInstances((Integer) null); + vfModule0.setType(""); + vfModule0.setVersion("]"); + vfModule0.getId(); + vfModule0.setId(0); + vfModule0.setIsBase((-17)); + vfModule0.setId((-17)); + vfModule0.getDescription(); + vfModule0.getAsdcUuid(); + vfModule0.getIsBase(); + vfModule0.getModelName(); + vfModule0.getEnvironmentId(); + vfModule0.toString(); + vfModule0.setModelInvariantUuid("D2"); + vfModule0.getInitialCount(); + assertEquals(-17, vfModule0.getIsBase()); + } + + @Test(timeout = 4000) + public void test39() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(4477); + vfModule0.setVolTemplateId(integer0); + vfModule0.getModelInvariantUuid(); + vfModule0.getModelInvariantUuid(); + vfModule0.getVolTemplateId(); + vfModule0.getMinInstances(); + System.setCurrentTimeMillis((-1006L)); + } + + @Test(timeout = 4000) + public void test40() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + vfModule0.setMinInstances(integer0); + vfModule0.setType((String) null); + vfModule0.setAsdcUuid(",asdcUuid="); + Integer integer1 = vfModule0.getMinInstances(); + assertEquals(0, (int)integer1); + } + + @Test(timeout = 4000) + public void test41() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getDescription(); + String string0 = vfModule0.getModelCustomizationUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test42() throws Throwable { + VfModule vfModule0 = new VfModule(); + Instant instant0 = MockInstant.now(); + Timestamp timestamp0 = Timestamp.from(instant0); + vfModule0.setCreated(timestamp0); + int int0 = vfModule0.getId(); + assertEquals(0, int0); + + vfModule0.getLabel(); + String string0 = vfModule0.toString(); + assertEquals("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null,created=2/14/14 8:21 PM", string0); + } + + @Test(timeout = 4000) + public void test43() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getMinInstances(); + vfModule0.isBase(); + vfModule0.setModelVersion(""); + vfModule0.getIsBase(); + vfModule0.getModelInvariantUuid(); + vfModule0.setIsBase((-1066)); + vfModule0.toString(); + boolean boolean0 = vfModule0.isBase(); + assertEquals(-1066, vfModule0.getIsBase()); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test44() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getMinInstances(); + vfModule0.toString(); + vfModule0.setLabel("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.getDescription(); + vfModule0.getModelVersion(); + PrivateAccess.setVariable((Class) VfModule.class, vfModule0, "minInstances", (Object) null); + assertEquals(0, vfModule0.getIsBase()); + } + + @Test(timeout = 4000) + public void test45() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setAsdcUuid(",maxInstances="); + vfModule0.isTheSameVersion(",maxInstances="); + Integer integer0 = new Integer(0); + vfModule0.setEnvironmentId(integer0); + vfModule0.setTemplateId(integer0); + vfModule0.setModelCustomizationUuid(",maxInstances="); + vfModule0.getModelInvariantUuid(); + vfModule0.getType(); + vfModule0.getModelCustomizationUuid(); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.getMaxInstances(); + String string0 = vfModule0.toString(); + assertEquals("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=0,envtId=0,volTemplateId=null,volEnvtId=0, description=null,asdcUuid=,maxInstances=,modelVersion=null,modelCustomizationUuid=,maxInstances=,minInstances=null,maxInstances=null,initialCount=null,label=null", string0); + } + + @Test(timeout = 4000) + public void test46() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer((-1)); + Integer.remainderUnsigned((-1), (-1)); + Integer.remainderUnsigned(0, (-1)); + Integer.compareUnsigned((-1), 0); + vfModule0.setMaxInstances(integer0); + vfModule0.setMaxInstances(integer0); + vfModule0.setIsBase((-1)); + vfModule0.setVolTemplateId(integer0); + vfModule0.getTemplateId(); + Integer.divideUnsigned(0, (-1)); + vfModule0.setMinInstances((Integer) null); + vfModule0.getVnfResourceId(); + vfModule0.getVolTemplateId(); + vfModule0.setIsBase(0); + vfModule0.getInitialCount(); + int int0 = vfModule0.getIsBase(); + assertFalse(vfModule0.isBase()); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test47() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setType(""); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setDescription(""); + vfModule0.setModelInvariantUuid(""); + vfModule0.getModelInvariantUuid(); + vfModule0.getVolEnvironmentId(); + vfModule0.setVnfResourceId((Integer) null); + vfModule0.setModelName(""); + assertEquals(0, vfModule0.getIsBase()); + } + + @Test(timeout = 4000) + public void test48() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(275); + vfModule0.setInitialCount(integer0); + vfModule0.getEnvironmentId(); + vfModule0.setId(275); + vfModule0.getAsdcUuid(); + vfModule0.getModelName(); + vfModule0.getAsdcUuid(); + vfModule0.getCreated(); + assertEquals(275, vfModule0.getId()); + } } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTest.java new file mode 100644 index 0000000000..1a0d1de41a --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTest.java @@ -0,0 +1,23 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:33:42 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.utils; + +import org.junit.Test; +import static org.junit.Assert.*; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class RecordNotFoundExceptionESTest extends RecordNotFoundExceptionESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + RecordNotFoundException recordNotFoundException0 = new RecordNotFoundException("K\"]E;o`'jowz5?'`3"); + RecordNotFoundException recordNotFoundException1 = new RecordNotFoundException("~&", (Throwable) recordNotFoundException0); + assertFalse(recordNotFoundException1.equals((Object)recordNotFoundException0)); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTestscaffolding.java new file mode 100644 index 0000000000..e74f0c4502 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTestscaffolding.java @@ -0,0 +1,81 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Wed Feb 22 09:33:42 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.utils; + +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 RecordNotFoundExceptionESTestscaffolding { + + @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.db.catalog.utils.RecordNotFoundException"; + 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(RecordNotFoundExceptionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.utils.RecordNotFoundException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RecordNotFoundExceptionESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.db.catalog.utils.RecordNotFoundException" + ); + } +} -- cgit 1.2.3-korg