From 9a739d06b6a1821230090812b20d559f082051cc Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Fri, 19 Jan 2018 09:16:22 +0000 Subject: Improve UT for catalog db Improve UT for catalog db. Change-Id: I1fbe5516b29763fdaf2a2734f1aa7432a1261eae Issue-ID: SO-360 Signed-off-by: subhash kumar singh --- .../openecomp/mso/db/catalog/CatalogDatabase.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java') 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 0a5bdc51f3..774a77a2bb 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 @@ -1055,28 +1055,28 @@ public class CatalogDatabase implements Closeable { * @param networkType * @return NetworkResource object or null if none found */ - public NetworkResource getNetworkResource (String networkType) { + public NetworkResource getNetworkResource(String networkType) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get network resource with type " + networkType); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get network resource with type " + networkType); String hql = "FROM NetworkResource WHERE model_name = :network_type"; - Query query = getSession ().createQuery (hql); - query.setParameter ("network_type", networkType); + Query query = getSession().createQuery(hql); + query.setParameter("network_type", networkType); @SuppressWarnings("unchecked") - List resultList = query.list (); + 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); + 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); + 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); } /** -- cgit 1.2.3-korg