Update URL according to microservice name
[vfc/nfvo/driver/vnfm/svnfm.git] / huawei / vnfmadapter / VnfmadapterService / service / src / test / java / org / openo / nfvo / vnfmadapter / service / csm / connect / SslCertificateSocketTest.java
1 /*
2  * Copyright 2017 Huawei Technologies Co., Ltd.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.openo.nfvo.vnfmadapter.service.csm.connect;
18
19 import org.apache.commons.httpclient.params.HttpConnectionParams;
20 import org.junit.Test;
21 import org.openo.nfvo.vnfmadapter.common.VnfmException;
22
23 import java.io.IOException;
24
25 /**
26  * Created by QuanZhong on 2017/3/20.
27  */
28 public class SslCertificateSocketTest {
29     @Test
30     public void initTest(){
31         SslCertificateSocket socket = new SslCertificateSocket();
32         try {
33             socket.init();
34         } catch (VnfmException e) {
35             e.printStackTrace();
36         }
37     }
38     @Test
39     public void createSocketTest(){
40         SslCertificateSocket socket = new SslCertificateSocket();
41         try {
42             socket.createSocket("http://127.0.0.1",1234);
43         } catch (IOException e) {
44             e.printStackTrace();
45         }
46     }
47
48     @Test
49     public void createSocketTest2(){
50         SslCertificateSocket socket = new SslCertificateSocket();
51         try {
52             socket.createSocket("http://127.0.0.1",1234,null,4321,null);
53         } catch (IOException e) {
54             e.printStackTrace();
55         }
56     }
57     @Test
58     public void createSocketTest3(){
59         SslCertificateSocket socket = new SslCertificateSocket();
60         try {
61             HttpConnectionParams params = new HttpConnectionParams();
62             params.setConnectionTimeout(0);
63             socket.createSocket("http://127.0.0.1",1234,null,4321,params);
64         } catch (IOException e) {
65             e.printStackTrace();
66         }
67     }
68     @Test
69     public void createSocketTest4(){
70         SslCertificateSocket socket = new SslCertificateSocket();
71         try {
72             HttpConnectionParams params = new HttpConnectionParams();
73             params.setConnectionTimeout(3000);
74             socket.createSocket("http://127.0.0.1",1234,null,4321,params);
75         } catch (IOException e) {
76             e.printStackTrace();
77         }
78     }
79 }