Search in sources :

Example 56 with RequestDetails

use of org.onap.so.serviceinstancebeans.RequestDetails in project so by onap.

the class AaiResourceIdValidatorTest method validateVnfResourceIdInAAISameModelCustomizationIdTest.

@Test
public void validateVnfResourceIdInAAISameModelCustomizationIdTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setServiceInstanceId("siId123");
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId("id123");
    vnf.setModelCustomizationId("1234567");
    Optional<GenericVnf> opVnf = Optional.of(vnf);
    when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf);
    String id = testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, workflowResourceIds);
    assertEquals("id123", id);
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 57 with RequestDetails

use of org.onap.so.serviceinstancebeans.RequestDetails in project so by onap.

the class AaiResourceIdValidatorTest method validateVnfResourceIdInAAIDiffModelCustomizationIdTest.

@Test
public void validateVnfResourceIdInAAIDiffModelCustomizationIdTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setServiceInstanceId("siId123");
    GenericVnf vnf = new GenericVnf();
    vnf.setModelCustomizationId("9999999");
    Optional<GenericVnf> opVnf = Optional.of(vnf);
    when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("generic-vnf with name (vnfName123), same parent and different customization id (9999999) already exists. The name must be unique."));
    testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, workflowResourceIds);
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 58 with RequestDetails

use of org.onap.so.serviceinstancebeans.RequestDetails in project so by onap.

the class AaiResourceIdValidatorTest method validateVfModuleResourceIdTest.

@Test
public void validateVfModuleResourceIdTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    String id = testedObject.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, new WorkflowResourceIds());
    assertEquals("generatedId123", id);
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 59 with RequestDetails

use of org.onap.so.serviceinstancebeans.RequestDetails in project so by onap.

the class AaiResourceIdValidatorTest method validateResourceIdInAAIVnfNotGloballyUniqueTest.

@Test
public void validateResourceIdInAAIVnfNotGloballyUniqueTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    GenericVnfs genericVnfs = new GenericVnfs();
    GenericVnf vnf3 = new GenericVnf();
    vnf3.setVnfId("id123");
    genericVnfs.getGenericVnf().add(vnf3);
    when(bbInputSetupUtilsMock.getAAIVnfsGloballyByName("vnfName333")).thenReturn(genericVnfs);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("generic-vnf with name (vnfName333) id (id123) and different parent relationship already exists. The name must be unique."));
    testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName333", reqDetails, new WorkflowResourceIds());
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) GenericVnfs(org.onap.aai.domain.yang.GenericVnfs) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 60 with RequestDetails

use of org.onap.so.serviceinstancebeans.RequestDetails in project so by onap.

the class AaiResourceIdValidatorTest method validateConfigurationResourceIdInAAITest.

@Test
public void validateConfigurationResourceIdInAAITest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    String id = testedObject.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, new WorkflowResourceIds());
    assertEquals("generatedId123", id);
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Aggregations

RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)163 Test (org.junit.Test)126 Service (org.onap.so.db.catalog.beans.Service)55 File (java.io.File)52 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)51 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)47 WorkflowResourceIds (org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds)43 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)42 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)38 HashMap (java.util.HashMap)37 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)36 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)36 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)35 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)27 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)27 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)23 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)21 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)20 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)19 GenericVnf (org.onap.aai.domain.yang.GenericVnf)18