Search in sources :

Example 81 with InfraActiveRequests

use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.

the class RequestsDbClientTest method getInfraActiveRequestbyRequestIdTest.

@Test
public void getInfraActiveRequestbyRequestIdTest() {
    InfraActiveRequests infraActiveRequestsResponse = requestsDbClient.getInfraActiveRequestbyRequestId(infraActiveRequests.getRequestId());
    verifyInfraActiveRequests(infraActiveRequestsResponse);
    infraActiveRequestsResponse = requestsDbClient.getInfraActiveRequestbyRequestId(infraActiveRequests.getRequestId());
    assertNull(requestsDbClient.getInfraActiveRequestbyRequestId(UUID.randomUUID().toString()));
}
Also used : InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Example 82 with InfraActiveRequests

use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.

the class RequestsDbClientTest method checkVnfIdStatusTest.

@Test
public void checkVnfIdStatusTest() {
    InfraActiveRequests infraActiveRequestsResponse = requestsDbClient.checkVnfIdStatus(infraActiveRequests.getOperationalEnvId());
    verifyInfraActiveRequests(infraActiveRequestsResponse);
    assertNull(requestsDbClient.checkVnfIdStatus(UUID.randomUUID().toString()));
}
Also used : InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Example 83 with InfraActiveRequests

use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.

the class ArchiveInfraRequestsSchedulerTest method testArchiveInfraRequests.

@Test
@Transactional
public void testArchiveInfraRequests() throws Exception {
    String requestId1 = "requestId1";
    String requestId2 = "requestId2";
    InfraActiveRequests iar1 = new InfraActiveRequests();
    iar1.setRequestId(requestId1);
    InfraActiveRequests iar2 = new InfraActiveRequests();
    iar2.setRequestId(requestId2);
    List<InfraActiveRequests> requests = new ArrayList<>();
    requests.add(iar1);
    requests.add(iar2);
    iarRepo.saveAll(requests);
    scheduler.archiveInfraRequests(requests);
    assertEquals(2, archivedRepo.count());
    assertEquals(requestId1, archivedRepo.findById(requestId1).orElseThrow(() -> new Exception("Request Not Found")).getRequestId());
    assertEquals(requestId2, archivedRepo.findById(requestId2).orElseThrow(() -> new Exception("Request Not Found")).getRequestId());
}
Also used : ArrayList(java.util.ArrayList) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 84 with InfraActiveRequests

use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.

the class RequestsDbClientTest method getCloudOrchestrationFiltersFromInfraActiveTest.

@Test
public void getCloudOrchestrationFiltersFromInfraActiveTest() {
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("operationalEnvironmentId", infraActiveRequests.getOperationalEnvId());
    requestMap.put("operationalEnvironmentName", infraActiveRequests.getOperationalEnvName());
    requestMap.put("resourceType", "operationalEnvironment");
    List<InfraActiveRequests> iarr = requestsDbClient.getCloudOrchestrationFiltersFromInfraActive(requestMap);
    assertEquals(1, iarr.size());
    InfraActiveRequests infraActiveRequestsResponse = iarr.get(0);
    verifyInfraActiveRequests(infraActiveRequestsResponse);
}
Also used : HashMap(java.util.HashMap) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Example 85 with InfraActiveRequests

use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.

the class RequestsDbClientTest method getOrchestrationFiltersFromInfraActiveTest.

@Test
public void getOrchestrationFiltersFromInfraActiveTest() {
    Map<String, List<String>> requestMap = new HashMap<>();
    List<String> values = new ArrayList<>();
    values.add("EQUALS");
    values.add(infraActiveRequests.getServiceInstanceId());
    requestMap.put("serviceInstanceId", values);
    values = new ArrayList<>();
    values.add("EQUALS");
    values.add(infraActiveRequests.getServiceInstanceName());
    requestMap.put("serviceInstanceName", values);
    List<InfraActiveRequests> iaar = requestsDbClient.getOrchestrationFiltersFromInfraActive(requestMap);
    assertEquals(1, iaar.size());
    InfraActiveRequests infraActiveRequestsResponse = iaar.get(0);
    verifyInfraActiveRequests(infraActiveRequestsResponse);
    values = new ArrayList<>();
    values.add("EQUALS");
    values.add(UUID.randomUUID().toString());
    requestMap.put("serviceInstanceName", values);
    requestsDbClient.getOrchestrationFiltersFromInfraActive(requestMap);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Aggregations

InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)214 Test (org.junit.Test)119 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)29 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)26 Timestamp (java.sql.Timestamp)23 HttpEntity (org.springframework.http.HttpEntity)21 IOException (java.io.IOException)20 HashMap (java.util.HashMap)20 ApiException (org.onap.so.apihandlerinfra.exceptions.ApiException)20 ValidateException (org.onap.so.apihandlerinfra.exceptions.ValidateException)19 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)19 BaseTest (org.onap.so.apihandlerinfra.BaseTest)18 ErrorLoggerInfo (org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo)18 ArrayList (java.util.ArrayList)16 ValidationException (org.onap.so.exceptions.ValidationException)15 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)13 Transactional (javax.transaction.Transactional)13 UriComponentsBuilder (org.springframework.web.util.UriComponentsBuilder)12 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)11 ResponseBuilder (org.onap.so.apihandler.common.ResponseBuilder)11