aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-01-11 10:35:01 +0000
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-01-11 10:35:01 +0000
commit7aa50d539cd67191423168be7520a8613ecfcc6b (patch)
tree00da89685ebe4dceed024ae8cd83fd3131f520c6 /mso-catalog-db/src/main/java
parent4da1270fb9814f230e064e995bb379db6a4d25d4 (diff)
UT for catalogDatabase
Fix the UT's for catalogDatabase.java. Change-Id: Id385b5318c52e58d5de41a0a9032964de1bc63fa Issue-ID: SO-360 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'mso-catalog-db/src/main/java')
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java42
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);
}
/**