From 647f18788fe70fa03848b4657b8c1ac194d25870 Mon Sep 17 00:00:00 2001 From: seshukm Date: Thu, 2 Nov 2017 11:05:34 +0530 Subject: Add test cases for GET E2E svc IssueId: SO-260 Change-Id: Ie57b57b98472f6d8b012137562713de02d6a516c Signed-off-by: seshukm --- .../openecomp/mso/requestsdb/RequestsDatabase.java | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'mso-api-handlers/mso-requests-db/src/main/java') diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java index c6f0cea993..98121d8490 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java @@ -559,6 +559,70 @@ public class RequestsDatabase { return operStatus; } + /** + * get the operation progress + *
+ * + * @param serviceId the serviceId + * @return current progress of the operation + * @since ONAP Amsterdam Release + */ + public OperationStatus getOperationStatusByServiceId(String serviceId) { + + long startTime = System.currentTimeMillis(); + msoLogger.debug("Execute query on infra active request table"); + + OperationStatus operStatus = null; + Session session = sessionFactoryRequestDB.getSessionFactory().openSession(); + try { + session.beginTransaction(); + String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id"; + Query query = session.createQuery(hql); + query.setParameter("service_id", serviceId); + operStatus = (OperationStatus)query.uniqueResult(); + + } finally { + if(session != null && session.isOpen()) { + session.close(); + } + msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Successfully", "RequestDB", "getOperationStatus", null); + } + return operStatus; + } + + /** + * get the operation progress + *
+ * + * @param serviceName the serviceName + * @return current progress of the operation + * @since ONAP Amsterdam Release + */ + public OperationStatus getOperationStatusByServiceName(String serviceName) { + + long startTime = System.currentTimeMillis(); + msoLogger.debug("Execute query on infra active request table"); + + OperationStatus operStatus = null; + Session session = sessionFactoryRequestDB.getSessionFactory().openSession(); + try { + session.beginTransaction(); + String hql = "FROM OperationStatus WHERE SERVICE_NAME = :service_name"; + Query query = session.createQuery(hql); + query.setParameter("service_name", serviceName); + operStatus = (OperationStatus)query.uniqueResult(); + + } finally { + if(session != null && session.isOpen()) { + session.close(); + } + msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Successfully", "RequestDB", "getOperationStatus", null); + } + return operStatus; + } + /** * update the operation status *
-- cgit 1.2.3-korg