use of org.onap.aai.domain.yang.GenericVnfs in project so by onap.
the class AaiResourceIdValidatorTest method validateVnfResourceIdInAAINotGloballyUniqueTest.
@Test
public void validateVnfResourceIdInAAINotGloballyUniqueTest() throws Exception {
RequestDetails reqDetails = setupRequestDetails();
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("id123");
GenericVnfs genericVnfs = new GenericVnfs();
genericVnfs.getGenericVnf().add(vnf);
when(bbInputSetupUtilsMock.getAAIVnfsGloballyByName("vnfName123")).thenReturn(genericVnfs);
this.expectedException.expect(DuplicateNameException.class);
this.expectedException.expectMessage(containsString("generic-vnf with name (vnfName123) id (id123) and different parent relationship already exists. The name must be unique."));
testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, new WorkflowResourceIds());
}
use of org.onap.aai.domain.yang.GenericVnfs in project so by onap.
the class AAIResourcesClientTest method testGetOneMultipleResults.
@Test
public void testGetOneMultipleResults() {
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("my-vnf-id");
GenericVnf vnf2 = new GenericVnf();
vnf.setVnfId("my-vnf-id2");
GenericVnfs vnfs = new GenericVnfs();
vnfs.getGenericVnf().add(vnf);
vnfs.getGenericVnf().add(vnf2);
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));
thrown.expect(GraphInventoryMultipleItemsException.class);
aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
}
use of org.onap.aai.domain.yang.GenericVnfs in project so by onap.
the class AAIResourcesClientTest method testGetOneNoResults.
@Test
public void testGetOneNoResults() {
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.getOne(GenericVnfs.class, GenericVnf.class, uri);
assertFalse(result.isPresent());
}
use of org.onap.aai.domain.yang.GenericVnfs 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.aai.domain.yang.GenericVnfs 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());
}
Aggregations