From ab3dd55d09241672cdfaf34652b01a593d630fc2 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Wed, 17 Jan 2018 10:51:09 +0000 Subject: UT improvement for catalog db UT improvement for catalog db. Change-Id: Ie1a4554501ebc6e41a9a64b4613d72ae91e5ef03 Issue-ID: SO-360 Signed-off-by: subhash kumar singh --- .../openecomp/mso/db/catalog/CatalogDatabase.java | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'mso-catalog-db/src/main/java/org') 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 b5d8324872..ed30e61640 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 @@ -614,41 +614,41 @@ public class CatalogDatabase implements Closeable { * @param action * * @return ServiceRecipe object or null if none found */ - public ServiceRecipe getServiceRecipeByServiceModelUuid (String serviceModelUuid, String action) { + public ServiceRecipe getServiceRecipeByServiceModelUuid(String serviceModelUuid, String action) { StringBuilder hql; if(action == null){ - hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceModelUuid = :serviceModelUuid"); + hql = new StringBuilder("FROM ServiceRecipe WHERE serviceModelUuid = :serviceModelUuid"); }else { - hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceModelUuid = :serviceModelUuid AND action = :action "); + hql = new StringBuilder("FROM ServiceRecipe WHERE serviceModelUuid = :serviceModelUuid AND action = :action "); } long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get Service recipe with serviceModelUuid " + serviceModelUuid + LOGGER.debug("Catalog database - get Service recipe with serviceModelUuid " + serviceModelUuid + " and action " + action ); - Query query = getSession ().createQuery (hql.toString ()); - query.setParameter ("serviceModelUuid", serviceModelUuid); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); if(action != null){ - query.setParameter (ACTION, action); + query.setParameter(ACTION, action); } @SuppressWarnings("unchecked") - List resultList = query.list (); + List resultList = query.list(); - if (resultList.isEmpty ()) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service recipe not found", "CatalogDB", "getServiceRecipe", null); + 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); + 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); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipe", null); + return resultList.get(0); } public List getServiceRecipes (String serviceModelUuid) { -- cgit 1.2.3-korg