From 42dd47e5c8431cafee7b949122672d422e100ae3 Mon Sep 17 00:00:00 2001 From: Andrei_Barcovschi Date: Wed, 6 Mar 2019 12:45:45 +0000 Subject: Fix for So Mon UI search result Change-Id: Ifa65f415e47fd3ef95a48c5299b04f1038148421 Issue-ID: SO-1507 Signed-off-by: Andrei_Barcovschi --- .../InfraActiveRequestsRepositoryImplTest.java | 54 ++++++++++++++++++---- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap') diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java index 4097aee7d5..def999b556 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java @@ -49,9 +49,26 @@ import org.springframework.test.context.junit4.SpringRunner; @ActiveProfiles("test") public class InfraActiveRequestsRepositoryImplTest { + /** + * January 1, 2019 2:00:00 PM + */ + private static final long END_TIME = 1546351200000l; + + /** + * January 1, 2019 12:45:00 PM + */ + private static final long START_TIME = 1546346700000l; private static final int MAX_LIMIT = 1; - private static final long END_TIME_IN_MILISEC = 1482580740000l; // December 23, 2016 23:59 PM - private static final long START_TIME_IN_MILISEC = 1482282000000l; // December 21, 2016 01:00 AM + + /** + * December 23, 2016 23:59 PM + */ + private static final long END_TIME_IN_MILISEC = 1482580740000l; + + /** + * December 21, 2016 01:00 AM + */ + private static final long START_TIME_IN_MILISEC = 1482282000000l; private static final String REQUEST_ID_VALUE = "00032ab7-3fb3-42e5-965d-8ea592502017"; private static final String SERVICE_INSTANCE_ID_VALUE = "e3b5744d-2ad1-4cdd-8390-c999a38829bc"; @@ -96,7 +113,6 @@ public class InfraActiveRequestsRepositoryImplTest { assertEquals(SERVICE_INSTANCE_ID_VALUE, actualRequests.get(0).getServiceInstanceId()); } - @Test public void test_GetInfraActiveRequestsData_withLikeRequestID() { final Map values = new HashMap<>(); @@ -182,12 +198,34 @@ public class InfraActiveRequestsRepositoryImplTest { objUnderTest.getInfraActiveRequests(null, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, MAX_LIMIT); assertTrue(actualRequests.isEmpty()); } - + @Test - public void checkInstanceNameDuplicateNullInstanceNameTest(){ - Map instanceIdMap = new HashMap<>(); + public void checkInstanceNameDuplicateNullInstanceNameTest() { + final Map instanceIdMap = new HashMap<>(); instanceIdMap.put("serviceInstanceId", "e05864f0-ab35-47d0-8be4-56fd9619ba3b"); - InfraActiveRequests results = objUnderTest.checkInstanceNameDuplicate((HashMap)instanceIdMap, null, "vnf"); - assertNull(results); + final InfraActiveRequests results = + objUnderTest.checkInstanceNameDuplicate((HashMap) instanceIdMap, null, "vnf"); + assertNull(results); } + + @Test + public void test_GetInfraActiveRequestsData_returnRecordWithNullEndTime() { + final Map values = new HashMap<>(); + values.put(SERVICE_INSTANCE_ID, + new String[] {QueryOperationType.EQ.name(), "f7712652-b516-4925-a243-64550d26fd84"}); + final List actualRequests = + objUnderTest.getInfraActiveRequests(values, START_TIME, END_TIME, null); + assertFalse(actualRequests.isEmpty()); + + assertEquals(3, actualRequests.size()); + final Map result = new HashMap<>(); + for (final InfraActiveRequests actualActiveRequests : actualRequests) { + result.put(actualActiveRequests.getRequestId(), actualActiveRequests); + + } + final InfraActiveRequests actualInfraActiveRequests = result.get("9383dc81-7a6c-4673-8082-650d50a82a1a"); + assertNull(actualInfraActiveRequests.getEndTime()); + assertEquals("IN_PROGRESS", actualInfraActiveRequests.getRequestStatus()); + } + } -- cgit 1.2.3-korg