use of org.onap.aai.domain.yang.ServiceInstances in project so by onap.
the class BBInputSetupUtilsTest method getRelatedServiceInstanceFromInstanceGroupMultipleExceptionTest.
@Test
public void getRelatedServiceInstanceFromInstanceGroupMultipleExceptionTest() throws Exception {
final String instanceGroupId = "ig-001";
expectedException.expect(MultipleObjectsFoundException.class);
Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
ServiceInstance si1 = Mockito.mock(ServiceInstance.class);
ServiceInstance si2 = Mockito.mock(ServiceInstance.class);
serviceInstances.get().getServiceInstance().add(si1);
serviceInstances.get().getServiceInstance().add(si2);
doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIPluralResourceUri.class));
this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
}
use of org.onap.aai.domain.yang.ServiceInstances in project so by onap.
the class BBInputSetupUtilsTest method getAAIServiceInstancesGloballyByName_noAAIResourceTest.
@Test
public void getAAIServiceInstancesGloballyByName_noAAIResourceTest() {
final String serviceInstanceName = "serviceInstanceName";
doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIPluralResourceUri.class));
ServiceInstances actualServiceInstances = bbInputSetupUtils.getAAIServiceInstancesGloballyByName(serviceInstanceName);
assertNull(actualServiceInstances);
}
use of org.onap.aai.domain.yang.ServiceInstances in project so by onap.
the class AaiResourceIdValidatorTest method validateServiceResourceIdInAAIDifferentModelVersionId.
@Test
public void validateServiceResourceIdInAAIDifferentModelVersionId() throws Exception {
RequestDetails reqDetails = setupRequestDetails();
reqDetails.getModelInfo().setModelVersionId("1234567");
ServiceInstance si = new ServiceInstance();
si.setModelVersionId("9999999");
ServiceInstances serviceInstances = new ServiceInstances();
serviceInstances.getServiceInstance().add(si);
Optional<ServiceInstance> siOp = Optional.of(si);
when(bbInputSetupUtilsMock.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp);
this.expectedException.expect(DuplicateNameException.class);
this.expectedException.expectMessage(containsString("serviceInstance with name (siName123) and different version id (1234567) already exists. The name must be unique."));
String id = testedObject.validateServiceResourceIdInAAI("generatedId123", "siName123", reqDetails);
assertEquals("siId123", id);
}
Aggregations