5042b5b4312a3efea77349a53f5a6ace2d0eef41
[appc.git] / appc-adapters / appc-iaas-adapter / appc-iaas-adapter-bundle / src / test / java / org / onap / appc / adapter / iaas / impl / TestServiceCatalogFactory.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP : APPC\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
12  * \r
13  *      http://www.apache.org/licenses/LICENSE-2.0\r
14  * \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
20  * \r
21  * ============LICENSE_END=========================================================\r
22  */\r
23 \r
24 package org.onap.appc.adapter.iaas.impl;\r
25 \r
26 import java.util.Properties;\r
27 import org.junit.Assert;\r
28 import org.junit.Test;\r
29 \r
30 public class TestServiceCatalogFactory {\r
31 \r
32     @Test\r
33     public void testGetServiceCatalogV2() {\r
34         String tenantIdentifier = null;\r
35         String principal = null;\r
36         String credential = null;\r
37         String domain = null;\r
38         Properties properties = null;\r
39 \r
40         String url = "http://192.168.1.1:5000/v2.0/";\r
41         ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,\r
42                 domain, properties);\r
43         Assert.assertNotNull(catalog);\r
44         Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);\r
45 \r
46         url = "http://192.168.1.1:5000/v2/";\r
47         catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential, domain,\r
48                 properties);\r
49         Assert.assertNotNull(catalog);\r
50         Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);\r
51 \r
52         url = "http://192.168.1.1:5000/v2.1/";\r
53         catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential, domain,\r
54                 properties);\r
55         Assert.assertNotNull(catalog);\r
56         Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);\r
57 \r
58     }\r
59 \r
60     @Test\r
61     public void testGetServiceCatalogV3() {\r
62         String url = "http://192.168.1.1:5000/v3.0/";\r
63         String tenantIdentifier = null;\r
64         String principal = null;\r
65         String credential = null;\r
66         String domain = null;\r
67         Properties properties = null;\r
68         ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,\r
69                 domain, properties);\r
70 \r
71         Assert.assertNotNull(catalog);\r
72         Assert.assertEquals(catalog.getClass(), ServiceCatalogV3.class);\r
73     }\r
74 \r
75     @Test\r
76     public void testGetServiceCatalogOther() {\r
77         String url = "http://192.168.1.1:5000/v4.0/";\r
78         String tenantIdentifier = null;\r
79         String principal = null;\r
80         String credential = null;\r
81         String domain = null;\r
82         Properties properties = null;\r
83         ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,\r
84                 domain, properties);\r
85 \r
86         Assert.assertNull(catalog);\r
87     }\r
88 }\r