From 0750d459edaaf242190ddc87ead3c3207f2edb55 Mon Sep 17 00:00:00 2001 From: Ganesh Chandrasekaran Date: Wed, 5 Sep 2018 09:30:32 +0900 Subject: Test cases for Jsch client Issue-ID: APPC-1182 Change-Id: I67d04500b36c794bc8afb1db0b404b41bf0576a7 Signed-off-by: Ganesh Chandrasekaran --- .../netconf/internal/TestNetconfAdapter2.java | 21 ++++++ .../internal/TestNetconfDataAccessServiceImpl.java | 21 ++++++ .../appc/adapter/netconf/jsch/TestJSchLogger.java | 21 ++++++ .../netconf/jsch/TestNetconfClientJsch.java | 80 ++++++++++++++++++++++ 4 files changed, 143 insertions(+) create mode 100644 appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestNetconfClientJsch.java (limited to 'appc-adapters/appc-netconf-adapter') diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter2.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter2.java index 344170967..256d373df 100644 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter2.java +++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter2.java @@ -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; diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfDataAccessServiceImpl.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfDataAccessServiceImpl.java index 011b33a28..c1d28455c 100644 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfDataAccessServiceImpl.java +++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfDataAccessServiceImpl.java @@ -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; diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestJSchLogger.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestJSchLogger.java index 41f4b9518..3ac30a1e0 100644 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestJSchLogger.java +++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestJSchLogger.java @@ -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 index 000000000..2caf5d421 --- /dev/null +++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestNetconfClientJsch.java @@ -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 = ""; + + netconfClientJsch.configure(message); + } + + @Test (expected = NullPointerException.class) + public void testConfigureNull() throws APPCException, IOException { + String message = null; + + netconfClientJsch.configure(message); + } +} -- cgit 1.2.3-korg