summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/test/java/org
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-04-01 15:25:38 +0200
committerr.bogacki <r.bogacki@samsung.com>2019-04-01 15:26:10 +0200
commit798a0273c8f100a5c4728583d3d1c96712ec0e9d (patch)
tree7d244dc043af3e290edaaaafa1e8541c1ff6921f /adapters/mso-adapter-utils/src/test/java/org
parent1f8531ddb54b133ed0b25628d43ec698caa9b087 (diff)
JUnit tests for MsoMulticloudUtils
Increased junit tests coverage according to Sonar analyses. Added missing tests to deleteStack, queryStack, updateVdu and deleteVdu. Change-Id: I529725cfbe9be7cbdae9a197d39cd6a426ddb688 Issue-ID: SO-1692 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/test/java/org')
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
index b2a69ded46..cf20dd3e1c 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2019 Samsung Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -26,6 +28,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;
@@ -37,10 +40,15 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.BaseTest;
+import org.onap.so.adapters.vdu.CloudInfo;
+import org.onap.so.adapters.vdu.VduException;
+import org.onap.so.adapters.vdu.VduInstance;
import org.onap.so.adapters.vdu.VduModelInfo;
+import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.cloud.CloudConfig;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.exceptions.MsoException;
import org.springframework.beans.factory.annotation.Autowired;
@@ -73,6 +81,33 @@ public class MsoMulticloudUtilsTest extends BaseTest {
}
@Test
+ public void deleteStack() throws MsoException {
+ StackInfo result = multicloudUtils.deleteStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId");
+ assertNotNull(result);
+ assertTrue(HeatStatus.NOTFOUND == result.getStatus());
+ }
+
+ @Test
+ public void queryStack() throws MsoException {
+ StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId");
+ assertTrue(HeatStatus.NOTFOUND == result.getStatus());
+ }
+
+ @Test(expected = VduException.class)
+ public void updateVdu() throws MsoException {
+ multicloudUtils.updateVdu(new CloudInfo(), "instanceId", new HashMap<>(), new VduModelInfo(),
+ false);
+ }
+
+ @Test
+ public void deleteVdu() throws VduException {
+ CloudInfo cloudInfo = new CloudInfo("cloudSiteId", "cloudOwner", "tenantId", "tenantName");
+ VduInstance vduInstance = multicloudUtils.deleteVdu(cloudInfo, "instanceId", 3);
+ assertNotNull(vduInstance);
+ assertTrue(VduStateType.DELETED == vduInstance.getStatus().getState());
+ }
+
+ @Test
public void createStackMulticloudClientIsNull() {
try {
multicloudUtilsMock.cloudConfig = cloudConfigMock;