aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java118
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java11
7 files changed, 324 insertions, 32 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index 5f70ab5924..3a1e126fef 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -82,7 +82,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationValue = messageId;
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "queryVnfNotification")
@@ -117,7 +117,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setOutputs(outputs);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "createVnfNotification")
@@ -150,7 +150,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setRollback(rollback);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "updateVnfNotification")
@@ -181,7 +181,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setRollback(rollback);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "deleteVnfNotification")
@@ -208,6 +208,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setErrorMessage(errorMessage);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java
new file mode 100644
index 0000000000..d15d71a9e9
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java
@@ -0,0 +1,118 @@
+package org.onap.so.bpmn.common.workflow.service;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
+import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
+import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
+import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfAdapterNotifyServiceImplTest {
+
+
+ @InjectMocks
+ @Spy
+ private VnfAdapterNotifyServiceImpl vnfAdapterNotifyServiceImpl;
+
+ @Mock
+ private CallbackHandlerService callbackHandlerService;
+
+ @Mock
+ private CallbackResult callbackResult;
+
+ protected CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs();
+ protected QueryVnfNotification.Outputs queryOutputs = new QueryVnfNotification.Outputs();
+ protected UpdateVnfNotification.Outputs updateOutputs = new UpdateVnfNotification.Outputs();
+
+ protected VnfRollback vnfRollback = new VnfRollback();
+
+ @Test
+ public void rollbackVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("rollbackVnfNotification"),
+ any(RollbackVnfNotification.class), eq("rollbackVnfNotificationCallback"),
+ eq("rollbackVnfNotificationCallback"), eq("VNFRB_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.rollbackVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK,
+ "Error creating stack");
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("rollbackVnfNotification"),
+ any(RollbackVnfNotification.class), eq("rollbackVnfNotificationCallback"),
+ eq("rollbackVnfNotificationCallback"), eq("VNFRB_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void queryVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("queryVnfNotification"),
+ any(QueryVnfNotification.class), eq("queryVnfNotificationCallback"), eq("queryVnfNotificationCallback"),
+ eq("VNFQ_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+
+ vnfAdapterNotifyServiceImpl.queryVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ Boolean.TRUE, "vnfid", VnfStatus.ACTIVE, queryOutputs);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("queryVnfNotification"),
+ any(QueryVnfNotification.class), eq("queryVnfNotificationCallback"), eq("queryVnfNotificationCallback"),
+ eq("VNFQ_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+ }
+
+ @Test
+ public void createVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("createVnfNotification"),
+ any(CreateVnfNotification.class), eq("createVnfNotificationCallback"),
+ eq("createVnfNotificationCallback"), eq("VNFC_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.createVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ "vnfId", outputs, vnfRollback);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("createVnfNotification"),
+ any(CreateVnfNotification.class), eq("createVnfNotificationCallback"),
+ eq("createVnfNotificationCallback"), eq("VNFC_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void updateVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("updateVnfNotification"),
+ any(UpdateVnfNotification.class), eq("updateVnfNotificationCallback"),
+ eq("updateVnfNotificationCallback"), eq("VNFU_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.updateVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ updateOutputs, vnfRollback);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("updateVnfNotification"),
+ any(UpdateVnfNotification.class), eq("updateVnfNotificationCallback"),
+ eq("updateVnfNotificationCallback"), eq("VNFU_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void deleteVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("deleteVnfNotification"),
+ any(DeleteVnfNotification.class), eq("deleteVnfACallback"), eq("deleteVnfACallback"), eq("VNFDEL_uuid"),
+ eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+
+ vnfAdapterNotifyServiceImpl.deleteVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "");
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("deleteVnfNotification"),
+ any(DeleteVnfNotification.class), eq("deleteVnfACallback"), eq("deleteVnfACallback"), eq("VNFDEL_uuid"),
+ eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 4e74e5d414..c223d3ff11 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -2,14 +2,15 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) Copyright (C) 2018 Bell Canada.
+ * Copyright (C) 2018 Bell Canada.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +21,6 @@
package org.onap.so.bpmn.buildingblock;
-import java.util.Map;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -28,37 +28,37 @@ import org.springframework.stereotype.Component;
@Component
public class HomingV2 {
- @Autowired
- private OofHomingV2 oofHomingV2;
- @Autowired
+ static final String HOMING_SNIRO = "sniro";
+ static final String HOMING_OOF = "oof";
+ static final String HOMING_SOLUTION = "Homing_Solution";
+
private SniroHomingV2 sniroHomingV2;
+ private OofHomingV2 oofHomingV2;
- private static final String HOMINGSOLUTION = "Homing_Solution";
+ @Autowired
+ public HomingV2(OofHomingV2 oofHomingV2, SniroHomingV2 sniroHomingV2) {
+ this.oofHomingV2 = oofHomingV2;
+ this.sniroHomingV2 = sniroHomingV2;
+ }
public void callHoming(BuildingBlockExecution execution) {
- if (isOof(execution)) {
- oofHomingV2.callOof(execution);
- } else {
+ if (isSniro(execution)) {
sniroHomingV2.callSniro(execution);
+ } else {
+ oofHomingV2.callOof(execution);
}
}
public void processSolution(BuildingBlockExecution execution, String asyncResponse) {
- if (isOof(execution)) {
- oofHomingV2.processSolution(execution, asyncResponse);
- } else {
+ if (isSniro(execution)) {
sniroHomingV2.processSolution(execution, asyncResponse);
+ } else {
+ oofHomingV2.processSolution(execution, asyncResponse);
}
}
- // Default solution is SNIRO. OOF gets called only if specified.
- private boolean isOof(BuildingBlockExecution execution) {
- for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
- .getUserParams()) {
- if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) {
- return true;
- }
- }
- return false;
+ private boolean isSniro(BuildingBlockExecution execution) {
+ return execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams().stream()
+ .anyMatch(params -> HOMING_SNIRO.equals(params.get(HOMING_SOLUTION)));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java
new file mode 100644
index 0000000000..566cdccd50
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java
@@ -0,0 +1,14 @@
+package org.onap.so.bpmn.infrastructure.flowspecific.exceptions;
+
+public class UnassignNetworkException extends Exception {
+
+ private static final long serialVersionUID = 2864418350216433736L;
+
+ public UnassignNetworkException() {
+ super();
+ }
+
+ public UnassignNetworkException(String message) {
+ super(message);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
index c9a937b824..f95e7afed9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -24,19 +24,22 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAINetworkResources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UnassignNetworkBB {
-
+ private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class);
private static String messageCannotPerformUnassign =
"Cannot perform Unassign Network. Network is still related to ";
private static String messageErrorRollback = " Rollback is not possible. Please restore data manually.";
@@ -71,7 +74,8 @@ public class UnassignNetworkBB {
if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
String msg = messageCannotPerformUnassign + relatedToValue;
execution.setVariable("ErrorUnassignNetworkBB", msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ logger.error("ErrorUnassignNetworkBB: {}", msg);
+ throw new UnassignNetworkException(msg);
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java
new file mode 100644
index 0000000000..9dd0365e7a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.buildingblock;
+
+import static org.mockito.BDDMockito.then;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_OOF;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SNIRO;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SOLUTION;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+
+public class HomingV2Test {
+
+ @Test
+ public void whenHomingSolutionSetToSniroShouldCallSniro() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_SNIRO);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(sniroHoming).should().callSniro(givenExecution);
+ then(oofHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToSniroShouldProcessSniro() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_SNIRO);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(sniroHoming).should().processSolution(givenExecution, "dummy");
+ then(oofHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToOofShouldCallOof() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_OOF);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(oofHoming).should().callOof(givenExecution);
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToOofShouldProcessOof() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_OOF);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(oofHoming).should().processSolution(givenExecution, "dummy");
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionNotSetShouldCallOof() {
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>());
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(oofHoming).should().callOof(givenExecution);
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionNotSetShouldProcessOof() {
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>());
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(oofHoming).should().processSolution(givenExecution, "dummy");
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ private BuildingBlockExecution createBuildingBlockExecutionMock(Map<String, Object> userParams) {
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ GeneralBuildingBlock generalBuildingBlock = mock(GeneralBuildingBlock.class);
+ RequestContext requestContext = mock(RequestContext.class);
+ RequestParameters requestParameters = mock(RequestParameters.class);
+ List<Map<String, Object>> userParamsList = new ArrayList<>();
+
+ userParamsList.add(userParams);
+
+ when(execution.getGeneralBuildingBlock()).thenReturn(generalBuildingBlock);
+ when(generalBuildingBlock.getRequestContext()).thenReturn(requestContext);
+ when(requestContext.getRequestParameters()).thenReturn(requestParameters);
+ when(requestParameters.getUserParams()).thenReturn(userParamsList);
+
+ return execution;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
index bacc57758b..ed55c56231 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
@@ -40,9 +40,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
-import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.springframework.beans.factory.annotation.Autowired;
public class UnassignNetworkBBTest extends BaseTaskTest {
@@ -84,6 +82,15 @@ public class UnassignNetworkBBTest extends BaseTaskTest {
}
@Test
+ public void checkRelationshipRelatedToUnassignNetworkExceptionTest() throws Exception {
+ String msg = "Cannot perform Unassign Network. Network is still related to vf-module";
+ expectedException.expect(BpmnError.class);
+ doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module"));
+ unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module");
+ assertEquals(execution.getVariable("ErrorUnassignNetworkBB"), msg);
+ }
+
+ @Test
public void getCloudSdncRegion25Test() throws Exception {
CloudRegion cloudRegion = setCloudRegion();
cloudRegion.setCloudRegionVersion("2.5");