diff options
author | Ganesh Chandrasekaran <ganesh.c@samsung.com> | 2018-09-05 09:30:32 +0900 |
---|---|---|
committer | Ganesh Chandrasekaran <ganesh.c@samsung.com> | 2018-09-11 00:51:08 +0000 |
commit | 0750d459edaaf242190ddc87ead3c3207f2edb55 (patch) | |
tree | 72381ecc00a146033654c9314f7f18d024d74911 /appc-adapters/appc-netconf-adapter | |
parent | 136077f4957ae979ec620d53d4b6f671427f4a5c (diff) |
Test cases for Jsch client
Issue-ID: APPC-1182
Change-Id: I67d04500b36c794bc8afb1db0b404b41bf0576a7
Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Diffstat (limited to 'appc-adapters/appc-netconf-adapter')
4 files changed, 143 insertions, 0 deletions
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 = "<ok/>"; + + netconfClientJsch.configure(message); + } + + @Test (expected = NullPointerException.class) + public void testConfigureNull() throws APPCException, IOException { + String message = null; + + netconfClientJsch.configure(message); + } +} |