NonRT-RIC A1 Northbound API
[nonrtric.git] / sdnc-a1-controller / oam / SdncReports / SdncReportsApi / src / test / java / com / onap / sdnc / reports / service / CertificationClientServiceTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : SDN-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package com.onap.sdnc.reports.service;
23
24 import static org.junit.Assert.assertEquals;
25 import java.util.ArrayList;
26 import java.util.List;
27 import org.junit.Test;
28 import org.mockito.Mock;
29 import com.onap.sdnc.reports.model.CertificationInputs;
30 import com.onap.sdnc.reports.model.Input;
31 import com.onap.sdnc.reports.model.Output;
32 import com.onap.sdnc.reports.model.PreTestResponse;
33
34 public class CertificationClientServiceTest {
35         
36         @Mock
37         CertificationClientService cService;
38         
39         private String hostname = "host";
40         private String ipaddress = "10.53.122.25";
41         private String statistics = "0% loss";
42         private String avgTime = "Minimum = 0ms";
43         private String testType = "network";
44         
45         @Test(expected = NullPointerException.class)
46         public void TestRestClient() {
47
48                 PreTestResponse pretestResponse = new PreTestResponse();
49                 pretestResponse.setIpaddress(ipaddress);
50                 pretestResponse.setAvgTime(avgTime);
51                 pretestResponse.setHostname(hostname);
52                 pretestResponse.setStatus("successs");
53                 pretestResponse.setStatistics(statistics);
54                 pretestResponse.setTesttype(testType);
55
56                 List<PreTestResponse> preTestNew = new ArrayList<PreTestResponse>();
57                 preTestNew.add(pretestResponse);
58
59                 Input input = new Input();
60                 input.setIpaddress(ipaddress);
61                 input.setHostname(hostname);
62                 input.setNetwork(testType);
63
64                 CertificationInputs certificationInputs = new CertificationInputs();
65                 certificationInputs.setInput(input);
66                 CertificationClientService certificationClientservice = new CertificationClientService();
67                 certificationClientservice.restClient(certificationInputs, preTestNew, testType);
68                 
69         }
70
71         @Test
72         public void pingServiceTest() {
73                 CertificationInputs vnfinfo = new CertificationInputs();
74                 Input input = new Input();
75                 input.setIpaddress("10.53.122.25");
76                 input.setHostname("hostname");
77                 vnfinfo.setInput(input);
78                 Output mockOutput = new Output();
79                 mockOutput.setIpaddress("10.53.122.25");
80                 Output output = CertificationClientService.pingTest(vnfinfo);
81                 assertEquals(output.getIpaddress(), input.getIpaddress());
82         }
83
84         @Test
85         public void protocolTest() {
86                 CertificationInputs vnfinfo = new CertificationInputs();
87                 Input input = new Input();
88                 input.setIpaddress(ipaddress);
89                 input.setHostname("hostname");
90                 vnfinfo.setInput(input);
91                 Output mockOutput = new Output();
92                 mockOutput.setIpaddress(ipaddress);
93         }
94 }