use of org.onap.aai.domain.yang.ServiceInstance in project so by onap.
the class WorkflowActionBBTasksTest method before.
@Before
public void before() throws Exception {
execution = new DelegateExecutionFake();
ServiceInstance servInstance = new ServiceInstance();
servInstance.setServiceInstanceId("TEST");
when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance);
workflowAction.setBbInputSetupUtils(bbSetupUtils);
workflowAction.setBbInputSetup(bbInputSetup);
}
use of org.onap.aai.domain.yang.ServiceInstance 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);
}
use of org.onap.aai.domain.yang.ServiceInstance in project so by onap.
the class BpmnRequestBuilderTest method test_buildServiceInstanceDeleteRequest.
@Test
public void test_buildServiceInstanceDeleteRequest() throws Exception {
ServiceInstance service = provider.getMapper().readValue(new File(RESOURCE_PATH + "ServiceInstance.json"), ServiceInstance.class);
doReturn(service).when(aaiData).getServiceInstance("serviceId");
ServiceInstancesRequest expectedRequest = mapper.readValue(new File(RESOURCE_PATH + "ExpectedServiceRequest.json"), ServiceInstancesRequest.class);
// bad getter/setter setting multiple
expectedRequest.getRequestDetails().getModelInfo().setModelId(null);
// fields
ServiceInstancesRequest actualRequest = reqBuilder.buildServiceDeleteRequest("serviceId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
Aggregations