summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils
diff options
context:
space:
mode:
authorDeWayne Filppi <dewayne@cloudify.co>2017-10-03 17:45:02 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-03 17:45:02 +0000
commite3d141c14a320f1f98f6da034166ac6750d9ed44 (patch)
tree9c4684fcc60dc04cfc9927da40410e04f99e608c /adapters/mso-adapter-utils
parent3b954763ef6db6b00f4baf33b60fd8cde91dd0e3 (diff)
parent5008026f40fdfc6e23b628bac53740c3005ca044 (diff)
Merge "Adding UT for MsoHeatUtils"
Diffstat (limited to 'adapters/mso-adapter-utils')
-rw-r--r--adapters/mso-adapter-utils/pom.xml12
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java85
2 files changed, 86 insertions, 11 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml
index 62e7153473..90d1bbd680 100644
--- a/adapters/mso-adapter-utils/pom.xml
+++ b/adapters/mso-adapter-utils/pom.xml
@@ -105,6 +105,18 @@
<version>1.10.19</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
index 22a2c636e7..cd96756644 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
@@ -24,9 +24,7 @@ import java.util.HashMap;
import org.junit.BeforeClass;
import org.junit.Test;
-
import org.openecomp.mso.cloud.CloudConfigFactory;
-import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound;
import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
import org.openecomp.mso.openstack.exceptions.MsoException;
@@ -37,7 +35,7 @@ import org.openecomp.mso.openstack.utils.MsoCommonUtils;
import org.openecomp.mso.openstack.utils.MsoHeatUtils;
import org.openecomp.mso.properties.MsoPropertiesFactory;
-
+import com.woorea.openstack.heat.model.CreateStackParam;
/**
* This class implements test methods of the MsoHeatUtils
@@ -54,25 +52,41 @@ public class MsoHeatUtilsTest extends MsoCommonUtils {
ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
String config = classLoader.getResource("cloud_config.json").toString().substring(5);
cloudConfigFactory.initializeCloudConfig(config, 1);
- msoHeatUtils = new MsoHeatUtils("NO_PROP",msoPropertiesFactory,cloudConfigFactory);
+ msoHeatUtils = new MsoHeatUtils("NO_PROP", msoPropertiesFactory, cloudConfigFactory);
}
@Test
- public final void testCreateStackBadCloudConfig () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+ public final void testCreateStackBadCloudConfig()
+ throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
try {
- msoHeatUtils.createStack ("DOESNOTEXIST", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10);
+ msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap<String, Object>(),
+ Boolean.TRUE, 10);
} catch (MsoCloudSiteNotFound e) {
} catch (java.lang.NullPointerException npe) {
-
+
+ }
+
+ }
+
+ @Test
+ public final void testCreateStackFailedConnectionHeatClient()
+ throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+ try {
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE,
+ 10);
+ } catch (MsoIOException e) {
+
}
}
@Test
- public final void testCreateStackFailedConnectionHeatClient () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+ public final void testCreateStackFailedConnection()
+ throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
try {
- msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10);
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE,
+ 10);
} catch (MsoIOException e) {
}
@@ -80,15 +94,64 @@ public class MsoHeatUtilsTest extends MsoCommonUtils {
}
@Test
- public final void testCreateStackFailedConnection () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+ public final void createStackSuccessWithEnvironment() throws MsoException {
try {
- msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10);
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10,
+ "environment");
} catch (MsoIOException e) {
}
}
+ @Test
+ public final void createStackSuccessWithFiles() throws MsoException {
+ try {
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10,
+ "environment", new HashMap<String, Object>());
+ } catch (MsoIOException e) {
+ }
+
+ }
+ @Test
+ public final void createStackSuccessWithHeatFiles() throws MsoException {
+ try {
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10,
+ "environment", new HashMap<String, Object>(), new HashMap<String, Object>());
+ } catch (MsoIOException e) {
+
+ }
+ }
+
+ @Test
+ public final void requestToStringBuilderTest() {
+ CreateStackParam param = new CreateStackParam();
+ param.setDisableRollback(false);
+ param.setEnvironment("environment");
+ param.setFiles(new HashMap<String, Object>());
+ param.setParameters(new HashMap<>());
+ param.setStackName("stackName");
+ param.setTemplate("template");
+ param.setTemplateUrl("http://templateUrl");
+ param.setTimeoutMinutes(1);
+
+ msoHeatUtils.requestToStringBuilder(param);
+ }
+
+ @Test
+ public final void heatCacheResetTest() {
+ msoHeatUtils.heatCacheReset();
+ }
+
+ @Test
+ public final void expireHeatClientTest() {
+ msoHeatUtils.expireHeatClient("tenantId", "cloudId");
+ }
+
+ @Test
+ public final void heatCacheCleanupTest() {
+ msoHeatUtils.heatCacheCleanup();
+ }
}