2 * Copyright 2016-2017, Nokia Corporation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc;
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.TestBase;
22 import org.onap.vfccatalog.ApiClient;
23 import org.onap.vfccatalog.api.VnfpackageApi;
25 import static junit.framework.TestCase.assertEquals;
26 import static junit.framework.TestCase.assertNotNull;
27 import static org.mockito.Mockito.when;
29 public class TestVfcRestApiProvider extends TestBase {
30 private VfcRestApiProvider vfcRestApiProvider;
34 vfcRestApiProvider = new VfcRestApiProvider(msbApiProvider);
38 * the base URL of the LCM API is set
41 public void testNsLcmApi() throws Exception {
42 when(msbApiProvider.getMicroServiceUrl(VfcRestApiProvider.NSLCM_API_SERVICE_NAME, VfcRestApiProvider.NSLCM_API_VERION)).thenReturn("http://1.2.3.4:1234/nslcm/v1/lead/");
44 org.onap.vnfmdriver.ApiClient apiClient = vfcRestApiProvider.buildNslcmApiClient();
46 assertEquals("http://1.2.3.4:1234/lead/", apiClient.getAdapterBuilder().build().baseUrl().toString());
50 * the base URL of the Catalog API is set
53 public void testNsCatalogApi() throws Exception {
54 when(msbApiProvider.getMicroServiceUrl(VfcRestApiProvider.NSCATALOG_SERVICE_NAME, VfcRestApiProvider.NSCATALOG_API_VERSION)).thenReturn("http://1.2.3.4:1234/lead/");
56 ApiClient apiClient = vfcRestApiProvider.buildCatalogApiClient();
58 assertEquals("http://1.2.3.4:1234/lead/", apiClient.getAdapterBuilder().build().baseUrl().toString());
62 public void testNsLcm() {
63 when(msbApiProvider.getMicroServiceUrl(VfcRestApiProvider.NSLCM_API_SERVICE_NAME, VfcRestApiProvider.NSLCM_API_VERION)).thenReturn("http://1.2.3.4:1234/nslcm/v1/lead/");
66 assertNotNull(vfcRestApiProvider.getNsLcmApi());
70 public void testNsCatalog() {
71 when(msbApiProvider.getMicroServiceUrl(VfcRestApiProvider.NSCATALOG_SERVICE_NAME, VfcRestApiProvider.NSCATALOG_API_VERSION)).thenReturn("http://1.2.3.4:1234/lead/");
73 VnfpackageApi catalogApi = vfcRestApiProvider.getVfcCatalogApi();
75 assertNotNull(catalogApi);