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);
}
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);
}
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());
}
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);
}
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());
}
Aggregations