Test cases for Jsch client 35/64535/3
authorGanesh Chandrasekaran <ganesh.c@samsung.com>
Wed, 5 Sep 2018 00:30:32 +0000 (09:30 +0900)
committerGanesh Chandrasekaran <ganesh.c@samsung.com>
Tue, 11 Sep 2018 00:51:08 +0000 (00:51 +0000)
Issue-ID: APPC-1182

Change-Id: I67d04500b36c794bc8afb1db0b404b41bf0576a7
Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter2.java
appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfDataAccessServiceImpl.java
appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestJSchLogger.java
appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestNetconfClientJsch.java [new file with mode: 0644]

index 3441709..256d373 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=========================================================
+ */
+
 package org.onap.appc.adapter.netconf.internal;
 
 import org.junit.Assert;
index 011b33a..c1d2845 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=========================================================
+ */
+
 package org.onap.appc.adapter.netconf.internal;
 
 import org.junit.Assert;
index 41f4b95..3ac30a1 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=========================================================
+ */
+
 package org.onap.appc.adapter.netconf.jsch;
 
 import org.junit.Assert;
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestNetconfClientJsch.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestNetconfClientJsch.java
new file mode 100644 (file)
index 0000000..2caf5d4
--- /dev/null
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.adapter.netconf.jsch;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
+import org.onap.appc.adapter.netconf.internal.NetconfAdapter;
+import org.onap.appc.exceptions.APPCException;
+
+import java.io.IOException;
+
+public class TestNetconfClientJsch {
+
+    NetconfClientJsch netconfClientJsch;
+
+    @Before
+    public void SetUp() {
+        netconfClientJsch = new NetconfClientJsch();
+    }
+
+    @Test (expected = APPCException.class)
+    public void testConnect() throws APPCException, IOException {
+        NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
+        connectionDetails.setHost("test");
+        connectionDetails.setPort(8080);
+        connectionDetails.setUsername("test");
+        connectionDetails.setPassword("test");
+
+        netconfClientJsch.connect(connectionDetails);
+    }
+
+    @Test (expected = NullPointerException.class)
+    public void testExchangeMessage() throws APPCException, IOException {
+        String message = "test";
+
+        netconfClientJsch.exchangeMessage(message);
+    }
+
+    @Test (expected = NullPointerException.class)
+    public void testConfigure() throws APPCException, IOException {
+        String message = "test";
+
+        netconfClientJsch.configure(message);
+    }
+
+    @Test (expected = NullPointerException.class)
+    public void testConfigureOk() throws APPCException, IOException {
+        String message = "<ok/>";
+
+        netconfClientJsch.configure(message);
+    }
+
+    @Test (expected = NullPointerException.class)
+    public void testConfigureNull() throws APPCException, IOException {
+        String message = null;
+
+        netconfClientJsch.configure(message);
+    }
+}