diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-01-11 10:58:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-01-11 10:58:07 +0000 |
commit | 373d6cb4b4b5ea3332ddb536d908ca831c28304f (patch) | |
tree | 5f7c8dcefd3cefd243632b4cb79a3fb61a977598 /mso-catalog-db/src/main/java | |
parent | 5755fcdc1de5b3b0260b009f5055520f71093006 (diff) | |
parent | 7aa50d539cd67191423168be7520a8613ecfcc6b (diff) |
Merge "UT for catalogDatabase"
Diffstat (limited to 'mso-catalog-db/src/main/java')
-rw-r--r-- | mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index dd60bc7d9c..cdde98dd36 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -155,29 +155,29 @@ public class CatalogDatabase implements Closeable { * @return A list of HeatTemplate objects */ @SuppressWarnings("unchecked") - public List <HeatTemplate> getAllHeatTemplates () { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get all Heat templates"); + public List <HeatTemplate> getAllHeatTemplates() { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get all Heat templates"); String hql = "FROM HeatTemplate"; - Query query = getSession ().createQuery (hql); + Query query = getSession().createQuery(hql); - List <HeatTemplate> result = query.list (); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllHeatTemplates", null); + List <HeatTemplate> result = query.list(); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllHeatTemplates", null); return result; } /** * Fetch a specific Heat Template by ID. * - * @param templateId + * @param templateId template id * @return HeatTemplate object or null if none found */ @Deprecated - public HeatTemplate getHeatTemplate (int templateId) { - long startTime = System.currentTimeMillis (); + public HeatTemplate getHeatTemplate(int templateId) { + long startTime = System.currentTimeMillis(); LOGGER.debug ("Catalog database - get Heat template with id " + templateId); - HeatTemplate template = (HeatTemplate) getSession ().get (HeatTemplate.class, templateId); + HeatTemplate template = (HeatTemplate) getSession().get(HeatTemplate.class, templateId); LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); return template; } @@ -185,31 +185,31 @@ public class CatalogDatabase implements Closeable { /** * Return the newest version of a specific Heat Template (queried by Name). * - * @param templateName + * @param templateName template name * @return HeatTemplate object or null if none found */ - public HeatTemplate getHeatTemplate (String templateName) { + public HeatTemplate getHeatTemplate(String templateName) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get Heat template with name " + templateName); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get Heat template with name " + templateName); String hql = "FROM HeatTemplate WHERE templateName = :template_name"; - Query query = getSession ().createQuery (hql); - query.setParameter ("template_name", templateName); + Query query = getSession().createQuery (hql); + query.setParameter("template_name", templateName); @SuppressWarnings("unchecked") - List <HeatTemplate> resultList = query.list (); + List <HeatTemplate> resultList = query.list(); // See if something came back. Name is unique, so if (resultList.isEmpty ()) { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No template found", "CatalogDB", "getHeatTemplate", null); return null; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); - Collections.reverse (resultList); + Collections.sort(resultList, new MavenLikeVersioningComparator()); + Collections.reverse(resultList); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); - return resultList.get (0); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); + return resultList.get(0); } /** |