summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java/org
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-01-17 10:29:30 +0000
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-01-17 10:29:30 +0000
commitec3394aa110893362424cc3b4518da0b5f6415c9 (patch)
treec9843366838104983c62fd6ca3065cff82776f3a /mso-catalog-db/src/main/java/org
parent89f89afa5bf730f359e18c3672682a8fb0970e85 (diff)
Unit test improvement for catalog db
unit test improvement for catalog db. Change-Id: Iff84fb58e973120d9dcaddc4ab3dba6e6ce34975 Issue-ID: SO-360 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'mso-catalog-db/src/main/java/org')
-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 d27de9828f..7d59d2e0ae 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
@@ -462,25 +462,25 @@ public class CatalogDatabase implements Closeable {
LOGGER.debug ("Catalog database - get service modelUUID with id " + serviceNameVersionId);
String hql = "FROM Service WHERE MODEL_UUID = :MODEL_UUID and http_method = :http_method";
- query = getSession ().createQuery (hql);
- query.setParameter ("MODEL_UUID", serviceNameVersionId);
+ query = getSession().createQuery(hql);
+ query.setParameter("MODEL_UUID", serviceNameVersionId);
} else {
serviceId = map.get("serviceId");
serviceVersion = map.get("serviceVersion");
- LOGGER.debug ("Catalog database - get serviceId with id " + serviceId + " and serviceVersion with " + serviceVersion);
+ LOGGER.debug("Catalog database - get serviceId with id " + serviceId + " and serviceVersion with " + serviceVersion);
String hql = "FROM Service WHERE service_id = :service_id and service_version = :service_version and http_method = :http_method";
- query = getSession ().createQuery (hql);
- query.setParameter ("service_id", serviceId);
- query.setParameter ("service_version", serviceVersion);
+ query = getSession().createQuery(hql);
+ query.setParameter("service_id", serviceId);
+ query.setParameter("service_version", serviceVersion);
}
- query.setParameter ("http_method", httpMethod);
+ query.setParameter("http_method", httpMethod);
- long startTime = System.currentTimeMillis ();
+ long startTime = System.currentTimeMillis();
Service service = null;
try {
- service = (Service) query.uniqueResult ();
+ service = (Service) query.uniqueResult();
} catch (org.hibernate.NonUniqueResultException nure) {
LOGGER.debug("Non Unique Result Exception - data integrity error: service_id='" + serviceId + "', serviceVersion='" + serviceVersion + "'");
LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for service_id=" + serviceId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for service_id=" + serviceId);
@@ -511,28 +511,28 @@ public class CatalogDatabase implements Closeable {
* @param modelName
* @return Service object or null if none found
*/
- public Service getServiceByModelName (String modelName){
+ public Service getServiceByModelName(String modelName){
- long startTime = System.currentTimeMillis ();
- LOGGER.debug ("Catalog database - get service with name " + modelName);
+ long startTime = System.currentTimeMillis();
+ LOGGER.debug("Catalog database - get service with name " + modelName);
String hql = "FROM Service WHERE modelName = :MODEL_NAME";
- Query query = getSession ().createQuery (hql);
- query.setParameter ("MODEL_NAME", modelName);
+ Query query = getSession().createQuery(hql);
+ query.setParameter("MODEL_NAME", modelName);
@SuppressWarnings("unchecked")
- List <Service> resultList = query.list ();
+ List <Service> resultList = query.list();
// See if something came back.
- if (resultList.isEmpty ()) {
- LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByModelName", null);
+ if (resultList.isEmpty()) {
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByModelName", 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", "getServiceByModelName", null);
- return resultList.get (0);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByModelName", null);
+ return resultList.get(0);
}
public Service getServiceByVersionAndInvariantId(String modelInvariantId, String modelVersion) throws Exception {