2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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
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.openecomp.sdc.common.test;
23 import org.junit.Ignore;
24 import org.junit.Test;
25 import org.openecomp.sdc.common.http.client.api.HttpExecuteException;
26 import org.openecomp.sdc.common.http.client.api.HttpRequest;
27 import org.openecomp.sdc.common.http.client.api.HttpResponse;
28 import org.openecomp.sdc.common.http.config.HttpClientConfig;
29 import org.openecomp.sdc.common.http.config.Timeouts;
31 import java.net.MalformedURLException;
32 import java.util.concurrent.ExecutorService;
33 import java.util.concurrent.Executors;
34 import java.util.concurrent.TimeUnit;
36 public class E2EHttpClientTest {
40 public void testSsl() throws MalformedURLException {
42 String url = "https://135.76.210.29:2443/certificate-manager-fe/v1";
43 // String url = "http://135.76.123.110:1111//aai/v1/aai/cloud-infrastructure/operational-environments/operational-environment/12345";
45 HttpClientConfig httpClientConfig = new HttpClientConfig(new Timeouts(10000, 5000));
47 HttpResponse<String> response = HttpRequest.get(url, httpClientConfig);
48 System.out.println(response);
57 public void testSslMutliThread() throws MalformedURLException {
59 String url = "https://135.76.210.29:2443/certificate-manager-fe/v1";
60 // String url = "http://135.76.210.29:2080/certificate-manager-fe/v1";
61 String url2 = "http://135.76.123.110:1111//aai/v1/aai/cloud-infrastructure/operational-environments/operational-environment/12345";
63 HttpClientConfig httpClientConfig = new HttpClientConfig(new Timeouts(1000, 5000));
66 ExecutorService executor = Executors.newFixedThreadPool(threadCount);
67 for (int i = 0; i < threadCount; i++) {
68 Runnable worker = new Runnable() {
76 HttpResponse<String> response = HttpRequest.get(url, httpClientConfig);
77 System.out.println("Thead id=" + Thread.currentThread() + " Count = " + ++i + " " + response);
80 HttpResponse<String> response = HttpRequest.get(url2, httpClientConfig);
81 System.out.println("Thead id=" + Thread.currentThread() + " Count = " + ++i + " " + response);
85 catch (HttpExecuteException e) {
90 executor.execute(worker);
94 executor.awaitTermination(1, TimeUnit.SECONDS);
96 catch (InterruptedException e) {
100 while (!executor.isTerminated())