From ec99422b06b4c907293b293880243b77970368d0 Mon Sep 17 00:00:00 2001 From: "Kalkere Ramesh, Sharan (sk720x)" Date: Fri, 6 Nov 2020 21:46:35 -0800 Subject: do not throw an exception when no relationship exists from vfmodule to vnfc Issue-ID: SO-3369 Change-Id: Ia137384cbaa04fa014f865dd0eba14a7eca9605e Signed-off-by: Kalkere Ramesh, Sharan (sk720x) --- .../onap/so/adapters/tasks/orchestration/PollServiceTest.java | 5 +++++ .../so/adapters/tasks/orchestration/RollbackServiceTest.java | 6 ++++++ .../so/adapters/tasks/orchestration/StackServiceTest.java | 11 ++++++----- .../test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java | 6 +++--- 4 files changed, 20 insertions(+), 8 deletions(-) (limited to 'adapters/mso-openstack-adapters/src/test') diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java index 8d5ab8234e..60826705fd 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java @@ -14,6 +14,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.tasks.orchestration.PollService; +import org.onap.so.adapters.vnf.VnfAdapterUtils; import org.onap.so.logging.tasks.AuditMDCSetup; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoHeatUtils; @@ -33,6 +34,9 @@ public class PollServiceTest { @Mock private MsoHeatUtils msoHeatUtils; + @Mock + private VnfAdapterUtils vnfAdapterUtils; + @Mock private AuditMDCSetup mdcSetup; @@ -44,6 +48,7 @@ public class PollServiceTest { String xmlString = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml"))); + Mockito.when(vnfAdapterUtils.isMulticloudMode(Mockito.any(), Mockito.any())).thenReturn(false); Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(xmlString); Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(false); Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123"); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java index 1f68106f78..3a82dd5b72 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java @@ -18,6 +18,7 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.tasks.orchestration.RollbackService; import org.onap.so.adapters.vnf.MsoVnfAdapterImpl; +import org.onap.so.adapters.vnf.VnfAdapterUtils; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.entity.MsoRequest; import org.onap.so.logging.tasks.AuditMDCSetup; @@ -40,6 +41,9 @@ public class RollbackServiceTest { @Mock private MsoVnfAdapterImpl vnfAdapterImpl; + @Mock + private VnfAdapterUtils vnfAdapterUtils; + @Mock private MsoHeatUtils msoHeatUtils; @@ -65,6 +69,8 @@ public class RollbackServiceTest { Stack stack = new Stack(); stack.setId("heatId"); + + Mockito.when(vnfAdapterUtils.isMulticloudMode(Mockito.any(), Mockito.any())).thenReturn(false); Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload); Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java index cc2dfa213e..afe7e17855 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java @@ -7,7 +7,6 @@ import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; import java.util.Optional; -import javax.xml.ws.Holder; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.junit.Test; @@ -16,15 +15,13 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.adapters.tasks.orchestration.StackService; import org.onap.so.adapters.vnf.MsoVnfAdapterImpl; -import org.onap.so.entity.MsoRequest; +import org.onap.so.adapters.vnf.VnfAdapterUtils; +import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.logging.tasks.AuditMDCSetup; -import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoHeatUtils; import com.woorea.openstack.heat.model.Stack; -import org.onap.so.adapters.vnf.exceptions.VnfException; @RunWith(MockitoJUnitRunner.class) public class StackServiceTest { @@ -40,6 +37,9 @@ public class StackServiceTest { @Mock private MsoVnfAdapterImpl vnfAdapterImpl; + @Mock + private VnfAdapterUtils vnfAdapterUtils; + @Mock private MsoHeatUtils msoHeatUtils; @@ -64,6 +64,7 @@ public class StackServiceTest { Stack stack = new Stack(); stack.setId("heatId"); + Mockito.when(vnfAdapterUtils.isMulticloudMode(Mockito.any(), Mockito.any())).thenReturn(false); Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload); Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java index 1026284470..f06df8f22e 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -371,15 +371,15 @@ public class HeatBridgeImplTest { org.onap.aai.domain.yang.RelationshipList relList = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID, "test-genericVnf-id", "test-vfModule-id", server1); - assertEquals(3, relList.getRelationship().size()); + assertEquals(2, relList.getRelationship().size()); org.onap.aai.domain.yang.RelationshipList relList2 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID, "test-genericVnf-id", "test-vfModule-id", server2); - assertEquals(2, relList2.getRelationship().size()); + assertEquals(1, relList2.getRelationship().size()); org.onap.aai.domain.yang.RelationshipList relList3 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID, "test-genericVnf-id", "test-vfModule-id", server3); - assertEquals(2, relList3.getRelationship().size()); + assertEquals(1, relList3.getRelationship().size()); } -- cgit 1.2.3-korg