Search in sources :

Example 31 with ServiceInstance

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);
}
Also used : ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake) Before(org.junit.Before)

Example 32 with ServiceInstance

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);
}
Also used : ServiceInstances(org.onap.aai.domain.yang.ServiceInstances) ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 33 with ServiceInstance

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));
}
Also used : ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) File(java.io.File) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Test(org.junit.Test)

Aggregations

ServiceInstance (org.onap.aai.domain.yang.ServiceInstance)33 Test (org.junit.Test)27 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)14 ArrayList (java.util.ArrayList)13 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)13 List (java.util.List)12 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)12 ServiceInstances (org.onap.aai.domain.yang.ServiceInstances)11 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)11 RelationshipList (org.onap.aai.domain.yang.RelationshipList)9 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)9 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)8 GenericVnf (org.onap.aai.domain.yang.GenericVnf)8 VfModule (org.onap.aai.domain.yang.VfModule)8 NorthBoundRequest (org.onap.so.db.catalog.beans.macro.NorthBoundRequest)8 OrchestrationFlow (org.onap.so.db.catalog.beans.macro.OrchestrationFlow)8 WorkflowResourceIds (org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds)6 IOException (java.io.IOException)4 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)4 Relationship (org.onap.aai.domain.yang.Relationship)4