use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class MsoHeatUtilsTest method saveStack__Exists_Test.
@Test
public final void saveStack__Exists_Test() throws MsoException, IOException, NovaClientException {
CreateStackParam createStackParam = new CreateStackParam();
createStackParam.setStackName("stackName");
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("test", "value");
createStackParam.setParameters(parameters);
InfraActiveRequests request = new InfraActiveRequests();
request.setRequestId("requestId");
CloudApiRequests cloudRequest = new CloudApiRequests();
cloudRequest.setCloudIdentifier("stackName");
cloudRequest.setRequestBody("testMe");
cloudRequest.setRequestId("requestId");
request.getCloudApiRequests().add(cloudRequest);
doReturn(request).when(requestDbClient).getInfraActiveRequestbyRequestId("requestId");
doNothing().when(requestDbClient).updateInfraActiveRequests(request);
heatUtils.saveStackRequest(createStackParam, "requestId", "stackName");
Mockito.verify(requestDbClient, times(1)).updateInfraActiveRequests(request);
assertNotNull(request.getCloudApiRequests().get(0));
assertEquals("requestId", request.getCloudApiRequests().get(0).getRequestId());
assertNotEquals("testMe", request.getCloudApiRequests().get(0).getRequestBody());
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class InfraActiveRequestsRepositoryCustomControllerTest 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);
HttpEntity<Map<String, List<String>>> entityList = new HttpEntity(requestMap, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("/infraActiveRequests") + "/getOrchestrationFiltersFromInfraActive");
ResponseEntity<List<InfraActiveRequests>> response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entityList, new ParameterizedTypeReference<List<InfraActiveRequests>>() {
});
List<InfraActiveRequests> iarr = response.getBody();
assertEquals(200, response.getStatusCodeValue());
assertTrue(iarr.size() == 1);
infraActiveRequestsResponse = iarr.get(0);
verifyInfraActiveRequests();
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class InfraActiveRequestsRepositoryCustomControllerTest method checkInstanceNameDuplicateTest.
@Test
public void checkInstanceNameDuplicateTest() {
InstanceNameDuplicateCheckRequest instanceNameDuplicateCheckRequest = new InstanceNameDuplicateCheckRequest((HashMap<String, String>) null, infraActiveRequests.getOperationalEnvName(), infraActiveRequests.getRequestScope());
HttpEntity<InstanceNameDuplicateCheckRequest> entityList = new HttpEntity(instanceNameDuplicateCheckRequest, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("/infraActiveRequests") + "/checkInstanceNameDuplicate");
ResponseEntity<InfraActiveRequests> response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entityList, new ParameterizedTypeReference<InfraActiveRequests>() {
});
infraActiveRequestsResponse = response.getBody();
assertEquals(200, response.getStatusCodeValue());
verifyInfraActiveRequests();
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class InfraActiveRequestsRepositoryCustomControllerTest 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");
HttpEntity<Map<String, String>> entity = new HttpEntity<>(requestMap, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("/infraActiveRequests") + "/getCloudOrchestrationFiltersFromInfraActive");
ResponseEntity<List<InfraActiveRequests>> response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, new ParameterizedTypeReference<List<InfraActiveRequests>>() {
});
List<InfraActiveRequests> iarr = response.getBody();
assertEquals(200, response.getStatusCodeValue());
assertTrue(iarr.size() == 1);
infraActiveRequestsResponse = iarr.get(0);
verifyInfraActiveRequests();
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class InfraActiveRequestsRepositoryCustomControllerTest method setup.
@Before
public void setup() {
infraActiveRequests = new InfraActiveRequests();
infraActiveRequests.setRequestId(UUID.randomUUID().toString());
infraActiveRequests.setOperationalEnvId(UUID.randomUUID().toString());
infraActiveRequests.setServiceInstanceId(UUID.randomUUID().toString());
infraActiveRequests.setServiceInstanceName("serviceInstanceNameTest");
infraActiveRequests.setVnfId(UUID.randomUUID().toString());
infraActiveRequests.setVnfName("vnfInstanceNameTest");
infraActiveRequests.setVfModuleId(UUID.randomUUID().toString());
infraActiveRequests.setVfModuleName("vfModuleInstanceNameTest");
infraActiveRequests.setVolumeGroupId(UUID.randomUUID().toString());
infraActiveRequests.setVolumeGroupName("volumeGroupInstanceNameTest");
infraActiveRequests.setNetworkId(UUID.randomUUID().toString());
infraActiveRequests.setNetworkName("networkInstanceNameTest");
infraActiveRequests.setConfigurationId(UUID.randomUUID().toString());
infraActiveRequests.setConfigurationName("configurationInstanceNameTest");
infraActiveRequests.setCloudRegion("1");
infraActiveRequests.setTenantId(UUID.randomUUID().toString());
infraActiveRequests.setRequestScope("operationalEnvironment");
infraActiveRequests.setRequestorId(UUID.randomUUID().toString());
infraActiveRequests.setSource("sourceTest");
infraActiveRequests.setOperationalEnvName(UUID.randomUUID().toString());
infraActiveRequests.setRequestStatus("IN_PROGRESS");
infraActiveRequests.setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances");
saveInfraActiveRequest(infraActiveRequests);
}
Aggregations