Search in sources :

Example 86 with InfraActiveRequests

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

the class RequestsDbClientTest method checkInstanceNameDuplicateTest.

@Test
public void checkInstanceNameDuplicateTest() {
    InfraActiveRequests infraActiveRequestsResponse = requestsDbClient.checkInstanceNameDuplicate(null, infraActiveRequests.getOperationalEnvName(), infraActiveRequests.getRequestScope());
    verifyInfraActiveRequests(infraActiveRequestsResponse);
}
Also used : InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Example 87 with InfraActiveRequests

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

the class RequestsDbClientTest method checkInstanceNameDuplicateViaTest.

@Test
public void checkInstanceNameDuplicateViaTest() {
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("operationalEnvironmentId", infraActiveRequests.getOperationalEnvId());
    InfraActiveRequests infraActiveRequestsResponse = requestsDbClient.checkInstanceNameDuplicate((HashMap<String, String>) requestMap, null, infraActiveRequests.getRequestScope());
    verifyInfraActiveRequests(infraActiveRequestsResponse);
}
Also used : HashMap(java.util.HashMap) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Example 88 with InfraActiveRequests

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

the class RequestsDbClientTest method getInProgressVolumeGroupsAndVfModulesTest.

@Test
public void getInProgressVolumeGroupsAndVfModulesTest() {
    InfraActiveRequests request = new InfraActiveRequests();
    request.setRequestId(UUID.randomUUID().toString());
    request.setVfModuleId(UUID.randomUUID().toString());
    request.setRequestStatus("IN_PROGRESS");
    request.setRequestScope(ModelType.vfModule.toString());
    Instant startInstant = Instant.now().minus(3, ChronoUnit.MINUTES);
    request.setStartTime(Timestamp.from(startInstant));
    request.setRequestAction("create");
    requestsDbClient.save(request);
    List<InfraActiveRequests> infraActiveRequests = requestsDbClient.getInProgressVolumeGroupsAndVfModules();
    assertThat(request, sameBeanAs(infraActiveRequests.get(0)).ignoring("modifyTime"));
}
Also used : Instant(java.time.Instant) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Example 89 with InfraActiveRequests

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

the class RequestsDbClientTest method getInfraActiveRequestbyRequestIdWhereRequestUrlNullTest.

@Test
public void getInfraActiveRequestbyRequestIdWhereRequestUrlNullTest() {
    // requestUrl setup to null and save
    infraActiveRequests.setRequestUrl(null);
    requestsDbClient.updateInfraActiveRequests(infraActiveRequests);
    InfraActiveRequests infraActiveRequestsResponse = requestsDbClient.getInfraActiveRequestbyRequestId(infraActiveRequests.getRequestId());
    verifyInfraActiveRequests(infraActiveRequestsResponse);
    assertNull(infraActiveRequestsResponse.getRequestUrl());
}
Also used : InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Example 90 with InfraActiveRequests

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

the class BBInputSetupUtils method getRequestDetails.

protected RequestDetails getRequestDetails(String requestId) throws IOException {
    if (requestId != null && !requestId.isEmpty()) {
        InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId);
        String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", "");
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
        objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
        return objectMapper.readValue(requestBody, RequestDetails.class);
    } else {
        return null;
    }
}
Also used : InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

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