Search in sources :

Example 61 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateServiceResourceIdInAAIDuplicateNameMultipleTest.

@Test
public void validateServiceResourceIdInAAIDuplicateNameMultipleTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    ServiceInstances serviceInstances = new ServiceInstances();
    serviceInstances.getServiceInstance().add(new ServiceInstance());
    serviceInstances.getServiceInstance().add(new ServiceInstance());
    when(bbInputSetupUtilsMock.getAAIServiceInstancesGloballyByName("siName")).thenReturn(serviceInstances);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("serviceInstance with name (siName) and multiple combination of model-version-id + service-type + global-customer-id 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 62 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateVolumeGroupResourceIdInAAITest.

@Test
public void validateVolumeGroupResourceIdInAAITest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    String id = testedObject.validateVolumeGroupResourceIdInAAI("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 63 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateConfigurationResourceIdInAAINotGloballyUniqueTest.

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

Example 64 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateVfModuleResourceIdDifferentModelCustIdTest.

@Test
public void validateVfModuleResourceIdDifferentModelCustIdTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setVnfId("vnfId123");
    VfModules vfModules = new VfModules();
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleName("name123");
    vfModule.setModelCustomizationId("9999999");
    vfModules.getVfModule().add(vfModule);
    GenericVnf vnf = new GenericVnf();
    vnf.setVfModules(vfModules);
    when(bbInputSetupUtilsMock.getAAIGenericVnf("vnfId123")).thenReturn(vnf);
    this.expectedException.expect(DuplicateNameException.class);
    this.expectedException.expectMessage(containsString("vfModule with name (name123), same parent and different customization id (1234567) already exists. The name must be unique."));
    testedObject.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds);
}
Also used : VfModules(org.onap.aai.domain.yang.VfModules) GenericVnf(org.onap.aai.domain.yang.GenericVnf) 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 65 with RequestDetails

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

the class AaiResourceIdValidatorTest method validateNetworkResourceIdInAAISameModelCustIdTest.

@Test
public void validateNetworkResourceIdInAAISameModelCustIdTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setServiceInstanceId("siId123");
    L3Network network = new L3Network();
    network.setNetworkId("id123");
    network.setModelCustomizationId("1234567");
    Optional<L3Network> opNetwork = Optional.of(network);
    when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork);
    String id = testedObject.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds);
    assertEquals("id123", id);
}
Also used : L3Network(org.onap.aai.domain.yang.L3Network) 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