aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java2
14 files changed, 107 insertions, 58 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index 8822bc39dd..64f0072991 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -153,16 +153,6 @@ public class OrchestrationStatusValidator {
.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(),
orchestrationStatus, buildingBlockDetail.getTargetAction());
- if (aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType())
- && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction())
- && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
- extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution,
- previousOrchestrationStatusValidationResult, genericVnf,
- orchestrationStatusStateTransitionDirective);
- }
-
if (orchestrationStatusStateTransitionDirective
.getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) {
throw new OrchestrationStatusValidationException(
@@ -187,23 +177,4 @@ public class OrchestrationStatusValidator {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
}
}
-
- private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(
- BuildingBlockExecution execution,
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf,
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
- if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult
- .equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (genericVnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- }
- }
- return orchestrationStatusStateTransitionDirective;
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 100f81a0c7..d5798150d1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -290,12 +290,12 @@ public class WorkflowActionBBTasks {
flowsToExecute.remove(i);
} else {
String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
- if (flowName.contains("Assign")) {
- flowName = "Unassign" + flowName.substring(6, flowName.length());
- } else if (flowName.contains("Create")) {
- flowName = "Delete" + flowName.substring(6, flowName.length());
- } else if (flowName.contains("Activate")) {
- flowName = "Deactivate" + flowName.substring(8, flowName.length());
+ if (flowName.startsWith("Assign")) {
+ flowName = flowName.replaceFirst("Assign", "Unassign");
+ } else if (flowName.startsWith("Create")) {
+ flowName = flowName.replaceFirst("Create", "Delete");
+ } else if (flowName.startsWith("Activate")) {
+ flowName = flowName.replaceFirst("Activate", "Deactivate");
} else {
continue;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index 867d80a4ea..8b939940fa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -52,7 +52,7 @@ public class AAIConfigurationResources {
AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
- injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
+ injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration));
}
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
index 63bde79b3f..7ad74a6d86 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
@@ -33,6 +33,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -151,6 +152,8 @@ public class AAIVnfResources {
.get(org.onap.aai.domain.yang.GenericVnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
.orElse(new org.onap.aai.domain.yang.GenericVnf());
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ aaiValidatorImpl.setClient(client);
return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
index d4a4cfbd8a..0123eb67be 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
@@ -32,8 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
index b3ea18df58..01511eaccc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
@@ -37,14 +37,11 @@ import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SDNCVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class);
@Autowired
private VfModuleTopologyOperationRequestMapper sdncRM;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index 6434bfb176..27edeed02a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -36,8 +36,6 @@ import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
index 62d6a110f6..6a15ca321a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
@@ -34,8 +34,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 2e7877fe3b..07f448e5e1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -29,8 +29,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCProperties;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
index b8146b5504..2c8bdd931c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
@@ -36,7 +36,7 @@ public class SDNCRequest implements Serializable {
private SDNCTopology topology;
private String correlationValue = UUID.randomUUID().toString();
private String correlationName = "SDNCCallback";
- private Object sdncPayload;
+ private transient Object sdncPayload;
public String getTimeOut() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index d07574a1ad..c63cbc0b68 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -37,7 +37,6 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
@Component
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
index b371e3a48a..ffe48876c4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
@@ -50,7 +51,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.springframework.beans.factory.annotation.Autowired;
-@Ignore
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@InjectMocks
protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
@@ -72,6 +72,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
@@ -115,6 +122,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ .thenReturn(configuration);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -134,6 +148,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.getVariable("orchestrationStatusValidationResult"));
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -147,6 +162,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception {
expectedException.expect(BpmnError.class);
@@ -178,6 +194,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -228,8 +245,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
- execution.getVariable("orchestrationStatusValidationResult"));
+ assertNull(execution.getVariable("orchestrationStatusValidationResult"));
}
@Test
@@ -247,6 +263,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -257,7 +279,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
orchestrationStatusStateTransitionDirective.setId(1);
orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
@@ -288,6 +310,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -338,6 +366,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -380,6 +414,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -422,6 +462,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -464,6 +510,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -482,4 +534,39 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
}
+
+ @Test
+ public void continueValidationActivatedTest() throws Exception {
+ String flowToBeCalled = "DeactivateVnfBB";
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName(flowToBeCalled);
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.DEACTIVATE);
+ when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.DEACTIVATE);
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED,
+ OrchestrationAction.DEACTIVATE);
+
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 68f3d20c82..9855c8587a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -96,14 +96,12 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
public void createConfigurationTest() {
doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper)
.mapConfiguration(configuration);
- doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class),
- isA(org.onap.aai.domain.yang.Configuration.class));
-
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ any(Optional.class));
aaiConfigurationResources.createConfiguration(configuration);
assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus());
- verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class),
- isA(org.onap.aai.domain.yang.Configuration.class));
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
index 3680eaac81..425b595686 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -53,6 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -234,6 +235,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
boolean isVnfPserversLockedFlag = aaiVnfResources.checkVnfPserversLockedFlag("vnfId");
verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),
isA(AAIResourceUri.class));
+ verify(MOCK_aaiValidatorImpl, times(1)).setClient(isA(AAIRestClientImpl.class));
verify(MOCK_aaiValidatorImpl, times(1)).isPhysicalServerLocked(isA(String.class));
assertTrue(isVnfPserversLockedFlag);
}