2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.adapter_utils.tests;
23 import java.util.HashMap;
25 import org.junit.BeforeClass;
26 import org.junit.Test;
28 import org.openecomp.mso.cloud.CloudConfigFactory;
29 import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
30 import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
31 import org.openecomp.mso.openstack.exceptions.MsoException;
32 import org.openecomp.mso.openstack.exceptions.MsoIOException;
33 import org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists;
34 import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound;
35 import org.openecomp.mso.openstack.utils.MsoCommonUtils;
36 import org.openecomp.mso.openstack.utils.MsoHeatUtils;
37 import org.openecomp.mso.properties.MsoPropertiesFactory;
42 * This class implements test methods of the MsoHeatUtils
46 public class MsoHeatUtilsTest extends MsoCommonUtils {
47 public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
48 public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
49 public static MsoHeatUtils msoHeatUtils;
52 public static final void loadClasses() {
53 ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
54 String config = classLoader.getResource("cloud_config.json").toString().substring(5);
55 cloudConfigFactory.initializeCloudConfig(config, 1);
56 msoHeatUtils = new MsoHeatUtils("NO_PROP",msoPropertiesFactory,cloudConfigFactory);
60 public final void testCreateStackBadCloudConfig () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
62 msoHeatUtils.createStack ("DOESNOTEXIST", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10);
63 } catch (MsoCloudSiteNotFound e) {
70 public final void testCreateStackFailedConnectionHeatClient () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
72 msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10);
73 } catch (MsoIOException e) {
80 public final void testCreateStackFailedConnection () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
82 msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap<String,Object> (), Boolean.TRUE, 10);
83 } catch (MsoIOException e) {