use of org.onap.aai.domain.yang.L3Network in project so by onap.
the class BBInputSetupUtilsTest method getRelatedNetworkByNameFromServiceInstanceNotFoundTest.
@Test
public void getRelatedNetworkByNameFromServiceInstanceNotFoundTest() throws Exception {
String serviceInstanceId = "serviceInstanceId";
String networkName = "networkName";
doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIPluralResourceUri.class));
Optional<L3Network> actualNetwork = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName);
assertEquals(Optional.empty(), actualNetwork);
}
use of org.onap.aai.domain.yang.L3Network in project so by onap.
the class NetworkBBUtilsTest method isRelationshipRelatedToExistsTrueTest.
@Test
public void isRelationshipRelatedToExistsTrueTest() throws Exception {
final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
Optional<L3Network> l3network = aaiResultWrapper.asBean(L3Network.class);
boolean isVfModule = networkBBUtils.isRelationshipRelatedToExists(l3network, "vf-module");
assertTrue(isVfModule);
}
use of org.onap.aai.domain.yang.L3Network in project so by onap.
the class AaiResourceIdValidatorTest method validateNetworkResourceIdInAAIDuplicateNameTest.
@Test
public void validateNetworkResourceIdInAAIDuplicateNameTest() throws Exception {
RequestDetails reqDetails = setupRequestDetails();
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId("siId123");
L3Network network = new L3Network();
network.setModelCustomizationId("9999999");
Optional<L3Network> opNetwork = Optional.of(network);
when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork);
this.expectedException.expect(DuplicateNameException.class);
this.expectedException.expectMessage(containsString("l3Network with name (name123), same parent and different customization id (9999999) already exists. The name must be unique."));
testedObject.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds);
}
use of org.onap.aai.domain.yang.L3Network in project so by onap.
the class AaiResourceIdValidatorTest method validateResourceIdInAAINetworkTest.
@Test
public void validateResourceIdInAAINetworkTest() throws Exception {
RequestDetails reqDetails = setupRequestDetails();
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId("siId123");
L3Network network = new L3Network();
network.setNetworkId("id123");
network.setModelCustomizationId("1234567");
Optional<L3Network> opNetwork = Optional.of(network);
L3Network network2 = new L3Network();
network2.setNetworkId("id123");
network2.setModelCustomizationId("222");
Optional<L3Network> opNetwork2 = Optional.of(network2);
when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork);
when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "networkName222")).thenReturn(opNetwork2);
String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", reqDetails, workflowResourceIds);
assertEquals("id123", id);
String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", reqDetails, workflowResourceIds);
assertEquals("generatedId123", id2);
this.expectedException.expect(DuplicateNameException.class);
this.expectedException.expectMessage(containsString("l3Network with name (networkName222), same parent and different customization id (222) already exists. The name must be unique."));
testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName222", reqDetails, workflowResourceIds);
}
Aggregations