Search in sources :

Example 66 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateVfModuleResourceIdSameModelCustIdTest.

@Test
public void validateVfModuleResourceIdSameModelCustIdTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setVnfId("vnfId123");
    VfModules vfModules = new VfModules();
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("id123");
    vfModule.setVfModuleName("name123");
    vfModule.setModelCustomizationId("1234567");
    vfModules.getVfModule().add(vfModule);
    GenericVnf vnf = new GenericVnf();
    vnf.setVfModules(vfModules);
    when(bbInputSetupUtilsMock.getAAIGenericVnf("vnfId123")).thenReturn(vnf);
    String id = testedObject.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds);
    assertEquals("id123", id);
}
Also used : VfModules(org.onap.aai.domain.yang.VfModules) GenericVnf(org.onap.aai.domain.yang.GenericVnf) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) VfModule(org.onap.aai.domain.yang.VfModule) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 67 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateServiceResourceIdInAAIDuplicateNameTest.

@Test
public void validateServiceResourceIdInAAIDuplicateNameTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    ServiceInstance si = new ServiceInstance();
    si.setModelVersionId("1234567");
    ServiceInstances serviceInstances = new ServiceInstances();
    serviceInstances.getServiceInstance().add(si);
    when(bbInputSetupUtilsMock.getAAIServiceInstancesGloballyByName("siName")).thenReturn(serviceInstances);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("serviceInstance with name (siName) and global-customer-id (null), service-type (null), model-version-id (1234567) already exists. The name must be unique."));
    testedObject.validateServiceResourceIdInAAI("generatedId123", "siName", reqDetails);
}
Also used : ServiceInstances(org.onap.aai.domain.yang.ServiceInstances) ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 68 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateResourceIdInAAIConfigurationNotGloballyUniqueTest.

@Test
public void validateResourceIdInAAIConfigurationNotGloballyUniqueTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    when(bbInputSetupUtilsMock.existsAAIConfigurationGloballyByName("testConfig")).thenReturn(true);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("configuration with name testConfig already exists. The name must be unique."));
    testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "testConfig", reqDetails, new WorkflowResourceIds());
}
Also used : RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 69 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateVolumeGroupResourceIdInAAINotGloballyUniqueTest.

@Test
public void validateVolumeGroupResourceIdInAAINotGloballyUniqueTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    when(bbInputSetupUtilsMock.existsAAIVolumeGroupGloballyByName("name123")).thenReturn(true);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("volumeGroup with name name123 already exists. The name must be unique."));
    testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, workflowResourceIds);
}
Also used : RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) Test(org.junit.Test)

Example 70 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateResourceIdInAAISITest.

@Test
public void validateResourceIdInAAISITest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    reqDetails.getModelInfo().setModelVersionId("1234567");
    ServiceInstance si = new ServiceInstance();
    si.setServiceInstanceId("siId123");
    si.setModelVersionId("1234567");
    ServiceInstances serviceInstances = new ServiceInstances();
    serviceInstances.getServiceInstance().add(si);
    Optional<ServiceInstance> siOp = Optional.of(si);
    ServiceInstance si2 = new ServiceInstance();
    si2.setServiceInstanceId("siId222");
    si2.setModelVersionId("22222");
    si2.setServiceInstanceName("siName222");
    Optional<ServiceInstance> siOp2 = Optional.of(si2);
    ServiceInstances serviceInstances2 = new ServiceInstances();
    serviceInstances2.getServiceInstance().add(si2);
    when(bbInputSetupUtilsMock.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp);
    when(bbInputSetupUtilsMock.getAAIServiceInstanceByName("id123", "subServiceType123", "siName222")).thenReturn(siOp2);
    String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, new WorkflowResourceIds());
    assertEquals("siId123", id);
    String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111", reqDetails, new WorkflowResourceIds());
    assertEquals("generatedId123", id2);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("serviceInstance with name (siName222) and different version id (1234567) already exists. The name must be unique."));
    testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName222", reqDetails, new WorkflowResourceIds());
}
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) 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