From 89bf0b4f499c7fada8ad221defff5580d12331b6 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Thu, 18 Jan 2018 10:08:08 +0000 Subject: Improve UT for catalog DB Impprove UT for catalog DB. Change-Id: I78a0525cd7775f4371efc5ccbc549ea410384491 Issue-ID: SO-360 Signed-off-by: subhash kumar singh --- .../org/openecomp/mso/db/catalog/CatalogDatabase.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 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 af4d28d3ba..0804d3c162 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 @@ -807,22 +807,22 @@ public class CatalogDatabase implements Closeable { * @param modelCustomizationId * @return VnfResource object or null if none found */ - public VnfResource getVnfResourceByModelCustomizationId (String modelCustomizationId) { + public VnfResource getVnfResourceByModelCustomizationId(String modelCustomizationId) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get VNF resource with modelCustomizationId " + modelCustomizationId); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get VNF resource with modelCustomizationId " + modelCustomizationId); String hql = "SELECT vr " + "FROM VnfResource as vr JOIN vr.vnfResourceCustomizations as vrc " + "WHERE vrc.modelCustomizationUuid = :modelCustomizationId"; - Query query = getSession ().createQuery (hql); - query.setParameter ("modelCustomizationId", modelCustomizationId); + Query query = getSession().createQuery(hql); + query.setParameter("modelCustomizationId", modelCustomizationId); VnfResource resource = null; try { - resource = (VnfResource) query.uniqueResult (); - } catch (org.hibernate.NonUniqueResultException nure) { + 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: modelCustomizationUuid='" + modelCustomizationId + "'"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelCustomizationUuid=" + modelCustomizationId, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelCustomizationId=" + modelCustomizationId); @@ -839,9 +839,9 @@ public class CatalogDatabase implements Closeable { throw e; } if (resource == null) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVnfResourceByModelCustomizationId", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVnfResourceByModelCustomizationId", null); } else { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceByModelCustomizationId", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceByModelCustomizationId", null); } return resource; } -- cgit 1.2.3-korg