Test cases for Jsch client
[appc.git] / appc-adapters / appc-netconf-adapter / appc-netconf-adapter-bundle / src / test / java / org / onap / appc / adapter / netconf / jsch / TestNetconfClientJsch.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2018 Samsung
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  *
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.appc.adapter.netconf.jsch;
23
24 import org.junit.Assert;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
28 import org.onap.appc.adapter.netconf.internal.NetconfAdapter;
29 import org.onap.appc.exceptions.APPCException;
30
31 import java.io.IOException;
32
33 public class TestNetconfClientJsch {
34
35     NetconfClientJsch netconfClientJsch;
36
37     @Before
38     public void SetUp() {
39         netconfClientJsch = new NetconfClientJsch();
40     }
41
42     @Test (expected = APPCException.class)
43     public void testConnect() throws APPCException, IOException {
44         NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
45         connectionDetails.setHost("test");
46         connectionDetails.setPort(8080);
47         connectionDetails.setUsername("test");
48         connectionDetails.setPassword("test");
49
50         netconfClientJsch.connect(connectionDetails);
51     }
52
53     @Test (expected = NullPointerException.class)
54     public void testExchangeMessage() throws APPCException, IOException {
55         String message = "test";
56
57         netconfClientJsch.exchangeMessage(message);
58     }
59
60     @Test (expected = NullPointerException.class)
61     public void testConfigure() throws APPCException, IOException {
62         String message = "test";
63
64         netconfClientJsch.configure(message);
65     }
66
67     @Test (expected = NullPointerException.class)
68     public void testConfigureOk() throws APPCException, IOException {
69         String message = "<ok/>";
70
71         netconfClientJsch.configure(message);
72     }
73
74     @Test (expected = NullPointerException.class)
75     public void testConfigureNull() throws APPCException, IOException {
76         String message = null;
77
78         netconfClientJsch.configure(message);
79     }
80 }