Search in sources :

Example 26 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class WorkflowActionBBTasksTest method setVolumeGroupNameTest.

@Test
public void setVolumeGroupNameTest() {
    String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
    WorkflowType resourceType = WorkflowType.VOLUMEGROUP;
    InfraActiveRequests request = new InfraActiveRequests();
    request.setVnfId("4aa72c90-21eb-4465-8847-997e27af6c3e");
    VolumeGroup volumeGroup = new VolumeGroup();
    volumeGroup.setVolumeGroupName("volumeGroupName");
    Optional<VolumeGroup> returnVolumeGroup = Optional.of(volumeGroup);
    doReturn(returnVolumeGroup).when(bbSetupUtils).getRelatedVolumeGroupByIdFromVnf(request.getVnfId(), resourceId);
    workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
    assertEquals("volumeGroupName", request.getVolumeGroupName());
}
Also used : VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 27 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class AaiResourceIdValidatorTest method validateVolumeGroupResourceIdInAAISameModelCustIdTest.

@Test
public void validateVolumeGroupResourceIdInAAISameModelCustIdTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setVnfId("vnfId123");
    VolumeGroup volumeGroup = new VolumeGroup();
    volumeGroup.setVolumeGroupId("id123");
    volumeGroup.setVfModuleModelCustomizationId("1234567");
    Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup);
    when(bbInputSetupUtilsMock.getRelatedVolumeGroupByNameFromVnf("vnfId123", "name123")).thenReturn(opVolumeGroup);
    String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, workflowResourceIds);
    assertEquals("id123", id);
}
Also used : VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) 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 28 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class AaiResourceIdValidatorTest method validateResourceIdInAAIVolumeGroupTest.

@Test
public void validateResourceIdInAAIVolumeGroupTest() throws Exception {
    RequestDetails reqDetails = setupRequestDetails();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setVnfId("id123");
    VolumeGroup volumeGroup = new VolumeGroup();
    volumeGroup.setVolumeGroupId("id123");
    volumeGroup.setVolumeGroupName("name123");
    volumeGroup.setVfModuleModelCustomizationId("1234567");
    Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup);
    when(bbInputSetupUtilsMock.getRelatedVolumeGroupByNameFromVnf("id123", "name123")).thenReturn(opVolumeGroup);
    String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, workflowResourceIds);
    assertEquals("id123", id);
    String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", reqDetails, workflowResourceIds);
    assertEquals("generatedId123", id2);
}
Also used : VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) 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 29 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class AAIDataRetrievalTest method getVolumeGroupsOfVnfWhenNoneTest.

@Test
public void getVolumeGroupsOfVnfWhenNoneTest() throws Exception {
    VolumeGroups volumeGroups = new VolumeGroups();
    AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).relatedTo(Types.VOLUME_GROUPS.getFragment());
    doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
    List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
    assertEquals(true, volumeGroupList.isEmpty());
    Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId("vnfId");
    assertEquals(false, volumeGroupIds.isPresent());
}
Also used : AAIPluralResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri) VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) VolumeGroups(org.onap.aai.domain.yang.VolumeGroups) Test(org.junit.Test)

Example 30 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class AAIDataRetrievalTest method getVolumeGroups.

private VolumeGroups getVolumeGroups() {
    VolumeGroup volumeGroup1 = new VolumeGroup();
    volumeGroup1.setVolumeGroupId("vg1");
    VolumeGroup volumeGroup2 = new VolumeGroup();
    volumeGroup2.setVolumeGroupId("vg2");
    VolumeGroups volumeGroups = new VolumeGroups();
    volumeGroups.getVolumeGroup().add(volumeGroup1);
    volumeGroups.getVolumeGroup().add(volumeGroup2);
    return volumeGroups;
}
Also used : VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) VolumeGroups(org.onap.aai.domain.yang.VolumeGroups)

Aggregations

VolumeGroup (org.onap.aai.domain.yang.VolumeGroup)30 Test (org.junit.Test)25 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)16 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)12 ArrayList (java.util.ArrayList)11 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)11 List (java.util.List)10 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)10 RelationshipList (org.onap.aai.domain.yang.RelationshipList)10 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)10 NorthBoundRequest (org.onap.so.db.catalog.beans.macro.NorthBoundRequest)10 VfModule (org.onap.aai.domain.yang.VfModule)8 VolumeGroups (org.onap.aai.domain.yang.VolumeGroups)8 GenericVnf (org.onap.aai.domain.yang.GenericVnf)6 AAIPluralResourceUri (org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri)6 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)6 HeatEnvironment (org.onap.so.db.catalog.beans.HeatEnvironment)5 HeatTemplate (org.onap.so.db.catalog.beans.HeatTemplate)5 OrchestrationFlow (org.onap.so.db.catalog.beans.macro.OrchestrationFlow)4 ServiceInstance (org.onap.aai.domain.yang.ServiceInstance)3