use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class BpmnRequestBuilder method buildVolumeGroupDeleteRequest.
public ServiceInstancesRequest buildVolumeGroupDeleteRequest(String vnfId, String volumeGroupId) throws AAIEntityNotFound {
GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
if (vnf == null) {
throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
}
VolumeGroup volumeGroup = aaiDataRet.getVolumeGroup(vnfId, volumeGroupId);
if (volumeGroup == null) {
throw new AAIEntityNotFound(VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " volumeGroupId: " + volumeGroupId);
}
return createServiceInstancesRequest(vnf, volumeGroup);
}
use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class BpmnRequestBuilderTest method test_buildVolumeGroupDeleteRequest.
@Test
public void test_buildVolumeGroupDeleteRequest() throws Exception {
GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
VolumeGroup volumeGroup = provider.getMapper().readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
AAIResultWrapper wrapper = new AAIResultWrapper(volumeGroup);
doReturn(wrapper).when(aaiResourcesClient).get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).relatedTo(Types.VOLUME_GROUP.getFragment("volumeGroupId")));
ServiceInstancesRequest expectedRequest = mapper.readValue(new File(RESOURCE_PATH + "ExpectedVolumeGroupRequest.json"), ServiceInstancesRequest.class);
ServiceInstancesRequest actualRequest = reqBuilder.buildVolumeGroupDeleteRequest("vnfId", "volumeGroupId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class AAIDataRetrievalTest method getVolumeGroupsOfVnfTest.
@Test
public void getVolumeGroupsOfVnfTest() throws Exception {
VolumeGroups volumeGroups = getVolumeGroups();
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).relatedTo(Types.VOLUME_GROUPS.getFragment());
doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
assertEquals("vg1", volumeGroupList.get(0).getVolumeGroupId());
Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId("vnfId");
assertEquals(Optional.of("vg1,vg2"), volumeGroupIds);
}
use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class BBInputSetupUtilsTest method getRelatedVolumeGroupFromVfModuleNotFoundTest.
@Test
public void getRelatedVolumeGroupFromVfModuleNotFoundTest() throws Exception {
final String vnfId = "vnfId";
final String volumeGroupId = "volumeGroupId";
doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(VolumeGroups.class), eq(VolumeGroup.class), any(AAIPluralResourceUri.class));
Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId);
assertEquals(Optional.empty(), actualVolumeGroup);
}
use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.
the class BBInputSetupUtilsTest method getAAIVolumeGroupNullTest.
@Test
public void getAAIVolumeGroupNullTest() {
VolumeGroup actualAaiVnf = bbInputSetupUtils.getAAIVolumeGroup("cloudOwnerId", "cloudRegionId", "volumeGroupId");
assertNull(actualAaiVnf);
}
Aggregations