diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2020-08-20 12:48:17 +0200 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2020-08-20 12:48:30 +0200 |
commit | 4277231cf397c2fbc12d4f5ca16d51c0f657bb4f (patch) | |
tree | d1682f24cdad7beefdb315a808034a4f58c60105 /sdnr/wt/devicemanager-adapter-manager/provider/src | |
parent | 57976923bf81939fe7cea8c316fa94071612c3ea (diff) |
Fix code smells based on SonarCloud report
Bundles mountpoint-registrar and mountpoint-state-provider and also a Junit test case of aapter-manager devicemanager
Issue-ID: CCSDK-2671
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I84324e6433415bdc001d735e17930c2eb63bb439
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-adapter-manager/provider/src')
-rw-r--r-- | sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java | 65 |
1 files changed, 6 insertions, 59 deletions
diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java index 5f79d943a..3f53abfa8 100644 --- a/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java @@ -17,79 +17,26 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.test; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; +import static org.mockito.Mockito.mock; import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.impl.DeviceManagerAdapterManagerImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; public class TestDeviceManagerAdapterManagerImpl { - private static Path KARAF_ETC = Paths.get("etc"); - private static final Logger LOG = LoggerFactory.getLogger(TestDeviceManagerAdapterManagerImpl.class); DeviceManagerAdapterManagerImpl devMgrAdapterManager; - @Before - public void init() throws InterruptedException, IOException { - /*System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName()); - Path etc = KARAF_ETC; - delete(etc); - - System.out.println("Create empty:" + etc.toString()); - Files.createDirectories(etc);*/ - } - @Test public void test() throws Exception { devMgrAdapterManager = new DeviceManagerAdapterManagerImpl(); - /*DeviceManagerImpl devMgr = new DeviceManagerImpl(); - - try { - devMgr.init(); - devMgrOran.setNetconfNetworkElementService(devMgr); - devMgrOran.init(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - }*/ - /* - * devMgrOran.setNetconfNetworkElementService(null); devMgrOran.init(); - * NetconfNetworkElementService netConfNetworkElementService = - * mock(NetconfNetworkElementService.class); devMgrOran = - * mock(DeviceManagerORanImpl.class); - * when(netConfNetworkElementService.registerNetworkElementFactory(new - * ORanNetworkElementFactory())).thenReturn(null); - */ - + NetconfNetworkElementService netConfNetworkElementService = mock(NetconfNetworkElementService.class); + devMgrAdapterManager.setNetconfNetworkElementService(netConfNetworkElementService); + devMgrAdapterManager.init(); } @After public void cleanUp() throws Exception { devMgrAdapterManager.close(); } - - private static void delete(Path etc) throws IOException { - if (Files.exists(etc)) { - System.out.println("Found, removing:" + etc.toString()); - delete(etc.toFile()); - } - } - - private static void delete(File f) throws IOException { - if (f.isDirectory()) { - for (File c : f.listFiles()) { - delete(c); - } - } - if (!f.delete()) { - throw new FileNotFoundException("Failed to delete file: " + f); - } - } -} + } |