summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db-repositories/src/test/java
diff options
context:
space:
mode:
authorAndrei_Barcovschi <andrei.barcovschi@ericsson.com>2019-03-06 12:45:45 +0000
committerAndrei Barcovschi <andrei.barcovschi@ericsson.com>2019-03-06 15:27:47 +0000
commit42dd47e5c8431cafee7b949122672d422e100ae3 (patch)
tree39a01be9fbe9b25838d803970162e0ff867703f3 /mso-api-handlers/mso-requests-db-repositories/src/test/java
parent91426ec9f221e288ea3f54fa62030e6f17420b90 (diff)
Fix for So Mon UI search result
Change-Id: Ifa65f415e47fd3ef95a48c5299b04f1038148421 Issue-ID: SO-1507 Signed-off-by: Andrei_Barcovschi <andrei.barcovschi@ericsson.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db-repositories/src/test/java')
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java54
1 files changed, 46 insertions, 8 deletions
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<String, String[]> 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<String, String> instanceIdMap = new HashMap<>();
+ public void checkInstanceNameDuplicateNullInstanceNameTest() {
+ final Map<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "e05864f0-ab35-47d0-8be4-56fd9619ba3b");
- InfraActiveRequests results = objUnderTest.checkInstanceNameDuplicate((HashMap<String, String>)instanceIdMap, null, "vnf");
- assertNull(results);
+ final InfraActiveRequests results =
+ objUnderTest.checkInstanceNameDuplicate((HashMap<String, String>) instanceIdMap, null, "vnf");
+ assertNull(results);
}
+
+ @Test
+ public void test_GetInfraActiveRequestsData_returnRecordWithNullEndTime() {
+ final Map<String, String[]> values = new HashMap<>();
+ values.put(SERVICE_INSTANCE_ID,
+ new String[] {QueryOperationType.EQ.name(), "f7712652-b516-4925-a243-64550d26fd84"});
+ final List<InfraActiveRequests> actualRequests =
+ objUnderTest.getInfraActiveRequests(values, START_TIME, END_TIME, null);
+ assertFalse(actualRequests.isEmpty());
+
+ assertEquals(3, actualRequests.size());
+ final Map<String, InfraActiveRequests> 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());
+ }
+
}