From 2af896d2434c765c4372285b2c8fb2aaab7eae3d Mon Sep 17 00:00:00 2001 From: Lukasz Muszkieta Date: Tue, 30 Jan 2018 14:02:49 +0100 Subject: add junit for StackInfo Change-Id: I80e60b590d761c30fd2c71e259c2b4f5cf53b508 Issue-ID: SO-360 Signed-off-by: Lukasz Muszkieta --- .../vnf/test/MsoVnfAdapterAsyncImplTest.java | 17 ------ .../adapters/vnf/test/MsoVnfAdapterImplTest.java | 65 ---------------------- .../openecomp/mso/adapters/vnf/test/QueryTest.java | 24 ++------ 3 files changed, 6 insertions(+), 100 deletions(-) (limited to 'adapters/mso-vnf-adapter') diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java index b680170abe..a045b00699 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java @@ -22,18 +22,10 @@ package org.openecomp.mso.adapters.vnf.test; import java.util.HashMap; import java.util.Map; - import org.junit.Test; import org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsyncImpl; import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.HeatStatus; -import org.openecomp.mso.openstack.beans.StackInfo; import org.openecomp.mso.openstack.beans.VnfRollback; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.utils.MsoHeatUtils; - -import mockit.Mock; -import mockit.MockUp; public class MsoVnfAdapterAsyncImplTest { @@ -45,15 +37,6 @@ public class MsoVnfAdapterAsyncImplTest { @Test public void createVNFTest() { - new MockUp() { - @Mock - public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException { - StackInfo info = new StackInfo(); - info.setStatus(HeatStatus.CREATED); - return info; - } - }; - MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl(); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java index 77879089e9..6f01954db3 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java @@ -22,24 +22,11 @@ package org.openecomp.mso.adapters.vnf.test; import java.util.HashMap; import java.util.Map; - import javax.xml.ws.Holder; - import org.junit.Test; import org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl; -import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.VfModule; -import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; -import org.openecomp.mso.db.catalog.beans.VnfResource; import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.HeatStatus; -import org.openecomp.mso.openstack.beans.StackInfo; import org.openecomp.mso.openstack.beans.VnfRollback; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.utils.MsoHeatUtils; - -import mockit.Mock; -import mockit.MockUp; public class MsoVnfAdapterImplTest { @@ -51,16 +38,6 @@ public class MsoVnfAdapterImplTest { @Test public void createVnfTest() { - - new MockUp() { - @Mock - public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException { - StackInfo info = new StackInfo(); - info.setStatus(HeatStatus.CREATED); - return info; - } - }; - MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); @@ -80,37 +57,6 @@ public class MsoVnfAdapterImplTest { @Test public void updateVnfTest() { - - new MockUp() { - @Mock - public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException { - StackInfo info = new StackInfo(); - info.setStatus(HeatStatus.CREATED); - return info; - } - }; - - new MockUp() { - @Mock - public VfModuleCustomization getVfModuleCustomizationByModelCustomizationId(String modelCustomizationUuid) { - VfModuleCustomization vfcModule = new VfModuleCustomization(); - VfModule vfm = new VfModule(); - vfm.setVnfResourceModelUUId("88a6ca3ee0394ade9403f075db23167e"); - vfcModule.setVfModule(vfm); - return vfcModule; - } - }; - - new MockUp() { - @Mock - public VnfResource getVnfResourceByModelUuid(String modelUuid) { - VnfResource vnfResource = new VnfResource(); - vnfResource.setAicVersionMin("1"); - vnfResource.setAicVersionMax("2"); - return vnfResource; - } - }; - MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); @@ -130,17 +76,6 @@ public class MsoVnfAdapterImplTest { @Test public void deleteVnfTest() { - new MockUp() { - @Mock - public Map queryStackForOutputs(String cloudSiteId, String tenantId, String stackName) - throws MsoException { - - Map outputs = new HashMap<>(); - outputs.put("Key1", "value1"); - return outputs; - } - }; - MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java index 315db2eb83..f6e79e12a0 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java @@ -21,26 +21,23 @@ package org.openecomp.mso.adapters.vnf.test; -import java.util.Map; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import java.util.Map; import javax.xml.ws.Holder; - import mockit.Mock; import mockit.MockUp; import org.junit.Test; import org.openecomp.mso.adapters.vnf.MsoVnfAdapter; import org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl; +import org.openecomp.mso.adapters.vnf.exceptions.VnfException; import org.openecomp.mso.openstack.beans.HeatStatus; import org.openecomp.mso.openstack.beans.StackInfo; import org.openecomp.mso.openstack.beans.VnfStatus; -import org.openecomp.mso.adapters.vnf.exceptions.VnfException; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; import org.openecomp.mso.openstack.exceptions.MsoException; import org.openecomp.mso.openstack.utils.MsoHeatUtils; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class QueryTest { @Test @@ -49,8 +46,7 @@ public class QueryTest { new MockUp() { @Mock public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException { - StackInfo info = new StackInfo(); - info.setStatus(HeatStatus.CREATED); + StackInfo info = new StackInfo("stackName", HeatStatus.CREATED); return info; } }; @@ -77,8 +73,7 @@ public class QueryTest { new MockUp() { @Mock public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException { - StackInfo info = new StackInfo(); - info.setStatus(HeatStatus.NOTFOUND); + StackInfo info = new StackInfo("stackName", HeatStatus.NOTFOUND); return info; } }; @@ -102,13 +97,6 @@ public class QueryTest { @Test(expected = VnfException.class) public void testQueryVnfWithException() throws VnfException { { - new MockUp() { - @Mock - public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException { - throw new MsoCloudSiteNotFound(cloudSiteId); - } - }; - MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl(); String cloudId = "MT"; String tenantId = "MSO_Test"; -- cgit 1.2.3-korg