From 025301d08b061482c1f046d562bf017c8cbcfe8d Mon Sep 17 00:00:00 2001 From: ChrisC Date: Tue, 31 Jan 2017 11:40:03 +0100 Subject: Initial OpenECOMP MSO commit Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d Signed-off-by: ChrisC --- .../openecomp/mso/db/catalog/CatalogDatabase.java | 1838 ++++++++++++++++++++ .../mso/db/catalog/beans/HeatEnvironment.java | 141 ++ .../openecomp/mso/db/catalog/beans/HeatFiles.java | 137 ++ .../mso/db/catalog/beans/HeatNestedTemplate.java | 97 ++ .../mso/db/catalog/beans/HeatTemplate.java | 217 +++ .../mso/db/catalog/beans/HeatTemplateParam.java | 78 + .../mso/db/catalog/beans/NetworkRecipe.java | 51 + .../mso/db/catalog/beans/NetworkResource.java | 139 ++ .../org/openecomp/mso/db/catalog/beans/Recipe.java | 112 ++ .../openecomp/mso/db/catalog/beans/Service.java | 127 ++ .../mso/db/catalog/beans/ServiceRecipe.java | 119 ++ .../openecomp/mso/db/catalog/beans/VfModule.java | 195 +++ .../mso/db/catalog/beans/VfModuleToHeatFiles.java | 83 + .../mso/db/catalog/beans/VnfComponent.java | 115 ++ .../mso/db/catalog/beans/VnfComponentsRecipe.java | 72 + .../openecomp/mso/db/catalog/beans/VnfRecipe.java | 63 + .../mso/db/catalog/beans/VnfResource.java | 225 +++ .../mso/db/catalog/utils/MavenLikeVersioning.java | 118 ++ .../utils/MavenLikeVersioningComparator.java | 49 + .../mso/db/catalog/utils/package-info.java | 26 + .../src/main/resources/HeatEnvironment.hbm.xml | 58 + .../src/main/resources/HeatNestedTemplate.hbm.xml | 38 + .../src/main/resources/HeatTemplate.hbm.xml | 93 + .../src/main/resources/NetworkRecipe.hbm.xml | 61 + .../src/main/resources/NetworkResource.hbm.xml | 55 + mso-catalog-db/src/main/resources/Service.hbm.xml | 84 + mso-catalog-db/src/main/resources/VfModule.hbm.xml | 81 + .../src/main/resources/VfModuleToHeatFiles.hbm.xml | 36 + .../src/main/resources/VnfComponent.hbm.xml | 43 + .../src/main/resources/VnfComponentsRecipe.hbm.xml | 53 + .../src/main/resources/VnfRecipe.hbm.xml | 66 + .../src/main/resources/VnfResource.hbm.xml | 134 ++ .../main/resources/hibernate-catalog-ajsc.cfg.xml | 75 + .../main/resources/hibernate-catalog-mysql.cfg.xml | 52 + .../mso/db/catalog/CatalogDatabaseESTest.java | 1307 ++++++++++++++ .../catalog/CatalogDatabaseESTestscaffolding.java | 1093 ++++++++++++ .../db/catalog/beans/HeatEnvironmentESTest.java | 245 +++ .../beans/HeatEnvironmentESTestscaffolding.java | 79 + .../mso/db/catalog/beans/HeatFilesESTest.java | 268 +++ .../catalog/beans/HeatFilesESTestscaffolding.java | 79 + .../db/catalog/beans/HeatNestedTemplateESTest.java | 171 ++ .../beans/HeatNestedTemplateESTestscaffolding.java | 83 + .../mso/db/catalog/beans/HeatTemplateESTest.java | 397 +++++ .../beans/HeatTemplateESTestscaffolding.java | 111 ++ .../db/catalog/beans/HeatTemplateParamESTest.java | 154 ++ .../beans/HeatTemplateParamESTestscaffolding.java | 78 + .../mso/db/catalog/beans/NetworkRecipeESTest.java | 79 + .../beans/NetworkRecipeESTestscaffolding.java | 80 + .../db/catalog/beans/NetworkResourceESTest.java | 228 +++ .../beans/NetworkResourceESTestscaffolding.java | 79 + .../mso/db/catalog/beans/RecipeESTest.java | 183 ++ .../db/catalog/beans/RecipeESTestscaffolding.java | 79 + .../mso/db/catalog/beans/ServiceESTest.java | 296 ++++ .../db/catalog/beans/ServiceESTestscaffolding.java | 80 + .../mso/db/catalog/beans/ServiceRecipeESTest.java | 239 +++ .../beans/ServiceRecipeESTestscaffolding.java | 79 + .../mso/db/catalog/beans/VfModuleESTest.java | 726 ++++++++ .../catalog/beans/VfModuleESTestscaffolding.java | 79 + .../catalog/beans/VfModuleToHeatFilesESTest.java | 128 ++ .../VfModuleToHeatFilesESTestscaffolding.java | 83 + .../mso/db/catalog/beans/VnfComponentESTest.java | 247 +++ .../beans/VnfComponentESTestscaffolding.java | 83 + .../catalog/beans/VnfComponentsRecipeESTest.java | 125 ++ .../VnfComponentsRecipeESTestscaffolding.java | 80 + .../mso/db/catalog/beans/VnfRecipeESTest.java | 94 + .../catalog/beans/VnfRecipeESTestscaffolding.java | 80 + .../mso/db/catalog/beans/VnfResourceESTest.java | 636 +++++++ .../beans/VnfResourceESTestscaffolding.java | 80 + .../mso/db/catalog/test/CatalogTestDatabase.java | 105 ++ .../mso/db/catalog/test/HeatTemplateTest.java | 85 + .../mso/db/catalog/test/MavenVersioningTest.java | 187 ++ .../utils/MavenLikeVersioningComparatorESTest.java | 71 + ...nLikeVersioningComparatorESTestscaffolding.java | 79 + .../catalog/utils/MavenLikeVersioningESTest.java | 193 ++ .../MavenLikeVersioningESTestscaffolding.java | 78 + mso-catalog-db/src/test/resources/logback-test.xml | 47 + 76 files changed, 13704 insertions(+) create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparator.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/package-info.java create mode 100644 mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/HeatNestedTemplate.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/NetworkResource.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/Service.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/VfModule.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/VfModuleToHeatFiles.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/VnfComponent.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/VnfResource.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/hibernate-catalog-ajsc.cfg.xml create 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/CatalogDatabaseESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatEnvironmentESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatEnvironmentESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatFilesESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatFilesESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplateESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplateESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParamESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParamESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkRecipeESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkRecipeESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkResourceESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkResourceESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/RecipeESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/RecipeESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceRecipeESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceRecipeESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFilesESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFilesESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipeESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipeESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfRecipeESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfRecipeESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfResourceESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfResourceESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogTestDatabase.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparatorESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparatorESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/resources/logback-test.xml (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 new file mode 100644 index 0000000000..35158a46b4 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -0,0 +1,1838 @@ +/*- + * ============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 java.io.Closeable; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.openecomp.mso.db.catalog.beans.*; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.service.ServiceRegistry; +import org.hibernate.service.ServiceRegistryBuilder; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioningComparator; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; + +/** + * This class encapsulates all of the objects that can be queried from a Catalog database. + * Clients must use these methods to retrieve catalog objects. The session is not + * available for clients to do their own direct queries to the database. + * + * + */ +public class CatalogDatabase implements Closeable { + + 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_NAME = "modelName"; + private static final String TYPE = "type"; + private static final String VF_MODULE_ID = "vfModuleId"; + private static boolean initialized = false; + private static SessionFactory sessionFactory; + private static ServiceRegistry serviceRegistry; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); + + private Session session = null; + + public CatalogDatabase () { + } + + + 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) { + try { + session = sessionFactory.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); + throw he; + } + } + + return session; + } + + /** + * Close an open Catalog Database session. + * This method should always be called when a client is finished using a + * CatalogDatabase instance. + */ + @Override + public void close () { + if (session != null) { + session.close (); + session = null; + } + } + + /** + * Commits the current transaction on this session and starts a fresh one. + */ + public void commit () { + getSession ().getTransaction ().commit (); + getSession ().beginTransaction (); + } + + /** + * Rolls back current transaction and starts a fresh one. + */ + public void rollback () { + getSession ().getTransaction ().rollback (); + getSession ().beginTransaction (); + } + + /** + * Return all Heat Templates in the Catalog DB + * + * @return A list of HeatTemplate objects + */ + @SuppressWarnings("unchecked") + public List getAllHeatTemplates () { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get all Heat templates"); + String hql = "FROM HeatTemplate"; + Query query = getSession ().createQuery (hql); + + List result = query.list (); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllHeatTemplates", null); + return result; + } + + /** + * Fetch a specific Heat Template by ID. + * + * @param templateId + * @return HeatTemplate object or null if none found + */ + public HeatTemplate getHeatTemplate (int templateId) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Heat template with id " + templateId); + + HeatTemplate template = (HeatTemplate) getSession ().get (HeatTemplate.class, templateId); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); + return template; + } + + /** + * Return the newest version of a specific Heat Template (queried by Name). + * + * @param templateName + * @return HeatTemplate object or null if none found + */ + public HeatTemplate getHeatTemplate (String templateName) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Heat template with name " + templateName); + + String hql = "FROM HeatTemplate WHERE templateName = :template_name"; + Query query = getSession ().createQuery (hql); + query.setParameter ("template_name", templateName); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. Name is unique, so + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No template found", "CatalogDB", "getHeatTemplate", null); + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); + return resultList.get (0); + } + + /** + * Return a specific version of a specific Heat Template (queried by Name). + * + * @param templateName + * @param version + * @return HeatTemplate object or null if none found + */ + public HeatTemplate getHeatTemplate (String templateName, String version) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Heat template with name " + templateName + + " and version " + + version); + + String hql = "FROM HeatTemplate WHERE templateName = :template_name AND version = :version"; + Query query = getSession ().createQuery (hql); + query.setParameter ("template_name", templateName); + query.setParameter ("version", version); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No template found.", "CatalogDB", "getHeatTemplate", null); + return null; + } + // Name + Version is unique, so should only be one element + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); + return resultList.get (0); + } + + /** + * Fetch a Service definition + */ + public Service getService (String serviceName) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with name " + serviceName); + + String hql = "FROM Service WHERE serviceName = :service_name"; + Query query = getSession ().createQuery (hql); + query.setParameter ("service_name", serviceName); + + 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: serviceName='" + serviceName + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for serviceName=" + serviceName, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for serviceName=" + serviceName); + return null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: serviceName='" + serviceName + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for serviceName=" + serviceName, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for serviceName=" + serviceName); + return null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: serviceName='" + serviceName); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for serviceName=" + serviceName, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for serviceName=" + serviceName); + 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; + } + + /** + * Fetch a Service definition + */ + public Service getServiceByUUID (String serviceNameVersionId) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with UUID " + serviceNameVersionId); + + String hql = "FROM Service WHERE serviceNameVersionId = :service_id"; + Query query = getSession ().createQuery (hql); + query.setParameter ("service_id", serviceNameVersionId); + + 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: serviceNameVersionId='" + serviceNameVersionId + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for serviceNameVersionId=" + serviceNameVersionId, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for serviceNameVersionId=" + serviceNameVersionId); + return null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: serviceName='" + serviceNameVersionId + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for serviceNameVersionId=" + serviceNameVersionId, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for serviceNameVersionId=" + serviceNameVersionId); + return null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: serviceName='" + serviceNameVersionId); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for serviceNameVersionId=" + serviceNameVersionId, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for serviceNameVersionId=" + serviceNameVersionId); + 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; + } + + /** + * Fetch the Common Service API definition using Http Method + serviceNameVersionId + */ + public Service getService(HashMap map, String httpMethod) { + + String serviceNameVersionId = map.get("serviceNameVersionId"); + Query query; + String serviceId = "not_set"; + String serviceVersion = "not_set"; + + if(serviceNameVersionId != null && serviceNameVersionId.length() > 0){ + LOGGER.debug ("Catalog database - get serviceNameVersionId with id " + serviceNameVersionId); + + String hql = "FROM Service WHERE service_name_version_id = :service_name_version_id and http_method = :http_method"; + query = getSession ().createQuery (hql); + query.setParameter ("service_name_version_id", serviceNameVersionId); + } else { + serviceId = map.get("serviceId"); + serviceVersion = map.get("serviceVersion"); + LOGGER.debug ("Catalog database - get serviceId with id " + serviceId + " and serviceVersion with " + serviceVersion); + + String hql = "FROM Service WHERE service_id = :service_id and service_version = :service_version and http_method = :http_method"; + query = getSession ().createQuery (hql); + query.setParameter ("service_id", serviceId); + query.setParameter ("service_version", serviceVersion); + } + + query.setParameter ("http_method", httpMethod); + + long startTime = System.currentTimeMillis (); + Service service = null; + try { + service = (Service) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - data integrity error: service_id='" + serviceId + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for service_id=" + serviceId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for service_id=" + serviceId); + service = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: service_id='" + serviceId + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for service_id=" + serviceId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for service_id=" + serviceId); + service = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: service_id='" + serviceId + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for service_id=" + serviceId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for service_id=" + serviceId); + service = 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; + } + + /** + * Return the newest version of a Service (queried by Name). + * + * @param serviceName + * @return Service object or null if none found + */ + public Service getServiceByName (String serviceName) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with name " + serviceName); + + String hql = "FROM Service WHERE serviceName = :service_name"; + Query query = getSession ().createQuery (hql); + query.setParameter ("service_name", serviceName); + + @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); + } + + /** + * Return a newest version of Service recipe that matches a given SERVICE_ID and ACTION + * + * @param serviceId + * @param action * + * @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 "); + + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Service recipe with serviceId " + Integer.toString(serviceId) + + " and action " + + action + ); + + Query query = getSession ().createQuery (hql.toString ()); + query.setParameter ("serviceId", serviceId); + query.setParameter (ACTION, action); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service recipe not found", "CatalogDB", "getServiceRecipe", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipe", null); + return resultList.get (0); + } + + + /** + * Return the VNF component data - queried by the VNFs ID and the component type. + * + * @param vnfId + * @param type + * @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); + query.setParameter ("type", type); + + VnfComponent result = null; + try { + 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); + result = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: vnf_id='" + vnfId + "', componentType='" + type + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for vnf_id=" + vnfId + " and componentType=" + type, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vnf_id=" + vnfId); + result = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: vnf_id='" + vnfId + "', componentType='" + type + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for vnf_id=" + vnfId + " and componentType=" + type, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for vnf_id=" + vnfId); + result = null; + } + + //LOGGER.debug("Found VNF Component: " + result.toString()); + if (result != null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfComponent", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No VNFComponent found", "CatalogDB", "getVnfComponent", null); + } + return result; + } + + /** + * Return the newest version of a specific VNF resource (queried by Name). + * + * @param vnfType + * @return VnfResource object or null if none found + */ + public VnfResource getVnfResource (String vnfType) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get vnf resource with name " + vnfType); + + String hql = "FROM VnfResource WHERE vnfType = :vnf_name"; + Query query = getSession ().createQuery (hql); + query.setParameter ("vnf_name", vnfType); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. Name is unique, so + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF not found", "CatalogDB", "getVnfResource", null); + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResource", null); + return resultList.get (0); + } + + /** + * Return the newest version of a specific VNF resource (queried by Name). + * + * @param vnfType + * @param version + * @return VnfResource object or null if none found + */ + public VnfResource getVnfResource (String vnfType, String serviceVersion) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get VNF resource with name " + vnfType); + + String hql = "FROM VnfResource WHERE vnfType = :vnfName and version = :serviceVersion"; + Query query = getSession ().createQuery (hql); + query.setParameter ("vnfName", vnfType); + 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: vnfType='" + vnfType + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vnfType=" + vnfType + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for vnfType=" + vnfType); + resource = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: vnfType='" + vnfType + "', asdc_service_model_version='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for vnfType=" + vnfType + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vnfType=" + vnfType); + resource = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: vnfType='" + vnfType + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for vnfType=" + vnfType + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for vnfType=" + vnfType); + 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). + * + * @param id The vnf id + * @return VnfResource object or null if none found + */ + public VnfResource getVnfResourceById (int id) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get VNF resource with id " + id); + + String hql = "FROM VnfResource WHERE id = :id"; + Query query = getSession ().createQuery (hql); + query.setParameter ("id", id); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. Name is unique, so + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VnfResource not found", "CatalogDB", "getVnfResourceById", null); + return null; + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceById", null); + return resultList.get (0); + } + + /** + * Return the newest version of a vfModule - 1607 + * + */ + public VfModule getVfModuleModelName (String modelName) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get vfModuleModelName with name " + modelName); + + String hql = "FROM VfModule WHERE model_name = :model_name"; + Query query = getSession ().createQuery (hql); + query.setParameter ("model_name", modelName); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. Name is unique, so + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF not found", "CatalogDB", "getVfModuleModelName", null); + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleModelName", null); + return resultList.get (0); + } + + public VfModule getVfModuleModelName (String modelName, String model_version) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get vfModuleModelName with type='" + modelName + "' and asdc_service_model_version='" + model_version + "'"); + + String hql = "FROM VfModule WHERE model_name = :model_name and version = :model_version"; + Query query = getSession ().createQuery (hql); + query.setParameter ("model_name", modelName); + query.setParameter ("model_version", model_version); + + 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: type='" + modelName + "', asdc_service_model_version='" + model_version + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for type=" + modelName + " and version=" + model_version, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for type=" + modelName); + module = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: type='" + modelName + "', asdc_service_model_version='" + model_version + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for type=" + modelName + " and version=" + model_version, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for type=" + modelName); + module = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: type='" + modelName + "', asdc_service_model_version='" + model_version + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for type=" + modelName + " and version=" + model_version, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for type=" + modelName); + module = null; + } + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleModelName", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleModelName", null); + } + return module; + } + + + /** + * Return the newest version of a specific Network resource (queried by Type). + * + * @param networkType + * @return NetworkResource object or null if none found + */ + public NetworkResource getNetworkResource (String networkType) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get network resource with type " + networkType); + + String hql = "FROM NetworkResource WHERE networkType = :network_type"; + Query query = getSession ().createQuery (hql); + query.setParameter ("network_type", networkType); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. Name is unique, so + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Network Resource not found", "CatalogDB", "getNetworkResource", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkResource", null); + return resultList.get (0); + } + + /** + * Return a VNF recipe that matches a given VNF_TYPE, ACTION, and, if specified, SERVICE_TYPE + * + * @param vnfType + * @param action + * @param serviceType The service Name, if null or empty is provided, it won't be taken into account + * @return VnfRecipe object or null if none found + */ + public VnfRecipe getVnfRecipe (String vnfType, String action, String serviceType) { + boolean withServiceType = false; + + StringBuilder hql = new StringBuilder ("FROM VnfRecipe WHERE vnfType = :vnfType AND action = :action "); + + // If query c + if (serviceType == null || serviceType.isEmpty ()) { + hql.append ("AND serviceType is NULL "); + } else { + hql.append ("AND serviceType = :serviceType "); + withServiceType = true; + } + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get VNF recipe with name " + vnfType + + " and action " + + action + + " and service type " + + serviceType); + + Query query = getSession ().createQuery (hql.toString ()); + query.setParameter (VNF_TYPE, vnfType); + query.setParameter (ACTION, action); + if (withServiceType) { + query.setParameter (SERVICE_TYPE, serviceType); + } + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null); + return resultList.get (0); + } + + /** + * Return a VNF recipe that matches a given VNF_TYPE and ACTION + * + * @param vnfType + * @param action + * @return VnfRecipe object or null if none found + */ + public VnfRecipe getVnfRecipe (String vnfType, String action) { + StringBuilder hql = new StringBuilder ("FROM VnfRecipe WHERE vnfType = :vnfType AND action = :action "); + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get VNF recipe with name " + vnfType + + " and action " + + action); + + Query query = getSession ().createQuery (hql.toString ()); + query.setParameter (VNF_TYPE, vnfType); + query.setParameter (ACTION, action); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null); + return resultList.get (0); + } + + /** + * Return a VNF recipe that matches a given VF_MODULE_ID and ACTION + * + * @param vfModuleId + * @param action + * @return VnfRecipe object or null if none found + */ + public VnfRecipe getVnfRecipeByVfModuleId (String vnfType, String vfModuleId, String action) { + + StringBuilder hql = new StringBuilder ("FROM VnfRecipe WHERE vfModuleId = :vfModuleId and action = :action "); + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get VNF Recipe with vfModuleId " + vfModuleId); + + Query query = getSession ().createQuery (hql.toString ()); + query.setParameter (VF_MODULE_ID, vfModuleId); + query.setParameter (ACTION, action); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe Entry not found", "CatalogDB", "getVnfRecipeByVfModuleId", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF Recipe Entry found", "CatalogDB", "getVnfRecipeByVfModuleId", null); + return resultList.get (0); + } + + public VfModule getVfModuleType(String type) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get vfModuleType with type " + type); + + String hql = "FROM VfModule WHERE type = :type"; + Query query = getSession().createQuery(hql); + query.setParameter("type", type); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + if (resultList.isEmpty()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF not found", "CatalogDB", "getVfModuleType", null); + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + return resultList.get (0); + } + + public VfModule getVfModuleType(String type, String version) { + + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleType with type " + type + " and model_version " + version); + + String hql = "FROM VfModule WHERE type = :type and version = :version"; + Query query = getSession().createQuery(hql); + query.setParameter ("type", type); + query.setParameter ("version", version); + 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: type='" + type + "', asdc_service_model_version='" + version + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for type=" + type + " and version=" + version, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for type==" + type); + module = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: type='" + type + "', asdc_service_model_version='" + version + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for type=" + type + " and version=" + version, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for type=" + type); + module = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: type='" + type + "', asdc_service_model_version='" + version + "'"); + 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); + } + return module; + } + + + /** + * 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 + * VNF_RECIPE by VF_MODULE_ID and ACTION + * + * @param vnfType + * @parm vfModuleModelName + * @param action + * @return VnfRecipe object or null if none found + */ + public VnfRecipe getVfModuleRecipe (String vnfType, String vfModuleModelName, String action) { + String vfModuleType = vnfType + "::" + vfModuleModelName; + + StringBuilder hql = new StringBuilder ("FROM VfModule WHERE type = :type "); + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get VF MODULE with type " + vfModuleType); + + Query query = getSession ().createQuery (hql.toString ()); + query.setParameter (TYPE, vfModuleType); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF Module Entry not found", "CatalogDB", "getVfModuleRecipe", 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 VnfRecipe WHERE vfModuleId = :vfModuleId AND action = :action "); + + LOGGER.debug ("Catalog database - get VNF 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 resultList1 = query1.list (); + + if (resultList1.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVfModuleRecipe", 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", "getVfModuleRecipe", 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 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"); + + 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); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + 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 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 all VNF Resources in the Catalog DB + * + * @return A list of VnfResource objects + */ + @SuppressWarnings("unchecked") + public List getAllVnfResources () { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get all VNF resources"); + + String hql = "FROM VnfResource"; + Query query = getSession ().createQuery (hql); + + List result = query.list (); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllVnfResources", null); + return result; + } + + /** + * Return VNF Resources in the Catalog DB that match a given VNF role + * + * @return A list of VnfResource objects + */ + @SuppressWarnings("unchecked") + public List getVnfResourcesByRole (String vnfRole) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get all VNF resources for role " + vnfRole); + + String hql = "FROM VnfResource WHERE vnfRole = :vnfRole"; + Query query = getSession ().createQuery (hql); + query.setParameter ("vnfRole", vnfRole); + + List resources = query.list (); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourcesByRole", null); + return resources; + } + + /** + * Return all Network Resources in the Catalog DB + * + * @return A list of NetworkResource objects + */ + @SuppressWarnings("unchecked") + public List getAllNetworkResources () { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get all network resources"); + + String hql = "FROM NetworkResource"; + Query query = getSession ().createQuery (hql); + + List result = query.list (); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllNetworkResources", null); + return result; + } + + /** + * Return all VF Modules in the Catalog DB + * + * @return A list of VfModule objects + */ + @SuppressWarnings("unchecked") + public List getAllVfModules () { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get all vf modules"); + + String hql = "FROM VfModule"; + Query query = getSession ().createQuery (hql); + + List result = query.list (); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllVfModules", null); + return result; + } + + /** + * Return all HeatEnvironment in the Catalog DB + * + * @return A list of HeatEnvironment objects + */ + @SuppressWarnings("unchecked") + public List getAllHeatEnvironment () { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get all Heat environments"); + + String hql = "FROM HeatEnvironment"; + Query query = getSession ().createQuery (hql); + + List result = query.list (); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllHeatEnvironment", null); + return result; + } + + /** + * Fetch the Environment by Environment ID - 1510 + */ + public HeatEnvironment getHeatEnvironment (int id) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Heat environment with id " + id); + + String hql = "FROM HeatEnvironment WHERE id = :idValue"; + + LOGGER.debug ("getHeatEnvironment called with id=" + id); + + Query query = getSession ().createQuery (hql); + query.setParameter ("idValue", id); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Heat environment not found", "CatalogDB", "getHeatEnvironment", null); + return null; + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatEnvironment", null); + return resultList.get (0); + } + + /** + * Fetch the nested templates - 1510 + */ + + public Map getNestedTemplates (int templateId) { + Map nestedTemplates = null; + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - getNestedTemplates called with templateId " + templateId); + + String hql = "FROM HeatNestedTemplate where parent_template_id = :parentIdValue"; + + Query query = getSession ().createQuery (hql); + query.setParameter ("parentIdValue", templateId); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + // If nothing comes back, there are no nested templates + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No nestedTemplate found", "CatalogDB", "getNestedTemplates", null); + LOGGER.debug ("No nestedTemplates found for templateId=" + templateId + ", " + hql); + return null; + } + // Now, for each entry in NESTED_HEAT_TEMPLATES, we need to grab the template body from HEAT_TEMPLATE + nestedTemplates = new HashMap (); + for (HeatNestedTemplate hnt : resultList) { + LOGGER.debug ("Querying for " + hnt); + HeatTemplate ht = this.getHeatTemplate (hnt.getChildTemplateId ()); + if (ht == null) { + LOGGER.debug ("No template found matching childTemplateId=" + hnt.getChildTemplateId ()); + continue; + } + String providerResourceFile = hnt.getProviderResourceFile (); + String heatTemplateBody = ht.getTemplateBody (); + if (providerResourceFile != null && heatTemplateBody != null) { + nestedTemplates.put (providerResourceFile, heatTemplateBody); + } else { + LOGGER.debug ("providerResourceFile or heatTemplateBody were null - do not add to HashMap!"); + } + } + // Make sure we're not returning an empty map - if so, just return null + if (nestedTemplates.isEmpty ()) { + LOGGER.debug ("nestedTemplates is empty - just return null"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Nested template is empty", "CatalogDB", "getNestedTemplate", null); + return null; + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNestedTemplate", null); + return nestedTemplates; + } + + /* + * Fetch any files in the HEAT_FILES table 1510 + */ + public Map getHeatFiles (int vnfResourceId) { + Map heatFiles = null; + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - getHeatFiles called with vnfResourceId " + vnfResourceId); + String hql = "FROM HeatFiles where vnf_resource_id = :vnfResourceIdValue"; + + Query query = getSession ().createQuery (hql); + query.setParameter ("vnfResourceIdValue", vnfResourceId); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + // If nothing comes back, there are no heat files + if (resultList.isEmpty ()) { + LOGGER.debug ("No heatFiles found for vnfResourceId=" + vnfResourceId); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No heat files", "CatalogDB", "getHeatFiles", null); + return null; + } + // Now, we just need to return a HashMap (key=fileName, object=fileBody) + heatFiles = new HashMap (); + for (HeatFiles hf : resultList) { + LOGGER.debug ("Adding " + hf.getFileName () + "->" + hf.getFileBody ()); + heatFiles.put (hf.getFileName (), hf); + } + // Make sure we're not returning an empty map - if so, just return null + if (heatFiles.isEmpty ()) { + LOGGER.debug ("heatFiles is empty - just return null"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Heat files is empty", "CatalogDB", "getHeatFiles", null); + return null; + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatFiles", null); + return heatFiles; + } + + // New 1607 - with modularization, use new table to determine which HEAT_FILES entries to attach + + public Map getHeatFilesForVfModule(int vfModuleId) { + Map heatFiles = null; + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - getHeatFilesForVfModule called with vfModuleId " + vfModuleId); + String hql = "FROM VfModuleToHeatFiles where vf_module_id = :vfModuleIdValue"; + + Query query = getSession ().createQuery (hql); + query.setParameter ("vfModuleIdValue", vfModuleId); + + List mapList = query.list(); + if (mapList.isEmpty()) { + LOGGER.debug ("No heatFiles found for vfModuleId=" + vfModuleId); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No heatfiles found for vfModule", "CatalogDB", "getHeatFilesForVfModule", null); + return null; + } + //Now the fun part - we have a list of the heat files we need to get - could clean this up with a join + //TODO - convert this all with one join - brute force for now due to time + heatFiles = new HashMap(); + for (VfModuleToHeatFiles vmthf : mapList) { + int heatFilesId = vmthf.getHeatFilesId(); + hql = "FROM HeatFiles where id = :id_value"; + query = getSession().createQuery(hql); + query.setParameter("id_value", heatFilesId); + List fileList = query.list(); + if (fileList.isEmpty()) { + // Should this throw an exception?? + LOGGER.debug("Unable to find a HEAT_FILES entry at " + heatFilesId); + String errorString = "_ERROR|" + heatFilesId; + // The receiving code needs to know to throw an exception for this - or ignore it. + heatFiles.put(errorString, null); + } else { + // Should only ever have 1 result - add it to our Map + LOGGER.debug("Retrieved " + fileList.size() + " heat file entry at " + heatFilesId); + for (HeatFiles hf : fileList) { + LOGGER.debug("Adding " + hf.getFileName() + "->" + hf.getFileBody()); + heatFiles.put(hf.getFileName(), hf); + } + } + } + if (heatFiles.isEmpty()) { + LOGGER.debug ("heatFiles is empty - just return null"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. HeatFiles is empty", "CatalogDB", "getHeatFilesForVfModule", null); + return null; + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatFilesForVfModule", null); + return heatFiles; + } + + + + /** + * Get the heat template object based on asdc attributes + * + * @param templateName The template name, generally the yaml filename. "example.yaml" + * @param version The version as specified by ASDC. "1.1" + * @param asdcResourceName The ASDC resource name provided in the ASDC artifact + * + * @return The HeatTemplate + */ + public HeatTemplate getHeatTemplate (String templateName, String version, String asdcResourceName) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - getHeatTemplate with name " + templateName + + " and version " + + version + + " and ASDC resource name " + + asdcResourceName); + + String hql = "FROM HeatTemplate WHERE templateName = :template_name AND version = :version AND asdcResourceName = :asdcResourceName"; + Query query = getSession ().createQuery (hql); + query.setParameter ("template_name", templateName); + query.setParameter ("version", version); + query.setParameter ("asdcResourceName", asdcResourceName); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Heat template not found", "CatalogDB", "getHeatTemplate", null); + return null; + } + // Name + Version is unique, so should only be one element + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); + return resultList.get (0); + } + + /** + * Save the Heat Template + * + * @param heat The heat template + * @param paramSet The list of heat template parameters + */ + public void saveHeatTemplate (HeatTemplate heat, Set paramSet) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save Heat Template with name " + heat.getTemplateName()); + + heat.setParameters(null); + try { + HeatTemplate heatTemp = this.getHeatTemplate (heat.getTemplateName (), + heat.getVersion (), + heat.getAsdcResourceName ()); + if (heatTemp == null) { + this.getSession ().save (heat); + + if (paramSet != null) { + for (HeatTemplateParam param : paramSet) { + param.setHeatTemplateId (heat.getId ()); + } + heat.setParameters (paramSet); + this.getSession ().merge (heat); + } + + } else { + heat.setId(heatTemp.getId()); + } + } finally { + heat.setParameters(paramSet); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveHeatTemplate", null); + } + } + + /** + * Retrieves a Heat environment from DB based on its unique key. + * + * @param name the environment artifact name + * @param version the environment resource version + * @param asdcResourceName the environment resource name + * @return the heat environment from DB or null if not found + */ + public HeatEnvironment getHeatEnvironment (String name, String version, String asdcResourceName) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Heat environment with name " + name + + " and version " + + version + + " and ASDC resource name " + + asdcResourceName); + + String hql = "FROM HeatEnvironment WHERE name=:name AND version=:version AND asdcResourceName=:asdcResourceName"; + Query query = getSession ().createQuery (hql); + query.setParameter ("name", name); + query.setParameter ("version", version); + query.setParameter ("asdcResourceName", asdcResourceName); + HeatEnvironment env = null; + try { + env = (HeatEnvironment) 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: envName='" + name + "', version='" + version + "' and asdcResourceName=" + asdcResourceName); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for envName=" + name + " and version=" + version + " and asdcResourceName=" + asdcResourceName, "", "", MsoLogger.ErrorCode.DataError, "non unique result for envName=" + name); + env = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: envName='" + name + "', asdc_service_model_version='" + version + "' and asdcResourceName=" + asdcResourceName); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for envName=" + name + " and version=" + version + " and asdcResourceName=" + asdcResourceName, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for envName=" + name); + env = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: envName='" + name + "', asdc_service_model_version='" + version + "' and asdcResourceName=" + asdcResourceName); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for envName=" + name + " and version=" + version + " and asdcResourceName=" + asdcResourceName, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for envName=" + name); + env = null; + } + if (env == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getHeatTemplate", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); + } + return env; + } + + /** + * Save the HeatEnvironment + * + * @param env The Environment + */ + public void saveHeatEnvironment (HeatEnvironment env) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save Heat environment with name " + + env.getEnvironment()); + try { + HeatEnvironment dbEnv = getHeatEnvironment (env.getName (), env.getVersion (), env.getAsdcResourceName ()); + if (dbEnv == null) { + + this.getSession ().save (env); + + } else { + env.setId(dbEnv.getId()); + } + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveHeatTemplate", null); + } + } + + /** + * Save the heatTemplate + * + * @param heat The heat template + */ + public void saveHeatTemplate (HeatTemplate heat) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save Heat template with name " + heat.getTemplateName ()); + try { + this.getSession ().update (heat); + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveHeatTemplate", null); + } + } + + public void saveHeatFile (HeatFiles heatFile) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save Heat file with name " + heatFile.getFileName ()); + try { + this.getSession ().save (heatFile); + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveHeatFile", null); + } + } + + public void saveVnfRecipe (VnfRecipe vnfRecipe) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save VNF recipe with VNF type " + vnfRecipe.getVnfType ()); + try { + this.getSession ().save (vnfRecipe); + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveVnfRecipe", null); + } + } + + public void saveVnfComponentsRecipe (VnfComponentsRecipe vnfComponentsRecipe) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save VNF Component recipe with VNF type " + vnfComponentsRecipe.getVnfType ()); + try { + this.getSession ().save (vnfComponentsRecipe); + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveVnfComponentsRecipe", null); + } + } + + + public void saveOrUpdateVnfResource (VnfResource vnfResource) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save VNF Resource with VNF type " + vnfResource.getVnfType ()); + try { + + if (vnfResource.getId() != 0) { + this.getSession ().merge (vnfResource); + } else { + this.getSession ().save (vnfResource); + } + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVnfResource", 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()); + try { + Service serviceDB = this.getServiceByUUID(service.getServiceNameVersionId()); + if (serviceDB == null) { + this.getSession ().save (service); + } + + } 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()); + try { + + if (vfModule.getId() != 0) { + this.getSession ().merge (vfModule); + } else { + this.getSession ().save (vfModule); + } + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVfModule", null); + } + } + + public HeatNestedTemplate getNestedHeatTemplate(int parentTemplateId, int childTemplateId) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get nested Heat template with PerentId-Child Id " + + parentTemplateId +"-"+childTemplateId); + try { + 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) { + HeatNestedTemplate nestedTemplate = new HeatNestedTemplate (); + nestedTemplate.setParentTemplateId (parentTemplateId); + nestedTemplate.setChildTemplateId (childTemplate.getId ()); + nestedTemplate.setProviderResourceFile (yamlFile); + session.save (nestedTemplate); + } + } finally { + 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 + + " and vnfResourceID " + + vnfResourceId +// + " and ASDC resource name " + + asdcResourceName + + " and version " + + version); + + String hql = "FROM HeatFiles WHERE fileName = :fileName AND vnfResourceId = :vnfResourceId AND asdcResourceName = :asdcResourceName AND version = :version"; + Query query = getSession ().createQuery (hql); + query.setParameter ("fileName", fileName); + query.setParameter ("vnfResourceId", vnfResourceId); + query.setParameter ("asdcResourceName", asdcResourceName); + query.setParameter ("version", version); + + @SuppressWarnings("unchecked") + + HeatFiles heatFilesResult = null; + try { + heatFilesResult = (HeatFiles) 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: fileName='" + fileName + "', vnfResourceId='" + vnfResourceId + "' and asdcResourceName=" + asdcResourceName + " and version=" + version); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for fileName=" + fileName + " and vnfResourceId=" + vnfResourceId + " and asdcResourceName=" + asdcResourceName + " and version=" + version, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for fileName=" + fileName); + heatFilesResult = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: fileName='" + fileName + "', vnfResourceId='" + vnfResourceId + "' and asdcResourceName=" + asdcResourceName + " and version=" + version); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for fileName=" + fileName + " and vnfResourceId=" + vnfResourceId + " and asdcResourceName=" + asdcResourceName + " and version=" + version, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for fileName=" + fileName); + heatFilesResult = null; + } catch (Exception e) { + 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); + return null; + } + // Name + Version is unique, so should only be one element + 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 " + + childFile.getFileName()); + try { + HeatFiles heatFiles = getHeatFiles (childFile.getVnfResourceId(), childFile.getFileName(), childFile.getAsdcResourceName (),childFile.getVersion()); + if (heatFiles == null) { + + // asdc_heat_files_save + this.getSession ().save (childFile); + + } else { + /* replaced 'heatFiles' by 'childFile' + Based on following comment: + It must be childFile.setId instead of heatFiles.setId, we must return the ID if it exists in DB. + */ + childFile.setId(heatFiles.getId()); + } + + } finally { + 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 " + + childFile.getFileName()); + try { + saveHeatFiles (childFile); + 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 + * + * @param networkType + * @param action + * @param serviceType + * @return NetworkRecipe object or null if none found + */ + public NetworkRecipe getNetworkRecipe (String networkType, String action, String serviceType) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get network recipe with network type " + networkType + + " and action " + + action + + " and service type " + + serviceType); + + try { + String hql; + if (serviceType == null) { + hql = "FROM NetworkRecipe WHERE networkType = :networkType AND action = :action AND serviceType IS NULL "; + } else { + hql = "FROM NetworkRecipe WHERE networkType = :networkType AND action = :action AND serviceType = :serviceType "; + } + Query query = getSession ().createQuery (hql); + query.setParameter (NETWORK_TYPE, networkType); + query.setParameter (ACTION, action); + if (serviceType != null) { + query.setParameter ("serviceType", serviceType); + } + + @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 recipe that matches a given NETWORK_TYPE and ACTION + * + * @param networkType + * @param action + * @return NetworkRecipe object or null if none found + */ + public NetworkRecipe getNetworkRecipe (String networkType, String action) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get network recipe with network type " + networkType + + " and action " + + action + ); + + 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 VnfComponents recipe that matches a given VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, and, if specified, + * SERVICE_TYPE + * + * @param vnfType + * @param vnfComponentType + * @param action + * @param serviceType + * @return VnfComponentsRecipe object or null if none found + */ + public VnfComponentsRecipe getVnfComponentsRecipe (String vnfType, + String vnfComponentType, + String action, + String serviceType) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Vnf Component recipe with network type " + vnfType + + " and component type " + + vnfComponentType + + " and action " + + action + + " and service type " + + serviceType); + + try { + String hql; + if (serviceType == null) { + hql = "FROM VnfComponentsRecipe WHERE vnfType = :vnfType AND vnfComponentType = :vnfComponentType AND action = :action AND serviceType IS NULL "; + } else { + hql = "FROM VnfComponentsRecipe WHERE vnfType = :vnfType AND vnfComponentType = :vnfComponentType AND action = :action AND serviceType = :serviceType "; + } + Query query = getSession ().createQuery (hql); + query.setParameter (VNF_TYPE, vnfType); + query.setParameter (VNF_COMPONENT_TYPE, vnfComponentType); + query.setParameter (ACTION, action); + if (serviceType != null) { + query.setParameter ("serviceType", serviceType); + } + + @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", "getVnfComponentsRecipe", null); + } + } + + /** + * Return a VnfComponents recipe that matches a given VF_MODULE_ID, VNF_COMPONENT_TYPE, ACTION + * + * @param vfModuleId + * @param vnfComponentType + * @param action + * @return VnfComponentsRecipe object or null if none found + */ + public VnfComponentsRecipe getVnfComponentsRecipeByVfModuleId (String vfModuleId, + String vnfComponentType, + String action) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Vnf Component recipe with vfModuleId " + vfModuleId + + " and component type " + + vnfComponentType + + " and action " + + action); + + 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 (); + + 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", "getVnfComponentsRecipeByVfModuleId", null); + } + } + + + + public void saveOrUpdateVnfComponent (VnfComponent vnfComponent) { + long startTime = System.currentTimeMillis (); + + LOGGER.debug ("Catalog database - save VnfComponent where vnfId="+ vnfComponent.getVnfId()+ " AND componentType="+ vnfComponent.getComponentType()); + + VnfComponent vnfComponentDb = this.getVnfComponent(vnfComponent.getVnfId(), vnfComponent.getComponentType()); + + try { + + if (vnfComponentDb != null) { + this.getSession ().merge (vnfComponent); + } else { + this.getSession ().save (vnfComponent); + } + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVnfComponent", null); + } + } + + /** + * Return a VfModule record that matches a given MODEL_NAME + * + * @param modelName + * @return VfModule object or null if none found + */ + public VfModule getVfModule (String modelName) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get vf module with model name " + modelName); + + try { + String hql; + + hql = "FROM VfModule WHERE modelName = :modelName"; + + Query query = getSession ().createQuery (hql); + query.setParameter (MODEL_NAME, modelName); + + @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", "getVfModule", null); + } + } + + + /** + * Verify the health of the DB. + * + * @return boolean value indicate whether DB is healthy + */ + public boolean healthCheck () { + long startTime = System.currentTimeMillis (); + Session session = this.getSession (); + + Query query = session.createSQLQuery (" show tables "); + + List list = query.list(); + LOGGER.debug("healthCheck CatalogDB - Successful"); + return true; + } +} 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 new file mode 100644 index 0000000000..69db27e989 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.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 java.sql.Timestamp; +import java.text.DateFormat; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class HeatEnvironment extends MavenLikeVersioning { + private int id; + private String name = null; + private String description = null; + private String environment = null; + + private String asdcUuid; + private String asdcResourceName; + private String asdcLabel; + + private Timestamp created; + + public HeatEnvironment() {} + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + + /** + * @return the name + */ + public String getName () { + return name; + } + + + /** + * @param name the name to set + */ + public void setName (String name) { + this.name = name; + } + + public String getDescription() { + return this.description; + } + public void setDescription(String description) { + this.description = description; + } + + public String getEnvironment() { + return this.environment; + } + public void setEnvironment(String environment) { + this.environment = environment; + } + + public String getAsdcUuid() { + return asdcUuid; + } + + public void setAsdcUuid(String asdcUuid) { + this.asdcUuid = asdcUuid; + } + public String getAsdcLabel() { + return this.asdcLabel; + } + public void setAsdcLabel(String asdcLabel) { + this.asdcLabel = asdcLabel; + } + + + /** + * @return the asdcResourceName + */ + public String getAsdcResourceName () { + return asdcResourceName; + } + + + /** + * @param asdcResourceName the asdcResourceName to set + */ + public void setAsdcResourceName (String asdcResourceName) { + this.asdcResourceName = asdcResourceName; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append ("ID=" + this.id); + sb.append (", name="); + sb.append (name); + sb.append (", version="); + sb.append (version); + sb.append(", description="); + sb.append (description == null ? "null" : description); + sb.append(", environment="); + sb.append (environment == null ? "null" : environment); + sb.append(", asdcUuid="); + sb.append (asdcUuid == null ? "null" : asdcUuid); + sb.append (", asdcResourceName="); + sb.append (asdcResourceName == null ? "null" : asdcResourceName); + 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/HeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java new file mode 100644 index 0000000000..a1b6f228e1 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java @@ -0,0 +1,137 @@ +/*- + * ============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 HeatFiles extends MavenLikeVersioning { + private int id; + private String description = null; + private String fileName; + private String fileBody; + private int vnfResourceId; + private Timestamp created; + private String asdcUuid; + private String asdcLabel; + private String asdcResourceName; + + 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; + } + public void setVnfResourceId(int vnfResourceId) { + this.vnfResourceId = vnfResourceId; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + public String getAsdcUuid() { + return this.asdcUuid; + } + public void setAsdcUuid(String asdcUuid) { + this.asdcUuid = asdcUuid; + } + public String getAsdcLabel() { + return this.asdcLabel; + } + public void setAsdcLabel(String asdcLabel) { + this.asdcLabel = asdcLabel; + } + public String getAsdcResourceName() { + return asdcResourceName; + } + + public void setAsdcResourceName(String asdcResourceName) { + this.asdcResourceName = asdcResourceName; + } + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append ("ID=" + this.id); + if (this.description == null) { + sb.append(", description=null"); + } else { + sb.append(", description=" + this.description); + } + if (this.fileName == null) { + sb.append(", fileName=null"); + } else { + sb.append(",fileName=" + this.fileName); + } + if (this.fileBody == null) { + sb.append(", fileBody=null"); + } else { + sb.append(",fileBody=" + this.fileBody); + } + if (this.asdcResourceName == null) { + sb.append(", asdcResourceName=null"); + } else { + sb.append(",asdcResourceName=" + this.asdcResourceName); + } + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + sb.append(", vnfResourceId=" + this.vnfResourceId); + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java new file mode 100644 index 0000000000..eabbacf547 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java @@ -0,0 +1,97 @@ +/*- + * ============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; + +public class HeatNestedTemplate implements Serializable { + + private int parentTemplateId; + private int childTemplateId; + private String providerResourceFile; + public static final long serialVersionUID = -1322322139926390329L; + + public HeatNestedTemplate () { + super (); + } + + public void setParentTemplateId (int parentTemplateId) { + this.parentTemplateId = parentTemplateId; + } + + public int getParentTemplateId () { + return this.parentTemplateId; + } + + public void setChildTemplateId (int childTemplateId) { + this.childTemplateId = childTemplateId; + } + + public int getChildTemplateId () { + return this.childTemplateId; + } + + public void setProviderResourceFile (String providerResourceFile) { + this.providerResourceFile = providerResourceFile; + } + + public String getProviderResourceFile () { + return this.providerResourceFile; + } + + @Override + public String toString () { + StringBuilder sb = new StringBuilder (); + sb.append ("ParentTemplateId=" + this.parentTemplateId); + sb.append (", ChildTemplateId=" + this.childTemplateId); + if (this.providerResourceFile == null) { + sb.append (", providerResourceFile=null"); + } else { + sb.append (",providerResourceFile=" + this.providerResourceFile); + } + return sb.toString (); + } + + @Override + public boolean equals (Object o) { + if (!(o instanceof HeatNestedTemplate)) { + return false; + } + if (this == o) { + return true; + } + HeatNestedTemplate hnt = (HeatNestedTemplate) o; + if (hnt.getChildTemplateId () == this.childTemplateId && hnt.getParentTemplateId () == this.parentTemplateId) { + return true; + } + return false; + } + + @Override + public int hashCode () { + // hash code does not have to be a unique result - only that two objects that should be treated as equal + // return the same value. so this should work. + int result = 0; + result = this.parentTemplateId + this.childTemplateId; + return result; + } +} 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 new file mode 100644 index 0000000000..a80fa598b9 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java @@ -0,0 +1,217 @@ +/*- + * ============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.BufferedReader; +import java.io.FileReader; +import java.sql.Timestamp; +import java.text.DateFormat; +import java.util.Date; +import java.util.Set; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; +import org.openecomp.mso.logger.MsoLogger; + +public class HeatTemplate extends MavenLikeVersioning { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); + + private int id; + private String templateName; + private String templatePath = null; + private String templateBody = null; + private int timeoutMinutes; + private Set parameters; + private Set files; + private String description; + private String asdcUuid; + private String asdcResourceName; + private String asdcLabel; + + private Timestamp created; + + public enum TemplateStatus { + PARENT, CHILD, PARENT_COMPLETE + } + + public HeatTemplate () { + } + + public int getId () { + return id; + } + + public void setId (int id) { + this.id = id; + } + + public String getTemplateName () { + return templateName; + } + + public void setTemplateName (String templateName) { + this.templateName = templateName; + } + + public String getTemplatePath () { + return templatePath; + } + + public void setTemplatePath (String templatePath) { + this.templatePath = templatePath; + } + + public String getTemplateBody () { + return templateBody; + } + + public void setTemplateBody (String templateBody) { + this.templateBody = templateBody; + } + + public int getTimeoutMinutes () { + return timeoutMinutes; + } + + public void setTimeoutMinutes (int timeout) { + this.timeoutMinutes = timeout; + } + + public Set getParameters () { + return parameters; + } + + public void setParameters (Set parameters) { + this.parameters = parameters; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getHeatTemplate () { + if (templateBody != null && !templateBody.isEmpty ()) { + // The template body is in the DB table. Just return it. + return templateBody; + } + + String body = null; + + try (BufferedReader reader = new BufferedReader (new FileReader (templatePath))) + { + String line = null; + StringBuilder stringBuilder = new StringBuilder (); + while ((line = reader.readLine ()) != null) { + stringBuilder.append (line); + } + body = stringBuilder.toString (); + } catch (Exception e) { + LOGGER.debug ("Error reading template file " + templatePath, e); + } + + return body; + } + + public void setFiles (Set files) { + this.files = files; + } + + public Set getFiles () { + return this.files; + } + + public String getAsdcUuid() { + return asdcUuid; + } + + public void setAsdcUuid(String asdcUuidp) { + this.asdcUuid = asdcUuidp; + } + + public String getAsdcResourceName() { + return asdcResourceName; + } + + public void setAsdcResourceName(String asdcResourceName) { + this.asdcResourceName = asdcResourceName; + } + public String getAsdcLabel() { + return this.asdcLabel; + } + public void setAsdcLabel(String asdcLabel) { + this.asdcLabel = asdcLabel; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString () { + String body = (templateBody != null) ? "(" + templateBody.length () + " chars)" : "(Not defined)"; + StringBuilder sb = new StringBuilder (); + sb.append ("Template=") + .append (templateName) + .append (",version=") + .append (version) + .append (",path=") + .append (templatePath) + .append (",body=") + .append (body) + .append (",timeout=") + .append (timeoutMinutes) + .append (",asdcUuid=") + .append (asdcUuid) + .append (",asdcResourceName=") + .append (asdcResourceName) + .append (",description=") + .append (description); + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + + + if (parameters != null && !parameters.isEmpty ()) { + sb.append (",params=["); + for (HeatTemplateParam param : parameters) { + sb.append (param.getParamName ()); + if (param.isRequired ()) { + sb.append ("(reqd)"); + } + sb.append (","); + } + sb.replace (sb.length () - 1, sb.length (), "]"); + } + return sb.toString (); + } + + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java new file mode 100644 index 0000000000..0d77a0a4f8 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java @@ -0,0 +1,78 @@ +/*- + * ============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; + + +public class HeatTemplateParam { + private int id; + private int heatTemplateId; + private String paramName; + private boolean required; + private String paramType; + private String paramAlias; + + public HeatTemplateParam() {} + + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public int getHeatTemplateId() { + return heatTemplateId; + } + public void setHeatTemplateId(int heatTemplateId) { + this.heatTemplateId = heatTemplateId; + } + public String getParamName() { + return paramName; + } + public void setParamName(String paramName) { + this.paramName = paramName; + } + public boolean isRequired() { + return required; + } + public void setRequired(boolean required) { + this.required = required; + } + public String getParamAlias() { + return paramAlias; + } + public void setParamAlias(String paramAlias) { + this.paramAlias = paramAlias; + } + + public String getParamType() { + return paramType; + } + + public void setParamType (String paramType) { + this.paramType = paramType; + } + + + @Override + public String toString () { + return "Param=" + paramName + ",type=" + paramType + ",required=" + required + ",paramAlias=" + paramAlias; + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java new file mode 100644 index 0000000000..1cd3526946 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java @@ -0,0 +1,51 @@ +/*- + * ============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; + + +public class NetworkRecipe extends Recipe { + private String networkType; + private String networkParamXSD; + public NetworkRecipe() {} + + public String getNetworkType() { + return networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public String getNetworkParamXSD() { + return networkParamXSD; + } + public void setNetworkParamXSD(String networkParamXSD) { + this.networkParamXSD = networkParamXSD; + } + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append(super.toString()); + sb.append (",networkType=" + networkType); + sb.append (",networkParamXSD=" + networkParamXSD); + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java new file mode 100644 index 0000000000..be812fa346 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java @@ -0,0 +1,139 @@ +/*- + * ============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.utils.MavenLikeVersioning; + +import java.sql.Timestamp; +import java.text.DateFormat; + +public class NetworkResource extends MavenLikeVersioning { + private int id; + private String networkType; + private String orchestrationMode = null; + private String description = null; + private int templateId; + private String neutronNetworkType = null; + private String aicVersionMin = null; + private String aicVersionMax = null; + + private Timestamp created; + + public NetworkResource() {} + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getNetworkType() { + return networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public String getOrchestrationMode() { + return orchestrationMode; + } + public void setOrchestrationMode(String orchestrationMode) { + this.orchestrationMode = orchestrationMode; + } + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + public int getTemplateId () { + return templateId; + } + + public void setTemplateId (int templateId) { + this.templateId = templateId; + } + + public String getNeutronNetworkType() { + return neutronNetworkType; + } + + public void setNeutronNetworkType(String neutronNetworkType) { + this.neutronNetworkType = neutronNetworkType; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + public String getAicVersionMin() { + return aicVersionMin; + } + + public void setAicVersionMin(String aicVersionMin) { + this.aicVersionMin = aicVersionMin; + } + + public String getAicVersionMax() { + return aicVersionMax; + } + + public void setAicVersionMax(String aicVersionMax) { + this.aicVersionMax = aicVersionMax; + } + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append("NETWORK="); + sb.append(networkType); + sb.append(",version="); + sb.append(version); + sb.append(",mode="); + sb.append(orchestrationMode); + sb.append(",template="); + sb.append(templateId); + sb.append(",neutronType="); + sb.append(neutronNetworkType); + sb.append(",aicVersionMin="); + sb.append(aicVersionMin); + sb.append(",aicVersionMax="); + sb.append(aicVersionMax); + + sb.append("id="); + sb.append(id); + + 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/Recipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java new file mode 100644 index 0000000000..b0a34e6c60 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java @@ -0,0 +1,112 @@ +/*- + * ============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 Recipe extends MavenLikeVersioning { + + private int id; + protected String action; + private String description; + protected String orchestrationUri; + private int recipeTimeout; + private String serviceType; + + private Timestamp created; + + public Recipe () { + super (); + } + + public int getId () { + return id; + } + + public void setId (int id) { + this.id = id; + } + + public String getAction () { + return action; + } + + public void setAction (String action) { + this.action = action; + } + + public String getDescription () { + return description; + } + + public void setDescription (String description) { + this.description = description; + } + + public String getOrchestrationUri () { + return orchestrationUri; + } + + public void setOrchestrationUri (String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + public int getRecipeTimeout () { + return recipeTimeout; + } + + public void setRecipeTimeout (int recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + public String getServiceType () { + return serviceType; + } + + public void setServiceType (String serviceType) { + this.serviceType = serviceType; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("RECIPE: " + action); + sb.append(",uri=" + orchestrationUri); + + 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/Service.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java new file mode 100644 index 0000000000..07fb35596e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java @@ -0,0 +1,127 @@ +/*- + * ============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.utils.MavenLikeVersioning; + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.util.Map; + +public class Service extends MavenLikeVersioning { + private int id; + private String serviceName; + private String description; + private String httpMethod; + private String serviceNameVersionId; + private String serviceVersion; + private Map recipes; + + private String modelInvariantUUID; + private Timestamp created; + + public Service() {} + + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + + public String getServiceName() { + return serviceName; + } + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + public Map getRecipes() { + return recipes; + } + public void setRecipes(Map recipes) { + this.recipes = recipes; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + public String getHttpMethod() { + return httpMethod; + } + + public void setHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; + } + + public String getServiceNameVersionId() { + return serviceNameVersionId; + } + + public void setServiceNameVersionId(String serviceNameVersionId) { + this.serviceNameVersionId = serviceNameVersionId; + } + + public String getServiceVersion() { + return serviceVersion; + } + + public void setServiceVersion(String serviceVersion) { + this.serviceVersion = serviceVersion; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("SERVICE: id=" + id + ",name=" + serviceName + ",version=" + version + ",description=" + description+",modelInvariantUUID="+modelInvariantUUID); + for (String recipeAction : recipes.keySet()) { + ServiceRecipe recipe = recipes.get(recipeAction); + sb.append ("\n" + recipe.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/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java new file mode 100644 index 0000000000..53ec3ba278 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java @@ -0,0 +1,119 @@ +/*- + * ============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 ServiceRecipe extends MavenLikeVersioning { + private int id; + private int serviceId; + private String action; + private String description; + private String orchestrationUri; + private String serviceParamXSD; + private int recipeTimeout; + private Integer serviceTimeoutInterim; + + private Timestamp created; + + + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + + public int getServiceId() { + return serviceId; + } + public void setServiceId(int serviceId) { + this.serviceId = serviceId; + } + + public String getAction() { + return action; + } + public void setAction(String action) { + this.action = action; + } + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + public String getOrchestrationUri() { + return orchestrationUri; + } + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + public String getServiceParamXSD() { + return serviceParamXSD; + } + public void setServiceParamXSD(String serviceParamXSD) { + this.serviceParamXSD = serviceParamXSD; + } + + public int getRecipeTimeout() { + return recipeTimeout; + } + public void setRecipeTimeout(int recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + public Integer getServiceTimeoutInterim() { + return serviceTimeoutInterim; + } + + public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) { + this.serviceTimeoutInterim = serviceTimeoutInterim; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("RECIPE: " + action); + sb.append(",uri=" + orchestrationUri); + 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/VfModule.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java new file mode 100644 index 0000000000..505b3bba9a --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java @@ -0,0 +1,195 @@ +/*- + * ============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 VfModule extends MavenLikeVersioning { + + private int id; + private Integer vnfResourceId; + private String type; + private String modelName; + private int isBase; + private Integer templateId; + private Integer environmentId; + private Integer volTemplateId; + private Integer volEnvironmentId; + private String description; + private String asdcUuid; + private Timestamp created; + private String modelInvariantUuid; + private String modelVersion; + + 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; + } + + public void setType(String type) { + this.type = type; + } + + public int getIsBase() { + return this.isBase; + } + public void setIsBase(int isBase) { + this.isBase = isBase; + } + public boolean isBase() { + if (this.isBase == 0) { + return false; + } else { + return true; + } + } + + public Integer getTemplateId() { + return this.templateId; + } + public void setTemplateId(Integer templateId) { + this.templateId = templateId; + } + + public Integer getEnvironmentId() { + return this.environmentId; + } + public void setEnvironmentId(Integer environmentId) { + this.environmentId = environmentId; + } + + public Integer getVolTemplateId() { + return this.volTemplateId; + } + 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; + } + + public void setAsdcUuid(String asdcUuidp) { + this.asdcUuid = asdcUuidp; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + 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; + } + + @Override + public String toString () { + StringBuffer buf = new StringBuffer(); + + buf.append("VF="); + buf.append(this.type); + buf.append(",modelName="); + buf.append(modelName); + buf.append(",version="); + buf.append(version); + buf.append(",id="); + buf.append(this.id); + buf.append(",vnfResourceId="); + buf.append(this.vnfResourceId); + buf.append(",templateId="); + buf.append(this.templateId); + buf.append(",envtId="); + buf.append(this.environmentId); + buf.append(",volTemplateId="); + buf.append(this.volTemplateId); + buf.append(",volEnvtId="); + buf.append(this.volEnvironmentId); + buf.append(", description="); + buf.append(this.description); + buf.append(",asdcUuid="); + buf.append(asdcUuid); + buf.append(",modelVersion="); + buf.append(this.modelVersion); + + 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/VfModuleToHeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java new file mode 100644 index 0000000000..b0b00759f0 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java @@ -0,0 +1,83 @@ +/*- + * ============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; + +public class VfModuleToHeatFiles implements Serializable { + + private int vfModuleId; + private int heatFilesId; + public static final long serialVersionUID = -1322322139926390329L; + + public VfModuleToHeatFiles() { + super(); + } + + public int getVfModuleId() { + return this.vfModuleId; + } + public void setVfModuleId(int vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public int getHeatFilesId() { + return this.heatFilesId; + } + public void setHeatFilesId(int heatFilesId) { + this.heatFilesId = heatFilesId; + } + + @Override + public String toString () { + StringBuilder sb = new StringBuilder (); + sb.append ("VF_MODULE_ID=" + this.vfModuleId); + sb.append (", HEAT_FILES_ID=" + this.heatFilesId); + return sb.toString (); + } + + @Override + public boolean equals (Object o) { + if (!(o instanceof VfModuleToHeatFiles)) { + return false; + } + if (this == o) { + return true; + } + VfModuleToHeatFiles vmthf = (VfModuleToHeatFiles) o; + if (vmthf.getVfModuleId() == this.getVfModuleId() && vmthf.getVfModuleId() == this.getVfModuleId()) { + return true; + } + return false; + } + + @Override + public int hashCode () { + // hash code does not have to be a unique result - only that two objects that should be treated as equal + // return the same value. so this should work. + int result = 0; + result = this.vfModuleId + this.heatFilesId; + return result; + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java new file mode 100644 index 0000000000..5a05b957f0 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java @@ -0,0 +1,115 @@ +/*- + * ============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.io.Serializable; + +public class VnfComponent implements Serializable { + private int vnfId; + private String componentType = null; + private Integer heatTemplateId; + private Integer heatEnvironmentId; + public static final long serialVersionUID = -1322322139926390329L; + + private Timestamp created; + + public VnfComponent() {} + + public int getVnfId() { + return vnfId; + } + public void setVnfId(int id) { + this.vnfId = id; + } + + public String getComponentType() { + return componentType; + } + public void setComponentType(String ct) { + this.componentType = ct; + } + + public Integer getHeatTemplateId() { + return heatTemplateId; + } + public void setHeatTemplateId(Integer ht) { + this.heatTemplateId = ht; + } + + public Integer getHeatEnvironmentId() { + return heatEnvironmentId; + } + public void setHeatEnvironmentId(Integer he) { + this.heatEnvironmentId = he; + } + + public Timestamp getCreated() { + return created; + } + + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("VnfComponent: "); + sb.append("vnfId=" + vnfId); + sb.append(",componentType=" + componentType); + sb.append(",heatTemplateId=" + heatTemplateId); + sb.append(",heatEnvironmentId=" + heatEnvironmentId); + + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + return sb.toString(); + } + + @Override + public boolean equals (Object o) { + if (!(o instanceof VnfComponent)) { + return false; + } + if (this == o) { + return true; + } + VnfComponent vnfComponent = (VnfComponent) o; + if (vnfComponent.getVnfId() == this.vnfId && vnfComponent.componentType.equalsIgnoreCase(this.componentType)) { + return true; + } + return false; + } + + @Override + public int hashCode () { + // return the hashCode of the concat string of type+vnfId - should be okay. + int result = 0; + result = (this.componentType + this.vnfId).toString().hashCode(); + return result; + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java new file mode 100644 index 0000000000..547b2fc70a --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java @@ -0,0 +1,72 @@ +/*- + * ============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; + + +public class VnfComponentsRecipe extends Recipe { + + private String vnfType; + private String vnfComponentParamXSD; + private String vnfComponentType; + private String vfModuleId; + + public VnfComponentsRecipe() {} + + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getVnfComponentParamXSD() { + return vnfComponentParamXSD; + } + public void setVnfComponentParamXSD(String vnfComponentParamXSD) { + this.vnfComponentParamXSD = vnfComponentParamXSD; + } + + public String getVnfComponentType() { + return vnfComponentType; + } + public void setVnfComponentType(String vnfComponentType) { + this.vnfComponentType = vnfComponentType; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append(super.toString()); + sb.append (",vnfComponentParamXSD=" + vnfComponentParamXSD); + sb.append (",serviceType=" + getServiceType ()); + sb.append (",vnfComponentType=" + getVnfComponentType ()); + sb.append (",vfModuleId=" + getVfModuleId ()); + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java new file mode 100644 index 0000000000..1f0cd0ab1d --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java @@ -0,0 +1,63 @@ +/*- + * ============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; + + +public class VnfRecipe extends Recipe { + + private String vnfType; + private String vnfParamXSD; + private String vfModuleId; + + public VnfRecipe() {} + + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getVnfParamXSD() { + return vnfParamXSD; + } + public void setVnfParamXSD(String vnfParamXSD) { + this.vnfParamXSD = vnfParamXSD; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append(super.toString()); + sb.append (",vnfParamXSD=" + vnfParamXSD); + sb.append (",serviceType=" + getServiceType ()); + sb.append (",vfModuleId=" + getVfModuleId ()); + return sb.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 new file mode 100644 index 0000000000..60c7ef216e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java @@ -0,0 +1,225 @@ +/*- + * ============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 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 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; + + public VnfResource () { + } + + public int getId () { + return id; + } + + public void setId (int id) { + this.id = id; + } + + public String getVnfType () { + return vnfType; + } + + public void setVnfType (String vnfType) { + this.vnfType = vnfType; + } + + public String getOrchestrationMode () { + return orchestrationMode; + } + + public void setOrchestrationMode (String orchestrationMode) { + this.orchestrationMode = orchestrationMode; + } + + public String getDescription () { + return description; + } + + public void setDescription (String description) { + this.description = description; + } + + public Integer getTemplateId () { + return templateId; + } + + public void setTemplateId (Integer templateId) { + this.templateId = templateId; + } + + public Integer getEnvironmentId () { + return this.environmentId; + } + + public void setEnvironmentId (Integer environmentId) { + this.environmentId = environmentId; + } + + public Map getHeatFiles () { + return this.heatFiles; + } + + public void setHeatFiles (Map heatFiles) { + this.heatFiles = heatFiles; + } + + public String getAsdcUuid() { + return asdcUuid; + } + + public void setAsdcUuid(String asdcUuidp) { + this.asdcUuid = asdcUuidp; + } + + public Timestamp getCreated() { + return created; + } + + 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; + } + + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getServiceModelInvariantUUID() { + return serviceModelInvariantUUID; + } + + public void setServiceModelInvariantUUID(String serviceModelInvariantUUID) { + this.serviceModelInvariantUUID = serviceModelInvariantUUID; + } + + @Override + public String toString () { + StringBuffer buf = new StringBuffer(); + + buf.append("VNF="); + buf.append(vnfType); + buf.append(",version="); + buf.append(version); + buf.append(",mode="); + buf.append(orchestrationMode); + buf.append(",template="); + buf.append(templateId); + buf.append(",envtId="); + buf.append(environmentId); + buf.append(",asdcUuid="); + buf.append(asdcUuid); + buf.append(",aicVersionMin="); + buf.append(this.aicVersionMin); + buf.append(",aicVersionMax="); + buf.append(this.aicVersionMax); + buf.append(",modelInvariantUuid="); + buf.append(this.modelInvariantUuid); + buf.append(",modelVersion="); + buf.append(this.modelVersion); + buf.append(",modelCustomizationName="); + buf.append(this.modelCustomizationName); + buf.append(",modelName="); + buf.append(this.modelName); + buf.append(",serviceModelInvariantUUID="); + buf.append(this.serviceModelInvariantUUID); + + if (created != null) { + buf.append(",created="); + buf.append(DateFormat.getInstance().format(created)); + } + 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 new file mode 100644 index 0000000000..c617a4a6f4 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java @@ -0,0 +1,118 @@ +/*- + * ============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; + + + +/** + * 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 { + + protected String version; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** + * This method is used to compare the current object version to a specified one + * It is assumed that the version is like the maven one, eg: 2.0.1.5.6 + * + * @param versionToCompare The version that will be used for comparison + * @return True if the current object is more recent than the specified version, False otherwise + * + */ + public Boolean isMoreRecentThan (String versionToCompare) { + if (versionToCompare == null || this.version == null) { + return Boolean.FALSE; + } + String [] currentVersionArray = this.version.split("\\."); + String [] specifiedVersionArray = versionToCompare.split("\\."); + + int smalestStringLength = 0; + + if (currentVersionArray.length > specifiedVersionArray.length) { + smalestStringLength = specifiedVersionArray.length; + } else { + smalestStringLength = currentVersionArray.length; + } + + for (int currentVersionIndex=0;currentVersionIndex < smalestStringLength;++currentVersionIndex) { + + if (Integer.valueOf(currentVersionArray[currentVersionIndex]) < Integer.valueOf(specifiedVersionArray[currentVersionIndex])) { + return Boolean.FALSE; + } else if (Integer.valueOf(currentVersionArray[currentVersionIndex]) > Integer.valueOf(specifiedVersionArray[currentVersionIndex])) { + return Boolean.TRUE; + } + } + + // Even if versionToCompare has more digits, it means versionToCompare is more recent + if (Integer.valueOf(currentVersionArray[smalestStringLength-1]).intValue () == Integer.valueOf(specifiedVersionArray[smalestStringLength-1]).intValue ()) { + if (currentVersionArray.length > specifiedVersionArray.length) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + return Boolean.TRUE; + } + + /** + * This method is used to compare the current object version to a specified one + * It is assumed that the version is like the maven one, eg: 2.0.1.5.6 + * + * @param versionToCompare The version that will be used for comparison + * @return True if the current object is equal to the specified version, False otherwise + * + */ + public Boolean isTheSameVersion (String versionToCompare) { + if (versionToCompare == null && this.version == null) { + return Boolean.TRUE; + } else if (versionToCompare == null || this.version == null) { + return Boolean.FALSE; + } + String [] currentVersionArray = this.version.split("\\."); + String [] specifiedVersionArray = versionToCompare.split("\\."); + + if (currentVersionArray.length != specifiedVersionArray.length) { + return Boolean.FALSE; + } + + for (int currentVersionIndex=0;currentVersionIndex < currentVersionArray.length;++currentVersionIndex) { + + if (Integer.valueOf(currentVersionArray[currentVersionIndex]).intValue () != Integer.valueOf(specifiedVersionArray[currentVersionIndex]).intValue ()) { + return Boolean.FALSE; + } + } + + return Boolean.TRUE; + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparator.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparator.java new file mode 100644 index 0000000000..e80c03cc27 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparator.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; + + +import java.util.Comparator; + +/** + * This class can be used to sort object from MavenLikeVersioning type. + * + * + * + */ +public class MavenLikeVersioningComparator implements Comparator { + + @Override + public int compare(MavenLikeVersioning o1, MavenLikeVersioning o2) { + final int BEFORE = -1; + final int EQUAL = 0; + final int AFTER = 1; + + if (o1.isTheSameVersion(o2.getVersion())) { + return EQUAL; + } else if (o1.isMoreRecentThan(o2.getVersion())) { + return AFTER; + } else { + return BEFORE; + } + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/package-info.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/package-info.java new file mode 100644 index 0000000000..3644529fd3 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/package-info.java @@ -0,0 +1,26 @@ +/*- + * ============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========================================================= + */ + +/** + * Utility classes for catalog DB. + */ + +package org.openecomp.mso.db.catalog.utils; + diff --git a/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml b/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml new file mode 100644 index 0000000000..992e5d467a --- /dev/null +++ b/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml @@ -0,0 +1,58 @@ + + + + + + + + + This class describes a HEAT Environment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/HeatNestedTemplate.hbm.xml b/mso-catalog-db/src/main/resources/HeatNestedTemplate.hbm.xml new file mode 100644 index 0000000000..90ae8ab2ea --- /dev/null +++ b/mso-catalog-db/src/main/resources/HeatNestedTemplate.hbm.xml @@ -0,0 +1,38 @@ + + + + + + + + This class describes a nested HEAT template relationship + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml b/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml new file mode 100644 index 0000000000..9bc6fb1414 --- /dev/null +++ b/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml @@ -0,0 +1,93 @@ + + + + + + + + + This class describes a HEAT template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This class describes an input parameter to a heat template + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml b/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml new file mode 100644 index 0000000000..bdd16d37e6 --- /dev/null +++ b/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml @@ -0,0 +1,61 @@ + + + + + + + + + This class describes a Network recipe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml b/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml new file mode 100644 index 0000000000..b3b657aa9f --- /dev/null +++ b/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml @@ -0,0 +1,55 @@ + + + + + + + + + This class describes a Network Resource + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/Service.hbm.xml b/mso-catalog-db/src/main/resources/Service.hbm.xml new file mode 100644 index 0000000000..4e43413f47 --- /dev/null +++ b/mso-catalog-db/src/main/resources/Service.hbm.xml @@ -0,0 +1,84 @@ + + + + + + + + + This class describes a Service that may be orchestrated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This class describes a Service recipe + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/VfModule.hbm.xml b/mso-catalog-db/src/main/resources/VfModule.hbm.xml new file mode 100644 index 0000000000..1ccc48daf6 --- /dev/null +++ b/mso-catalog-db/src/main/resources/VfModule.hbm.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/VfModuleToHeatFiles.hbm.xml b/mso-catalog-db/src/main/resources/VfModuleToHeatFiles.hbm.xml new file mode 100644 index 0000000000..9af02d866a --- /dev/null +++ b/mso-catalog-db/src/main/resources/VfModuleToHeatFiles.hbm.xml @@ -0,0 +1,36 @@ + + + + + + + + This class describes a VF Module to HEAT Files Entry + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/VnfComponent.hbm.xml b/mso-catalog-db/src/main/resources/VnfComponent.hbm.xml new file mode 100644 index 0000000000..3cda770e63 --- /dev/null +++ b/mso-catalog-db/src/main/resources/VnfComponent.hbm.xml @@ -0,0 +1,43 @@ + + + + + + + + + VnfComponent describes a table of components for a VNF_RESOURCE + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml b/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml new file mode 100644 index 0000000000..e0ef0d2bc2 --- /dev/null +++ b/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml @@ -0,0 +1,53 @@ + + + + + + + + + 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 new file mode 100644 index 0000000000..ea2b39e861 --- /dev/null +++ b/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml @@ -0,0 +1,66 @@ + + + + + + + + + This class describes a VNF Recipe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/VnfResource.hbm.xml b/mso-catalog-db/src/main/resources/VnfResource.hbm.xml new file mode 100644 index 0000000000..4c9e3b59e3 --- /dev/null +++ b/mso-catalog-db/src/main/resources/VnfResource.hbm.xml @@ -0,0 +1,134 @@ + + + + + + + + + This class describes a VNF Resource + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This class describes a HEAT Template File + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/hibernate-catalog-ajsc.cfg.xml b/mso-catalog-db/src/main/resources/hibernate-catalog-ajsc.cfg.xml new file mode 100644 index 0000000000..7f28a36346 --- /dev/null +++ b/mso-catalog-db/src/main/resources/hibernate-catalog-ajsc.cfg.xml @@ -0,0 +1,75 @@ + + + + + + + + + org.hibernate.dialect.MySQL5Dialect + false + true + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..306dfc6d0b --- /dev/null +++ b/mso-catalog-db/src/main/resources/hibernate-catalog-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/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java new file mode 100644 index 0000000000..bfd4aa8e09 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java @@ -0,0 +1,1307 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:18:49 GMT 2016 + */ + +package org.openecomp.mso.db.catalog; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.MockitoExtension.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import org.openecomp.mso.db.catalog.beans.HeatEnvironment; +import org.openecomp.mso.db.catalog.beans.HeatFiles; +import org.openecomp.mso.db.catalog.beans.HeatTemplate; +import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; +import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.ServiceRecipe; +import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles; +import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe; +import org.openecomp.mso.db.catalog.beans.VnfRecipe; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import java.time.chrono.ChronoLocalDate; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.PrivateAccess; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.evosuite.runtime.mock.java.time.chrono.MockJapaneseDate; +import org.evosuite.runtime.mock.java.time.chrono.MockThaiBuddhistDate; +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) +public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + VfModuleToHeatFiles vfModuleToHeatFiles0 = mock(VfModuleToHeatFiles.class, new ViolatedAssumptionAnswer()); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn(vfModuleToHeatFiles0).when(list0).get(anyInt()); + doReturn(false).when(list0).isEmpty(); + doReturn(1, 1).when(list0).size(); + Query query0 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query1 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(list0).when(query1).list(); + doReturn(query0).when(query1).setParameter(anyString() , any()); + List list1 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + Query query2 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query3 = mock(Query.class, new ViolatedAssumptionAnswer()); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn("YF}DP?7kbDc>q", (String) null, "", "").when(session0).toString(); + doReturn(query1).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + // Undeclared exception! + 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 + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.APIH_GENERATED_REQUEST_ID; + MessageEnum messageEnum1 = MessageEnum.APIH_DUPLICATE_CHECK_EXC; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); + HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); + // Undeclared exception! + try { + catalogDatabase0.getVfModuleType((String) null, (String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + VnfComponentsRecipe vnfComponentsRecipe0 = mock(VnfComponentsRecipe.class, new ViolatedAssumptionAnswer()); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn(true).when(list0).isEmpty(); + Query query0 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query1 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(list0).when(query1).list(); + doReturn(query0).when(query1).setParameter(anyString() , any()); + List list1 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + Query query2 = mock(Query.class, new ViolatedAssumptionAnswer()); + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + Query query3 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(query2, query2, query2, query2).when(query3).setParameter(anyString() , any()); + doReturn(serviceRecipe0).when(query3).uniqueResult(); + Query query4 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(query4).list(); + doReturn((Query) null, (Query) null, (Query) null).when(query4).setParameter(anyString() , any()); + Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn("F4D:=_l\"v%zem^./^", "", "", ",volTemplateId=", ", fileName=null").when(session1).toString(); + doReturn(",volTemplateId=").when(session1).save(any()); + doReturn(query1, query3, query4).when(session1).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); + catalogDatabase0.getHeatEnvironment((-1)); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + Session session2 = mock(Session.class, new ViolatedAssumptionAnswer()); + HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); + doReturn("~+(<.").when(heatTemplate0).getAsdcResourceName(); + doReturn("qOWRn", "@;i!EF=FjdS;").when(heatTemplate0).getTemplateName(); + doReturn("o~%Y*9E5Pu.f").when(heatTemplate0).getVersion(); + Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); + HeatFiles heatFiles0 = mock(HeatFiles.class, new ViolatedAssumptionAnswer()); + doReturn("").when(heatFiles0).getAsdcResourceName(); + doReturn("@;i!EF=FjdS;", "~+(<.").when(heatFiles0).getFileName(); + doReturn((-1)).when(heatFiles0).getVnfResourceId(); + doReturn("i#C").when(heatFiles0).getVersion(); + catalogDatabase0.saveHeatFiles(heatFiles0); + Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); + // Undeclared exception! + try { + catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + MockJapaneseDate mockJapaneseDate0 = new MockJapaneseDate(); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn(true).when(list0).isEmpty(); + Query query0 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query1 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(list0).when(query1).list(); + doReturn(query0).when(query1).setParameter(anyString() , any()); + List list1 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(list1).get(anyInt()); + doReturn(false).when(list1).isEmpty(); + doReturn(0).when(list1).size(); + Query query2 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query3 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(list1).when(query3).list(); + doReturn(query2, query2, query2).when(query3).setParameter(anyString() , any()); + Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn("F4D:=_l\"v%zem^./^", "po=vr", "po=vr", "po=vr").when(session1).toString(); + doReturn("po=vr").when(session1).save(any()); + doReturn(query1, query3).when(session1).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); + catalogDatabase0.getHeatEnvironment((-1)); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + Session session2 = mock(Session.class, new ViolatedAssumptionAnswer()); + HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); + doReturn("").when(heatTemplate0).getAsdcResourceName(); + doReturn(0).when(heatTemplate0).getId(); + doReturn("", "RDu8*C_[t4L").when(heatTemplate0).getTemplateName(); + doReturn((String) null).when(heatTemplate0).getVersion(); + Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); + doReturn(true).when(iterator0).hasNext(); + doReturn((Object) null).when(iterator0).next(); + Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); + doReturn(iterator0).when(set0).iterator(); + // Undeclared exception! + try { + catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.RA_DB_INVALID_STATUS; + MessageEnum messageEnum1 = MessageEnum.LOGGER_UPDATE_SUC; + MessageEnum messageEnum2 = MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + HashMap hashMap0 = new HashMap(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + // Undeclared exception! + try { + catalogDatabase0.getService(hashMap0, "Successfully. No template found"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + // Undeclared exception! + try { + catalogDatabase0.getNestedTemplates(2377); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.APIH_QUERY_PARAM_WRONG; + MessageEnum messageEnum1 = MessageEnum.RA_SEND_REQUEST_SDNC; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + // Undeclared exception! + 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) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + Query query0 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query1 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(query0, query0).when(query1).setParameter(anyString() , any()); + doReturn((Object) null).when(query1).uniqueResult(); + Query query2 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(query2).list(); + doReturn((Query) null).when(query2).setParameter(anyString() , any()); + Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn("F4D:=_l\"v%zem^./^", "getVfModuleRecipe").when(session1).toString(); + doReturn(query1, query2).when(session1).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); + catalogDatabase0.getVnfComponent(187, ""); + // Undeclared exception! + try { + catalogDatabase0.getHeatEnvironment((-1)); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + 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) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.APIH_PROPERTY_LOAD_SUC; + MessageEnum messageEnum1 = MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + HashMap hashMap0 = new HashMap(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + // Undeclared exception! + try { + catalogDatabase0.getVnfComponentsRecipeByVfModuleId("", "(3", ""); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null, (String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + 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, ""); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + // Undeclared exception! + try { + catalogDatabase0.getService((String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + // Undeclared exception! + try { + catalogDatabase0.getVfModuleModelName("", "RiY"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.RA_UPDATE_TENANT_ERR; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + VnfRecipe vnfRecipe0 = mock(VnfRecipe.class, new ViolatedAssumptionAnswer()); + Service service0 = new Service(); + // Undeclared exception! + try { + catalogDatabase0.saveService(service0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(session0).toString(); + doReturn((Query) null).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + // Undeclared exception! + try { + catalogDatabase0.getNetworkRecipe("735uWxa&iIbU.4]O$", ",hpGX76\"X~ow4", ""); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); + VnfResource vnfResource0 = mock(VnfResource.class, new ViolatedAssumptionAnswer()); + // Undeclared exception! + try { + catalogDatabase0.saveService((Service) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.RA_CREATE_NETWORK_EXC; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + // Undeclared exception! + try { + catalogDatabase0.saveHeatTemplate((HeatTemplate) null, (Set) linkedHashSet0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + VnfResource vnfResource0 = mock(VnfResource.class, new ViolatedAssumptionAnswer()); + doReturn((-1)).when(vnfResource0).getId(); + doReturn("#5|%>JWRPJfP)S@").when(vnfResource0).getVnfType(); + // Undeclared exception! + try { + catalogDatabase0.saveOrUpdateVnfResource(vnfResource0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.RA_ANALYZE_ERROR_EXC; + MsoLogger.StatusCode.values(); + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.saveVnfRecipe((VnfRecipe) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Service service0 = mock(Service.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(service0).getServiceName(); + doReturn((String) null, (String) null).when(service0).getServiceNameVersionId(); + doReturn((String) null).when(service0).getServiceVersion(); + // Undeclared exception! + try { + catalogDatabase0.saveService(service0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.APIH_BAD_ORDER; + MessageEnum messageEnum1 = MessageEnum.RA_SEND_VNF_NOTIF_ERR; + MessageEnum messageEnum2 = MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND; + MessageEnum messageEnum3 = MessageEnum.RA_VNF_NOT_EXIST; + MsoLogger.ErrorCode msoLogger_ErrorCode0 = MsoLogger.ErrorCode.PermissionError; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + // Undeclared exception! + try { + catalogDatabase0.saveHeatEnvironment(heatEnvironment0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.APIH_GENERAL_METRICS; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.saveHeatEnvironment((HeatEnvironment) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getVnfRecipe((String) null, (String) null, (String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + MsoLogger.ErrorCode.values(); + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.rollback(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getAllHeatTemplates(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getHeatFilesForVfModule((-1539)); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getHeatEnvironment(0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getAllHeatEnvironment(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.commit(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + HeatFiles heatFiles0 = new HeatFiles(); + heatFiles0.setVersion("E0)WE F/LaV~i2U01"); + heatFiles0.setFileName("uIZl|"); + // Undeclared exception! + try { + catalogDatabase0.saveHeatFiles(heatFiles0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.saveVnfComponentsRecipe((VnfComponentsRecipe) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.INIT_LOGGER_FAIL; + MessageEnum messageEnum1 = MessageEnum.ASDC_CREATE_SERVICE; + MessageEnum messageEnum2 = MessageEnum.NO_PROPERTIES; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.healthCheck(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + catalogDatabase0.close(); + // Undeclared exception! + try { + catalogDatabase0.getHeatTemplate(1197); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test33() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getAllNetworkResources(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test34() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + 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) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test35() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getHeatTemplate((String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test36() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getVnfComponent(1987, "R$9=*_j3~I=:_"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test37() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + 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) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test38() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getVnfResourcesByRole(""); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test39() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.RA_ASYNC_DELETE_VNF; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getAllVnfResources(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test40() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(list0).get(anyInt()); + doReturn(false).when(list0).isEmpty(); + doReturn(0, 0).when(list0).size(); + Query query0 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query1 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(list0).when(query1).list(); + doReturn(query0).when(query1).setParameter(anyString() , any()); + Query query2 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(query2).list(); + doReturn((Query) null).when(query2).setParameter(anyString() , any()); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn("YF}DP?7kbDc>q", (String) null, "", "", "").when(session0).toString(); + doReturn(query1, query2).when(session0).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + catalogDatabase0.getHeatTemplate((String) null); + // Undeclared exception! + try { + catalogDatabase0.getHeatEnvironment(148); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test41() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(list0).get(anyInt()); + doReturn(false).when(list0).isEmpty(); + doReturn(0).when(list0).size(); + Query query0 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query1 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(list0).when(query1).list(); + doReturn(query0).when(query1).setParameter(anyString() , any()); + Query query2 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn((Query) null, (Query) null, (Query) null, (Query) null).when(query2).setParameter(anyString() , any()); + doReturn((Object) null).when(query2).uniqueResult(); + Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn("F4D:=_l\"v%zem^./^", "", "", ",volTemplateId=", (String) null).when(session1).toString(); + doReturn(",volTemplateId=").when(session1).save(any()); + doReturn(query1, query2, (Query) null).when(session1).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); + catalogDatabase0.getHeatEnvironment((-1)); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + Session session2 = mock(Session.class, new ViolatedAssumptionAnswer()); + HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); + doReturn("~+(<.").when(heatTemplate0).getAsdcResourceName(); + doReturn("qOWRn", "@;i!EF=FjdS;").when(heatTemplate0).getTemplateName(); + doReturn("o~%Y*9E5Pu.f").when(heatTemplate0).getVersion(); + Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); + HeatFiles heatFiles0 = mock(HeatFiles.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(heatFiles0).getAsdcResourceName(); + doReturn((String) null, (String) null).when(heatFiles0).getFileName(); + doReturn(0).when(heatFiles0).getVnfResourceId(); + doReturn((String) null).when(heatFiles0).getVersion(); + catalogDatabase0.saveHeatFiles(heatFiles0); + Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); + // Undeclared exception! + try { + catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test42() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(list0).get(anyInt()); + doReturn(false).when(list0).isEmpty(); + doReturn(0).when(list0).size(); + Query query0 = mock(Query.class, new ViolatedAssumptionAnswer()); + Query query1 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn(list0).when(query1).list(); + doReturn(query0).when(query1).setParameter(anyString() , any()); + Query query2 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(query2).list(); + doReturn((Query) null, (Query) null, (Query) null).when(query2).setParameter(anyString() , any()); + Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn("F4D:=_l\"v%zem^./^", "", "ASDC_PROPERTIES_NOT_FOUND").when(session1).toString(); + doReturn(query1, query2).when(session1).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); + catalogDatabase0.getHeatEnvironment((-1)); + PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); + Session session2 = mock(Session.class, new ViolatedAssumptionAnswer()); + HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); + doReturn("-wAG8.gOR.b_dq").when(heatTemplate0).getAsdcResourceName(); + doReturn("", "f:DC0FeMtZ").when(heatTemplate0).getTemplateName(); + doReturn("F4D:=_l\"v%zem^./^").when(heatTemplate0).getVersion(); + Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); + Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); + // Undeclared exception! + try { + catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test43() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + Session session0 = mock(Session.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); + Query query0 = mock(Query.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(query0).list(); + doReturn((Query) null).when(query0).setParameter(anyString() , any()); + Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); + doReturn("F4D:=_l\"v%zem^./^").when(session1).toString(); + doReturn(query0).when(session1).createQuery(anyString()); + PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); + // Undeclared exception! + try { + catalogDatabase0.getHeatEnvironment((-1)); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test44() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.GENERAL_EXCEPTION_ARG; + MessageEnum messageEnum1 = MessageEnum.RA_EVALUATE_XPATH_ERROR; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = ", vnfResourceId="; + String string1 = ""; + String string2 = "U`9Z8:QQUr-c(T@_/)"; + String string3 = "$q')fpKG]Q&i\"'{x"; + // Undeclared exception! + try { + catalogDatabase0.getNetworkResource("FT>Ri6U\"Ks<.H/g["); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test45() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + int int0 = 1030; + // Undeclared exception! + try { + catalogDatabase0.getAllVfModules(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test46() throws Throwable { + MsoLogger.ResponseCode msoLogger_ResponseCode0 = MsoLogger.ResponseCode.DataNotFound; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getVfModuleType("serviceVersion", "serviceVersion"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test47() throws Throwable { + MsoLogger.ResponseCode msoLogger_ResponseCode0 = MsoLogger.ResponseCode.Conflict; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getNestedTemplates(2377); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test48() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.APIH_SDNC_RESPONSE_ERROR; + MessageEnum messageEnum1 = MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC; + MessageEnum messageEnum2 = MessageEnum.RA_UPDATE_NETWORK_ERR; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = null; + // Undeclared exception! + try { + catalogDatabase0.getVnfResource((String) null, (String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test49() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = ", description="; + // Undeclared exception! + try { + catalogDatabase0.getServiceRecipe((-1319), ", description="); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test50() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = ",hpGX76\"X~ow4"; + String string1 = "735uWxa&iIbU.4]O$"; + String string2 = "APIH_ERROR_FROM_BPEL_SERVER"; + // Undeclared exception! + try { + catalogDatabase0.getNetworkRecipe("735uWxa&iIbU.4]O$", ",hpGX76\"X~ow4", ""); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test51() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = ",hpGX76\"X~ow4"; + String string1 = "APIH_ERROR_FROM_BPEL_SERVER"; + // Undeclared exception! + try { + catalogDatabase0.getNetworkRecipe("", ",hpGX76\"X~ow4"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test52() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = "$iJG7Jh~P"; + String string1 = "b4v5f&LOV|\\"; + String string2 = ""; + String string3 = null; + // Undeclared exception! + try { + catalogDatabase0.getVnfResource((String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test53() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = "Ikrt3T$WS\"UMs#Q"; + String string1 = null; + // Undeclared exception! + try { + catalogDatabase0.getServiceByUUID("Ikrt3T$WS\"UMs#Q"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test54() throws Throwable { + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = "v@(U"; + // Undeclared exception! + try { + catalogDatabase0.getVnfComponentsRecipe("!4@@1", "v@(U", "", (String) null, ""); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test55() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.RA_DB_INVALID_STATUS; + MessageEnum messageEnum1 = MessageEnum.LOGGER_UPDATE_SUC; + MessageEnum messageEnum2 = MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + HashMap hashMap0 = new HashMap(); + // Undeclared exception! + try { + catalogDatabase0.getService(hashMap0, "Successfully. No template found"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test56() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.APIH_PROPERTY_LOAD_SUC; + MessageEnum messageEnum1 = MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + try { + catalogDatabase0.getVnfComponentsRecipeByVfModuleId("", "(3", ""); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test57() throws Throwable { + MsoLogger.ResponseCode msoLogger_ResponseCode0 = MsoLogger.ResponseCode.ServiceNotAvailable; + MessageEnum messageEnum0 = MessageEnum.RA_CONFIG_LOAD; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + String string0 = ""; + String string1 = "RiY"; + // Undeclared exception! + try { + catalogDatabase0.getHeatEnvironment("", "RiY", "RiY"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test58() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.RA_CREATE_NETWORK_EXC; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + int int0 = 4811; + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + // Undeclared exception! + try { + catalogDatabase0.saveHeatTemplate(heatTemplate0, (Set) linkedHashSet0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } + + @Test(timeout = 4000) + public void test59() throws Throwable { + MessageEnum messageEnum0 = MessageEnum.APIH_QUERY_PARAM_WRONG; + MessageEnum messageEnum1 = MessageEnum.RA_SEND_REQUEST_SDNC; + CatalogDatabase catalogDatabase0 = new CatalogDatabase(); + // Undeclared exception! + 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) + // + verifyException("org.openecomp.mso.db.catalog.CatalogDatabase", e); + } + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTestscaffolding.java new file mode 100644 index 0000000000..c9bf8b40ba --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTestscaffolding.java @@ -0,0 +1,1093 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:18:49 GMT 2016 + */ + +package org.openecomp.mso.db.catalog; + +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 CatalogDatabaseESTestscaffolding { + + @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.CatalogDatabase"; + 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(CatalogDatabaseESTestscaffolding.class.getClassLoader() , + "org.hibernate.sql.Alias", + "org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator", + "org.hibernate.type.BasicType", + "org.hibernate.service.spi.ServiceInitiator", + "org.hibernate.type.UUIDBinaryType", + "org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor", + "org.hibernate.type.descriptor.java.NClobTypeDescriptor", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$4$1", + "org.hibernate.service.spi.SessionFactoryServiceRegistry", + "org.hibernate.Transaction", + "org.dom4j.tree.NamespaceStack", + "org.hibernate.annotations.common.reflection.ReflectionManager", + "org.hibernate.type.descriptor.java.ImmutableMutabilityPlan", + "org.hibernate.bytecode.spi.ReflectionOptimizer$InstantiationOptimizer", + "org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor", + "org.hibernate.mapping.FetchProfile", + "org.hibernate.id.TableHiLoGenerator", + "org.dom4j.tree.AbstractBranch", + "org.hibernate.type.NumericBooleanType", + "org.hibernate.annotations.common.reflection.ClassLoaderDelegate", + "org.hibernate.NaturalIdLoadAccess", + "org.hibernate.ScrollableResults", + "org.dom4j.Namespace", + "org.hibernate.engine.jdbc.batch.spi.BatchBuilder", + "org.dom4j.tree.DefaultDocumentType", + "org.hibernate.service.ConfigLoader", + "org.hibernate.metamodel.source.MetadataImplementor", + "org.hibernate.cfg.EJB3NamingStrategy", + "org.hibernate.boot.registry.classloading.spi.ClassLoaderService", + "org.hibernate.type.DoubleType", + "org.hibernate.mapping.Value", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$3$1", + "org.hibernate.type.descriptor.java.ClassTypeDescriptor", + "org.hibernate.service.internal.ConcurrentServiceBinding$Node", + "org.hibernate.CacheMode", + "org.hibernate.type.ForeignKeyDirection$2", + "org.hibernate.type.IdentifierBagType", + "org.hibernate.type.MapType", + "org.hibernate.cfg.MetadataSourceType", + "org.hibernate.dialect.Dialect", + "org.hibernate.boot.registry.selector.StrategyRegistration", + "org.hibernate.type.ForeignKeyDirection$1", + "org.hibernate.ScrollMode", + "org.hibernate.FetchMode", + "org.hibernate.type.CurrencyType", + "org.hibernate.persister.collection.CollectionPersister", + "org.hibernate.service.internal.ConcurrentServiceBinding$Entry", + "org.hibernate.metamodel.relational.Size", + "org.hibernate.AssertionFailure", + "org.hibernate.bytecode.spi.ReflectionOptimizer$AccessOptimizer", + "org.dom4j.tree.FlyweightComment", + "org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform", + "org.hibernate.type.CustomType", + "org.hibernate.id.enhanced.TableGenerator", + "org.hibernate.mapping.RelationalModel", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$5$1", + "org.hibernate.event.spi.PostUpdateEventListener", + "org.hibernate.type.descriptor.java.ClobTypeDescriptor", + "org.hibernate.hql.spi.MultiTableBulkIdStrategy$DeleteHandler", + "org.dom4j.tree.ConcurrentReaderHashMap$ValueIterator", + "org.hibernate.cfg.beanvalidation.IntegrationException", + "org.hibernate.proxy.ProxyFactory", + "org.hibernate.mapping.Filterable", + "org.hibernate.tool.hbm2ddl.SingleLineSqlCommandExtractor", + "org.hibernate.type.SortedSetType", + "org.hibernate.engine.config.spi.ConfigurationService", + "org.hibernate.engine.config.internal.ConfigurationServiceInitiator", + "org.hibernate.persister.spi.PersisterClassResolver", + "org.hibernate.type.TypeFactory", + "org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl", + "org.hibernate.secure.spi.PermissibleAction$1", + "org.hibernate.cfg.Configuration$CacheHolder", + "org.hibernate.annotations.common.reflection.Filter", + "org.hibernate.dialect.Sybase11Dialect", + "org.hibernate.engine.jdbc.spi.JdbcServices", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$4$1", + "org.hibernate.engine.transaction.jta.platform.internal.JRun4JtaPlatform", + "org.hibernate.type.descriptor.java.CalendarDateTypeDescriptor", + "org.hibernate.type.descriptor.java.CurrencyTypeDescriptor", + "org.hibernate.type.BlobType", + "org.hibernate.type.descriptor.java.BlobTypeDescriptor$BlobMutabilityPlan", + "org.hibernate.annotations.common.reflection.XClass", + "org.hibernate.dialect.PostgresPlusDialect", + "org.hibernate.engine.transaction.jta.platform.internal.JtaSynchronizationStrategy", + "org.hibernate.type.CharacterArrayType", + "org.hibernate.metamodel.binding.AttributeBindingContainer", + "org.hibernate.internal.util.xml.XmlDocument", + "org.hibernate.engine.jdbc.spi.SqlExceptionHelper", + "org.hibernate.dialect.DerbyTenSixDialect", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor", + "org.hibernate.hql.spi.MultiTableBulkIdStrategy$UpdateHandler", + "org.hibernate.integrator.spi.IntegratorService", + "org.hibernate.dialect.SAPDBDialect", + "org.hibernate.dialect.SybaseAnywhereDialect", + "org.hibernate.internal.util.ValueHolder", + "org.hibernate.engine.jdbc.internal.JdbcServicesImpl", + "org.hibernate.type.descriptor.sql.BigIntTypeDescriptor", + "org.hibernate.dialect.SybaseASE15Dialect", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.hibernate.engine.jdbc.internal.JdbcServicesInitiator", + "org.dom4j.tree.ConcurrentReaderHashMap$HashIterator", + "org.hibernate.type.AnyType", + "org.dom4j.util.SingletonStrategy", + "org.hibernate.type.descriptor.java.ByteArrayTypeDescriptor", + "org.dom4j.tree.BackedList", + "org.hibernate.service.ServiceRegistryBuilder", + "org.jboss.logging.JDKLoggerProvider", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl", + "org.hibernate.service.internal.ConcurrentServiceBinding", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2$1", + "org.hibernate.type.ListType", + "org.hibernate.type.IntegerType", + "org.hibernate.dialect.Ingres9Dialect", + "org.hibernate.dialect.TeradataDialect", + "org.hibernate.AnnotationException", + "org.hibernate.proxy.EntityNotFoundDelegate", + "org.hibernate.type.SetType", + "org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator", + "org.hibernate.ReplicationMode$1", + "org.hibernate.type.NClobType", + "org.hibernate.service.spi.Configurable", + "org.hibernate.ReplicationMode$2", + "org.hibernate.ReplicationMode$3", + "org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory", + "org.hibernate.ReplicationMode$4", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$5$1", + "org.openecomp.mso.db.catalog.beans.Service", + "org.hibernate.annotations.common.reflection.java.JavaReflectionManager", + "org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractor", + "org.hibernate.TransientObjectException", + "org.hibernate.id.IncrementGenerator", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.hibernate.annotations.common.reflection.java.generics.TypeEnvironmentFactory", + "org.hibernate.engine.spi.FilterDefinition", + "org.hibernate.type.TypeFactory$TypeScopeImpl", + "org.hibernate.annotations.common.reflection.XMethod", + "org.hibernate.engine.jdbc.connections.spi.ConnectionProvider", + "org.hibernate.type.ByteType", + "org.hibernate.event.spi.AbstractEvent", + "org.hibernate.integrator.spi.Integrator", + "org.hibernate.dialect.Oracle8iDialect", + "org.dom4j.ElementHandler", + "org.dom4j.tree.DefaultAttribute", + "org.hibernate.engine.transaction.spi.LocalStatus", + "org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor", + "org.hibernate.mapping.RootClass", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$3$1", + "org.hibernate.engine.loading.internal.CollectionLoadContext", + "org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform", + "org.hibernate.type.descriptor.sql.DoubleTypeDescriptor", + "org.hibernate.type.CompositeCustomType", + "org.hibernate.boot.registry.selector.spi.StrategySelectionException", + "org.hibernate.dialect.JDataStoreDialect", + "org.hibernate.annotations.common.util.impl.Log_$logger", + "org.dom4j.rule.Pattern", + "org.openecomp.mso.db.catalog.beans.HeatFiles", + "org.hibernate.dialect.PointbaseDialect", + "org.hibernate.dialect.DerbyDialect", + "org.hibernate.event.internal.EntityCopyNotAllowedObserver", + "org.hibernate.id.SelectGenerator", + "org.hibernate.dialect.TimesTenDialect", + "org.hibernate.internal.util.xml.ErrorLogger", + "org.hibernate.id.insert.InsertGeneratedIdentifierDelegate", + "org.dom4j.tree.AbstractComment", + "org.hibernate.MultiTenancyStrategy", + "org.dom4j.Branch", + "org.jboss.logging.DelegatingBasicLogger", + "org.hibernate.type.ShortType", + "org.hibernate.service.StandardServiceInitiators", + "org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry", + "org.hibernate.type.descriptor.sql.NCharTypeDescriptor", + "org.hibernate.service.spi.Manageable", + "org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl", + "org.hibernate.metamodel.domain.Type", + "org.dom4j.XPath", + "org.hibernate.type.VersionType", + "org.hibernate.integrator.internal.IntegratorServiceImpl", + "org.hibernate.dialect.Ingres10Dialect", + "org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl", + "org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor$TimestampMutabilityPlan", + "org.hibernate.type.AdaptedImmutableType", + "org.hibernate.type.TypeResolver", + "org.hibernate.type.descriptor.java.TimeZoneTypeDescriptor", + "org.hibernate.type.BinaryType", + "org.hibernate.bytecode.spi.BytecodeProvider", + "org.hibernate.SynchronizeableQuery", + "org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData", + "org.hibernate.metamodel.binding.EntityBinding", + "org.hibernate.type.descriptor.java.CharacterTypeDescriptor", + "org.hibernate.event.spi.EventSource", + "org.hibernate.id.IntegralDataTypeHolder", + "org.dom4j.tree.DefaultText", + "org.hibernate.engine.jdbc.dialect.internal.DialectResolverInitiator", + "org.hibernate.type.ManyToOneType", + "org.hibernate.engine.transaction.jta.platform.internal.JOTMJtaPlatform", + "org.hibernate.engine.jdbc.LobCreationContext", + "org.hibernate.engine.transaction.jta.platform.internal.JOnASJtaPlatform", + "org.hibernate.id.enhanced.SequenceStyleGenerator", + "org.hibernate.tuple.entity.DynamicMapEntityTuplizer", + "org.dom4j.tree.ConcurrentReaderHashMap$KeyIterator", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.hibernate.LockOptions", + "org.hibernate.type.descriptor.sql.TinyIntTypeDescriptor", + "org.hibernate.cache.internal.CollectionCacheInvalidator", + "org.hibernate.dialect.AbstractTransactSQLDialect", + "org.hibernate.annotations.common.reflection.XAnnotatedElement", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$5", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$4", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$3", + "org.hibernate.service.spi.ServiceContributor", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2", + "org.hibernate.jdbc.WorkExecutorVisitable", + "org.hibernate.service.spi.ServiceRegistryAwareService", + "org.hibernate.type.descriptor.sql.DecimalTypeDescriptor", + "org.dom4j.tree.AbstractDocument", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioningComparator", + "org.hibernate.dialect.FirebirdDialect", + "org.hibernate.id.SequenceIdentityGenerator", + "org.dom4j.Attribute", + "org.hibernate.type.descriptor.java.MutabilityPlan", + "org.hibernate.dialect.DerbyTenSevenDialect", + "org.jboss.logging.AbstractLoggerProvider", + "org.dom4j.Document", + "org.hibernate.boot.registry.BootstrapServiceRegistryBuilder", + "org.hibernate.Criteria", + "org.hibernate.annotations.common.reflection.java.JavaXCollectionType", + "org.hibernate.event.internal.EntityCopyAllowedLoggedObserver", + "org.dom4j.tree.ConcurrentReaderHashMap", + "org.hibernate.SessionEventListener", + "org.hibernate.dialect.MimerSQLDialect", + "org.openecomp.mso.db.catalog.beans.VnfResource", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.hibernate.InvalidMappingException", + "org.hibernate.service.UnknownUnwrapTypeException", + "org.hibernate.exception.spi.ViolatedConstraintNameExtracter", + "org.dom4j.tree.AbstractDocumentType", + "org.hibernate.persister.internal.PersisterFactoryInitiator", + "org.hibernate.metamodel.Metadata", + "org.hibernate.engine.transaction.jta.platform.internal.BorlandEnterpriseServerJtaPlatform", + "org.hibernate.engine.spi.Mapping", + "org.hibernate.service.Service", + "org.dom4j.CDATA", + "org.dom4j.tree.FlyweightText", + "org.hibernate.type.ObjectType", + "org.openecomp.mso.db.catalog.CatalogDatabase", + "org.hibernate.service.spi.ServiceRegistryImplementor", + "org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformResolver", + "org.dom4j.tree.ConcurrentReaderHashMap$BarrierLock", + "org.hibernate.type.descriptor.sql.LongVarbinaryTypeDescriptor", + "org.hibernate.type.DbTimestampType", + "org.hibernate.procedure.ProcedureCall", + "org.hibernate.service.UnknownServiceException", + "org.hibernate.id.BulkInsertionCapableIdentifierGenerator", + "org.hibernate.service.spi.Stoppable", + "org.hibernate.annotations.common.reflection.XProperty", + "org.hibernate.boot.registry.BootstrapServiceRegistry", + "org.hibernate.cfg.Configuration$MetadataSourceQueue", + "org.hibernate.type.descriptor.sql.NVarcharTypeDescriptor", + "org.hibernate.jdbc.Work", + "org.hibernate.type.PrimitiveType", + "org.hibernate.type.descriptor.sql.SmallIntTypeDescriptor", + "org.hibernate.tuple.entity.PojoEntityTuplizer", + "org.hibernate.engine.jdbc.dialect.internal.DialectFactoryInitiator", + "org.hibernate.usertype.UserType", + "org.hibernate.type.TimeType", + "org.hibernate.internal.util.xml.XMLHelper", + "org.hibernate.annotations.common.reflection.MetadataProvider", + "org.hibernate.cfg.beanvalidation.BeanValidationIntegrator", + "org.hibernate.tuple.entity.AbstractEntityTuplizer", + "org.hibernate.service.spi.ServiceBinding$ServiceLifecycleOwner", + "org.jboss.logging.LoggerProvider", + "org.hibernate.tool.hbm2ddl.ImportScriptException", + "org.dom4j.io.SAXReader", + "org.hibernate.id.IdentityGenerator", + "org.hibernate.type.ForeignKeyDirection", + "org.hibernate.persister.entity.Joinable", + "org.hibernate.type.BigDecimalType", + "org.hibernate.type.WrapperBinaryType", + "org.hibernate.internal.util.ConfigHelper", + "org.hibernate.id.enhanced.AccessCallback", + "org.dom4j.DocumentType", + "org.hibernate.dialect.PostgreSQL82Dialect", + "com.att.eelf.configuration.SLF4jWrapper", + "org.hibernate.id.Configurable", + "org.hibernate.id.SequenceGenerator", + "org.hibernate.dialect.Oracle9iDialect", + "org.hibernate.cfg.Configuration", + "org.dom4j.tree.DefaultDocument", + "org.hibernate.engine.spi.SessionFactoryImplementor", + "org.jboss.logging.AbstractMdcLoggerProvider", + "org.hibernate.type.SerializationException", + "org.hibernate.cfg.annotations.reflection.XMLContext$Default", + "org.hibernate.type.descriptor.java.CalendarTypeDescriptor$CalendarMutabilityPlan", + "org.openecomp.mso.logger.MsoLogger", + "org.hibernate.engine.jndi.spi.JndiService", + "org.dom4j.tree.ConcurrentReaderHashMap$KeySet", + "org.hibernate.type.BooleanType", + "org.hibernate.mapping.Collection", + "org.hibernate.type.descriptor.sql.TimestampTypeDescriptor", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor", + "org.hibernate.engine.jndi.internal.JndiServiceImpl", + "org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor", + "org.hibernate.metamodel.source.BindingContext", + "org.hibernate.cache.internal.RegionFactoryInitiator", + "org.openecomp.mso.db.catalog.beans.HeatTemplateParam", + "org.dom4j.util.SimpleSingleton", + "org.hibernate.cfg.annotations.reflection.XMLContext", + "org.hibernate.metamodel.binding.AttributeBinding", + "org.hibernate.type.CharacterType", + "org.hibernate.type.FloatType", + "org.hibernate.annotations.common.reflection.AnnotationReader", + "org.hibernate.internal.util.xml.XmlInfrastructureException", + "org.jboss.logging.LoggerProviders$1", + "org.hibernate.internal.util.xml.XmlDocumentImpl", + "org.openecomp.mso.db.catalog.beans.HeatEnvironment", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$4$1", + "org.hibernate.id.factory.IdentifierGeneratorFactory", + "org.hibernate.type.CollectionType", + "org.hibernate.type.descriptor.java.ByteTypeDescriptor", + "org.hibernate.boot.registry.StandardServiceRegistryBuilder", + "org.hibernate.secure.internal.DisabledJaccServiceImpl", + "org.hibernate.secure.spi.JaccService", + "org.hibernate.tuple.Tuplizer", + "org.hibernate.internal.util.ValueHolder$DeferredInitializer", + "org.hibernate.internal.util.xml.Origin", + "org.hibernate.engine.transaction.jta.platform.internal.TransactionManagerAccess", + "org.hibernate.type.ComponentType", + "org.hibernate.engine.jdbc.spi.ResultSetWrapper", + "org.hibernate.service.spi.Startable", + "org.hibernate.type.DiscriminatorType", + "org.hibernate.type.descriptor.sql.BooleanTypeDescriptor", + "org.dom4j.Comment", + "org.hibernate.service.internal.ProvidedService", + "org.hibernate.type.descriptor.java.BlobTypeDescriptor", + "org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$TcclSafeAggregatedClassLoader", + "org.jboss.logging.Slf4jLoggerProvider", + "org.hibernate.type.SortedMapType", + "org.hibernate.type.LongType", + "org.hibernate.annotations.common.reflection.MetadataProviderInjector", + "org.hibernate.type.descriptor.java.LongTypeDescriptor", + "org.hibernate.id.UUIDGenerationStrategy", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.hibernate.LockMode", + "org.jboss.logging.Slf4jLocationAwareLogger$1", + "org.hibernate.boot.registry.selector.spi.StrategySelector", + "org.hibernate.EntityMode", + "org.hibernate.dialect.HSQLDialect", + "org.hibernate.Session$LockRequest", + "org.hibernate.type.descriptor.java.BigDecimalTypeDescriptor", + "org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory", + "org.hibernate.engine.jdbc.batch.internal.BatchBuilderInitiator", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.openecomp.mso.db.catalog.beans.VnfComponent", + "com.att.eelf.configuration.EELFManager", + "org.dom4j.Text", + "org.dom4j.tree.AbstractCharacterData", + "org.hibernate.engine.transaction.jta.platform.internal.ResinJtaPlatform", + "org.hibernate.service.ServiceRegistry", + "org.dom4j.io.DOMReader", + "org.hibernate.type.TimestampType", + "org.hibernate.persister.internal.PersisterClassResolverInitiator", + "org.jboss.logging.Logger$Level", + "org.hibernate.type.NTextType", + "org.hibernate.UnknownProfileException", + "org.hibernate.engine.spi.CollectionKey", + "org.hibernate.type.descriptor.java.JavaTypeDescriptor", + "org.hibernate.type.descriptor.sql.LongVarcharTypeDescriptor", + "org.hibernate.secure.spi.GrantedPermission", + "org.hibernate.type.Type", + "org.hibernate.engine.jdbc.cursor.internal.RefCursorSupportInitiator", + "org.hibernate.MappingNotFoundException", + "org.hibernate.internal.util.collections.JoinedIterator", + "org.hibernate.jmx.internal.JmxServiceInitiator", + "org.hibernate.type.descriptor.java.JdbcTimeTypeDescriptor", + "org.hibernate.type.CustomCollectionType", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$3$1", + "org.hibernate.event.service.spi.DuplicationStrategy", + "org.hibernate.type.PostgresUUIDType$PostgresUUIDSqlTypeDescriptor", + "org.dom4j.io.DispatchHandler", + "org.hibernate.annotations.common.util.impl.LoggerFactory", + "org.hibernate.dialect.SQLServer2005Dialect", + "org.dom4j.Entity", + "org.hibernate.boot.registry.selector.StrategyRegistrationProvider", + "org.hibernate.id.PostInsertIdentifierGenerator", + "org.hibernate.type.descriptor.java.ShortTypeDescriptor", + "org.hibernate.type.descriptor.sql.NumericTypeDescriptor", + "org.hibernate.dialect.CUBRIDDialect", + "org.hibernate.annotations.common.reflection.java.JavaXType", + "org.hibernate.integrator.spi.ServiceContributingIntegrator", + "org.hibernate.type.descriptor.java.StringTypeDescriptor", + "org.dom4j.ProcessingInstruction", + "org.hibernate.boot.registry.StandardServiceRegistry", + "org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor$DateMutabilityPlan", + "org.hibernate.id.IdentifierGenerator", + "org.hibernate.engine.jdbc.dialect.spi.DialectResolver", + "org.hibernate.engine.jdbc.spi.SqlExceptionHelper$WarningHandler", + "org.hibernate.type.OneToOneType", + "org.hibernate.id.GUIDGenerator", + "org.hibernate.internal.util.xml.MappingReader$SupportedOrmXsdVersion", + "org.dom4j.io.ElementStack", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$5", + "org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl", + "org.hibernate.SessionFactory", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$3", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$4", + "org.hibernate.type.MaterializedClobType", + "org.hibernate.type.BigIntegerType", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$2", + "org.hibernate.service.internal.AbstractServiceRegistryImpl", + "com.att.eelf.i18n.EELFMsgs", + "org.hibernate.dialect.SybaseASE157Dialect", + "org.dom4j.tree.AbstractText", + "org.hibernate.Version", + "org.hibernate.engine.transaction.jta.platform.internal.WeblogicJtaPlatform", + "org.hibernate.cache.spi.OptimisticCacheSource", + "org.hibernate.dialect.SQLServerDialect", + "org.hibernate.dialect.SybaseDialect", + "org.hibernate.engine.spi.CascadeStyle", + "org.dom4j.tree.NamespaceCache", + "org.hibernate.engine.jdbc.dialect.spi.DialectFactory", + "org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformResolverInitiator", + "org.hibernate.internal.util.xml.OriginImpl", + "org.hibernate.jmx.spi.JmxService", + "org.hibernate.id.UUIDGenerator", + "org.hibernate.persister.spi.PersisterFactory", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$2$1", + "org.hibernate.TypeHelper", + "org.hibernate.cfg.AvailableSettings", + "org.hibernate.type.PostgresUUIDType", + "org.hibernate.dialect.DB2Dialect", + "org.hibernate.Session", + "org.hibernate.internal.util.config.ConfigurationHelper", + "org.dom4j.tree.QNameCache", + "org.hibernate.SimpleNaturalIdLoadAccess", + "org.hibernate.engine.transaction.jta.platform.internal.BitronixJtaPlatform", + "org.jboss.logging.BasicLogger", + "org.hibernate.type.SpecialOneToOneType", + "org.hibernate.internal.util.config.ConfigurationException", + "org.hibernate.metamodel.spi.TypeContributor", + "org.hibernate.engine.transaction.jta.platform.internal.SunOneJtaPlatform", + "org.hibernate.engine.jdbc.connections.internal.MultiTenantConnectionProviderInitiator", + "org.hibernate.cfg.Environment", + "org.hibernate.hql.spi.TemporaryTableBulkIdStrategy", + "org.hibernate.type.LocaleType", + "org.hibernate.boot.registry.internal.StandardServiceRegistryImpl", + "org.hibernate.type.descriptor.sql.SqlTypeDescriptor", + "org.dom4j.NodeFilter", + "org.hibernate.type.descriptor.java.FloatTypeDescriptor", + "org.hibernate.type.descriptor.java.UrlTypeDescriptor", + "org.dom4j.tree.DefaultComment", + "org.hibernate.type.descriptor.java.SerializableTypeDescriptor", + "org.hibernate.dialect.MySQL5InnoDBDialect", + "org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory", + "org.hibernate.usertype.CompositeUserType", + "org.hibernate.engine.jdbc.spi.SqlStatementLogger", + "org.hibernate.mapping.Table", + "org.hibernate.secure.spi.IntegrationException", + "org.hibernate.mapping.AuxiliaryDatabaseObject", + "org.hibernate.annotations.common.reflection.XMember", + "org.hibernate.type.descriptor.sql.VarcharTypeDescriptor", + "org.hibernate.type.descriptor.java.PrimitiveCharacterArrayTypeDescriptor", + "org.hibernate.type.descriptor.java.UUIDTypeDescriptor", + "org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData$SQLStateType", + "org.openecomp.mso.db.catalog.beans.Recipe", + "org.hibernate.secure.spi.JaccIntegrator$1", + "org.hibernate.id.factory.internal.MutableIdentifierGeneratorFactoryInitiator", + "org.hibernate.cfg.SettingsFactory", + "org.dom4j.io.SAXContentHandler", + "org.dom4j.QName", + "org.hibernate.type.AssociationType", + "org.hibernate.cfg.ExtendsQueueEntry", + "org.hibernate.ReplicationMode", + "org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader", + "org.dom4j.tree.DefaultElement", + "org.hibernate.engine.transaction.spi.TransactionImplementor", + "org.hibernate.persister.entity.EntityPersister", + "org.dom4j.Node", + "org.hibernate.service.spi.ServiceBinding", + "org.hibernate.type.BasicTypeRegistry", + "org.hibernate.internal.util.ValueHolder$1", + "org.hibernate.dialect.function.SQLFunction", + "org.hibernate.NonUniqueResultException", + "org.hibernate.SessionFactoryObserver", + "org.hibernate.type.descriptor.sql.RealTypeDescriptor", + "org.hibernate.dialect.PostgreSQL81Dialect", + "org.hibernate.collection.spi.PersistentCollection", + "org.hibernate.type.descriptor.sql.DateTypeDescriptor", + "org.dom4j.tree.AbstractAttribute", + "org.hibernate.internal.CoreMessageLogger_$logger", + "org.hibernate.dialect.PostgreSQLDialect", + "org.hibernate.dialect.MySQLDialect", + "org.hibernate.internal.jaxb.cfg.JaxbHibernateConfiguration", + "org.openecomp.mso.db.catalog.beans.VnfRecipe", + "org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform", + "org.hibernate.service.ConfigLoader$1", + "org.hibernate.type.MaterializedNClobType", + "org.hibernate.type.IdentifierType", + "org.hibernate.type.SingleColumnType", + "org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor", + "org.hibernate.SessionBuilder", + "org.openecomp.mso.db.catalog.beans.NetworkRecipe", + "org.hibernate.mapping.MetaAttributable", + "org.hibernate.type.descriptor.java.MutableMutabilityPlan", + "org.hibernate.secure.spi.JaccPermissionDeclarations", + "org.hibernate.type.UrlType", + "org.hibernate.tuple.entity.AbstractEntityTuplizer$MappedIdentifierValueMarshaller", + "org.hibernate.tuple.component.ComponentMetamodel", + "org.hibernate.persister.walking.spi.EntityDefinition", + "org.hibernate.type.YesNoType", + "org.hibernate.id.AbstractPostInsertGenerator", + "org.openecomp.mso.db.catalog.beans.VfModule", + "org.hibernate.annotations.common.reflection.java.JavaXArrayType", + "org.hibernate.exception.spi.SQLExceptionConverter", + "org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader$1", + "org.hibernate.type.AbstractStandardBasicType", + "org.hibernate.hql.spi.QueryTranslatorFactory", + "org.hibernate.SharedSessionContract", + "org.hibernate.cfg.Configuration$ObjectNameNormalizerImpl", + "org.hibernate.annotations.common.reflection.java.JavaXSimpleType", + "org.hibernate.cfg.ObjectNameNormalizer", + "org.hibernate.service.internal.SessionFactoryServiceRegistryFactoryImpl", + "org.hibernate.service.internal.ServiceDependencyException", + "org.hibernate.event.spi.PostDeleteEvent", + "org.hibernate.type.descriptor.java.BooleanTypeDescriptor", + "org.hibernate.type.descriptor.sql.FloatTypeDescriptor", + "org.hibernate.type.descriptor.sql.SqlTypeDescriptorRegistry", + "org.hibernate.dialect.InformixDialect", + "org.jboss.logging.Logger", + "org.hibernate.cfg.Configuration$1", + "org.hibernate.tuple.entity.EntityMetamodel$GenerationStrategyPair", + "org.hibernate.type.ImageType", + "org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory", + "org.hibernate.engine.transaction.jta.platform.internal.JBossStandAloneJtaPlatform", + "org.hibernate.cfg.Configuration$3", + "org.hibernate.engine.jndi.JndiNameException", + "org.hibernate.dialect.PostgreSQL9Dialect", + "org.hibernate.type.CompositeType", + "org.openecomp.mso.db.catalog.beans.HeatNestedTemplate", + "org.dom4j.ElementPath", + "org.jboss.logging.LoggerProviders", + "org.hibernate.type.descriptor.WrapperOptions", + "org.hibernate.id.SequenceHiLoGenerator", + "org.hibernate.type.descriptor.java.NClobTypeDescriptor$NClobMutabilityPlan", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$3", + "org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles", + "org.openecomp.mso.entity.MsoRequest", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$2", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$4", + "org.hibernate.secure.spi.JaccIntegrator", + "org.hibernate.tuple.entity.EntityMetamodel", + "org.hibernate.dialect.DerbyTenFiveDialect", + "org.hibernate.tuple.Instantiator", + "org.hibernate.type.descriptor.java.AbstractTypeDescriptor", + "org.hibernate.type.BagType", + "org.hibernate.type.CalendarType", + "org.hibernate.internal.util.ClassLoaderHelper", + "org.hibernate.BasicQueryContract", + "org.hibernate.CallbackException", + "org.hibernate.engine.jdbc.LobCreator", + "org.hibernate.type.descriptor.java.DoubleTypeDescriptor", + "org.dom4j.Element", + "org.hibernate.dialect.FrontBaseDialect", + "org.hibernate.boot.registry.classloading.spi.ClassLoadingException", + "org.hibernate.tuple.entity.EntityTuplizerFactory", + "org.hibernate.stat.SessionStatistics", + "org.hibernate.type.OrderedSetType", + "org.hibernate.mapping.TableOwner", + "org.hibernate.type.descriptor.ValueBinder", + "org.hibernate.bytecode.spi.ReflectionOptimizer", + "org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$Work", + "org.hibernate.dialect.DB2390Dialect", + "org.hibernate.engine.jdbc.connections.internal.UserSuppliedConnectionProviderImpl", + "org.hibernate.type.descriptor.java.LocaleTypeDescriptor", + "org.hibernate.engine.transaction.jta.platform.internal.WebSphereJtaPlatform", + "org.hibernate.engine.jdbc.spi.JdbcConnectionAccess", + "org.hibernate.SharedSessionBuilder", + "org.openecomp.mso.db.catalog.beans.NetworkResource", + "org.hibernate.type.TimeZoneType", + "org.hibernate.mapping.PersistentClass", + "org.hibernate.tuple.entity.EntityTuplizer", + "org.hibernate.engine.transaction.jta.platform.internal.OC4JJtaPlatform", + "org.hibernate.type.descriptor.java.ClobTypeDescriptor$ClobMutabilityPlan", + "org.hibernate.Query", + "org.hibernate.annotations.common.reflection.java.generics.TypeEnvironment", + "org.hibernate.internal.util.beans.BeanInfoHelper$BeanInfoDelegate", + "org.hibernate.event.spi.PostDeleteEventListener", + "org.jboss.logging.Slf4jLogger", + "org.hibernate.annotations.common.Version", + "org.hibernate.EmptyInterceptor", + "org.hibernate.type.descriptor.sql.TimeTypeDescriptor", + "org.hibernate.type.descriptor.java.IntegerTypeDescriptor", + "org.hibernate.bytecode.spi.ClassTransformer", + "org.hibernate.id.TableGenerator", + "org.hibernate.id.Assigned", + "com.att.eelf.configuration.EELFLogger$Level", + "org.hibernate.type.ClobType", + "org.hibernate.id.UUIDHexGenerator", + "org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory", + "org.hibernate.id.enhanced.DatabaseStructure", + "org.hibernate.cache.CacheException", + "org.hibernate.event.spi.PostUpdateEvent", + "org.hibernate.type.TypeFactory$1", + "org.hibernate.HibernateException", + "org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider", + "org.hibernate.cfg.annotations.reflection.JPAMetadataProvider", + "org.hibernate.cfg.NamingStrategy", + "org.hibernate.dialect.H2Dialect", + "org.hibernate.type.descriptor.sql.BasicBinder", + "org.hibernate.dialect.IngresDialect", + "org.hibernate.persister.walking.spi.CollectionDefinition", + "org.dom4j.tree.ConcurrentReaderHashMap$Entry", + "org.hibernate.tool.hbm2ddl.DatabaseMetadata", + "org.hibernate.id.ForeignGenerator", + "org.hibernate.type.EmbeddedComponentType", + "org.hibernate.event.spi.PostInsertEvent", + "com.att.eelf.configuration.EELFLogger", + "org.hibernate.type.descriptor.sql.LongNVarcharTypeDescriptor", + "org.hibernate.type.descriptor.sql.CharTypeDescriptor", + "org.hibernate.type.descriptor.sql.IntegerTypeDescriptor", + "org.hibernate.type.CharacterNCharType", + "org.hibernate.internal.util.xml.DTDEntityResolver", + "org.dom4j.io.JAXPHelper", + "org.hibernate.cache.spi.RegionFactory", + "org.dom4j.tree.FlyweightAttribute", + "org.hibernate.engine.jndi.internal.JndiServiceInitiator", + "org.dom4j.IllegalAddException", + "org.hibernate.type.descriptor.java.BigIntegerTypeDescriptor", + "org.hibernate.annotations.common.reflection.XPackage", + "org.hibernate.persister.walking.spi.AttributeSource", + "org.hibernate.internal.util.compare.ComparableComparator", + "org.dom4j.tree.AbstractNode", + "org.dom4j.Visitor", + "org.hibernate.type.XmlRepresentableType", + "org.dom4j.CharacterData", + "org.hibernate.type.AbstractSingleColumnStandardBasicType", + "org.hibernate.bytecode.spi.ProxyFactoryFactory", + "org.hibernate.cfg.Mappings", + "org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform", + "org.hibernate.type.DateType", + "org.hibernate.type.descriptor.java.UUIDTypeDescriptor$ValueTransformer", + "org.hibernate.cfg.RecoverableException", + "org.hibernate.type.SerializableType", + "org.hibernate.bytecode.buildtime.spi.ClassFilter", + "org.hibernate.internal.util.xml.MappingReader", + "org.hibernate.dialect.DB2400Dialect", + "org.openecomp.mso.db.catalog.beans.HeatTemplate", + "org.hibernate.hql.spi.PersistentTableBulkIdStrategy", + "org.hibernate.engine.jdbc.spi.SchemaNameResolver", + "org.hibernate.annotations.common.util.StandardClassLoaderDelegateImpl", + "org.hibernate.IdentifierLoadAccess", + "org.hibernate.annotations.common.reflection.ClassLoadingException", + "org.hibernate.metamodel.domain.AttributeContainer", + "org.hibernate.type.UUIDCharType", + "org.hibernate.transform.ResultTransformer", + "org.hibernate.cache.internal.NoCachingRegionFactory", + "org.hibernate.service.spi.ServiceException", + "org.hibernate.internal.util.collections.CollectionHelper", + "org.hibernate.exception.spi.SQLExceptionConversionDelegate", + "org.hibernate.secure.spi.PermissibleAction", + "org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe", + "org.hibernate.annotations.common.reflection.java.JavaMetadataProvider", + "org.hibernate.Filter", + "org.hibernate.context.spi.CurrentTenantIdentifierResolver", + "org.hibernate.SQLQuery", + "org.hibernate.Interceptor", + "org.dom4j.tree.ConcurrentReaderHashMap$Values", + "org.dom4j.io.SAXHelper", + "org.hibernate.engine.jndi.JndiException", + "org.hibernate.dialect.MckoiDialect", + "org.hibernate.engine.transaction.internal.TransactionFactoryInitiator", + "org.hibernate.LobHelper", + "org.hibernate.exception.spi.ConversionContext", + "org.hibernate.JDBCException", + "org.hibernate.engine.jdbc.dialect.internal.DialectResolverSet", + "org.hibernate.type.TextType", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor", + "org.hibernate.dialect.Oracle10gDialect", + "org.hibernate.engine.jdbc.cursor.spi.RefCursorSupport", + "org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder", + "org.hibernate.id.AbstractUUIDGenerator", + "org.openecomp.mso.db.catalog.beans.ServiceRecipe", + "org.hibernate.hql.spi.MultiTableBulkIdStrategy", + "org.hibernate.type.LiteralType", + "org.hibernate.service.internal.SessionFactoryServiceRegistryFactoryInitiator", + "org.hibernate.service.spi.SessionFactoryServiceRegistryFactory", + "org.hibernate.metamodel.spi.TypeContributions", + "org.hibernate.service.spi.InjectService", + "org.hibernate.engine.loading.internal.EntityLoadContext", + "org.hibernate.type.ClassType", + "org.hibernate.type.TypeFactory$TypeScope", + "org.hibernate.type.descriptor.java.ArrayMutabilityPlan", + "org.hibernate.bytecode.buildtime.spi.FieldFilter", + "org.hibernate.cache.spi.QueryCacheFactory", + "org.hibernate.criterion.CriteriaSpecification", + "org.hibernate.type.ArrayType", + "org.hibernate.type.CharArrayType", + "org.hibernate.engine.transaction.jta.platform.internal.OrionJtaPlatform", + "org.jboss.logging.Logger$1", + "org.hibernate.boot.registry.selector.internal.StrategySelectorImpl", + "org.hibernate.type.ProcedureParameterExtractionAware", + "org.hibernate.MappingException", + "org.hibernate.mapping.Fetchable", + "org.hibernate.type.AbstractType", + "org.hibernate.dialect.MySQL5Dialect", + "org.hibernate.engine.spi.SessionImplementor", + "org.hibernate.dialect.InterbaseDialect", + "org.hibernate.type.descriptor.sql.BinaryTypeDescriptor", + "org.dom4j.tree.ConcurrentReaderHashMap$1", + "org.hibernate.type.TrueFalseType", + "org.hibernate.event.spi.PostInsertEventListener", + "org.hibernate.type.StringRepresentableType", + "org.hibernate.internal.CoreMessageLogger", + "org.hibernate.tuple.InDatabaseValueGenerationStrategy", + "org.hibernate.dialect.Cache71Dialect", + "org.hibernate.secure.spi.PermissionCheckEntityInformation", + "org.hibernate.type.descriptor.java.JdbcTimeTypeDescriptor$TimeMutabilityPlan", + "org.hibernate.tuple.InMemoryValueGenerationStrategy", + "org.hibernate.type.EntityType", + "org.hibernate.event.internal.EntityCopyAllowedObserver", + "org.dom4j.tree.AbstractElement", + "org.hibernate.dialect.ProgressDialect", + "org.hibernate.cfg.Settings", + "org.dom4j.DocumentFactory", + "org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractorInitiator", + "org.dom4j.DocumentException", + "org.hibernate.type.descriptor.java.SerializableTypeDescriptor$SerializableMutabilityPlan", + "org.dom4j.tree.ConcurrentReaderHashMap$EntrySet", + "org.hibernate.type.CalendarDateType", + "com.att.eelf.i18n.EELFResourceManager", + "org.hibernate.type.StringType", + "org.openecomp.mso.logger.MessageEnum", + "org.jboss.logging.Slf4jLocationAwareLogger", + "org.hibernate.type.StringNVarcharType", + "org.hibernate.engine.transaction.spi.TransactionFactory", + "org.hibernate.cfg.AttributeConverterDefinition", + "org.hibernate.FlushMode", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$2$1", + "org.hibernate.type.MaterializedBlobType", + "org.hibernate.event.spi.EntityCopyObserver", + "org.hibernate.cfg.EJB3DTDEntityResolver", + "org.hibernate.annotations.common.util.impl.Log", + "org.hibernate.dialect.SQLServer2008Dialect", + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfoSource", + "org.hibernate.type.descriptor.java.CalendarTypeDescriptor", + "org.hibernate.type.descriptor.ValueExtractor", + "com.att.eelf.i18n.EELFResourceManager$1", + "org.hibernate.service.spi.Wrapped", + "org.hibernate.bytecode.spi.EntityInstrumentationMetadata", + "org.hibernate.id.PersistentIdentifierGenerator", + "org.hibernate.internal.CoreLogging", + "org.hibernate.type.OrderedMapType", + "org.hibernate.jdbc.ReturningWork", + "org.hibernate.metamodel.relational.Size$LobMultiplier", + "org.hibernate.boot.registry.StandardServiceInitiator" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(CatalogDatabaseESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "com.att.eelf.i18n.EELFResourceManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.openecomp.mso.logger.MsoLogger", + "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.db.catalog.CatalogDatabase", + "org.openecomp.mso.db.catalog.beans.VnfComponent", + "org.openecomp.mso.db.catalog.beans.HeatTemplate", + "org.openecomp.mso.db.catalog.beans.HeatNestedTemplate", + "org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles", + "org.jboss.logging.Logger", + "org.jboss.logging.DelegatingBasicLogger", + "org.hibernate.internal.CoreMessageLogger_$logger", + "org.jboss.logging.Slf4jLocationAwareLogger", + "org.jboss.logging.Logger$Level", + "org.jboss.logging.Slf4jLocationAwareLogger$1", + "org.jboss.logging.LoggerProviders", + "org.hibernate.cfg.MetadataSourceType", + "org.hibernate.cfg.Configuration", + "org.hibernate.cfg.SettingsFactory", + "org.hibernate.type.TypeResolver", + "org.hibernate.type.BasicTypeRegistry", + "org.hibernate.metamodel.relational.Size", + "org.hibernate.metamodel.relational.Size$LobMultiplier", + "org.hibernate.type.AbstractStandardBasicType", + "org.hibernate.type.AbstractSingleColumnStandardBasicType", + "org.hibernate.type.descriptor.sql.SqlTypeDescriptorRegistry", + "org.hibernate.type.descriptor.sql.BooleanTypeDescriptor", + "org.hibernate.type.descriptor.java.AbstractTypeDescriptor", + "org.hibernate.type.descriptor.java.ImmutableMutabilityPlan", + "org.hibernate.internal.util.compare.ComparableComparator", + "org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry", + "org.hibernate.type.descriptor.java.BooleanTypeDescriptor", + "org.hibernate.type.BooleanType", + "org.hibernate.type.descriptor.sql.IntegerTypeDescriptor", + "org.hibernate.type.NumericBooleanType", + "org.hibernate.type.descriptor.sql.VarcharTypeDescriptor", + "org.hibernate.type.descriptor.sql.CharTypeDescriptor", + "org.hibernate.type.TrueFalseType", + "org.hibernate.type.YesNoType", + "org.hibernate.type.descriptor.sql.TinyIntTypeDescriptor", + "org.hibernate.type.descriptor.java.ByteTypeDescriptor", + "org.hibernate.type.ByteType", + "org.hibernate.type.descriptor.java.CharacterTypeDescriptor", + "org.hibernate.type.CharacterType", + "org.hibernate.type.descriptor.sql.SmallIntTypeDescriptor", + "org.hibernate.type.descriptor.java.ShortTypeDescriptor", + "org.hibernate.type.ShortType", + "org.hibernate.type.descriptor.java.IntegerTypeDescriptor", + "org.hibernate.type.IntegerType", + "org.hibernate.type.descriptor.sql.BigIntTypeDescriptor", + "org.hibernate.type.descriptor.java.LongTypeDescriptor", + "org.hibernate.type.LongType", + "org.hibernate.type.descriptor.sql.RealTypeDescriptor", + "org.hibernate.type.descriptor.sql.FloatTypeDescriptor", + "org.hibernate.type.descriptor.java.FloatTypeDescriptor", + "org.hibernate.type.FloatType", + "org.hibernate.type.descriptor.sql.DoubleTypeDescriptor", + "org.hibernate.type.descriptor.java.DoubleTypeDescriptor", + "org.hibernate.type.DoubleType", + "org.hibernate.type.descriptor.sql.DecimalTypeDescriptor", + "org.hibernate.type.descriptor.sql.NumericTypeDescriptor", + "org.hibernate.type.descriptor.java.BigDecimalTypeDescriptor", + "org.hibernate.type.BigDecimalType", + "org.hibernate.type.descriptor.java.BigIntegerTypeDescriptor", + "org.hibernate.type.BigIntegerType", + "org.hibernate.type.descriptor.java.StringTypeDescriptor", + "org.hibernate.type.StringType", + "org.hibernate.type.descriptor.sql.NVarcharTypeDescriptor", + "org.hibernate.type.StringNVarcharType", + "org.hibernate.type.descriptor.sql.NCharTypeDescriptor", + "org.hibernate.type.CharacterNCharType", + "org.hibernate.type.descriptor.java.UrlTypeDescriptor", + "org.hibernate.type.UrlType", + "org.hibernate.type.descriptor.sql.DateTypeDescriptor", + "org.hibernate.type.descriptor.java.MutableMutabilityPlan", + "org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor$DateMutabilityPlan", + "org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor", + "org.hibernate.type.DateType", + "org.hibernate.type.descriptor.sql.TimeTypeDescriptor", + "org.hibernate.type.descriptor.java.JdbcTimeTypeDescriptor$TimeMutabilityPlan", + "org.hibernate.type.descriptor.java.JdbcTimeTypeDescriptor", + "org.hibernate.type.TimeType", + "org.hibernate.type.descriptor.sql.TimestampTypeDescriptor", + "org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor$TimestampMutabilityPlan", + "org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor", + "org.hibernate.type.TimestampType", + "org.hibernate.type.DbTimestampType", + "org.hibernate.type.descriptor.java.CalendarTypeDescriptor$CalendarMutabilityPlan", + "org.hibernate.type.descriptor.java.CalendarTypeDescriptor", + "org.hibernate.type.CalendarType", + "org.hibernate.type.descriptor.java.CalendarDateTypeDescriptor", + "org.hibernate.type.CalendarDateType", + "org.hibernate.type.descriptor.java.LocaleTypeDescriptor", + "org.hibernate.type.LocaleType", + "org.hibernate.type.descriptor.java.CurrencyTypeDescriptor", + "org.hibernate.type.CurrencyType", + "org.hibernate.type.descriptor.java.TimeZoneTypeDescriptor", + "org.hibernate.type.TimeZoneType", + "org.hibernate.type.descriptor.java.ClassTypeDescriptor", + "org.hibernate.type.ClassType", + "org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor", + "org.hibernate.type.descriptor.sql.BinaryTypeDescriptor", + "org.hibernate.type.descriptor.java.UUIDTypeDescriptor", + "org.hibernate.type.UUIDBinaryType", + "org.hibernate.type.UUIDCharType", + "org.hibernate.type.PostgresUUIDType$PostgresUUIDSqlTypeDescriptor", + "org.hibernate.type.PostgresUUIDType", + "org.hibernate.type.descriptor.java.ArrayMutabilityPlan", + "org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor", + "org.hibernate.type.BinaryType", + "org.hibernate.type.descriptor.java.ByteArrayTypeDescriptor", + "org.hibernate.type.WrapperBinaryType", + "org.hibernate.type.descriptor.sql.LongVarbinaryTypeDescriptor", + "org.hibernate.type.ImageType", + "org.hibernate.type.descriptor.java.PrimitiveCharacterArrayTypeDescriptor", + "org.hibernate.type.CharArrayType", + "org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor", + "org.hibernate.type.CharacterArrayType", + "org.hibernate.type.descriptor.sql.LongVarcharTypeDescriptor", + "org.hibernate.type.TextType", + "org.hibernate.type.descriptor.sql.LongNVarcharTypeDescriptor", + "org.hibernate.type.NTextType", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$2", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$3", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$4", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor$5", + "org.hibernate.type.descriptor.sql.BlobTypeDescriptor", + "org.hibernate.type.descriptor.java.BlobTypeDescriptor$BlobMutabilityPlan", + "org.hibernate.type.descriptor.java.BlobTypeDescriptor", + "org.hibernate.type.BlobType", + "org.hibernate.type.MaterializedBlobType", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$3", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$4", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor$5", + "org.hibernate.type.descriptor.sql.ClobTypeDescriptor", + "org.hibernate.type.descriptor.java.ClobTypeDescriptor$ClobMutabilityPlan", + "org.hibernate.type.descriptor.java.ClobTypeDescriptor", + "org.hibernate.type.ClobType", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$2", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$3", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor$4", + "org.hibernate.type.descriptor.sql.NClobTypeDescriptor", + "org.hibernate.type.descriptor.java.NClobTypeDescriptor$NClobMutabilityPlan", + "org.hibernate.type.descriptor.java.NClobTypeDescriptor", + "org.hibernate.type.NClobType", + "org.hibernate.type.MaterializedClobType", + "org.hibernate.type.MaterializedNClobType", + "org.hibernate.type.descriptor.java.SerializableTypeDescriptor", + "org.hibernate.type.descriptor.java.SerializableTypeDescriptor$SerializableMutabilityPlan", + "org.hibernate.type.SerializableType", + "org.hibernate.type.AbstractType", + "org.hibernate.type.AnyType", + "org.hibernate.type.ObjectType", + "org.hibernate.type.AdaptedImmutableType", + "org.hibernate.type.TypeFactory", + "org.hibernate.type.TypeFactory$TypeScopeImpl", + "org.hibernate.cfg.Configuration$ObjectNameNormalizerImpl", + "org.hibernate.cfg.Configuration$MetadataSourceQueue", + "org.hibernate.cfg.annotations.reflection.JPAMetadataProvider", + "org.hibernate.cfg.annotations.reflection.XMLContext", + "org.hibernate.annotations.common.util.impl.Log_$logger", + "org.hibernate.annotations.common.reflection.java.JavaReflectionManager", + "org.hibernate.annotations.common.util.StandardClassLoaderDelegateImpl", + "org.hibernate.internal.util.xml.DTDEntityResolver", + "org.hibernate.internal.util.xml.XMLHelper", + "org.hibernate.EmptyInterceptor", + "org.hibernate.internal.util.ConfigHelper", + "org.hibernate.internal.util.ClassLoaderHelper", + "org.hibernate.HibernateException", + "org.hibernate.internal.util.config.ConfigurationHelper", + "org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl", + "org.hibernate.cfg.Environment", + "org.hibernate.tuple.entity.EntityTuplizerFactory", + "org.hibernate.EntityMode", + "org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory", + "org.hibernate.cfg.EJB3NamingStrategy", + "org.hibernate.cfg.EJB3DTDEntityResolver", + "org.hibernate.internal.util.xml.ErrorLogger", + "org.dom4j.io.SAXReader", + "org.dom4j.io.SAXHelper", + "org.dom4j.DocumentFactory", + "org.dom4j.tree.AbstractNode", + "org.dom4j.tree.AbstractBranch", + "org.dom4j.tree.AbstractDocument", + "org.dom4j.tree.DefaultDocument", + "org.dom4j.tree.AbstractCharacterData", + "org.dom4j.tree.AbstractComment", + "org.dom4j.tree.FlyweightComment", + "org.dom4j.tree.DefaultComment", + "org.dom4j.tree.AbstractDocumentType", + "org.dom4j.tree.DefaultDocumentType", + "org.dom4j.tree.NamespaceCache", + "org.dom4j.tree.ConcurrentReaderHashMap", + "org.dom4j.tree.ConcurrentReaderHashMap$BarrierLock", + "org.dom4j.Namespace", + "org.dom4j.QName", + "org.dom4j.tree.AbstractElement", + "org.dom4j.tree.DefaultElement", + "org.dom4j.tree.AbstractAttribute", + "org.dom4j.tree.FlyweightAttribute", + "org.dom4j.tree.DefaultAttribute", + "org.dom4j.tree.AbstractText", + "org.dom4j.tree.FlyweightText", + "org.dom4j.tree.DefaultText", + "org.dom4j.tree.BackedList", + "org.hibernate.internal.util.xml.OriginImpl", + "org.hibernate.internal.util.xml.MappingReader", + "org.hibernate.internal.util.xml.XmlDocumentImpl", + "org.hibernate.boot.registry.StandardServiceRegistryBuilder", + "org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder", + "org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl", + "org.hibernate.integrator.internal.IntegratorServiceImpl", + "org.hibernate.cfg.beanvalidation.BeanValidationIntegrator", + "org.hibernate.secure.spi.JaccIntegrator", + "org.hibernate.cache.internal.CollectionCacheInvalidator", + "org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl", + "org.hibernate.boot.registry.selector.internal.StrategySelectorImpl", + "org.hibernate.service.spi.ServiceBinding", + "org.hibernate.engine.config.internal.ConfigurationServiceInitiator", + "org.hibernate.tool.hbm2ddl.SingleLineSqlCommandExtractor", + "org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractorInitiator", + "org.hibernate.engine.jndi.internal.JndiServiceInitiator", + "org.hibernate.jmx.internal.JmxServiceInitiator", + "org.hibernate.persister.internal.PersisterClassResolverInitiator", + "org.hibernate.persister.internal.PersisterFactoryInitiator", + "org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator", + "org.hibernate.engine.jdbc.connections.internal.MultiTenantConnectionProviderInitiator", + "org.hibernate.engine.jdbc.dialect.internal.DialectResolverInitiator", + "org.hibernate.engine.jdbc.dialect.internal.DialectFactoryInitiator", + "org.hibernate.engine.jdbc.batch.internal.BatchBuilderInitiator", + "org.hibernate.engine.jdbc.internal.JdbcServicesInitiator", + "org.hibernate.engine.jdbc.cursor.internal.RefCursorSupportInitiator", + "org.hibernate.id.factory.internal.MutableIdentifierGeneratorFactoryInitiator", + "org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformResolverInitiator", + "org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator", + "org.hibernate.engine.transaction.internal.TransactionFactoryInitiator", + "org.hibernate.service.internal.SessionFactoryServiceRegistryFactoryInitiator", + "org.hibernate.cache.internal.RegionFactoryInitiator", + "org.hibernate.service.StandardServiceInitiators", + "org.hibernate.service.ConfigLoader", + "org.hibernate.internal.util.ValueHolder", + "org.hibernate.secure.internal.DisabledJaccServiceImpl", + "org.hibernate.service.internal.AbstractServiceRegistryImpl", + "org.hibernate.service.internal.ConcurrentServiceBinding", + "org.hibernate.internal.util.collections.CollectionHelper", + "org.hibernate.engine.jdbc.internal.JdbcServicesImpl", + "org.hibernate.MultiTenancyStrategy", + "org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl", + "org.hibernate.engine.jndi.internal.JndiServiceImpl" + ); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatEnvironmentESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatEnvironmentESTest.java new file mode 100644 index 0000000000..4c3a257acf --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatEnvironmentESTest.java @@ -0,0 +1,245 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:13:39 GMT 2016 + */ + +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 HeatEnvironmentESTest extends HeatEnvironmentESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + heatEnvironment0.setName(""); + String string0 = heatEnvironment0.getName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + heatEnvironment0.setId(4618); + int int0 = heatEnvironment0.getId(); + assertEquals(4618, int0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + heatEnvironment0.setId((-2248)); + int int0 = heatEnvironment0.getId(); + assertEquals((-2248), int0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + heatEnvironment0.setEnvironment("=?"); + String string0 = heatEnvironment0.getEnvironment(); + assertEquals("=?", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + heatEnvironment0.setEnvironment(""); + String string0 = heatEnvironment0.getEnvironment(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + heatEnvironment0.setDescription("&G"); + String string0 = heatEnvironment0.getDescription(); + assertEquals("&G", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + heatEnvironment0.setDescription(""); + String string0 = heatEnvironment0.getDescription(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + Timestamp timestamp0 = new Timestamp((long) 0); + heatEnvironment0.setCreated(timestamp0); + Timestamp timestamp1 = heatEnvironment0.getCreated(); + assertSame(timestamp1, timestamp0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + HeatEnvironment heatEnvironment0 = new HeatEnvironment(); + heatEnvironment0.setAsdcUuid("L5UX?6N |"); + String string0 = heatTemplate0.getTemplatePath(); + assertEquals("9PO'c]OQ>6N |", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setTemplateName("Template=null,version=null,path=null,body=(Not defined),timeout=0,asdcUuid=null,asdcResourceName=null,description=null"); + String string0 = heatTemplate0.getTemplateName(); + assertEquals("Template=null,version=null,path=null,body=(Not defined),timeout=0,asdcUuid=null,asdcResourceName=null,description=null", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setTemplateName(""); + String string0 = heatTemplate0.getTemplateName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setTemplateBody("ParentTemplateId="); + String string0 = heatTemplate0.getTemplateBody(); + assertEquals("ParentTemplateId=", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setTemplateBody(""); + String string0 = heatTemplate0.getTemplateBody(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + heatTemplate0.setParameters(linkedHashSet0); + Set set0 = heatTemplate0.getParameters(); + assertEquals(0, set0.size()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + linkedHashSet0.add(heatTemplateParam0); + heatTemplate0.setParameters(linkedHashSet0); + Set set0 = heatTemplate0.getParameters(); + assertFalse(set0.isEmpty()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setId(118); + int int0 = heatTemplate0.getId(); + assertEquals(118, int0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setId((-340)); + int int0 = heatTemplate0.getId(); + assertEquals((-340), int0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + HeatNestedTemplate heatNestedTemplate0 = new HeatNestedTemplate(); + linkedHashSet0.add(heatNestedTemplate0); + heatTemplate0.setFiles(linkedHashSet0); + Set set0 = heatTemplate0.getFiles(); + assertFalse(set0.isEmpty()); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setDescription("PARENT_COMPLETE"); + String string0 = heatTemplate0.getDescription(); + assertEquals("PARENT_COMPLETE", string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setDescription(""); + String string0 = heatTemplate0.getDescription(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LocalDateTime localDateTime0 = MockLocalDateTime.now(); + Timestamp timestamp0 = Timestamp.valueOf(localDateTime0); + heatTemplate0.setCreated(timestamp0); + Timestamp timestamp1 = heatTemplate0.getCreated(); + assertSame(timestamp1, timestamp0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setAsdcUuid("msg"); + String string0 = heatTemplate0.getAsdcUuid(); + assertEquals("msg", string0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setAsdcResourceName("!IMW$RE2UtEWIEeJc5"); + String string0 = heatTemplate0.getAsdcResourceName(); + assertEquals("!IMW$RE2UtEWIEeJc5", string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setAsdcLabel(" linkedHashSet0 = new LinkedHashSet(); + linkedHashSet0.add((HeatTemplateParam) null); + heatTemplate0.setParameters(linkedHashSet0); + // Undeclared exception! + try { + heatTemplate0.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.beans.HeatTemplate", e); + } + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setRequired(true); + linkedHashSet0.add(heatTemplateParam0); + heatTemplate0.setParameters(linkedHashSet0); + String string0 = heatTemplate0.toString(); + assertEquals("Template=null,version=null,path=null,body=(Not defined),timeout=0,asdcUuid=null,asdcResourceName=null,description=null,params=[null(reqd)]", string0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + linkedHashSet0.add(heatTemplateParam0); + heatTemplate0.setParameters(linkedHashSet0); + String string0 = heatTemplate0.toString(); + assertEquals("Template=null,version=null,path=null,body=(Not defined),timeout=0,asdcUuid=null,asdcResourceName=null,description=null,params=[null]", string0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LocalDateTime localDateTime0 = MockLocalDateTime.now(); + Timestamp timestamp0 = Timestamp.valueOf(localDateTime0); + heatTemplate0.setCreated(timestamp0); + String string0 = heatTemplate0.toString(); + assertEquals("Template=null,version=null,path=null,body=(Not defined),timeout=0,asdcUuid=null,asdcResourceName=null,description=null,created=2/14/14 8:21 PM", string0); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setTemplateBody("]"); + String string0 = heatTemplate0.toString(); + assertEquals("Template=null,version=null,path=null,body=(1 chars),timeout=0,asdcUuid=null,asdcResourceName=null,description=null", string0); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setTemplateBody("]"); + String string0 = heatTemplate0.getHeatTemplate(); + assertEquals("]", string0); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + String string0 = heatTemplate0.getAsdcLabel(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + String string0 = heatTemplate0.getTemplatePath(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + Set set0 = heatTemplate0.getFiles(); + assertNull(set0); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setTemplateBody(""); + String string0 = heatTemplate0.getHeatTemplate(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + Timestamp timestamp0 = heatTemplate0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test33() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + Set set0 = heatTemplate0.getParameters(); + assertNull(set0); + } + + @Test(timeout = 4000) + public void test34() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + String string0 = heatTemplate0.getDescription(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test35() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setAsdcResourceName(""); + String string0 = heatTemplate0.getAsdcResourceName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test36() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + String string0 = heatTemplate0.getAsdcUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test37() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + heatTemplate0.setFiles(linkedHashSet0); + Set set0 = heatTemplate0.getFiles(); + assertTrue(set0.isEmpty()); + } + + @Test(timeout = 4000) + public void test38() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + heatTemplate0.setParameters(linkedHashSet0); + String string0 = heatTemplate0.toString(); + assertEquals("Template=null,version=null,path=null,body=(Not defined),timeout=0,asdcUuid=null,asdcResourceName=null,description=null", string0); + } + + @Test(timeout = 4000) + public void test39() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setTemplatePath(""); + String string0 = heatTemplate0.getTemplatePath(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test40() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + Timestamp timestamp0 = new Timestamp(0L); + heatTemplate0.setCreated(timestamp0); + Timestamp timestamp1 = heatTemplate0.getCreated(); + assertSame(timestamp1, timestamp0); + } + + @Test(timeout = 4000) + public void test41() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + String string0 = heatTemplate0.getAsdcResourceName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test42() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + int int0 = heatTemplate0.getId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test43() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + String string0 = heatTemplate0.getTemplateName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test44() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + String string0 = heatTemplate0.getTemplateBody(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test45() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + int int0 = heatTemplate0.getTimeoutMinutes(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test46() throws Throwable { + HeatTemplate heatTemplate0 = new HeatTemplate(); + heatTemplate0.setAsdcUuid(""); + String string0 = heatTemplate0.getAsdcUuid(); + assertEquals("", string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateESTestscaffolding.java new file mode 100644 index 0000000000..538852c3b0 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateESTestscaffolding.java @@ -0,0 +1,111 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:12:27 GMT 2016 + */ + +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 HeatTemplateESTestscaffolding { + + @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.HeatTemplate"; + 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(HeatTemplateESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.logger.MsoLogger", + "org.openecomp.mso.logger.MessageEnum", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.entity.MsoRequest", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "com.att.eelf.configuration.EELFLogger", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.configuration.EELFLogger$Level", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.db.catalog.beans.HeatTemplate", + "org.openecomp.mso.db.catalog.beans.HeatTemplateParam", + "org.openecomp.mso.db.catalog.beans.HeatNestedTemplate", + "com.att.eelf.configuration.SLF4jWrapper", + "com.att.eelf.i18n.EELFResourceManager$1", + "com.att.eelf.i18n.EELFResourceManager" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(HeatTemplateESTestscaffolding.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.HeatTemplate", + "org.openecomp.mso.db.catalog.beans.HeatNestedTemplate" + ); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParamESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParamESTest.java new file mode 100644 index 0000000000..f084204170 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParamESTest.java @@ -0,0 +1,154 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:22:57 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 HeatTemplateParamESTest extends HeatTemplateParamESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setRequired(true); + boolean boolean0 = heatTemplateParam0.isRequired(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setParamType(""); + String string0 = heatTemplateParam0.getParamType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setParamName("c_(T_3dD%"); + String string0 = heatTemplateParam0.getParamName(); + assertEquals("c_(T_3dD%", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setParamName(""); + String string0 = heatTemplateParam0.getParamName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setParamAlias("Param=c_(T_3dD%,type=null,required=false,paramAlias=null"); + String string0 = heatTemplateParam0.getParamAlias(); + assertEquals("Param=c_(T_3dD%,type=null,required=false,paramAlias=null", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setParamAlias(""); + String string0 = heatTemplateParam0.getParamAlias(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setId(10); + int int0 = heatTemplateParam0.getId(); + assertEquals(10, int0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setId((-5343)); + int int0 = heatTemplateParam0.getId(); + assertEquals((-5343), int0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setHeatTemplateId(10); + int int0 = heatTemplateParam0.getHeatTemplateId(); + assertEquals(10, int0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + String string0 = heatTemplateParam0.toString(); + assertEquals("Param=null,type=null,required=false,paramAlias=null", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + int int0 = heatTemplateParam0.getHeatTemplateId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + String string0 = heatTemplateParam0.getParamType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + String string0 = heatTemplateParam0.getParamAlias(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + boolean boolean0 = heatTemplateParam0.isRequired(); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setHeatTemplateId((-1)); + int int0 = heatTemplateParam0.getHeatTemplateId(); + assertEquals((-1), int0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + int int0 = heatTemplateParam0.getId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + String string0 = heatTemplateParam0.getParamName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + heatTemplateParam0.setParamType("(pA6"); + String string0 = heatTemplateParam0.getParamType(); + assertEquals("(pA6", string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParamESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParamESTestscaffolding.java new file mode 100644 index 0000000000..1fbef16290 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParamESTestscaffolding.java @@ -0,0 +1,78 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:22:57 GMT 2016 + */ + +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 HeatTemplateParamESTestscaffolding { + + @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.HeatTemplateParam"; + 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(HeatTemplateParamESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.HeatTemplateParam" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkRecipeESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkRecipeESTest.java new file mode 100644 index 0000000000..4d7d131b00 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkRecipeESTest.java @@ -0,0 +1,79 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:22:12 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 NetworkRecipeESTest extends NetworkRecipeESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + NetworkRecipe networkRecipe0 = new NetworkRecipe(); + networkRecipe0.setOrchestrationUri(""); + String string0 = networkRecipe0.toString(); + assertEquals("RECIPE: null,uri=,networkType=null,networkParamXSD=null", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + NetworkRecipe networkRecipe0 = new NetworkRecipe(); + networkRecipe0.setAction("WL:?f53^x"); + String string0 = networkRecipe0.toString(); + assertEquals("RECIPE: WL:?f53^x,uri=null,networkType=null,networkParamXSD=null", string0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + NetworkRecipe networkRecipe0 = new NetworkRecipe(); + networkRecipe0.setNetworkType("RECIPE: "); + String string0 = networkRecipe0.getNetworkType(); + assertEquals("RECIPE: ", string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + NetworkRecipe networkRecipe0 = new NetworkRecipe(); + networkRecipe0.setNetworkParamXSD("!R\"am4?r!"); + String string0 = networkRecipe0.getNetworkParamXSD(); + assertEquals("!R\"am4?r!", string0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + NetworkRecipe networkRecipe0 = new NetworkRecipe(); + String string0 = networkRecipe0.getNetworkParamXSD(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + NetworkRecipe networkRecipe0 = new NetworkRecipe(); + networkRecipe0.setNetworkType(""); + String string0 = networkRecipe0.getNetworkType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + NetworkRecipe networkRecipe0 = new NetworkRecipe(); + networkRecipe0.setNetworkParamXSD(""); + String string0 = networkRecipe0.getNetworkParamXSD(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + NetworkRecipe networkRecipe0 = new NetworkRecipe(); + String string0 = networkRecipe0.getNetworkType(); + assertNull(string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkRecipeESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkRecipeESTestscaffolding.java new file mode 100644 index 0000000000..04184f50e2 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkRecipeESTestscaffolding.java @@ -0,0 +1,80 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:22:12 GMT 2016 + */ + +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 NetworkRecipeESTestscaffolding { + + @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.NetworkRecipe"; + 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(NetworkRecipeESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.NetworkRecipe", + "org.openecomp.mso.db.catalog.beans.Recipe", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkResourceESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkResourceESTest.java new file mode 100644 index 0000000000..71520bb983 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkResourceESTest.java @@ -0,0 +1,228 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:21:59 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; + +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class NetworkResourceESTest extends NetworkResourceESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setTemplateId((-835)); + int int0 = networkResource0.getTemplateId(); + assertEquals((-835), int0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setOrchestrationMode("V"); + String string0 = networkResource0.getOrchestrationMode(); + assertEquals("V", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setOrchestrationMode(""); + String string0 = networkResource0.getOrchestrationMode(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setNeutronNetworkType(",aicVersionMin="); + String string0 = networkResource0.getNeutronNetworkType(); + assertEquals(",aicVersionMin=", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setNeutronNetworkType(""); + String string0 = networkResource0.getNeutronNetworkType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setNetworkType("zOD2"); + String string0 = networkResource0.getNetworkType(); + assertEquals("zOD2", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setId(1); + int int0 = networkResource0.getId(); + assertEquals(1, int0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setId((-6321)); + int int0 = networkResource0.getId(); + assertEquals((-6321), int0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setDescription("NETWORK=null,version=null,mode=null,template=0,neutronType=null,aicVersionMin=VO>5~X,aicVersionMax=VO>5~Xid=0"); + String string0 = networkResource0.getDescription(); + assertEquals("NETWORK=null,version=null,mode=null,template=0,neutronType=null,aicVersionMin=VO>5~X,aicVersionMax=VO>5~Xid=0", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setAicVersionMin(""); + String string0 = networkResource0.getAicVersionMin(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setAicVersionMax("E{6!_C$30Kby>]gllF"); + String string0 = networkResource0.getAicVersionMax(); + assertEquals("E{6!_C$30Kby>]gllF", string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setAicVersionMax(""); + String string0 = networkResource0.getAicVersionMax(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + Timestamp timestamp0 = mock(Timestamp.class, new ViolatedAssumptionAnswer()); + doReturn(1L).when(timestamp0).getTime(); + networkResource0.setCreated(timestamp0); + String string0 = networkResource0.toString(); + assertEquals("NETWORK=null,version=null,mode=null,template=0,neutronType=null,aicVersionMin=null,aicVersionMax=nullid=0,created=1/1/70 12:00 AM", string0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + String string0 = networkResource0.toString(); + assertEquals("NETWORK=null,version=null,mode=null,template=0,neutronType=null,aicVersionMin=null,aicVersionMax=nullid=0", string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + String string0 = networkResource0.getDescription(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setAicVersionMin("VO>5~X"); + String string0 = networkResource0.getAicVersionMin(); + assertEquals("VO>5~X", string0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + String string0 = networkResource0.getNeutronNetworkType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + String string0 = networkResource0.getOrchestrationMode(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + String string0 = networkResource0.getAicVersionMax(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + String string0 = networkResource0.getAicVersionMin(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + int int0 = networkResource0.getTemplateId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setDescription(""); + String string0 = networkResource0.getDescription(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + String string0 = networkResource0.getNetworkType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + Timestamp timestamp0 = networkResource0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + int int0 = networkResource0.getId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setNetworkType(""); + String string0 = networkResource0.getNetworkType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + NetworkResource networkResource0 = new NetworkResource(); + networkResource0.setTemplateId(2085); + int int0 = networkResource0.getTemplateId(); + assertEquals(2085, int0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkResourceESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkResourceESTestscaffolding.java new file mode 100644 index 0000000000..fdef26efcb --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/NetworkResourceESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:21:59 GMT 2016 + */ + +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 NetworkResourceESTestscaffolding { + + @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.NetworkResource"; + 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(NetworkResourceESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.NetworkResource", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/RecipeESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/RecipeESTest.java new file mode 100644 index 0000000000..03ad09cda5 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/RecipeESTest.java @@ -0,0 +1,183 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:21:28 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; + +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class RecipeESTest extends RecipeESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setOrchestrationUri(""); + String string0 = recipe0.toString(); + assertEquals("RECIPE: null,uri=", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setServiceType("s5s< CkZ9K:R0~ ;"); + String string0 = recipe0.getServiceType(); + assertEquals("s5s< CkZ9K:R0~ ;", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setServiceType(""); + String string0 = recipe0.getServiceType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setRecipeTimeout((-639)); + int int0 = recipe0.getRecipeTimeout(); + assertEquals((-639), int0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.orchestrationUri = "."; + String string0 = recipe0.getOrchestrationUri(); + assertEquals(".", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setOrchestrationUri(""); + String string0 = recipe0.getOrchestrationUri(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setId(1); + int int0 = recipe0.getId(); + assertEquals(1, int0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setId((-529)); + int int0 = recipe0.getId(); + assertEquals((-529), int0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setDescription("F+/="); + String string0 = recipe0.getDescription(); + assertEquals("F+/=", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setDescription(""); + String string0 = recipe0.getDescription(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setAction("RECIPE: null,uri=null"); + String string0 = recipe0.getAction(); + assertEquals("RECIPE: null,uri=null", string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.action = ""; + String string0 = recipe0.getAction(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + Recipe recipe0 = new Recipe(); + Timestamp timestamp0 = mock(Timestamp.class, new ViolatedAssumptionAnswer()); + doReturn(0L).when(timestamp0).getTime(); + recipe0.setCreated(timestamp0); + String string0 = recipe0.toString(); + assertEquals("RECIPE: null,uri=null,created=1/1/70 12:00 AM", string0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + Recipe recipe0 = new Recipe(); + int int0 = recipe0.getId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + Recipe recipe0 = new Recipe(); + String string0 = recipe0.getDescription(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + Recipe recipe0 = new Recipe(); + int int0 = recipe0.getRecipeTimeout(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + Recipe recipe0 = new Recipe(); + recipe0.setRecipeTimeout(957); + int int0 = recipe0.getRecipeTimeout(); + assertEquals(957, int0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + Recipe recipe0 = new Recipe(); + String string0 = recipe0.getAction(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + Recipe recipe0 = new Recipe(); + Timestamp timestamp0 = recipe0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + Recipe recipe0 = new Recipe(); + String string0 = recipe0.getOrchestrationUri(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + Recipe recipe0 = new Recipe(); + String string0 = recipe0.getServiceType(); + assertNull(string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/RecipeESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/RecipeESTestscaffolding.java new file mode 100644 index 0000000000..667bc9387a --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/RecipeESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:21:28 GMT 2016 + */ + +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 RecipeESTestscaffolding { + + @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.Recipe"; + 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(RecipeESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.Recipe", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceESTest.java new file mode 100644 index 0000000000..57f2d5d7a8 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceESTest.java @@ -0,0 +1,296 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:19:44 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import java.sql.Timestamp; +import java.time.Clock; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.evosuite.runtime.mock.java.time.MockClock; +import org.evosuite.runtime.mock.java.time.MockLocalDateTime; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ServiceESTest extends ServiceESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + Service service0 = new Service(); + service0.setServiceVersion("RECIPE: "); + String string0 = service0.getServiceVersion(); + assertEquals("RECIPE: ", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + Service service0 = new Service(); + service0.setServiceNameVersionId(">{PeD}EDcITG;{Z%FH"); + String string0 = service0.getServiceNameVersionId(); + assertEquals(">{PeD}EDcITG;{Z%FH", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + Service service0 = new Service(); + service0.setServiceName("RECIPE: "); + String string0 = service0.getServiceName(); + assertEquals("RECIPE: ", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + Service service0 = new Service(); + service0.setServiceName(""); + String string0 = service0.getServiceName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + Service service0 = new Service(); + HashMap hashMap0 = new HashMap(); + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + hashMap0.put(",created=", serviceRecipe0); + service0.setRecipes(hashMap0); + Map map0 = service0.getRecipes(); + assertFalse(map0.isEmpty()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + Service service0 = new Service(); + service0.setModelInvariantUUID("BZ@s"); + String string0 = service0.getModelInvariantUUID(); + assertEquals("BZ@s", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + Service service0 = new Service(); + service0.setId(1033); + int int0 = service0.getId(); + assertEquals(1033, int0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + Service service0 = new Service(); + service0.setId((-164)); + int int0 = service0.getId(); + assertEquals((-164), int0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + Service service0 = new Service(); + service0.setHttpMethod(",description="); + String string0 = service0.getHttpMethod(); + assertEquals(",description=", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + Service service0 = new Service(); + service0.setDescription(""); + String string0 = service0.getDescription(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + Service service0 = new Service(); + Timestamp timestamp0 = new Timestamp(0L); + service0.setCreated(timestamp0); + Timestamp timestamp1 = service0.getCreated(); + assertEquals(0, timestamp1.getNanos()); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + Service service0 = new Service(); + Clock clock0 = MockClock.systemUTC(); + LocalDateTime localDateTime0 = MockLocalDateTime.now(clock0); + Timestamp timestamp0 = Timestamp.valueOf(localDateTime0); + service0.setCreated(timestamp0); + Timestamp timestamp1 = service0.getCreated(); + assertSame(timestamp1, timestamp0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + Service service0 = new Service(); + // Undeclared exception! + try { + service0.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 { + Service service0 = new Service(); + HashMap hashMap0 = new HashMap(); + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + hashMap0.put(",created=", serviceRecipe0); + service0.setRecipes(hashMap0); + String string0 = service0.toString(); + assertEquals("SERVICE: id=0,name=null,version=null,description=null,modelInvariantUUID=null\nRECIPE: null,uri=null", string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + Service service0 = new Service(); + service0.setServiceNameVersionId("83y*#72]},kHXOT"); + service0.setServiceNameVersionId("f6t}qujI)DMM>b=J"); + Map map0 = (Map) mock(Map.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(map0).toString(); + doReturn((Set) null).when(map0).keySet(); + service0.setRecipes(map0); + service0.isTheSameVersion("83y*#72]},kHXOT"); + service0.isMoreRecentThan(")0"); + service0.getRecipes(); + // Undeclared exception! + try { + service0.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 test15() throws Throwable { + Service service0 = new Service(); + String string0 = service0.getDescription(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + Service service0 = new Service(); + HashMap hashMap0 = new HashMap(); + service0.setRecipes(hashMap0); + Map map0 = service0.getRecipes(); + assertEquals(0, map0.size()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + Service service0 = new Service(); + int int0 = service0.getId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + Service service0 = new Service(); + String string0 = service0.getServiceName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + Service service0 = new Service(); + service0.setHttpMethod(""); + String string0 = service0.getHttpMethod(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + Service service0 = new Service(); + String string0 = service0.getModelInvariantUUID(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + Service service0 = new Service(); + String string0 = service0.getServiceVersion(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + Service service0 = new Service(); + service0.setServiceNameVersionId(""); + String string0 = service0.getServiceNameVersionId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + Service service0 = new Service(); + String string0 = service0.getHttpMethod(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + Service service0 = new Service(); + Map map0 = service0.getRecipes(); + assertNull(map0); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + Service service0 = new Service(); + service0.setDescription("Ir%#'ua8B=h&yW\"(|"); + String string0 = service0.getDescription(); + assertEquals("Ir%#'ua8B=h&yW\"(|", string0); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + Service service0 = new Service(); + String string0 = service0.getServiceNameVersionId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + Service service0 = new Service(); + service0.setServiceVersion(""); + String string0 = service0.getServiceVersion(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + Service service0 = new Service(); + Timestamp timestamp0 = service0.getCreated(); + service0.setCreated(timestamp0); + assertNull(service0.getServiceName()); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + Service service0 = new Service(); + service0.setModelInvariantUUID(""); + String string0 = service0.getModelInvariantUUID(); + assertEquals("", string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceESTestscaffolding.java new file mode 100644 index 0000000000..d420236688 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceESTestscaffolding.java @@ -0,0 +1,80 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:19:44 GMT 2016 + */ + +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 ServiceESTestscaffolding { + + @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.Service"; + 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(ServiceESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.ServiceRecipe", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.db.catalog.beans.Service" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceRecipeESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceRecipeESTest.java new file mode 100644 index 0000000000..4b4ec68325 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceRecipeESTest.java @@ -0,0 +1,239 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:20:36 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; + +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ServiceRecipeESTest extends ServiceRecipeESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + Integer integer0 = new Integer(0); + serviceRecipe0.setServiceTimeoutInterim(integer0); + Integer integer1 = serviceRecipe0.getServiceTimeoutInterim(); + assertEquals(0, (int)integer1); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + Integer integer0 = new Integer(536); + serviceRecipe0.setServiceTimeoutInterim(integer0); + Integer integer1 = serviceRecipe0.getServiceTimeoutInterim(); + assertEquals(536, (int)integer1); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + Integer integer0 = new Integer((-1032)); + serviceRecipe0.setServiceTimeoutInterim(integer0); + Integer integer1 = serviceRecipe0.getServiceTimeoutInterim(); + assertEquals((-1032), (int)integer1); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setServiceParamXSD("*9+?bc]Ov"); + String string0 = serviceRecipe0.getServiceParamXSD(); + assertEquals("*9+?bc]Ov", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setServiceId(1643); + int int0 = serviceRecipe0.getServiceId(); + assertEquals(1643, int0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setServiceId((-1639)); + int int0 = serviceRecipe0.getServiceId(); + assertEquals((-1639), int0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setRecipeTimeout(536); + int int0 = serviceRecipe0.getRecipeTimeout(); + assertEquals(536, int0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setRecipeTimeout((-1)); + int int0 = serviceRecipe0.getRecipeTimeout(); + assertEquals((-1), int0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setOrchestrationUri("R~N]`p<1UHw6JYz"); + String string0 = serviceRecipe0.getOrchestrationUri(); + assertEquals("R~N]`p<1UHw6JYz", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setId(1); + int int0 = serviceRecipe0.getId(); + assertEquals(1, int0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setDescription("wLV^;f35^#"); + String string0 = serviceRecipe0.getDescription(); + assertEquals("wLV^;f35^#", string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setAction("@T7x,XN.)]mDZ"); + String string0 = serviceRecipe0.getAction(); + assertEquals("@T7x,XN.)]mDZ", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setAction(""); + String string0 = serviceRecipe0.getAction(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + Timestamp timestamp0 = mock(Timestamp.class, new ViolatedAssumptionAnswer()); + doReturn(0L).when(timestamp0).getTime(); + serviceRecipe0.setCreated(timestamp0); + String string0 = serviceRecipe0.toString(); + assertEquals("RECIPE: null,uri=null,created=1/1/70 12:00 AM", string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + String string0 = serviceRecipe0.toString(); + assertEquals("RECIPE: null,uri=null", string0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + String string0 = serviceRecipe0.getOrchestrationUri(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + String string0 = serviceRecipe0.getAction(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + Timestamp timestamp0 = serviceRecipe0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + String string0 = serviceRecipe0.getServiceParamXSD(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setId((-642)); + int int0 = serviceRecipe0.getId(); + assertEquals((-642), int0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setDescription(""); + String string0 = serviceRecipe0.getDescription(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + String string0 = serviceRecipe0.getDescription(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + int int0 = serviceRecipe0.getServiceId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + Integer integer0 = serviceRecipe0.getServiceTimeoutInterim(); + assertNull(integer0); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + int int0 = serviceRecipe0.getRecipeTimeout(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setOrchestrationUri(""); + String string0 = serviceRecipe0.getOrchestrationUri(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + int int0 = serviceRecipe0.getId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + serviceRecipe0.setServiceParamXSD(""); + String string0 = serviceRecipe0.getServiceParamXSD(); + assertEquals("", string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceRecipeESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceRecipeESTestscaffolding.java new file mode 100644 index 0000000000..b17b447241 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceRecipeESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:20:36 GMT 2016 + */ + +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 ServiceRecipeESTestscaffolding { + + @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.ServiceRecipe"; + 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(ServiceRecipeESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.ServiceRecipe", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning" + ); + } + + private static void resetClasses() { + } +} 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 new file mode 100644 index 0000000000..1a1c6ea2c2 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java @@ -0,0 +1,726 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:19:11 GMT 2016 + */ + +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 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.junit.runner.RunWith; + +@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); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTestscaffolding.java new file mode 100644 index 0000000000..5688849059 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:19:11 GMT 2016 + */ + +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 VfModuleESTestscaffolding { + + @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.VfModule"; + 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(VfModuleESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.db.catalog.beans.VfModule" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFilesESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFilesESTest.java new file mode 100644 index 0000000000..fa35d936ea --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFilesESTest.java @@ -0,0 +1,128 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:18:06 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 VfModuleToHeatFilesESTest extends VfModuleToHeatFilesESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + vfModuleToHeatFiles0.setVfModuleId(1842); + VfModuleToHeatFiles vfModuleToHeatFiles1 = new VfModuleToHeatFiles(); + boolean boolean0 = vfModuleToHeatFiles0.equals(vfModuleToHeatFiles1); + assertEquals(1842, vfModuleToHeatFiles0.getVfModuleId()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + vfModuleToHeatFiles0.setVfModuleId((-999)); + int int0 = vfModuleToHeatFiles0.getVfModuleId(); + assertEquals((-999), int0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + vfModuleToHeatFiles0.setHeatFilesId(3619); + int int0 = vfModuleToHeatFiles0.getHeatFilesId(); + assertEquals(3619, int0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + vfModuleToHeatFiles0.setHeatFilesId((-1390)); + int int0 = vfModuleToHeatFiles0.getHeatFilesId(); + assertEquals((-1390), int0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + VfModuleToHeatFiles vfModuleToHeatFiles1 = new VfModuleToHeatFiles(); + boolean boolean0 = vfModuleToHeatFiles0.equals(vfModuleToHeatFiles1); + assertTrue(boolean0); + assertEquals(0, vfModuleToHeatFiles1.getVfModuleId()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + VfModuleToHeatFiles vfModuleToHeatFiles1 = new VfModuleToHeatFiles(); + vfModuleToHeatFiles0.setVfModuleId((-232)); + boolean boolean0 = vfModuleToHeatFiles0.equals(vfModuleToHeatFiles1); + assertEquals(-232, vfModuleToHeatFiles0.getVfModuleId()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + Object object0 = new Object(); + boolean boolean0 = vfModuleToHeatFiles0.equals(object0); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + boolean boolean0 = vfModuleToHeatFiles0.equals(vfModuleToHeatFiles0); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + int int0 = vfModuleToHeatFiles0.getHeatFilesId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + int int0 = vfModuleToHeatFiles0.getVfModuleId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + vfModuleToHeatFiles0.hashCode(); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + String string0 = vfModuleToHeatFiles0.toString(); + assertEquals("VF_MODULE_ID=0, HEAT_FILES_ID=0", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + vfModuleToHeatFiles0.setHeatFilesId((-1)); + vfModuleToHeatFiles0.hashCode(); + assertEquals(-1, vfModuleToHeatFiles0.getHeatFilesId()); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + VfModuleToHeatFiles vfModuleToHeatFiles0 = new VfModuleToHeatFiles(); + vfModuleToHeatFiles0.setVfModuleId(1); + int int0 = vfModuleToHeatFiles0.getVfModuleId(); + assertEquals(1, int0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFilesESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFilesESTestscaffolding.java new file mode 100644 index 0000000000..d22bff428d --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFilesESTestscaffolding.java @@ -0,0 +1,83 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:18:06 GMT 2016 + */ + +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 VfModuleToHeatFilesESTestscaffolding { + + @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.VfModuleToHeatFiles"; + 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(VfModuleToHeatFilesESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(VfModuleToHeatFilesESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles" + ); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentESTest.java new file mode 100644 index 0000000000..7a31349d12 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentESTest.java @@ -0,0 +1,247 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:14:48 GMT 2016 + */ + +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 VnfComponentESTest extends VnfComponentESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + vnfComponent0.setVnfId(2405); + VnfComponent vnfComponent1 = new VnfComponent(); + boolean boolean0 = vnfComponent0.equals(vnfComponent1); + assertEquals(2405, vnfComponent0.getVnfId()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + boolean boolean0 = vnfComponent0.equals(vnfComponent0); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + vnfComponent0.setVnfId(1343); + int int0 = vnfComponent0.getVnfId(); + assertEquals(1343, int0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + vnfComponent0.setVnfId((-1)); + int int0 = vnfComponent0.getVnfId(); + assertEquals((-1), int0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = new Integer(0); + vnfComponent0.setHeatTemplateId(integer0); + Integer integer1 = vnfComponent0.getHeatTemplateId(); + assertEquals(0, (int)integer1); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = new Integer((-1)); + vnfComponent0.setHeatTemplateId(integer0); + Integer integer1 = vnfComponent0.getHeatTemplateId(); + assertEquals((-1), (int)integer1); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = new Integer(0); + vnfComponent0.setHeatEnvironmentId(integer0); + Integer integer1 = vnfComponent0.getHeatEnvironmentId(); + assertEquals(0, (int)integer1); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = new Integer(1); + vnfComponent0.setHeatEnvironmentId(integer0); + Integer integer1 = vnfComponent0.getHeatEnvironmentId(); + assertEquals(1, (int)integer1); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = new Integer((-1)); + vnfComponent0.setHeatEnvironmentId(integer0); + Integer integer1 = vnfComponent0.getHeatEnvironmentId(); + assertEquals((-1), (int)integer1); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Timestamp timestamp0 = new Timestamp(0L); + vnfComponent0.setCreated(timestamp0); + Timestamp timestamp1 = vnfComponent0.getCreated(); + assertEquals(0, timestamp1.getNanos()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Timestamp timestamp0 = new Timestamp((-1098L)); + vnfComponent0.setCreated(timestamp0); + Timestamp timestamp1 = vnfComponent0.getCreated(); + assertSame(timestamp1, timestamp0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + vnfComponent0.setComponentType("BiXPVXS}ta?x9wcq"); + String string0 = vnfComponent0.getComponentType(); + assertEquals("BiXPVXS}ta?x9wcq", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + vnfComponent0.setComponentType(""); + String string0 = vnfComponent0.getComponentType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + int int0 = vnfComponent0.getVnfId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + VnfComponent vnfComponent1 = new VnfComponent(); + vnfComponent0.setComponentType(""); + vnfComponent1.setComponentType(""); + boolean boolean0 = vnfComponent0.equals(vnfComponent1); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + VnfComponent vnfComponent1 = new VnfComponent(); + vnfComponent1.setComponentType("X\"p(eM"); + boolean boolean0 = vnfComponent0.equals(vnfComponent1); + assertEquals(0, vnfComponent1.getVnfId()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = new Integer((-1)); + boolean boolean0 = vnfComponent0.equals(integer0); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Timestamp timestamp0 = new Timestamp((-38L)); + vnfComponent0.setCreated(timestamp0); + String string0 = vnfComponent0.toString(); + assertEquals("VnfComponent: vnfId=0,componentType=null,heatTemplateId=null,heatEnvironmentId=null,created=12/31/69 11:59 PM", string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + String string0 = vnfComponent0.toString(); + assertEquals("VnfComponent: vnfId=0,componentType=null,heatTemplateId=null,heatEnvironmentId=null", string0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + vnfComponent0.setVnfId((-1)); + VnfComponent vnfComponent1 = new VnfComponent(); + boolean boolean0 = vnfComponent0.equals(vnfComponent1); + assertEquals(-1, vnfComponent0.getVnfId()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + vnfComponent0.hashCode(); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Timestamp timestamp0 = vnfComponent0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = vnfComponent0.getHeatEnvironmentId(); + assertNull(integer0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + String string0 = vnfComponent0.getComponentType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = vnfComponent0.getHeatTemplateId(); + assertNull(integer0); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + Integer integer0 = new Integer(1910); + vnfComponent0.setHeatTemplateId(integer0); + Integer integer1 = vnfComponent0.getHeatTemplateId(); + assertEquals(1910, (int)integer1); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + VnfComponent vnfComponent0 = new VnfComponent(); + VnfComponent vnfComponent1 = new VnfComponent(); + // Undeclared exception! + try { + vnfComponent0.equals(vnfComponent1); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentESTestscaffolding.java new file mode 100644 index 0000000000..de177332f4 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentESTestscaffolding.java @@ -0,0 +1,83 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:14:48 GMT 2016 + */ + +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 VnfComponentESTestscaffolding { + + @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.VnfComponent"; + 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(VnfComponentESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.VnfComponent" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(VnfComponentESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.db.catalog.beans.VnfComponent" + ); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipeESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipeESTest.java new file mode 100644 index 0000000000..651e7f72f4 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipeESTest.java @@ -0,0 +1,125 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:22:43 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 VnfComponentsRecipeESTest extends VnfComponentsRecipeESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setOrchestrationUri("{bpW{ ow"); + String string0 = vnfComponentsRecipe0.toString(); + assertEquals("RECIPE: null,uri={bpW{ ow,vnfComponentParamXSD=null,serviceType=null,vnfComponentType=null,vfModuleId=null", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.action = "(G:J?!6e"; + String string0 = vnfComponentsRecipe0.toString(); + assertEquals("RECIPE: (G:J?!6e,uri=null,vnfComponentParamXSD=null,serviceType=null,vnfComponentType=null,vfModuleId=null", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setVnfType("RECIPE: null,uri=null,vnfComponentParamXSD=null,serviceType=null,vnfComponentType=null,vfModuleId=null"); + String string0 = vnfComponentsRecipe0.getVnfType(); + assertEquals("RECIPE: null,uri=null,vnfComponentParamXSD=null,serviceType=null,vnfComponentType=null,vfModuleId=null", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setVnfType(""); + String string0 = vnfComponentsRecipe0.getVnfType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setVnfComponentType("RECIPE: null,uri=null,vnfComponentParamXSD=null,serviceType=null,vnfComponentType=null,vfModuleId=null"); + String string0 = vnfComponentsRecipe0.getVnfComponentType(); + assertEquals("RECIPE: null,uri=null,vnfComponentParamXSD=null,serviceType=null,vnfComponentType=null,vfModuleId=null", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setVnfComponentParamXSD("d'fp("); + String string0 = vnfComponentsRecipe0.getVnfComponentParamXSD(); + assertEquals("d'fp(", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setVnfComponentParamXSD(""); + String string0 = vnfComponentsRecipe0.getVnfComponentParamXSD(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setVfModuleId("Wg>|PNS?"); + String string0 = vnfComponentsRecipe0.getVfModuleId(); + assertEquals("Wg>|PNS?", string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + String string0 = vnfComponentsRecipe0.getVfModuleId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + String string0 = vnfComponentsRecipe0.getVnfType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setVnfComponentType(""); + String string0 = vnfComponentsRecipe0.getVnfComponentType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + String string0 = vnfComponentsRecipe0.getVnfComponentParamXSD(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + vnfComponentsRecipe0.setVfModuleId(""); + String string0 = vnfComponentsRecipe0.getVfModuleId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + VnfComponentsRecipe vnfComponentsRecipe0 = new VnfComponentsRecipe(); + String string0 = vnfComponentsRecipe0.getVnfComponentType(); + assertNull(string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipeESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipeESTestscaffolding.java new file mode 100644 index 0000000000..da535d4d04 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipeESTestscaffolding.java @@ -0,0 +1,80 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:22:43 GMT 2016 + */ + +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 VnfComponentsRecipeESTestscaffolding { + + @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.VnfComponentsRecipe"; + 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(VnfComponentsRecipeESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.Recipe", + "org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfRecipeESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfRecipeESTest.java new file mode 100644 index 0000000000..d86647973f --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfRecipeESTest.java @@ -0,0 +1,94 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:23:26 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +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 VnfRecipeESTest extends VnfRecipeESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + vnfRecipe0.setVnfParamXSD("@!JsE$ &"); + String string0 = vnfRecipe0.toString(); + assertEquals("RECIPE: null,uri=null,vnfParamXSD=@!JsE$ &,serviceType=null,vfModuleId=null", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + vnfRecipe0.setVnfType("<[sFL"); + String string0 = vnfRecipe0.getVnfType(); + assertEquals("<[sFL", string0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + vnfRecipe0.setVnfType(""); + String string0 = vnfRecipe0.getVnfType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + vnfRecipe0.setVnfParamXSD(""); + String string0 = vnfRecipe0.getVnfParamXSD(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + vnfRecipe0.setVfModuleId("QL"); + String string0 = vnfRecipe0.getVfModuleId(); + assertEquals("QL", string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + vnfRecipe0.setVfModuleId(""); + String string0 = vnfRecipe0.getVfModuleId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + String string0 = vnfRecipe0.getVnfParamXSD(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + vnfRecipe0.setVnfParamXSD("RECIPE: null,uri=null,vnfParamXSD=null,serviceType=null,vfModuleId=null"); + String string0 = vnfRecipe0.getVnfParamXSD(); + assertEquals("RECIPE: null,uri=null,vnfParamXSD=null,serviceType=null,vfModuleId=null", string0); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + String string0 = vnfRecipe0.getVfModuleId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test9() throws Throwable { + VnfRecipe vnfRecipe0 = new VnfRecipe(); + String string0 = vnfRecipe0.getVnfType(); + assertNull(string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfRecipeESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfRecipeESTestscaffolding.java new file mode 100644 index 0000000000..4532226a4e --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfRecipeESTestscaffolding.java @@ -0,0 +1,80 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:23:26 GMT 2016 + */ + +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 VnfRecipeESTestscaffolding { + + @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.VnfRecipe"; + 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(VnfRecipeESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.Recipe", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.db.catalog.beans.VnfRecipe" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfResourceESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfResourceESTest.java new file mode 100644 index 0000000000..74562f8bc3 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VnfResourceESTest.java @@ -0,0 +1,636 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:21:05 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.MockitoExtension.*; + +import java.sql.Timestamp; +import java.util.Map; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class VnfResourceESTest extends VnfResourceESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.getAicVersionMax(); + Integer integer0 = new Integer(347); + vnfResource0.setTemplateId(integer0); + vnfResource0.toString(); + vnfResource0.setModelInvariantUuid(", vnfResourceId="); + vnfResource0.getModelCustomizationName(); + vnfResource0.isTheSameVersion((String) null); + vnfResource0.getId(); + Integer integer1 = new Integer(0); + vnfResource0.setTemplateId(integer1); + vnfResource0.setOrchestrationMode((String) null); + vnfResource0.getModelName(); + vnfResource0.getId(); + vnfResource0.getEnvironmentId(); + vnfResource0.setModelName(""); + vnfResource0.getOrchestrationMode(); + vnfResource0.toString(); + vnfResource0.getModelName(); + vnfResource0.setModelCustomizationName(", vnfResourceId="); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setAicVersionMax("W8eoH"); + vnfResource0.setVnfType(""); + vnfResource0.setAicVersionMin(""); + vnfResource0.getServiceModelInvariantUUID(); + vnfResource0.setAsdcUuid(""); + VnfResource vnfResource1 = new VnfResource(); + vnfResource0.getTemplateId(); + vnfResource0.getVnfType(); + vnfResource0.setModelName(""); + vnfResource1.setModelCustomizationName((String) null); + vnfResource0.getHeatFiles(); + vnfResource1.getModelName(); + vnfResource1.setDescription(""); + vnfResource1.setModelCustomizationName((String) null); + vnfResource0.getEnvironmentId(); + vnfResource0.getAsdcUuid(); + vnfResource1.setVnfType("<[%6q]17$) null); + vnfResource0.setServiceModelInvariantUUID(""); + vnfResource0.getServiceModelInvariantUUID(); + vnfResource0.setDescription(""); + vnfResource0.getCreated(); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setAicVersionMax(""); + vnfResource0.isTheSameVersion("ID="); + vnfResource0.getModelCustomizationName(); + vnfResource0.getVnfType(); + vnfResource0.setModelInvariantUuid((String) null); + vnfResource0.getHeatFiles(); + vnfResource0.setHeatFiles((Map) null); + vnfResource0.toString(); + vnfResource0.setServiceModelInvariantUUID(""); + vnfResource0.setModelVersion(""); + vnfResource0.getCreated(); + vnfResource0.getCreated(); + vnfResource0.setVnfType(""); + Integer integer0 = new Integer(0); + vnfResource0.setTemplateId(integer0); + vnfResource0.getHeatFiles(); + vnfResource0.getAicVersionMax(); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setServiceModelInvariantUUID(""); + vnfResource0.setId(1731); + vnfResource0.setAsdcUuid((String) null); + vnfResource0.setVersion((String) null); + vnfResource0.setAsdcUuid((String) null); + vnfResource0.getEnvironmentId(); + vnfResource0.setServiceModelInvariantUUID((String) null); + vnfResource0.setId(1731); + vnfResource0.getDescription(); + vnfResource0.setEnvironmentId((Integer) null); + vnfResource0.getAicVersionMin(); + vnfResource0.getId(); + vnfResource0.setModelCustomizationName("`y0\"kaFz37W|^|'Y"); + vnfResource0.getId(); + vnfResource0.setVersion(",created="); + vnfResource0.setModelInvariantUuid((String) null); + vnfResource0.getCreated(); + vnfResource0.getAicVersionMax(); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.isMoreRecentThan("2+Mv%?pGcj"); + vnfResource0.setAsdcUuid("2+Mv%?pGcj"); + vnfResource0.getModelInvariantUuid(); + vnfResource0.getModelVersion(); + vnfResource0.setVnfType(""); + vnfResource0.getVnfType(); + vnfResource0.setId(0); + vnfResource0.getCreated(); + vnfResource0.getModelCustomizationName(); + vnfResource0.setDescription(""); + vnfResource0.getModelVersion(); + vnfResource0.getAicVersionMin(); + vnfResource0.getOrchestrationMode(); + vnfResource0.getDescription(); + vnfResource0.setAsdcUuid(""); + vnfResource0.setAicVersionMax(",template="); + Integer integer0 = new Integer(4008); + vnfResource0.setTemplateId(integer0); + vnfResource0.setAicVersionMax(",aicVersionMax="); + vnfResource0.setVnfType(""); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.getHeatFiles(); + vnfResource0.setHeatFiles((Map) null); + vnfResource0.isMoreRecentThan(""); + vnfResource0.toString(); + Integer integer0 = new Integer((-3414)); + vnfResource0.setEnvironmentId(integer0); + vnfResource0.getEnvironmentId(); + vnfResource0.getCreated(); + vnfResource0.setModelInvariantUuid(""); + vnfResource0.setModelInvariantUuid(""); + vnfResource0.setAicVersionMin(",template="); + vnfResource0.getEnvironmentId(); + vnfResource0.getServiceModelInvariantUUID(); + vnfResource0.getCreated(); + Integer integer1 = new Integer(898); + vnfResource0.setTemplateId(integer1); + vnfResource0.setModelVersion("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"); + vnfResource0.getHeatFiles(); + vnfResource0.getServiceModelInvariantUUID(); + vnfResource0.getId(); + VnfResource vnfResource1 = new VnfResource(); + vnfResource0.setId(0); + vnfResource0.setId(1); + vnfResource1.setServiceModelInvariantUUID(",template="); + vnfResource1.setVnfType(""); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.toString(); + Integer integer0 = new Integer(2830); + vnfResource0.setEnvironmentId(integer0); + vnfResource0.getAicVersionMin(); + vnfResource0.getModelCustomizationName(); + vnfResource0.getHeatFiles(); + vnfResource0.setHeatFiles((Map) null); + vnfResource0.setId((-802)); + vnfResource0.getHeatFiles(); + vnfResource0.getAicVersionMin(); + vnfResource0.setOrchestrationMode((String) null); + vnfResource0.setAicVersionMax((String) null); + vnfResource0.setModelCustomizationName("mU"); + vnfResource0.getEnvironmentId(); + vnfResource0.setModelInvariantUuid((String) null); + vnfResource0.getModelName(); + vnfResource0.getCreated(); + vnfResource0.getHeatFiles(); + vnfResource0.setModelCustomizationName(",template="); + Integer integer1 = new Integer((-802)); + vnfResource0.setEnvironmentId(integer1); + vnfResource0.getAicVersionMax(); + vnfResource0.setCreated((Timestamp) null); + vnfResource0.getModelCustomizationName(); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + Integer integer0 = new Integer((-850)); + vnfResource0.setTemplateId(integer0); + vnfResource0.setAsdcUuid(",modelInvariantUuid="); + vnfResource0.getAsdcUuid(); + vnfResource0.setVersion("M:u'/:}/c=[kT$1|~"); + vnfResource0.setVnfType("Sz!+cMn"); + vnfResource0.getTemplateId(); + vnfResource0.setId((-850)); + vnfResource0.getModelVersion(); + vnfResource0.setVersion("M:u'/:}/c=[kT$1|~"); + vnfResource0.setServiceModelInvariantUUID("M:u'/:}/c=[kT$1|~"); + vnfResource0.setVnfType((String) null); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + Integer integer0 = new Integer(0); + vnfResource0.setTemplateId(integer0); + vnfResource0.setModelVersion(""); + vnfResource0.getAsdcUuid(); + vnfResource0.setModelCustomizationName("e]B=gmKEhOL"); + vnfResource0.getModelVersion(); + vnfResource0.getHeatFiles(); + vnfResource0.setModelName(""); + vnfResource0.setDescription("v\u0000tj])h=a"); + vnfResource0.setAicVersionMax("v\u0000tj])h=a"); + vnfResource0.getAicVersionMin(); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setModelInvariantUuid(""); + VnfResource vnfResource1 = new VnfResource(); + vnfResource1.getCreated(); + vnfResource0.setCreated((Timestamp) null); + Integer integer0 = new Integer((-821)); + vnfResource0.setEnvironmentId(integer0); + vnfResource0.setServiceModelInvariantUUID(""); + vnfResource0.setVnfType("[="); + vnfResource0.getModelInvariantUuid(); + vnfResource0.getModelVersion(); + vnfResource0.setOrchestrationMode(""); + vnfResource1.setAicVersionMax(""); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.getAicVersionMax(); + Integer integer0 = new Integer(0); + vnfResource0.setTemplateId(integer0); + vnfResource0.isMoreRecentThan((String) null); + vnfResource0.setVnfType((String) null); + vnfResource0.setServiceModelInvariantUUID("."); + Integer integer1 = new Integer(1); + vnfResource0.setTemplateId(integer1); + vnfResource0.toString(); + vnfResource0.getModelCustomizationName(); + vnfResource0.setId(0); + vnfResource0.setModelVersion(",modelVersion="); + vnfResource0.getCreated(); + vnfResource0.setCreated((Timestamp) null); + vnfResource0.getTemplateId(); + vnfResource0.getServiceModelInvariantUUID(); + vnfResource0.getModelInvariantUuid(); + vnfResource0.getEnvironmentId(); + vnfResource0.setAicVersionMax(",modelName="); + Integer integer2 = new Integer((-777)); + vnfResource0.setTemplateId(integer2); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.getHeatFiles(); + vnfResource0.setHeatFiles((Map) null); + vnfResource0.setModelName("Wwy:ofB"); + Integer integer0 = new Integer(0); + vnfResource0.setTemplateId(integer0); + Integer integer1 = new Integer(0); + vnfResource0.setEnvironmentId(integer1); + vnfResource0.setModelVersion("H[4j < uiNVQa.0w-P"); + vnfResource0.toString(); + vnfResource0.getModelInvariantUuid(); + vnfResource0.setVnfType("Wwy:ofB"); + vnfResource0.setAicVersionMin("]$0J9oRP[=9"); + vnfResource0.getModelName(); + vnfResource0.getVnfType(); + vnfResource0.getTemplateId(); + vnfResource0.getAicVersionMax(); + vnfResource0.setAsdcUuid("VNF=null,version=null,mode=null,template=0,envtId=0,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=H[4j < uiNVQa.0w-P,modelCustomizationName=null,modelName=Wwy:ofB,serviceModelInvariantUUID=null"); + vnfResource0.getHeatFiles(); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setModelCustomizationName("@%}qMRUUV?U7X~(re"); + vnfResource0.getEnvironmentId(); + vnfResource0.setOrchestrationMode("@%}qMRUUV?U7X~(re"); + vnfResource0.setEnvironmentId((Integer) null); + vnfResource0.setModelName("@%}qMRUUV?U7X~(re"); + vnfResource0.getEnvironmentId(); + vnfResource0.toString(); + vnfResource0.setAsdcUuid("VNF=null,version=null,mode=@%}qMRUUV?U7X~(re,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=@%}qMRUUV?U7X~(re,modelName=@%}qMRUUV?U7X~(re,serviceModelInvariantUUID=null"); + vnfResource0.getAsdcUuid(); + vnfResource0.setAsdcUuid("l<;mp"); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.toString(); + vnfResource0.setModelName("KPE,e"); + vnfResource0.setAsdcUuid("KPE,e"); + vnfResource0.setAicVersionMax("KPE,e"); + vnfResource0.setAicVersionMin(""); + vnfResource0.setModelCustomizationName((String) null); + vnfResource0.setDescription("UI!~W@$,"); + vnfResource0.setModelCustomizationName("UI!~W@$,"); + vnfResource0.setModelVersion(", description=null"); + Integer integer0 = new Integer((-1783)); + vnfResource0.setEnvironmentId(integer0); + vnfResource0.getAicVersionMin(); + vnfResource0.getModelInvariantUuid(); + vnfResource0.setAsdcUuid("nsmO^IEr4"); + vnfResource0.getModelVersion(); + vnfResource0.setDescription("KPE,e"); + vnfResource0.setModelInvariantUuid((String) null); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.getAsdcUuid(); + vnfResource0.getHeatFiles(); + vnfResource0.setHeatFiles((Map) null); + vnfResource0.setModelVersion(""); + Integer integer0 = new Integer(0); + vnfResource0.setEnvironmentId(integer0); + vnfResource0.setModelName("&"); + vnfResource0.getCreated(); + vnfResource0.getAsdcUuid(); + vnfResource0.setOrchestrationMode(""); + vnfResource0.setServiceModelInvariantUUID(""); + vnfResource0.setServiceModelInvariantUUID("&"); + vnfResource0.setModelInvariantUuid(""); + vnfResource0.setTemplateId(integer0); + vnfResource0.getOrchestrationMode(); + vnfResource0.setOrchestrationMode((String) null); + vnfResource0.getModelCustomizationName(); + VnfResource vnfResource1 = new VnfResource(); + vnfResource1.setAicVersionMax(""); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setModelVersion("nT~K_A6F(}G"); + vnfResource0.getModelVersion(); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + Integer integer0 = new Integer(4093); + vnfResource0.setTemplateId(integer0); + vnfResource0.setModelVersion("o)|85b9k"); + vnfResource0.isTheSameVersion("o)|85b9k"); + vnfResource0.getCreated(); + vnfResource0.setCreated((Timestamp) null); + vnfResource0.getTemplateId(); + vnfResource0.toString(); + vnfResource0.getServiceModelInvariantUUID(); + vnfResource0.toString(); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setAicVersionMax("e"); + vnfResource0.getAicVersionMax(); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setAicVersionMax("s%I`;jJq\"jMHIJ"); + vnfResource0.getCreated(); + vnfResource0.setCreated((Timestamp) null); + vnfResource0.setAicVersionMin("s%I`;jJq\"jMHIJ"); + vnfResource0.setVnfType("s%I`;jJq\"jMHIJ"); + vnfResource0.getVnfType(); + vnfResource0.setModelName("s%I`;jJq\"jMHIJ"); + vnfResource0.setModelVersion("s%I`;jJq\"jMHIJ"); + vnfResource0.getModelInvariantUuid(); + vnfResource0.setVnfType("s%I`;jJq\"jMHIJ"); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setModelName("hF&vbMtZNXOQ"); + vnfResource0.setDescription(",serviceModelInvariantUUID="); + vnfResource0.setModelCustomizationName("?v>=ahb.RUT$"); + vnfResource0.getCreated(); + vnfResource0.setCreated((Timestamp) null); + vnfResource0.setModelVersion("Vz:NMii"); + vnfResource0.setOrchestrationMode("Vz:NMii"); + vnfResource0.getEnvironmentId(); + VnfResource vnfResource1 = new VnfResource(); + vnfResource0.getModelName(); + vnfResource1.setId(0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setDescription((String) null); + vnfResource0.setId((-1887)); + vnfResource0.getId(); + vnfResource0.toString(); + vnfResource0.toString(); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setModelCustomizationName("lGX-!8UJxdrx]B'3"); + vnfResource0.setId(0); + vnfResource0.setServiceModelInvariantUUID(""); + vnfResource0.setOrchestrationMode("lGX-!8UJxdrx]B'3"); + vnfResource0.setModelName(""); + vnfResource0.setServiceModelInvariantUUID(""); + vnfResource0.getModelCustomizationName(); + vnfResource0.setServiceModelInvariantUUID(""); + vnfResource0.setModelName("!{XY#&,~p1Ku"); + vnfResource0.getEnvironmentId(); + vnfResource0.getAicVersionMax(); + vnfResource0.getAicVersionMin(); + vnfResource0.setModelVersion(",fileName="); + vnfResource0.toString(); + vnfResource0.toString(); + vnfResource0.setId(0); + vnfResource0.getAsdcUuid(); + vnfResource0.getAsdcUuid(); + vnfResource0.setDescription(""); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + Integer integer0 = new Integer((-1033)); + vnfResource0.setTemplateId(integer0); + vnfResource0.setAicVersionMin("?ph"); + vnfResource0.setVnfType("_LG54"); + vnfResource0.getAicVersionMin(); + vnfResource0.getEnvironmentId(); + vnfResource0.setDescription(",fileBody="); + vnfResource0.toString(); + vnfResource0.getId(); + vnfResource0.setModelVersion(">dV"); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.getEnvironmentId(); + vnfResource0.setModelInvariantUuid((String) null); + Integer integer0 = new Integer((-513)); + vnfResource0.setTemplateId(integer0); + vnfResource0.setModelVersion(""); + Integer integer1 = new Integer(1650); + vnfResource0.setTemplateId(integer1); + vnfResource0.getHeatFiles(); + vnfResource0.getTemplateId(); + vnfResource0.getDescription(); + vnfResource0.getServiceModelInvariantUUID(); + Integer integer2 = new Integer(0); + vnfResource0.setTemplateId(integer2); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setVnfType(""); + vnfResource0.setModelName(""); + vnfResource0.setDescription(",envtId="); + vnfResource0.getDescription(); + vnfResource0.setVnfType(",envtId="); + vnfResource0.setAicVersionMax(""); + vnfResource0.getOrchestrationMode(); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setAicVersionMin(""); + vnfResource0.getModelInvariantUuid(); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setVnfType("Va`9"); + vnfResource0.setModelVersion("gBfjaCmk_2B"); + vnfResource0.toString(); + vnfResource0.setVnfType("VNF=Va`9,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=gBfjaCmk_2B,modelCustomizationName=null,modelName=null,serviceModelInvariantUUID=null"); + vnfResource0.getModelCustomizationName(); + vnfResource0.setOrchestrationMode("Va`9"); + vnfResource0.getDescription(); + vnfResource0.getOrchestrationMode(); + vnfResource0.getServiceModelInvariantUUID(); + vnfResource0.getAsdcUuid(); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.getVnfType(); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setVnfType("z?*}&4;|s"); + vnfResource0.setAicVersionMin("z?*}&4;|s"); + vnfResource0.toString(); + Map map0 = (Map) mock(Map.class, new ViolatedAssumptionAnswer()); + Timestamp timestamp0 = mock(Timestamp.class, new ViolatedAssumptionAnswer()); + doReturn(0L, 0L, 0L, 0L, 0L).when(timestamp0).getTime(); + doReturn((String) null, (String) null, (String) null, (String) null, (String) null).when(timestamp0).toString(); + vnfResource0.setCreated(timestamp0); + vnfResource0.setHeatFiles(map0); + vnfResource0.setServiceModelInvariantUUID("VNF=z?*}&4;|s,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=z?*}&4;|s,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=null,modelName=null,serviceModelInvariantUUID=null"); + vnfResource0.toString(); + Timestamp timestamp1 = vnfResource0.getCreated(); + vnfResource0.toString(); + vnfResource0.toString(); + vnfResource0.toString(); + vnfResource0.setAicVersionMax("z?*}&4;|s"); + vnfResource0.setId(531); + vnfResource0.getCreated(); + vnfResource0.toString(); + vnfResource0.getCreated(); + vnfResource0.getCreated(); + Timestamp timestamp2 = vnfResource0.getCreated(); + assertSame(timestamp2, timestamp1); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setVnfType("Va`9"); + vnfResource0.setModelVersion("gBfjaCmk_2B"); + vnfResource0.getModelCustomizationName(); + vnfResource0.getDescription(); + vnfResource0.getOrchestrationMode(); + vnfResource0.getServiceModelInvariantUUID(); + String string0 = vnfResource0.getAsdcUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setOrchestrationMode("nT~K_A6F(}G"); + String string0 = vnfResource0.getModelVersion(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.setModelCustomizationName(""); + vnfResource0.toString(); + vnfResource0.setModelInvariantUuid("VNF=null,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=,modelName=null,serviceModelInvariantUUID=null"); + Integer integer0 = new Integer(0); + vnfResource0.setEnvironmentId(integer0); + vnfResource0.getAicVersionMin(); + vnfResource0.getOrchestrationMode(); + vnfResource0.setModelName((String) null); + vnfResource0.setVnfType(""); + vnfResource0.getHeatFiles(); + vnfResource0.setHeatFiles((Map) null); + vnfResource0.getVnfType(); + vnfResource0.getEnvironmentId(); + vnfResource0.setVnfType("VNF=null,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=,modelName=null,serviceModelInvariantUUID=null"); + vnfResource0.getModelCustomizationName(); + vnfResource0.getCreated(); + vnfResource0.getAicVersionMax(); + vnfResource0.getModelInvariantUuid(); + vnfResource0.setTemplateId(integer0); + vnfResource0.setAsdcUuid(""); + assertNull(vnfResource0.getServiceModelInvariantUUID()); + } + + @Test(timeout = 4000) + public void test33() throws Throwable { + VnfResource vnfResource0 = new VnfResource(); + vnfResource0.getDescription(); + vnfResource0.setVnfType("8@%dK*Sm}Sc[/\"*^vL"); + vnfResource0.setAicVersionMax("8@%dK*Sm}Sc[/\"*^vL"); + vnfResource0.setModelCustomizationName((String) null); + vnfResource0.setDescription(";bAY~(4TDJ[r4 heatTemplates; + + static { + heatTemplates = new HashMap(); + + addTemplate("ApacheDemo", "C:/temp/apache-demo.json", 2, + new ArrayList(Arrays.asList("private_subnet_gateway", "private_subnet_cidr")), + new ArrayList (Arrays.asList("vnf_id", "public_net_id"))); + } + + public CatalogTestDatabase () { + } + + private static void addTemplate (String name, String path, int timeout, List reqd, List opt) + { + HeatTemplate template = new HeatTemplate(); + template.setId(id++); + template.setTemplateName("ApacheDemo"); + template.setTemplatePath("C:/temp/apache-demo.json"); + template.setTimeoutMinutes(2); + + Set params = new HashSet(); + + for (String s : reqd) { + HeatTemplateParam param = new HeatTemplateParam(); + param.setId(id++); + param.setParamName(s); + param.setRequired(true); + params.add(param); + } + + for (String s : opt) { + HeatTemplateParam param = new HeatTemplateParam(); + param.setId(id++); + param.setParamName(s); + param.setRequired(false); + params.add(param); + } + template.setParameters(params); + + heatTemplates.put(name, template); + } + + @Override + public HeatTemplate getHeatTemplate (String templateName) + { + if (heatTemplates.containsKey(templateName)) { + return heatTemplates.get(templateName); + } else { + return null; + } + } + + @Override + public HeatTemplate getHeatTemplate (String templateName, String version) + { + return getHeatTemplate(templateName); + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java new file mode 100644 index 0000000000..bf8f3eae59 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java @@ -0,0 +1,85 @@ +/*- + * ============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.test; + + +import static org.junit.Assert.*; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.HashSet; + +import org.junit.Test; + +import org.openecomp.mso.db.catalog.beans.HeatTemplate; +import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; + +/** + */ + +public class HeatTemplateTest { + + @Test + public final void heatTemplateTest () { + HeatTemplate heatTemplate = new HeatTemplate (); + heatTemplate.setTemplateBody ("testBody"); + assertTrue (heatTemplate.getHeatTemplate ().equals ("testBody")); + assertTrue (heatTemplate.toString ().contains ("8 chars")); + heatTemplate.setTemplateBody (null); + assertTrue (heatTemplate.toString ().contains ("Not defined")); + HashSet set = new HashSet<> (); + HeatTemplateParam param = new HeatTemplateParam (); + param.setParamName ("param name"); + param.setParamType ("string"); + param.setRequired (false); + set.add (param); + HeatTemplateParam param2 = new HeatTemplateParam (); + param2.setParamName ("param 2"); + param2.setParamType ("string"); + param2.setRequired (true); + set.add (param2); + heatTemplate.setParameters (set); + String heatStr = heatTemplate.toString (); + assertTrue (heatStr.contains ("param name")); + assertTrue (heatStr.toString ().contains ("param 2(reqd)")); + + File tempFile; + try { + tempFile = File.createTempFile ("heatTemplate", "test"); + tempFile.deleteOnExit (); + try (Writer writer = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (tempFile), + "utf-8"))) { + writer.write ("something\n"); + writer.write ("something2\n"); + } + heatTemplate.setTemplatePath (tempFile.getAbsolutePath ()); + assertTrue (heatTemplate.getHeatTemplate ().contains ("something2")); + } catch (IOException e) { + e.printStackTrace (); + fail ("Exception caught"); + } + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java new file mode 100644 index 0000000000..2f24a4cb1b --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java @@ -0,0 +1,187 @@ +/*- + * ============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.test; + + +import static org.junit.Assert.*; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +import org.junit.Test; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioningComparator; +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + + +public class MavenVersioningTest { + + @Test + public final void testVersion () { + MavenLikeVersioning mavenVersioning = new MavenLikeVersioning (); + assertFalse(mavenVersioning.isMoreRecentThan("0.0.0")); + assertFalse(mavenVersioning.isMoreRecentThan(null)); + mavenVersioning.setVersion("0.0.1"); + + assertFalse(mavenVersioning.isMoreRecentThan(null)); + assertTrue(mavenVersioning.isMoreRecentThan("0.0.0")); + assertTrue(mavenVersioning.isMoreRecentThan("0.0.0.1")); + + assertFalse(mavenVersioning.isMoreRecentThan("0.0.2")); + assertFalse(mavenVersioning.isMoreRecentThan("0.0.1")); + assertFalse(mavenVersioning.isMoreRecentThan("00.00.01")); + + assertFalse(mavenVersioning.isMoreRecentThan("0.1")); + assertFalse(mavenVersioning.isMoreRecentThan("1")); + assertFalse(mavenVersioning.isMoreRecentThan("0.1.0.2")); + + assertFalse(mavenVersioning.isMoreRecentThan("0.1.1")); + assertFalse(mavenVersioning.isMoreRecentThan("2.1.1")); + + mavenVersioning.setVersion("1.0.1"); + assertTrue(mavenVersioning.isMoreRecentThan("0.0.0")); + assertTrue(mavenVersioning.isMoreRecentThan("0.5.2")); + assertTrue(mavenVersioning.isMoreRecentThan("1.0.0")); + + assertFalse(mavenVersioning.isMoreRecentThan("2.1.1")); + assertFalse(mavenVersioning.isMoreRecentThan("02.001.0001")); + assertFalse(mavenVersioning.isMoreRecentThan("1.0.1")); + assertFalse(mavenVersioning.isMoreRecentThan("1.0.2")); + assertFalse(mavenVersioning.isMoreRecentThan("1.1.1")); + assertFalse(mavenVersioning.isMoreRecentThan("1.0.10")); + + + mavenVersioning.setVersion("100.0.1"); + assertTrue(mavenVersioning.isMoreRecentThan("0.0.0")); + assertTrue(mavenVersioning.isMoreRecentThan("0.5.2")); + assertTrue(mavenVersioning.isMoreRecentThan("1.0.0")); + + assertFalse(mavenVersioning.isMoreRecentThan("101.1.1")); + assertFalse(mavenVersioning.isMoreRecentThan("100.0.1")); + assertFalse(mavenVersioning.isMoreRecentThan("100.0.2")); + assertFalse(mavenVersioning.isMoreRecentThan("100.1.1")); + + assertFalse(mavenVersioning.isMoreRecentThan("100.0.1.4")); + } + + @Test + public final void testOneDigitVersion() { + MavenLikeVersioning oneDigit = new MavenLikeVersioning(); + oneDigit.setVersion("1"); + assertFalse(oneDigit.isMoreRecentThan("2")); + assertFalse(oneDigit.isMoreRecentThan("2.0")); + assertFalse(oneDigit.isMoreRecentThan("1.0")); + + oneDigit.setVersion("1.0"); + assertTrue(oneDigit.isMoreRecentThan("1")); + + oneDigit.setVersion("1"); + assertFalse(oneDigit.isTheSameVersion("1.1")); + assertFalse(oneDigit.isTheSameVersion("1.0")); + assertFalse(oneDigit.isTheSameVersion("1.0.0")); + + oneDigit.setVersion("2"); + assertTrue(oneDigit.isMoreRecentThan("1")); + assertTrue(oneDigit.isMoreRecentThan("1.0")); + assertTrue(oneDigit.isMoreRecentThan("1.1")); + assertTrue(oneDigit.isMoreRecentThan("0.1")); + assertFalse(oneDigit.isMoreRecentThan("2.0")); + + } + + @Test + public final void testVersionEquals () { + + MavenLikeVersioning heatTemplate = new MavenLikeVersioning(); + assertFalse(heatTemplate.isTheSameVersion("100.0")); + assertTrue(heatTemplate.isTheSameVersion(null)); + heatTemplate.setVersion("100.0.1"); + assertFalse(heatTemplate.isTheSameVersion(null)); + assertFalse(heatTemplate.isTheSameVersion("100.0")); + assertFalse(heatTemplate.isTheSameVersion("100")); + assertFalse(heatTemplate.isTheSameVersion("100.0.1.1")); + assertTrue(heatTemplate.isTheSameVersion("100.0.1")); + assertTrue(heatTemplate.isTheSameVersion("00100.000.0001")); + assertFalse(heatTemplate.isTheSameVersion("0.0.1")); + assertTrue(heatTemplate.isTheSameVersion("100.0.01")); + + } + + @Test + public final void testListSort () { + MavenLikeVersioning test1 = new MavenLikeVersioning(); + test1.setVersion("1.1"); + MavenLikeVersioning test2 = new MavenLikeVersioning(); + test2.setVersion("1.10"); + MavenLikeVersioning test3 = new MavenLikeVersioning(); + test3.setVersion("1.2"); + MavenLikeVersioning test4 = new MavenLikeVersioning(); + test4.setVersion("1.20"); + MavenLikeVersioning test5 = new MavenLikeVersioning(); + test5.setVersion("1.02"); + MavenLikeVersioning test6 = new MavenLikeVersioning(); + test6.setVersion("2.02"); + MavenLikeVersioning test7 = new MavenLikeVersioning(); + test7.setVersion("0.02"); + MavenLikeVersioning test8 = new MavenLikeVersioning(); + test8.setVersion("2.02"); + MavenLikeVersioning test9 = new MavenLikeVersioning(); + test9.setVersion("10.2004"); + MavenLikeVersioning test10 = new MavenLikeVersioning(); + test10.setVersion("2"); + MavenLikeVersioning test11 = new MavenLikeVersioning(); + test11.setVersion("12"); + MavenLikeVersioning test12 = new MavenLikeVersioning(); + test12.setVersion("2.0"); + + List list= new LinkedList(); + list.add(test1); + list.add(test2); + list.add(test3); + list.add(test4); + list.add(test5); + list.add(test6); + list.add(test7); + list.add(test8); + list.add(test9); + list.add(test10); + list.add(test11); + list.add(test12); + + Collections.sort(list,new MavenLikeVersioningComparator()); + //Collections.reverse(list); + assertTrue(list.get(0).getVersion().equals("0.02")); + assertTrue(list.get(1).getVersion().equals("1.1")); + assertTrue(list.get(2).getVersion().equals("1.02") || list.get(3).getVersion().equals("1.02")); + assertTrue(list.get(3).getVersion().equals("1.2") || list.get(2).getVersion().equals("1.2")); + assertTrue(list.get(4).getVersion().equals("1.10")); + assertTrue(list.get(5).getVersion().equals("1.20")); + assertTrue(list.get(6).getVersion().equals("2")); + assertTrue(list.get(7).getVersion().equals("2.0")); + assertTrue(list.get(8).getVersion().equals("2.02")); + assertTrue(list.get(9).getVersion().equals("2.02")); + assertTrue(list.get(10).getVersion().equals("10.2004")); + assertTrue(list.get(11).getVersion().equals("12")); + + } +} + diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparatorESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparatorESTest.java new file mode 100644 index 0000000000..86a10d3c80 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparatorESTest.java @@ -0,0 +1,71 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:20:06 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.utils; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; + +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 MavenLikeVersioningComparatorESTest extends MavenLikeVersioningComparatorESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MavenLikeVersioningComparator mavenLikeVersioningComparator0 = new MavenLikeVersioningComparator(); + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.setVersion(""); + // Undeclared exception! + try { + mavenLikeVersioningComparator0.compare(mavenLikeVersioning0, mavenLikeVersioning0); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // For input string: \"\" + // + verifyException("java.lang.NumberFormatException", e); + } + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + MavenLikeVersioningComparator mavenLikeVersioningComparator0 = new MavenLikeVersioningComparator(); + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + // Undeclared exception! + try { + mavenLikeVersioningComparator0.compare((MavenLikeVersioning) null, mavenLikeVersioning0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.utils.MavenLikeVersioningComparator", e); + } + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + MavenLikeVersioningComparator mavenLikeVersioningComparator0 = new MavenLikeVersioningComparator(); + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + int int0 = mavenLikeVersioningComparator0.compare(mavenLikeVersioning0, mavenLikeVersioning0); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + MavenLikeVersioningComparator mavenLikeVersioningComparator0 = new MavenLikeVersioningComparator(); + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.setVersion(""); + MavenLikeVersioning mavenLikeVersioning1 = new MavenLikeVersioning(); + int int0 = mavenLikeVersioningComparator0.compare(mavenLikeVersioning0, mavenLikeVersioning1); + assertEquals((-1), int0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparatorESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparatorESTestscaffolding.java new file mode 100644 index 0000000000..3dea78d541 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningComparatorESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:20:06 GMT 2016 + */ + +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 MavenLikeVersioningComparatorESTestscaffolding { + + @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.MavenLikeVersioningComparator"; + 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(MavenLikeVersioningComparatorESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioningComparator" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningESTest.java new file mode 100644 index 0000000000..cb1df74381 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningESTest.java @@ -0,0 +1,193 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:10:39 GMT 2016 + */ + +package org.openecomp.mso.db.catalog.utils; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; + +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 MavenLikeVersioningESTest extends MavenLikeVersioningESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.setVersion("8"); + Boolean boolean0 = mavenLikeVersioning0.isTheSameVersion("0"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = "nS!?LIvx.hXgs?:="; + Boolean boolean0 = mavenLikeVersioning0.isTheSameVersion("xqR"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = "8"; + String string0 = mavenLikeVersioning0.getVersion(); + assertEquals("8", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = ""; + String string0 = mavenLikeVersioning0.getVersion(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = "/g"; + // Undeclared exception! + try { + mavenLikeVersioning0.isTheSameVersion("/g"); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // For input string: \"/g\" + // + verifyException("java.lang.NumberFormatException", e); + } + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.setVersion("8"); + Boolean boolean0 = mavenLikeVersioning0.isTheSameVersion("90"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = ""; + Boolean boolean0 = mavenLikeVersioning0.isTheSameVersion("dbqf\u0005I/ufZo.8No"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = "8"; + Boolean boolean0 = mavenLikeVersioning0.isTheSameVersion("8"); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = "nS!?LIvx.hXgs?:="; + Boolean boolean0 = mavenLikeVersioning0.isTheSameVersion((String) null); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + Boolean boolean0 = mavenLikeVersioning0.isTheSameVersion((String) null); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + Boolean boolean0 = mavenLikeVersioning0.isTheSameVersion("8"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = "8"; + mavenLikeVersioning0.version = "90"; + Boolean boolean0 = mavenLikeVersioning0.isMoreRecentThan("8"); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = "8"; + Boolean boolean0 = mavenLikeVersioning0.isMoreRecentThan("90"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.version = "8"; + Boolean boolean0 = mavenLikeVersioning0.isMoreRecentThan("8"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.setVersion("3n+.F"); + // Undeclared exception! + try { + mavenLikeVersioning0.isMoreRecentThan("Q"); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // For input string: \"3n+\" + // + verifyException("java.lang.NumberFormatException", e); + } + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + Boolean boolean0 = mavenLikeVersioning0.isMoreRecentThan("Q"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + Boolean boolean0 = mavenLikeVersioning0.isMoreRecentThan((String) null); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + mavenLikeVersioning0.setVersion("."); + // Undeclared exception! + try { + mavenLikeVersioning0.isMoreRecentThan("Q"); + fail("Expecting exception: ArrayIndexOutOfBoundsException"); + + } catch(ArrayIndexOutOfBoundsException e) { + // + // -1 + // + verifyException("org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", e); + } + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + MavenLikeVersioning mavenLikeVersioning0 = new MavenLikeVersioning(); + String string0 = mavenLikeVersioning0.getVersion(); + assertNull(string0); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningESTestscaffolding.java new file mode 100644 index 0000000000..81bef44d60 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioningESTestscaffolding.java @@ -0,0 +1,78 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:10:39 GMT 2016 + */ + +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 MavenLikeVersioningESTestscaffolding { + + @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.MavenLikeVersioning"; + 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(MavenLikeVersioningESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning" + ); + } + + private static void resetClasses() { + } +} diff --git a/mso-catalog-db/src/test/resources/logback-test.xml b/mso-catalog-db/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..a23395fe1b --- /dev/null +++ b/mso-catalog-db/src/test/resources/logback-test.xml @@ -0,0 +1,47 @@ + + + + + + + %d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg