diff options
author | Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com> | 2020-11-06 21:46:35 -0800 |
---|---|---|
committer | Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com> | 2020-11-08 18:15:48 -0500 |
commit | ec99422b06b4c907293b293880243b77970368d0 (patch) | |
tree | b840c3e2f0b1068363bdc3517e73b93d4d8a92e7 /adapters/mso-openstack-adapters/src/test/java | |
parent | ea82d794ac51faa699b9b84ea003a9242b8d4ccc (diff) |
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) <sk720x@att.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java')
4 files changed, 20 insertions, 8 deletions
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; @@ -34,6 +35,9 @@ public class PollServiceTest { private MsoHeatUtils msoHeatUtils; @Mock + private VnfAdapterUtils vnfAdapterUtils; + + @Mock private AuditMDCSetup mdcSetup; @InjectMocks @@ -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; @@ -41,6 +42,9 @@ public class RollbackServiceTest { private MsoVnfAdapterImpl vnfAdapterImpl; @Mock + private VnfAdapterUtils vnfAdapterUtils; + + @Mock private MsoHeatUtils msoHeatUtils; @Mock @@ -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 { @@ -41,6 +38,9 @@ public class StackServiceTest { private MsoVnfAdapterImpl vnfAdapterImpl; @Mock + private VnfAdapterUtils vnfAdapterUtils; + + @Mock private MsoHeatUtils msoHeatUtils; @Mock @@ -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()); } |