use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class MonitorInstantiateVnfmNodeTaskTest method testGetNodeStatus_genericVnfWithOrchStatusCreated_executionVariableSetToCreate.
@Test
public void testGetNodeStatus_genericVnfWithOrchStatusCreated_executionVariableSetToCreate() throws Exception {
final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf();
final GenericVnf aaiGenericVnf = getAAIGenericVnf();
aaiGenericVnf.setOrchestrationStatus(VNF_CREATED);
when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.of(aaiGenericVnf));
objUnderTest.getNodeStatus(stubbedxecution);
assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class MonitorTerminateVnfmNodeTaskTest method getAAIGenericVnf.
private GenericVnf getAAIGenericVnf() {
final GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId(VNF_ID);
genericVnf.setVnfName(VNF_NAME);
return genericVnf;
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class AAIResourcesClientTest method testGetFirstWrongPluralClass.
@Test
public void testGetFirstWrongPluralClass() {
GenericVnf vnf = new GenericVnf();
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
RestClient restClientMock = mock(RestClient.class);
doReturn(restClientMock).when(client).createClient(uri);
when(restClientMock.get(GenericVnf.class)).thenReturn(Optional.of(vnf));
Optional<GenericVnf> result = aaiClient.getFirst(GenericVnf.class, GenericVnf.class, uri);
assertFalse(result.isPresent());
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class AAIResourcesClientTest method testGetFirstMultipleResults.
@Test
public void testGetFirstMultipleResults() {
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("my-vnf-id");
GenericVnf vnf2 = new GenericVnf();
vnf2.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));
Optional<GenericVnf> result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri);
assertEquals("my-vnf-id", result.get().getVnfId());
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class GraphInventoryPatchConverterTest method convertObjectToPatchFormatTest.
@Test
public void convertObjectToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
GenericVnf vnf = new GenericVnf();
vnf.setIpv4Loopback0Address("");
String result = validator.marshallObjectToPatchFormat(vnf);
GenericVnf resultObj = mapper.readValue(result.toString(), GenericVnf.class);
assertTrue("expect object to become a String to prevent double marshalling", result instanceof String);
assertNull("expect null because of custom mapper", resultObj.getIpv4Loopback0Address());
}
Aggregations