2 * ============LICENSE_START=======================================================
3 * DCAEGEN2-SERVICES-SDK
4 * ================================================================================
5 * Copyright (C) 2018-2019 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.get;
24 import org.junit.jupiter.api.BeforeEach;
25 import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
26 import org.onap.dcaegen2.services.sdk.rest.services.model.AaiModel;
27 import reactor.netty.http.client.HttpClient;
29 import java.util.HashMap;
32 import static org.mockito.Mockito.mock;
33 import static org.mockito.Mockito.when;
35 class AaiHttpGetClientTest {
37 private static final String SUCCESS_RESPONSE = "{\"correlationId\":\"NOKnhfsadhff\"," +
38 "\"ipaddress-v4\":\"256.22.33.155\", " +
39 "\"ipaddress-v6\":\"200J:0db8:85a3:0000:0000:8a2e:0370:7334\"}";
41 private AaiHttpGetClient aaiReactiveHttpGetClient;
42 private HttpClient httpClient;
44 private AaiClientConfiguration aaiConfigurationMock;
45 private AaiModel aaiModel;
46 private Map<String,String> aaiHeaders;
52 aaiModel = mock(AaiModel.class);
53 aaiConfigurationMock = mock(AaiClientConfiguration.class);
55 when(aaiConfigurationMock.aaiHost()).thenReturn("54.45.33.2");
56 when(aaiConfigurationMock.aaiProtocol()).thenReturn("https");
57 when(aaiConfigurationMock.aaiPort()).thenReturn(1234);
58 when(aaiConfigurationMock.aaiUserName()).thenReturn("PRH");
59 when(aaiConfigurationMock.aaiUserPassword()).thenReturn("PRH");
60 when(aaiConfigurationMock.aaiBasePath()).thenReturn("/aai/v11");
61 when(aaiConfigurationMock.aaiPnfPath()).thenReturn("/network/pnfs/pnf");
62 when(aaiConfigurationMock.aaiHeaders()).thenReturn(aaiHeaders);
64 when(aaiModel.getCorrelationId()).thenReturn("NOKnhfsadhff");
70 private void setupHeaders() {
71 aaiHeaders = new HashMap<>();
72 aaiHeaders.put("X-FromAppId", "PRH");
73 aaiHeaders.put("X-TransactionId", "vv-temp");
74 aaiHeaders.put("Accept", "application/json");
75 aaiHeaders.put("Real-Time", "true");
76 aaiHeaders.put("Content-Type", "application/json");
79 private void mockHttpClientObject() {
80 //when(HttpClient.create().)