aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/test/java
diff options
context:
space:
mode:
authorSumapriya <SS00493505@techmahindra.com>2018-03-23 16:38:43 +0530
committerSumapriya <SS00493505@techmahindra.com>2018-03-23 16:38:43 +0530
commit5b8c5811f25b61a7d33162675ae1a193423cc48e (patch)
tree6214a422c7c813b44afd20cc212ead789d1b6b1c /adapters/mso-adapter-utils/src/test/java
parentf1e617b79170b92a9c11a16f227f9ac68c024e2e (diff)
Junit for mso.openstock.utils
Adding Junit for: 1.MsoHeatEnvironmentParameter.java 2.MsoHeatEnvironmentResource.java 3.MsoKeystoneUtils.java 4.MsoNeutronUtils.java 5.MsoTenantUtilsFactory.java 6.MsoTenantUtils.java 7.MsoYamlEditorWithEnvt.java Sonar Link: https://sonar.onap.org/code?id=org.onap.so%3Aso&selected=org.onap.so.adapters%3Amso-adapter-utils%3Asrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fmso%2Fopenstack%2Futils Change-Id: Icafbc3d2239c00b0e4a74cd5750971a772791865 Issue-ID: SO-528 Signed-off-by: Sumapriya <SS00493505@techmahindra.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/test/java')
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java46
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java47
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java126
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java114
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java44
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java55
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java70
7 files changed, 502 insertions, 0 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java
new file mode 100644
index 0000000000..17a94840cf
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java
@@ -0,0 +1,46 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.openstack.utils;
+
+import static org.mockito.Mockito.mock;
+
+import org.junit.Test;
+
+public class MsoHeatEnvironmentParameterTest {
+
+ @Test
+ public void test() {
+ MsoHeatEnvironmentParameter hep=mock(MsoHeatEnvironmentParameter.class);
+ Object op=hep.getName();
+ MsoHeatEnvironmentParameter meo=new MsoHeatEnvironmentParameter();
+ MsoHeatEnvironmentParameter mea=new MsoHeatEnvironmentParameter("name");
+ MsoHeatEnvironmentParameter mep=new MsoHeatEnvironmentParameter("name"," value");
+ mea.setName("name");
+ mep.setValue("value");
+ assert(mea.getName().equals("name"));
+ assert(mep.getValue().equals("value"));
+ assert(meo.toString()!=null);
+ //assertTrue(op.equals(hep));
+ meo.equals(op);
+ meo.hashCode();
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java
new file mode 100644
index 0000000000..fb666ea5df
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java
@@ -0,0 +1,47 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.openstack.utils;
+
+import org.junit.Test;
+
+
+public class MsoHeatEnvironmentResourceTest {
+
+
+ @Test
+ public void test() {
+ Object op=true;
+ // MsoHeatEnvironmentResource mer=mock(MsoHeatEnvironmentResource.class);
+ // MsoHeatEnvironmentResource mrea=new MsoHeatEnvironmentResource();
+ MsoHeatEnvironmentResource mre=new MsoHeatEnvironmentResource("name");
+ MsoHeatEnvironmentResource mae=new MsoHeatEnvironmentResource("name", "value");
+ mre.setName("name");
+ mae.setValue("value");
+ assert(mre.getName().equals("name"));
+ assert(mae.getValue().equals("value"));
+ assert(mre.toString()!=null);
+ //assertFalse(mer.equals(op));
+ mae.equals(op);
+ mae.hashCode();
+ //when(mer.hashCode()).thenReturn(result);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java
new file mode 100644
index 0000000000..41126759ef
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java
@@ -0,0 +1,126 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.openstack.utils;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.openecomp.mso.cloud.CloudIdentity;
+import org.openecomp.mso.cloud.CloudSite;
+import org.openecomp.mso.openstack.beans.MsoTenant;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.woorea.openstack.keystone.Keystone;
+import com.woorea.openstack.keystone.model.Tenant;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({MsoKeystoneUtils.class,CloudSite.class,CloudIdentity.class,Tenant.class,Keystone.class,MsoTenant.class,MsoJavaProperties.class})
+public class MsoKeystoneUtilsTest {
+
+ @Mock
+ Tenant tenant;
+
+ @Mock
+ Keystone adminClient;
+
+ @Mock
+ MsoTenant mst;
+
+ @Mock
+ CloudSite cs;
+
+ @Mock
+ CloudIdentity cloudIdentity;
+
+ @Mock
+ MsoJavaProperties msoProps;
+
+ @Test
+ public void testcreateTenant() throws MsoException{
+ MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID"));
+ Map<String,String>metadata=new HashMap<>();
+ metadata.put("1", "value");
+ PowerMockito.when(tenant.getId ()).thenReturn("ID");
+ doReturn(tenant.getId ()).when(msk).createTenant("tenantName", "cloudSiteId", metadata, true);
+ PowerMockito.spy(tenant.getId ());
+ String Id = msk.createTenant("tenantName", "cloudSiteId", metadata, true);
+ Assert.assertEquals(tenant.getId (), Id);
+ assert(msk.createTenant("tenantName", "cloudSiteId", metadata, true)!=null);
+ }
+ @Test
+ public void testdeleteTenant() throws MsoException{
+ MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID"));
+ doReturn(true).when(msk).deleteTenant("tenantId", "cloudSiteId");
+ assertTrue(msk.deleteTenant("tenantId", "cloudSiteId"));
+ }
+ @Test
+ public void testfindTenantByName() throws Exception{
+ MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID"));
+ doReturn(null).when(msk).findTenantByName(adminClient, "tenantName");
+ assertNull(msk.findTenantByName(adminClient, "tenantName"));
+ }
+ @Test
+ public void testqueryTenant() throws MsoException{
+ MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID"));
+ Map<String,String>metadata=new HashMap<>();
+ metadata.put("1", "value");
+ PowerMockito.when(mst.getTenantId()).thenReturn("tenantId");
+ PowerMockito.when(mst.getMetadata()).thenReturn(metadata);
+ PowerMockito.when(mst.getTenantName()).thenReturn("name");
+ doReturn(mst).when(msk).queryTenant ("tenantId", "cloudSiteId");
+ assertNotNull(msk.queryTenant("tenantId", "cloudSiteId"));
+ }
+
+ @Test
+ public void testqueryTenantByName()throws MsoException {
+ MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID"));
+ Map<String,String>metadata=new HashMap<>();
+ metadata.put("1", "value");
+ PowerMockito.when(mst.getTenantId()).thenReturn("tenantId");
+ PowerMockito.when(mst.getMetadata()).thenReturn(metadata);
+ PowerMockito.when(mst.getTenantName()).thenReturn("name");
+ doReturn(mst).when(msk).queryTenantByName ("tenantId", "cloudSiteId");
+ assertNotNull(msk.queryTenantByName("tenantId", "cloudSiteId"));
+
+ }
+
+ @Test
+ public void testgetKeystoneAdminClient() throws MsoException{
+ Keystone keystone = new Keystone (cloudIdentity.getKeystoneUrl ("region", "msoPropID"));
+ MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID"));
+ doReturn(keystone).when(msk).getKeystoneAdminClient(cs);
+ assertNotNull(msk.getKeystoneAdminClient(cs));
+ }
+
+ }
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java
new file mode 100644
index 0000000000..5c52cb514f
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java
@@ -0,0 +1,114 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.openstack.utils;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.openecomp.mso.cloud.CloudConfig;
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.cloud.CloudSite;
+import org.openecomp.mso.openstack.beans.NetworkInfo;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.utils.MsoNeutronUtils.NetworkType;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.woorea.openstack.quantum.Quantum;
+import com.woorea.openstack.quantum.model.Network;
+import com.woorea.openstack.quantum.model.Segment;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({MsoNeutronUtils.class,MsoCommonUtils.class,NetworkInfo.class,CloudConfigFactory.class,CloudConfig.class,Segment.class,Network.class,Quantum.class})
+public class MsoNeutronUtilsTest{
+
+@Mock
+MsoCommonUtils utils;
+
+@Mock
+NetworkInfo net;
+
+@Mock
+CloudConfig cloudConfig;
+
+@Mock
+Segment segment;
+
+@Mock
+CloudConfigFactory cloudConfigFactory;
+
+@Mock
+Network network;
+
+@Mock
+NetworkInfo ninfo;
+
+@Mock
+Quantum neutronClient;
+
+@Mock
+CloudSite cloudSite;
+
+
+ @Test
+ public void testcreateNetwork() throws MsoException{
+ List<Integer> vlans=new ArrayList();
+ vlans.add(1);
+ MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory));
+ NetworkType type=NetworkType.PROVIDER;
+ doReturn(ninfo).when(mnu).createNetwork("cloudSiteId", "tenantId", type, "networkName", "provider", vlans);
+ assert(mnu.createNetwork("cloudSiteId", "tenantId", type, "networkName", "provider", vlans)!=null);
+
+ }
+ @Test
+ public void testqueryNetwork() throws MsoException{
+ MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory));
+ doReturn(ninfo).when(mnu).queryNetwork("networkNameOrId", "tenantId", "cloudSiteId");
+ assert(mnu.queryNetwork("networkNameOrId", "tenantId", "cloudSiteId")!=null);
+ }
+
+ @Test
+ public void testdeleteNetwork() throws MsoException{
+ MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory));
+ doReturn(true).when(mnu).deleteNetwork("networkId", "tenantId", "cloudSiteId");
+ assertTrue(mnu.deleteNetwork("networkId", "tenantId", "cloudSiteId"));
+
+ }
+ @Test
+ public void testupdateNetwork() throws MsoException{
+ List<Integer> vlans=new ArrayList();
+ vlans.add(1);
+ NetworkType type=NetworkType.PROVIDER;
+ MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory));
+ doReturn(ninfo).when(mnu).updateNetwork("cloudSiteId", "tenantId", "Nid", type, "provider", vlans);
+ assert(mnu.updateNetwork("cloudSiteId", "tenantId", "Nid", type, "provider", vlans)!=null);
+ }
+
+ }
+
+
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java
new file mode 100644
index 0000000000..a759e0d1a6
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java
@@ -0,0 +1,44 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.openstack.utils;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+
+public class MsoTenantUtilsFactoryTest {
+
+ MsoTenantUtils tenantU = null;
+
+ @Test
+ public void test() throws MsoCloudSiteNotFound {
+ tenantU = mock( MsoKeystoneUtils.class);
+ new MsoTenantUtilsFactory("ID");
+ MsoTenantUtilsFactory mti=mock(MsoTenantUtilsFactory.class);
+ mti.getTenantUtils("cloudSiteId");
+ when(mti.getTenantUtils("cloudSiteId")).thenReturn(tenantU);
+ mti.getTenantUtilsByServerType("type");
+ when(mti.getTenantUtilsByServerType("type")).thenReturn(tenantU);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java
new file mode 100644
index 0000000000..ffb1e3b787
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java
@@ -0,0 +1,55 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.openstack.utils;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.openecomp.mso.cloud.CloudIdentity;
+
+@RunWith(MockitoJUnitRunner.class)
+public class MsoTenantUtilsTest {
+
+ @Test
+ public void test()throws Exception {
+ MsoTenantUtils mtu =mock(MsoTenantUtils.class);
+ //MsoTenantUtils mki = null;
+ CloudIdentity cloudIdentity=mock(CloudIdentity.class);
+ Map <String, String> metadata=new HashMap<>();
+ mtu.createTenant("name", "id", metadata, true);
+ verify(mtu).createTenant("name", "id", metadata, true);
+ mtu.queryTenant("tenantId", "cloudSiteId");
+ verify(mtu).queryTenant("tenantId", "cloudSiteId");
+ mtu.deleteTenant("tenantId", "cloudSiteId");
+ verify(mtu).deleteTenant("tenantId", "cloudSiteId");
+ mtu.getKeystoneUrl("regionId", "msoPropID", cloudIdentity);
+ verify(mtu).getKeystoneUrl("regionId", "msoPropID", cloudIdentity);
+ mtu.queryTenantByName("tenantName", "cloudSiteId");
+ verify(mtu).queryTenantByName("tenantName", "cloudSiteId");
+
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java
new file mode 100644
index 0000000000..3dee177dee
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java
@@ -0,0 +1,70 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.openstack.utils;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+import org.powermock.api.mockito.PowerMockito;
+
+public class MsoYamlEditorWithEnvtTest {
+
+ @Mock
+ MsoHeatEnvironmentParameter mhep;
+
+ @Mock
+ HeatTemplateParam hep;
+
+ @Test
+ public void testgetParameterList() {
+ Set<HeatTemplateParam> paramSet = new HashSet<>();
+ paramSet.add(hep);
+ mhep=PowerMockito.spy(new MsoHeatEnvironmentParameter());
+ MsoYamlEditorWithEnvt Mso=mock(MsoYamlEditorWithEnvt.class);
+ when(Mso.getParameterList()).thenReturn(paramSet);
+ assert(Mso.getParameterList()!=null);
+ }
+
+ @Test
+ public void testgetResourceLisstFromEnvt() {
+ Set<MsoHeatEnvironmentParameter> paramSet = new HashSet<>();
+ paramSet.add(mhep);
+ new MsoHeatEnvironmentResource();;
+ mhep=PowerMockito.spy(new MsoHeatEnvironmentParameter());
+ MsoYamlEditorWithEnvt Mso=mock(MsoYamlEditorWithEnvt.class);
+ when(Mso.getParameterListFromEnvt()).thenReturn(paramSet);
+ }
+
+ @Test
+ public void getParameterListFromEnvt() {
+ mhep=PowerMockito.spy(new MsoHeatEnvironmentParameter());
+ Set<MsoHeatEnvironmentParameter> paramSet = new HashSet<>();
+ paramSet.add(mhep);
+ new MsoHeatEnvironmentResource();;
+ MsoYamlEditorWithEnvt Mso=mock(MsoYamlEditorWithEnvt.class);
+ when(Mso.getParameterListFromEnvt()).thenReturn(paramSet);
+ }
+
+}