TCA: Replace any openecomp reference by onap
[dcaegen2/analytics/tca.git] / dcae-analytics-aai / src / test / java / org / onap / dcae / apod / analytics / aai / it / BaseAnalyticsAAIIT.java
1 /*
2  * ===============================LICENSE_START======================================
3  *  dcae-analytics
4  * ================================================================================
5  *    Copyright © 2017 AT&T 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.dcae.apod.analytics.aai.it;
22
23 import org.onap.dcae.apod.analytics.aai.domain.config.AAIHttpClientConfig;
24 import org.onap.dcae.apod.analytics.aai.domain.config.AAIHttpClientConfigBuilder;
25 import org.onap.dcae.apod.analytics.test.BaseDCAEAnalyticsIT;
26
27 import java.net.MalformedURLException;
28 import java.net.URL;
29 import java.util.LinkedHashMap;
30 import java.util.Map;
31
32 /**
33  * @author Rajiv Singla . Creation Date: 9/18/2017.
34  */
35 public abstract class BaseAnalyticsAAIIT extends BaseDCAEAnalyticsIT {
36
37     protected static final String AAI_HOST_NAME = "1.2.3.4";
38     protected static final Integer AAI_HOST_PORT_NUMBER = 1234;
39     protected static final String AAI_HOST_PROTOCOL = "https";
40     protected static final String AAI_VNF_ENRICHMENT_PATH = "/aai/v11/network/generic-vnfs/generic-vnf";
41     protected static final String AAI_VSERVER_NODE_QUERY_PATH = "/aai/v11/search/nodes-query";
42     protected static final Map<String, String> AAI_HEADERS = new LinkedHashMap<>();
43
44
45     protected static final String AAI_VSERVER_QUERY_RESPONSE_LOCATION = "data/json/aai/aai_vserver_resource_data.json";
46
47     static {
48         AAI_HEADERS.put("X-FromAppId", "vv-temp");
49         AAI_HEADERS.put("X-TransactionId", "vv-temp");
50         AAI_HEADERS.put("Accept", "application/json");
51         AAI_HEADERS.put("Real-Time", "true");
52         AAI_HEADERS.put("Content-Type", "application/json");
53     }
54
55     protected static final String AAI_USER_NAME = "DCAE";
56     protected static final String AAI_USER_PASSWORD = "DCAE";
57     protected static final boolean IGNORE_SSL_CERTIFICATE_ERRORS = true;
58
59
60     protected AAIHttpClientConfig getAAIHttpClientConfig() {
61         try {
62             URL proxyURL = new URL("http://username:password@proxy.att.com:80");
63             return new AAIHttpClientConfigBuilder(AAI_HOST_NAME)
64                     .setAaiProtocol(AAI_HOST_PROTOCOL)
65                     .setAaiHostPortNumber(AAI_HOST_PORT_NUMBER)
66                     .setAaiUserName(AAI_USER_NAME)
67                     .setAaiUserPassword(AAI_USER_PASSWORD)
68                     .setAaiProxyURL(proxyURL)
69                     .setAaiIgnoreSSLCertificateErrors(IGNORE_SSL_CERTIFICATE_ERRORS).build();
70         } catch (MalformedURLException e) {
71             throw new IllegalArgumentException(e);
72         }
73     }
74
75
76 }