aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils')
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryTest.java73
-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/MsoHeatUtilsTest.java216
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest2.java172
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java143
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java124
-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
10 files changed, 0 insertions, 990 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryTest.java
deleted file mode 100644
index 668bc68a3d..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.assertj.core.api.Assertions.assertThat;
-
-import org.junit.Test;
-
-public class MsoHeatEnvironmentEntryTest {
-
- private static final String PARAMETER_NAME = "keyTest";
- private static final String VALUE_NAME = "valueTest";
- private static final String NOT_EXISTING_PARAM = "notExistingParam";
- private static final String RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY = "parameters: {"
- + PARAMETER_NAME + ": " + VALUE_NAME + "}";
- private static final String RAW_ENTRY_WITH_RESOURCE_REGISTRY = "resource_registry: resourceTest";
- private static final String RAW_ENTRY_INVALID = "invalidRawEntry";
-
- @Test
- public void createObjectWithNullStringBuilder() {
- MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(null);
- assertThat(testedObject.isValid()).isTrue();
- assertThat(testedObject.getRawEntry()).isNull();
- assertThat(testedObject.containsParameter(PARAMETER_NAME)).isFalse();
- }
-
- @Test
- public void toFullString_ResourceRegistryNotPresentInRawEntry() {
- StringBuilder sb = new StringBuilder(RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY);
- MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb);
- assertThat(testedObject.getRawEntry()).isEqualTo(sb);
- assertThat(testedObject.isValid()).isTrue();
- assertThat(testedObject.containsParameter(PARAMETER_NAME)).isTrue();
- assertThat(testedObject.toString()).doesNotContain(RAW_ENTRY_WITH_RESOURCE_REGISTRY);
- }
-
- @Test
- public void toFullString_ExceptionOccurred() {
- StringBuilder sb = new StringBuilder(RAW_ENTRY_INVALID);
- MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb);
- assertThat(testedObject.getRawEntry()).isEqualTo(sb);
- assertThat(testedObject.isValid()).isFalse();
- assertThat(testedObject.getErrorString()).isNotNull().isNotEmpty();
- }
-
- @Test
- public void checkIfContainsTheParameter() {
- StringBuilder sb = new StringBuilder(RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY);
- MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb);
- assertThat(testedObject.getRawEntry()).isEqualTo(sb);
- assertThat(testedObject.isValid()).isTrue();
- assertThat(testedObject.containsParameter(PARAMETER_NAME)).isTrue();
- assertThat(testedObject.containsParameter(NOT_EXISTING_PARAM)).isFalse();
- }
-}
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
deleted file mode 100644
index 17a94840cf..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-* ============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
deleted file mode 100644
index fb666ea5df..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-* ============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/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java
deleted file mode 100644
index 9ba9b2f39d..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * 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 com.woorea.openstack.heat.Heat;
-import com.woorea.openstack.heat.model.Stack;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.openecomp.mso.cloud.CloudConfigFactory;
-import org.openecomp.mso.cloud.CloudSite;
-import org.openecomp.mso.openstack.beans.HeatStatus;
-import org.openecomp.mso.openstack.beans.StackInfo;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.doReturn;
-
-//@RunWith(PowerMockRunner.class)
-@PrepareForTest({MsoHeatUtils.class})
-
-
-public class MsoHeatUtilsTest {
-
- @Mock
- StackInfo stackInfo;
-
- @Mock
- MsoPropertiesFactory msoPropertiesFactory;
-
- @Mock
- CloudConfigFactory cloudConfigFactory;
-
- @Mock
- Heat heatClient;
-
- @Mock
- CloudSite cloudSite;
-
- @Test(expected = NullPointerException.class)
- public void testCreateStack() throws MsoException
- {
-
- MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
- Map<String,String>metadata=new HashMap<>();
- metadata.put("1", "value");
- mht.createStack("cloudSiteId",
- "tenantId",
- "stackName",
- "heatTemplate",
- metadata,
- true,
- 1);
- doReturn(mht.createStack("cloudSiteId",
- "tenantId",
- "stackName",
- "heatTemplate",
- metadata,
- true,
- 1,
- null, null,
- null,
- true));
-
- }
-
- @Test(expected = NullPointerException.class)
- public void testCreateStackOne() throws MsoException
- {
- MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
- Map<String,String>metadata=new HashMap<>();
- metadata.put("1", "value");
- mht.createStack("cloudSiteId",
- "tenantId",
- "stackName",
- "heatTemplate",
- metadata,
- true,
- 1,
- "env");
- doReturn(mht.createStack("cloudSiteId",
- "tenantId",
- "stackName",
- "heatTemplate",
- metadata,
- true,
- 1,
- "env", null,
- null,
- true));
- }
-
- @Test(expected = NullPointerException.class)
- public void testCreateStackTwo() throws MsoException
- {
- MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
- Map<String,String>metadata=new HashMap<>();
- metadata.put("1", "value");
- Map<String,Object>fileMap=new HashMap<>();
- fileMap.put("2", "value");
- mht.createStack("cloudSiteId",
- "tenantId",
- "stackName",
- "heatTemplate",
- metadata,
- true,
- 1,
- "env",
- fileMap);
- doReturn(mht.createStack("cloudSiteId",
- "tenantId",
- "stackName",
- "heatTemplate",
- metadata,
- true,
- 1,
- "env", fileMap,
- null,
- true));
- }
-
- @Test(expected = NullPointerException.class)
- public void testCreateStackThree() throws MsoException
- {
- MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
- Map<String,String>metadata=new HashMap<>();
- metadata.put("1", "value");
- Map<String,Object>fileMap=new HashMap<>();
- fileMap.put("2", "value");
- Map<String,Object>heatFileMap=new HashMap<>();
- heatFileMap.put("3", "value");
- mht.createStack("cloudSiteId",
- "tenantId",
- "stackName",
- "heatTemplate",
- metadata,
- true,
- 1,
- "env",
- fileMap,
- heatFileMap);
- doReturn(mht.createStack("cloudSiteId",
- "tenantId",
- "stackName",
- "heatTemplate",
- metadata,
- true,
- 1,
- "env", fileMap,
- heatFileMap,
- true));
- }
-
- @Test(expected = NullPointerException.class)
-
-
- public void testqueryStack() throws MsoException
- {
- MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
-
- mht.queryStack("cloudSiteId","tenantId","stackName");
-
- try {
- heatClient = mht.getHeatClient (cloudSite, "tenantId");
- assertNotNull(heatClient);
-
- } catch (MsoTenantNotFound e) {
- doReturn(new StackInfo ("stackName", HeatStatus.NOTFOUND));
- } catch (MsoException me) {
-
- me.addContext ("QueryStack");
- throw me;
- }
-
- Stack heatStack = mht.queryHeatStack (heatClient, "stackName");
-
- assertNull(heatStack);
- StackInfo stackInfo = new StackInfo ("stackName", HeatStatus.NOTFOUND);
- doReturn(stackInfo);
-
- assertNotNull(heatStack);
- doReturn(new StackInfo (heatStack));
-
-
-
- }
-
-}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest2.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest2.java
deleted file mode 100644
index 74d512c63e..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest2.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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 com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.openecomp.mso.adapters.vdu.CloudInfo;
-import org.openecomp.mso.adapters.vdu.PluginAction;
-import org.openecomp.mso.adapters.vdu.VduArtifact;
-import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType;
-import org.openecomp.mso.adapters.vdu.VduInstance;
-import org.openecomp.mso.adapters.vdu.VduModelInfo;
-import org.openecomp.mso.adapters.vdu.VduStateType;
-import org.openecomp.mso.adapters.vdu.VduStatus;
-import org.openecomp.mso.cloud.CloudConfig;
-import org.openecomp.mso.cloud.CloudConfigFactory;
-import org.openecomp.mso.cloud.CloudSite;
-import org.openecomp.mso.cloudify.beans.DeploymentInfo;
-import org.openecomp.mso.cloudify.beans.DeploymentStatus;
-import org.openecomp.mso.cloudify.utils.MsoCloudifyUtils;
-import org.openecomp.mso.openstack.beans.HeatStatus;
-import org.openecomp.mso.openstack.beans.StackInfo;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-
-public class MsoHeatUtilsTest2 {
-
- @Test
- public void instantiateVduTest() throws MsoException, JsonProcessingException {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("canonicalName");
- expected.setVduInstanceName("name");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.INSTANTIATED);
- status.setLastAction((new PluginAction("create", "complete", "")));
- expected.setStatus(status);
-
- MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class);
- CloudSite site = new CloudSite();
- Optional<CloudSite> opSite = Optional.ofNullable(site);
- CloudConfig config = Mockito.mock(CloudConfig.class);
- CloudConfigFactory cloudConfigFactory = Mockito.mock(CloudConfigFactory.class);
- when(cloudConfigFactory.getCloudConfig()).thenReturn(config);
- when(heatUtils.getCloudConfigFactory()).thenReturn(cloudConfigFactory);
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("cloudSiteId");
- cloudInfo.setTenantId("tenantId");
- VduModelInfo vduModel = new VduModelInfo();
- vduModel.setModelCustomizationUUID("blueprintId");
- vduModel.setTimeoutMinutes(1);
- VduArtifact artifact = new VduArtifact();
- artifact.setName("name");
- artifact.setType(ArtifactType.MAIN_TEMPLATE);
- byte[] content = new byte[1];
- artifact.setContent(content);
- List<VduArtifact> artifacts = new ArrayList<>();
- artifacts.add(artifact);
- vduModel.setArtifacts(artifacts);
- Map<String, byte[]> blueprintFiles = new HashMap<>();
- blueprintFiles.put(artifact.getName(), artifact.getContent());
- String instanceName = "instanceName";
- Map<String, Object> inputs = new HashMap<>();
- boolean rollbackOnFailure = true;
- String heatTemplate = new String(artifact.getContent());
- when(config.getCloudSite(cloudInfo.getCloudSiteId())).thenReturn(opSite);
- Map<String, Object> nestedTemplates = new HashMap<String, Object>();
- Map<String, Object> files = new HashMap<String, Object>();
-
- StackInfo stackInfo = new StackInfo();
- stackInfo.setCanonicalName("canonicalName");
- stackInfo.setName("name");
- stackInfo.setStatus(HeatStatus.CREATED);
-
- doReturn(stackInfo).when(heatUtils).createStack(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(),
- instanceName, heatTemplate, inputs, true, vduModel.getTimeoutMinutes(), null, nestedTemplates, files,
- rollbackOnFailure);
-
- VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void queryVduTest() throws MsoException, JsonProcessingException {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("canonicalName");
- expected.setVduInstanceName("name");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.INSTANTIATED);
- status.setLastAction((new PluginAction("create", "complete", "")));
- expected.setStatus(status);
-
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("cloudSiteId");
- cloudInfo.setTenantId("tenantId");
- String instanceId = "instanceId";
-
- StackInfo stackInfo = new StackInfo();
- stackInfo.setCanonicalName("canonicalName");
- stackInfo.setName("name");
- stackInfo.setStatus(HeatStatus.CREATED);
-
- MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class);
-
- doReturn(stackInfo).when(heatUtils).queryStack(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(), instanceId);
-
- VduInstance actual = heatUtils.queryVdu(cloudInfo, instanceId);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void deleteVduTest() throws MsoException {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("canonicalName");
- expected.setVduInstanceName("name");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.DELETED);
- expected.setStatus(status);
-
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("cloudSiteId");
- cloudInfo.setTenantId("tenantId");
- String instanceId = "instanceId";
-
- StackInfo stackInfo = new StackInfo();
- stackInfo.setCanonicalName("canonicalName");
- stackInfo.setName("name");
- stackInfo.setStatus(HeatStatus.NOTFOUND);
-
- int timeoutInMinutes = 1;
-
- MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class);
-
- doReturn(stackInfo).when(heatUtils).deleteStack( cloudInfo.getTenantId(), cloudInfo.getCloudSiteId(), instanceId, true);
-
- VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
-}
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
deleted file mode 100644
index f2d14d8b22..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-* ============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.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.openecomp.mso.cloud.CloudConfig;
-import org.openecomp.mso.cloud.CloudConfigFactory;
-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;
-
- @Mock
- private static CloudConfigFactory cloudConfigFactory;
-
- @BeforeClass
- public static final void prepare () {
- cloudConfigFactory = Mockito.mock(CloudConfigFactory.class);
- CloudConfig cloudConfig = Mockito.mock(CloudConfig.class);
- Mockito.when(cloudConfigFactory.getCloudConfig()).thenReturn(cloudConfig);
- }
-
- @Test
- public void testcreateTenant() throws MsoException{
- MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID", cloudConfigFactory));
- Map<String,String>metadata=new HashMap<>();
- metadata.put("1", "value");
- tenant = mock(Tenant.class);
- 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", cloudConfigFactory));
- 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", cloudConfigFactory));
- 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", cloudConfigFactory));
- Map<String,String>metadata=new HashMap<>();
- metadata.put("1", "value");
- mst = mock(MsoTenant.class);
- 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", cloudConfigFactory));
- Map<String,String>metadata=new HashMap<>();
- metadata.put("1", "value");
- mst = mock(MsoTenant.class);
- 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{
- cloudIdentity = mock(CloudIdentity.class);
- Keystone keystone = new Keystone (cloudIdentity.getKeystoneUrl ("region", "msoPropID"));
- MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID", cloudConfigFactory));
- doReturn(keystone).when(msk).getKeystoneAdminClient(cs);
- assertNotNull(msk.getKeystoneAdminClient(cs));
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 839da370df..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-* ============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 static org.mockito.Mockito.mock;
-
-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);
- cloudConfigFactory = mock(CloudConfigFactory.class);
- ninfo = mock(NetworkInfo.class);
- 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{
- cloudConfigFactory = mock(CloudConfigFactory.class);
- ninfo = mock(NetworkInfo.class);
- MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory));
- doReturn(ninfo).when(mnu).queryNetwork("networkNameOrId", "tenantId", "cloudSiteId");
- NetworkInfo ni = mnu.queryNetwork("networkNameOrId", "tenantId", "cloudSiteId");
- assert(ni!=null);
- }
-
- @Test
- public void testdeleteNetwork() throws MsoException{
- cloudConfigFactory = mock(CloudConfigFactory.class);
- 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;
- cloudConfigFactory = mock(CloudConfigFactory.class);
- ninfo = mock(NetworkInfo.class);
- 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
deleted file mode 100644
index a759e0d1a6..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* ============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
deleted file mode 100644
index ffb1e3b787..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* ============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
deleted file mode 100644
index 3dee177dee..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-* ============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);
- }
-
-}