summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-adapter-manager
diff options
context:
space:
mode:
authorKAPIL SINGAL <ks220y@att.com>2020-08-20 13:07:55 +0000
committerGerrit Code Review <gerrit@onap.org>2020-08-20 13:07:55 +0000
commit97cc01117ee7da2e43d9a6ba2892aada5de18f47 (patch)
tree7338bbecfc6270019b6f8a800b86c2de430ff99c /sdnr/wt/devicemanager-adapter-manager
parent777e44a8a1262e2d369b2917e31f176c858266b0 (diff)
parent4277231cf397c2fbc12d4f5ca16d51c0f657bb4f (diff)
Merge "Fix code smells based on SonarCloud report"
Diffstat (limited to 'sdnr/wt/devicemanager-adapter-manager')
-rw-r--r--sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java65
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);
- }
- }
-}
+ }