447e0ecc68bed566b4c2f33bbbb141ea765a28fb
[dcaegen2/services/prh.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * PNF-REGISTRATION-HANDLER
4  * ================================================================================
5  * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.dcaegen2.services.service.config;
22
23 import org.junit.jupiter.api.Assertions;
24 import org.junit.jupiter.api.BeforeAll;
25 import org.junit.jupiter.api.Test;
26 import org.onap.dcaegen2.services.config.AAIClientConfiguration;
27 import org.onap.dcaegen2.services.config.ImmutableAAIClientConfiguration;
28
29 public class AAIHttpClientConfigurationTest {
30
31     private static AAIClientConfiguration client;
32     private static final String AAI_HOST = "/aai/v11/network/pnfs/pnf/NOKQTFCOC540002E";
33     private static final Integer PORT = 1234;
34     private static final String PROTOCOL = "https";
35     private static final String USER_NAME_PASSWORD = "PRH";
36     private static final String BASE_PATH = "/aai/v11";
37     private static final String PNF_PATH = "/network/pnfs/pnf";
38
39     @BeforeAll
40     public static void init() {
41         client = new ImmutableAAIClientConfiguration.Builder()
42             .aaiHost(AAI_HOST)
43             .aaiHostPortNumber(PORT)
44             .aaiProtocol(PROTOCOL)
45             .aaiUserName(USER_NAME_PASSWORD)
46             .aaiUserPassword(USER_NAME_PASSWORD)
47             .aaiIgnoreSSLCertificateErrors(true)
48             .aaiBasePath(BASE_PATH)
49             .aaiPnfPath(PNF_PATH)
50             .build();
51     }
52
53     @Test
54     public void testGetters_success() {
55         Assertions.assertEquals(AAI_HOST, client.aaiHost());
56         Assertions.assertEquals(PORT, client.aaiHostPortNumber());
57         Assertions.assertEquals(PROTOCOL, client.aaiProtocol());
58         Assertions.assertEquals(USER_NAME_PASSWORD, client.aaiUserName());
59         Assertions.assertEquals(USER_NAME_PASSWORD, client.aaiUserPassword());
60         Assertions.assertEquals(true, client.aaiIgnoreSSLCertificateErrors());
61     }
62 }