From 96b5a685d0c3afddb632e4a68ca7483f933b55dc Mon Sep 17 00:00:00 2001 From: Rob Daugherty Date: Fri, 9 Mar 2018 15:02:18 -0500 Subject: Revert Reduce log noise/warnings This reverts commit 327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e. It is seriously impeding our ability complete the promised merge of AT&T 1802 code. While I'm all for coding standards, if we are serious about using spaces instead of tabs, then I think we need to (1) agree with the community when this will happen, (2) do consistently in all files, and (3) enforce it. Change-Id: Ib9b996f6b6c7d81ac9ac95d58b0c7d8cc39675ff Issue-ID: SO-368 Signed-off-by: Rob Daugherty --- .../mso/requestsdb/RequestsDatabaseTest.java | 141 +++++++-------------- 1 file changed, 47 insertions(+), 94 deletions(-) (limited to 'mso-api-handlers/mso-requests-db/src/test/java/org/openecomp') diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java index 198e603f0a..0bb126fa42 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java @@ -52,12 +52,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked SQLQuery query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createSQLQuery(" show tables "); - result = query; - query.list(); - result = Arrays.asList("table1", "table2"); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createSQLQuery(" show tables "); result = query; + query.list(); result = Arrays.asList("table1", "table2"); }}; assertTrue(requestsDatabase.healthCheck()); @@ -68,10 +65,8 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - query.executeUpdate(); - result = 1; + sessionFactoryManager.getSessionFactory().openSession(); result = session; + query.executeUpdate(); result = 1; }}; assertEquals(1, requestsDatabase.updateInfraStatus("123", "unknown", "unknown")); } @@ -81,10 +76,8 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - query.executeUpdate(); - result = 1; + sessionFactoryManager.getSessionFactory().openSession(); result = session; + query.executeUpdate(); result = 1; }}; assertEquals(1, requestsDatabase.updateInfraStatus("123", "unknown", 0, "unknown")); } @@ -94,10 +87,8 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - query.executeUpdate(); - result = 1; + sessionFactoryManager.getSessionFactory().openSession(); result = session; + query.executeUpdate(); result = 1; }}; assertEquals(1, requestsDatabase.updateInfraFinalStatus("123", "unknown", @@ -112,10 +103,8 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - query.uniqueResult(); - result = new InfraActiveRequests("123", "action"); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + query.uniqueResult(); result = new InfraActiveRequests("123", "action"); }}; assertEquals("123", requestsDatabase.getRequestFromInfraActive("123").getRequestId()); @@ -127,12 +116,9 @@ public class RequestsDatabaseTest { @Mocked Criteria criteria) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createCriteria(InfraActiveRequests.class); - result = criteria; - criteria.list(); - result = Arrays.asList(new InfraActiveRequests("123", "action")); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createCriteria(InfraActiveRequests.class); result = criteria; + criteria.list(); result = Arrays.asList(new InfraActiveRequests("123", "action")); }}; assertEquals(1, requestsDatabase.getRequestListFromInfraActive("queryattr", @@ -145,12 +131,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType"); - result = query; - query.uniqueResult(); - result = new InfraActiveRequests("123", "action"); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType"); result = query; + query.uniqueResult(); result = new InfraActiveRequests("123", "action"); }}; assertEquals("123", requestsDatabase.getRequestFromInfraActive("123", "requestType").getRequestId()); @@ -161,12 +144,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Criteria criteria) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createCriteria(InfraActiveRequests.class); - result = criteria; - criteria.list(); - result = Arrays.asList(new InfraActiveRequests()); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createCriteria(InfraActiveRequests.class); result = criteria; + criteria.list(); result = Arrays.asList(new InfraActiveRequests()); }}; assertEquals(1, requestsDatabase.getRequestListFromInfraActive("queryAttr", @@ -179,12 +159,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); - result = query; - query.list(); - result = Arrays.asList(new InfraActiveRequests("123", "action")); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); result = query; + query.list(); result = Arrays.asList(new InfraActiveRequests("123", "action")); }}; assertEquals("123", requestsDatabase.checkDuplicateByVnfName("vnfname", @@ -197,12 +174,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); - result = query; - query.list(); - result = Arrays.asList(new InfraActiveRequests("123", "action")); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); result = query; + query.list(); result = Arrays.asList(new InfraActiveRequests("123", "action")); }}; assertEquals("123", requestsDatabase.checkDuplicateByVnfId("vnfname", @@ -220,12 +194,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); - result = query; - query.uniqueResult(); - result = new SiteStatus(); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); result = query; + query.uniqueResult(); result = new SiteStatus(); }}; assertEquals(SiteStatus.class, requestsDatabase.getSiteStatus("site").getClass()); @@ -236,12 +207,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); - result = query; - query.uniqueResult(); - result = new SiteStatus(); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); result = query; + query.uniqueResult(); result = new SiteStatus(); }}; requestsDatabase.updateSiteStatus("site", true); } @@ -251,12 +219,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); - result = query; - query.uniqueResult(); - result = new OperationStatus(); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); result = query; + query.uniqueResult(); result = new OperationStatus(); }}; assertEquals(OperationStatus.class, requestsDatabase.getOperationStatus("123", @@ -268,12 +233,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id"); - result = query; - query.uniqueResult(); - result = new OperationStatus(); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id"); result = query; + query.uniqueResult(); result = new OperationStatus(); }}; assertEquals(OperationStatus.class, requestsDatabase.getOperationStatusByServiceId("123").getClass()); @@ -284,12 +246,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("FROM OperationStatus WHERE SERVICE_NAME = :service_name"); - result = query; - query.uniqueResult(); - result = new OperationStatus(); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("FROM OperationStatus WHERE SERVICE_NAME = :service_name"); result = query; + query.uniqueResult(); result = new OperationStatus(); }}; assertEquals(OperationStatus.class, requestsDatabase.getOperationStatusByServiceName("servicename").getClass()); @@ -300,12 +259,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); - result = query; - query.uniqueResult(); - result = new OperationStatus(); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); result = query; + query.uniqueResult(); result = new OperationStatus(); }}; requestsDatabase.updateOperationStatus(new OperationStatus()); } @@ -315,12 +271,9 @@ public class RequestsDatabaseTest { @Mocked Session session, @Mocked Query query) throws Exception { new Expectations() {{ - sessionFactoryManager.getSessionFactory().openSession(); - result = session; - session.createQuery("FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid"); - result = query; - query.uniqueResult(); - result = new ResourceOperationStatus(); + sessionFactoryManager.getSessionFactory().openSession(); result = session; + session.createQuery("FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid"); result = query; + query.uniqueResult(); result = new ResourceOperationStatus(); }}; assertEquals(ResourceOperationStatus.class, requestsDatabase.getResourceOperationStatus("serviceId", -- cgit 1.2.3-korg