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.api.VnfpackageApi;
23 import org.onap.vnfmdriver.api.NslcmApi;
25 import static junit.framework.TestCase.assertEquals;
26 import static junit.framework.TestCase.assertNull;
27 import static org.mockito.Mockito.when;
29 public class TestVfcRestApiProvider extends TestBase {
30 private VfcRestApiProvider vfcRestApiProvider;
34 vfcRestApiProvider = new VfcRestApiProvider(msbApiProvider);
38 * test VF-C NSLCM API retrieval
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 NslcmApi nsLcmApi = vfcRestApiProvider.getNsLcmApi();
46 assertEquals("http://1.2.3.4:1234/lead", nsLcmApi.getApiClient().getBasePath());
47 assertNull(nsLcmApi.getApiClient().getSslCaCert());
48 assertEquals(0, nsLcmApi.getApiClient().getAuthentications().size());
52 * test VF-C catalog API retrieval
55 public void testNsCatalogApi() throws Exception {
56 when(msbApiProvider.getMicroServiceUrl(VfcRestApiProvider.NSCATALOG_SERVICE_NAME, VfcRestApiProvider.NSCATALOG_API_VERSION)).thenReturn("http://1.2.3.4:1234/lead");
58 VnfpackageApi nsCatalogApi = vfcRestApiProvider.getOnapCatalogApi();
60 assertEquals("http://1.2.3.4:1234/lead", nsCatalogApi.getApiClient().getBasePath());
61 assertNull(nsCatalogApi.getApiClient().getSslCaCert());
62 assertEquals(0, nsCatalogApi.getApiClient().getAuthentications().size());