diff options
author | seshukm <seshu.kumar.m@huawei.com> | 2017-11-02 11:05:34 +0530 |
---|---|---|
committer | seshukm <seshu.kumar.m@huawei.com> | 2017-11-02 11:05:34 +0530 |
commit | 647f18788fe70fa03848b4657b8c1ac194d25870 (patch) | |
tree | 6388048b6487a1a18030d0b53d03c30d76a9df96 /mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb | |
parent | 2672c6dedb25d4c3173ea45cd8640f91ce9b1ff7 (diff) |
Add test cases for GET E2E svc
IssueId: SO-260
Change-Id: Ie57b57b98472f6d8b012137562713de02d6a516c
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb')
-rw-r--r-- | mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java | 64 |
1 files changed, 64 insertions, 0 deletions
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 @@ -560,6 +560,70 @@ public class RequestsDatabase { } /** + * get the operation progress + * <br> + * + * @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 + * <br> + * + * @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 * <br> * |