use of org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri in project so by onap.
the class AAIResourcesClientTest method testGetFirstNoResults.
@Test
public void testGetFirstNoResults() {
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("my-vnf-id");
GenericVnfs vnfs = new GenericVnfs();
vnfs.getGenericVnf().add(vnf);
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
RestClient restClientMock = mock(RestClient.class);
doReturn(restClientMock).when(client).createClient(uri);
when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
Optional<GenericVnf> result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri);
assertFalse(result.isPresent());
}
use of org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri in project so by onap.
the class AAIResourcesClientTest method testGetOne.
@Test
public void testGetOne() {
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("my-vnf-id");
GenericVnfs vnfs = new GenericVnfs();
vnfs.getGenericVnf().add(vnf);
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
RestClient restClientMock = mock(RestClient.class);
doReturn(restClientMock).when(client).createClient(uri);
when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
Optional<GenericVnf> result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
assertEquals("my-vnf-id", result.get().getVnfId());
}
use of org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri in project so by onap.
the class AAIDataRetrievalTest method getVolumeGroupsOfVnfWhenNoneTest.
@Test
public void getVolumeGroupsOfVnfWhenNoneTest() throws Exception {
VolumeGroups volumeGroups = new VolumeGroups();
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(true, volumeGroupList.isEmpty());
Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId("vnfId");
assertEquals(false, volumeGroupIds.isPresent());
}
use of org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri in project so by onap.
the class AAIDataRetrievalTest method getVfModulesOfVnfWhenNoneTest.
@Test
public void getVfModulesOfVnfWhenNoneTest() {
VfModules vfModules = new VfModules();
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId").vfModules());
doReturn(Optional.of(vfModules)).when(aaiResourcesClient).get(VfModules.class, uri);
List<VfModule> vfModulesList = aaiDataRetrieval.getVfModulesOfVnf("vnfId");
assertEquals(true, vfModulesList.isEmpty());
Optional<String> vfModuleIds = aaiDataRetrieval.getVfModuleIdsByVnfId("vnfId");
assertEquals(false, vfModuleIds.isPresent());
}
Aggregations