aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-vnf-adapter/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-vnf-adapter/src/test')
-rw-r--r--adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java25
-rw-r--r--adapters/mso-vnf-adapter/src/test/resources/cloud_config.json94
-rw-r--r--adapters/mso-vnf-adapter/src/test/resources/mso.properties27
3 files changed, 145 insertions, 1 deletions
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java
index d898a6547e..282b3b15cd 100644
--- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java
+++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java
@@ -28,6 +28,7 @@ import java.util.Map;
import javax.xml.ws.Holder;
import mockit.Mock;
import mockit.MockUp;
+import org.junit.Ignore;
import org.junit.Test;
import org.openecomp.mso.adapters.vnf.MsoVnfAdapter;
import org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl;
@@ -38,6 +39,10 @@ import org.openecomp.mso.openstack.beans.VnfStatus;
import org.openecomp.mso.openstack.exceptions.MsoException;
import org.openecomp.mso.openstack.utils.MsoHeatUtils;
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+
public class QueryTest {
@Test
@@ -95,9 +100,27 @@ public class QueryTest {
}
@Test(expected = VnfException.class)
+ // @Ignore // 1802 merge
public void testQueryVnfWithException() throws VnfException {
{
- MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl();
+ String propFile = MsoJavaProperties.class.getClassLoader().getResource("mso.properties").getPath();
+ String cloudConfigJsonFilePath = MsoJavaProperties.class.getClassLoader().getResource("cloud_config.json").getPath();
+
+ MsoPropertiesFactory msoPropFactory = new MsoPropertiesFactory();
+ CloudConfigFactory cloudConfigFact = new CloudConfigFactory();
+ try {
+ msoPropFactory.initializeMsoProperties("MSO_PROP_VNF_ADAPTER", propFile);
+ cloudConfigFact.initializeCloudConfig(cloudConfigJsonFilePath, 1);
+ } catch (org.openecomp.mso.properties.MsoPropertiesException e) {
+ // System.err.println("!?!?!?!! mso config exception: " + e);
+ // e.printStackTrace();
+ } catch (org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound e) {
+ // System.err.println("!?!?!?!! cloud config exception: " + e);
+ // e.printStackTrace();
+ }
+
+ MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl(msoPropFactory, cloudConfigFact);
+
String cloudId = "MT";
String tenantId = "MSO_Test";
String vnfName = "VNF_TEST1";
diff --git a/adapters/mso-vnf-adapter/src/test/resources/cloud_config.json b/adapters/mso-vnf-adapter/src/test/resources/cloud_config.json
new file mode 100644
index 0000000000..ff24633f32
--- /dev/null
+++ b/adapters/mso-vnf-adapter/src/test/resources/cloud_config.json
@@ -0,0 +1,94 @@
+{ "cloud_config": {
+ "identity_services":
+ {
+ "MT_KEYSTONE":
+ {
+ "identity_url": "http://localhost:5000/v2.0",
+ "mso_id": "john",
+ "mso_pass": "FD205490A48D48475607C36B9AD902BF",
+ "admin_tenant": "admin",
+ "member_role": "_member_",
+ "tenant_metadata": false,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "RACKSPACE_APIKEY"
+ },
+ "DAN_KEYSTONE":
+ {
+ "identity_url": "http://localhost:5000/v2.0",
+ "mso_id": "mockId",
+ "mso_pass": "BC59F80E38208A42ABB81ECCDD4FB3E4",
+ "admin_tenant": "service",
+ "member_role": "_member_",
+ "tenant_metadata": false,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MTINJVCC101_DCP":
+ {
+ "identity_url": "http://localhost:5000/v2.0",
+ "mso_id": "mockIdToo",
+ "mso_pass": "95604B9EAAC4D77D74786FAE54177206",
+ "admin_tenant": "service",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MTSNJA3DCP1":
+ {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "mockIdToo",
+ "mso_pass": "1491DE07AC9D716A7966BB8C2848F031",
+ "admin_tenant": "service",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "CS_service": {}
+
+ },
+ "cloud_sites":
+ {
+ "MT":
+ {
+ "region_id": "regionOne",
+ "clli": "MT",
+ "aic_version": "2.5",
+ "identity_service_id": "MT_KEYSTONE"
+ },
+ "DAN":
+ {
+ "region_id": "RegionOne",
+ "clli": "DAN",
+ "aic_version": "2.5",
+ "identity_service_id": "DAN_KEYSTONE"
+ },
+ "MTINJVCC101":
+ {
+ "region_id": "regionTwo",
+ "clli": "MTINJVCC101",
+ "aic_version": "2.5",
+ "identity_service_id": "MTINJVCC101_DCP"
+ },
+ "MTSNJA4LCP1":
+ {
+ "region_id": "mtsnjlcp1",
+ "clli": "MTSNJA4LCP1",
+ "aic_version": "2.5",
+ "identity_service_id": "MTSNJA3DCP1"
+ },
+ "CS":
+ {
+ "region_id": "clliRegion",
+ "clli": "CS_clli",
+ "aic_version": "2.5",
+ "identity_service_id": "CS_service"
+ }
+ }
+}
+}
+
+
+
+
diff --git a/adapters/mso-vnf-adapter/src/test/resources/mso.properties b/adapters/mso-vnf-adapter/src/test/resources/mso.properties
new file mode 100644
index 0000000000..d58521f1db
--- /dev/null
+++ b/adapters/mso-vnf-adapter/src/test/resources/mso.properties
@@ -0,0 +1,27 @@
+###
+# ============LICENSE_START=======================================================
+# ECOMP MSO
+# ================================================================================
+# 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=========================================================
+###
+
+ecomp.mso.cloud.1.cloudId=MT
+ecomp.mso.cloud.1.keystoneUrl=http://localhost:5000/v2.0
+ecomp.mso.cloud.1.msoId=John
+ecomp.mso.cloud.1.publicNetId=FD205490A48D48475607C36B9AD902BF
+ecomp.mso.cloud.1.test=1234
+ecomp.mso.cloud.1.boolean=true
+ecomp.mso.cloud.1.enum=enum1