2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Copyright (C) 2017 Amdocs
\r
8 * =============================================================================
\r
9 * Licensed under the Apache License, Version 2.0 (the "License");
\r
10 * you may not use this file except in compliance with the License.
\r
11 * You may obtain a copy of the License at
\r
13 * http://www.apache.org/licenses/LICENSE-2.0
\r
15 * Unless required by applicable law or agreed to in writing, software
\r
16 * distributed under the License is distributed on an "AS IS" BASIS,
\r
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
18 * See the License for the specific language governing permissions and
\r
19 * limitations under the License.
\r
21 * ============LICENSE_END=========================================================
\r
24 package org.onap.appc.adapter.iaas.impl;
\r
26 import java.util.Properties;
\r
27 import org.junit.Assert;
\r
28 import org.junit.Test;
\r
31 * This class tests the service catalog factory against a known provider.
\r
33 public class TestServiceCatalogFactory {
\r
36 public void testGetServiceCatalogV2() {
\r
37 String tenantIdentifier = null;
\r
38 String principal = null;
\r
39 String credential = null;
\r
40 String domain = null;
\r
41 Properties properties = null;
\r
43 String url = "http://192.168.1.1:5000/v2.0/";
\r
44 ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,
\r
45 domain, properties);
\r
46 Assert.assertNotNull(catalog);
\r
47 Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);
\r
49 url = "http://192.168.1.1:5000/v2/";
\r
50 catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential, domain,
\r
52 Assert.assertNotNull(catalog);
\r
53 Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);
\r
55 url = "http://192.168.1.1:5000/v2.1/";
\r
56 catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential, domain,
\r
58 Assert.assertNotNull(catalog);
\r
59 Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);
\r
64 public void testGetServiceCatalogV3() {
\r
65 String url = "http://192.168.1.1:5000/v3.0/";
\r
66 String tenantIdentifier = null;
\r
67 String principal = null;
\r
68 String credential = null;
\r
69 String domain = null;
\r
70 Properties properties = null;
\r
71 ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,
\r
72 domain, properties);
\r
74 Assert.assertNotNull(catalog);
\r
75 Assert.assertEquals(catalog.getClass(), ServiceCatalogV3.class);
\r
79 public void testGetServiceCatalogOther() {
\r
80 String url = "http://192.168.1.1:5000/v4.0/";
\r
81 String tenantIdentifier = null;
\r
82 String principal = null;
\r
83 String credential = null;
\r
84 String domain = null;
\r
85 Properties properties = null;
\r
86 ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,
\r
87 domain, properties);
\r
89 Assert.assertNull(catalog);
\r
93 public void testGetServiceCatalogEmptyURL() {
\r
95 String tenantIdentifier = null;
\r
96 String principal = null;
\r
97 String credential = null;
\r
98 String domain = null;
\r
99 Properties properties = null;
\r
100 ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,
\r
101 domain, properties);
\r
103 Assert.assertNull(catalog);
\r
107 public void testGetServiceCatalogWithoutVersion() {
\r
108 String url = "http://192.168.1.1:5000/";
\r
109 String tenantIdentifier = null;
\r
110 String principal = null;
\r
111 String credential = null;
\r
112 String domain = null;
\r
113 Properties properties = null;
\r
114 ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,
\r
115 domain, properties);
\r
117 Assert.assertNull(catalog);
\r