diff options
author | Joss Armstrong <joss.armstrong@ericsson.com> | 2019-02-05 16:18:40 +0000 |
---|---|---|
committer | Takamune Cho <takamune.cho@att.com> | 2019-02-06 13:02:52 +0000 |
commit | cd01ebd601bf8d93db5146d5ef5a94c1710cc1ed (patch) | |
tree | 3f42a938bff49e14c0e97d66130334ca6076c56f /appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test | |
parent | 441f27e9bafd79a0da9df831c10e660d5feefca1 (diff) |
Improve testing and coverage of netconf class
Test now covers main success flows and increased coverage
Issue-ID: APPC-1390
Change-Id: I951d5ac3426ae6d6aa3567c80aef5a5bb95fa1c7
Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test')
-rw-r--r-- | appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfDataAccessServiceImpl.java | 24 |
1 files changed, 6 insertions, 18 deletions
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 c1d28455c..e2d6f2704 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Samsung * ================================================================================ + * Modifications Copyright (C) 2019 Ericsson + * ================================================================================ * 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 @@ -25,10 +27,9 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.onap.appc.adapter.netconf.ConnectionDetails; import org.onap.appc.adapter.netconf.NetconfConnectionDetails; +import org.onap.appc.adapter.netconf.util.Constants; import org.onap.ccsdk.sli.core.dblib.DbLibService; - import javax.sql.rowset.CachedRowSet; import java.io.IOException; import java.io.PrintWriter; @@ -50,6 +51,8 @@ public class TestNetconfDataAccessServiceImpl { @Override public CachedRowSet getData(String s, ArrayList<String> arrayList, String s1) throws SQLException { CachedRowSet cachedRowSetMocked = Mockito.mock(CachedRowSet.class); + Mockito.when(cachedRowSetMocked.first()).thenReturn(true); + Mockito.when(cachedRowSetMocked.getString(Constants.FILE_CONTENT_TABLE_FIELD_NAME)).thenReturn("File_Content"); return cachedRowSetMocked; } @@ -117,35 +120,20 @@ public class TestNetconfDataAccessServiceImpl { @Test public void testRetrieveConfigFileName() throws IOException { String response = netconfDataAccessService.retrieveConfigFileName("test"); - - Assert.assertEquals("", response); - } - - @Test - public void testRetrieveConnectionDetails() throws IOException { - ConnectionDetails netconfConnectionDetails = new ConnectionDetails(); - - boolean response = netconfDataAccessService.retrieveConnectionDetails("test", netconfConnectionDetails); - - Assert.assertEquals(false, response); + Assert.assertEquals("File_Content", response); } @Test public void testRetrieveNetconfConnectionDetails() throws IOException { NetconfConnectionDetails netconfConnectionDetails = new NetconfConnectionDetails(); - boolean response = netconfDataAccessService.retrieveNetconfConnectionDetails("test", netconfConnectionDetails); - Assert.assertEquals(true, response); } @Test public void testLogDeviceInteraction() throws IOException { - NetconfConnectionDetails netconfConnectionDetails = new NetconfConnectionDetails(); - boolean response = netconfDataAccessService.logDeviceInteraction("test", "", "", ""); - Assert.assertEquals(true, response); } } |