diff options
author | highstreetherbert <herbert.eiselt@highstreet-technologies.com> | 2020-07-10 18:38:50 +0200 |
---|---|---|
committer | highstreetherbert <herbert.eiselt@highstreet-technologies.com> | 2020-07-10 18:38:58 +0200 |
commit | ddd171cb1b7d1ea74c0a45c579cd524b00d63464 (patch) | |
tree | 2051fdff8c6462a5c72b9f85abe01d74e12ba070 /sdnr/wt/devicemanager-oran | |
parent | 23c27ddcd79913d11eac16eb42c5a43899de97a1 (diff) |
Reformat sdnr devicemanager-oran to ONAP code style
Reformat to ONAP code style
Issue-ID: SDNC-1279
Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Change-Id: I83c61a94855ce4640651c45ac97157566d805028
Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-oran')
20 files changed, 282 insertions, 253 deletions
diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/DeviceManagerORanImpl.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/DeviceManagerORanImpl.java index 50a6a75ef..8d9a215e2 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/DeviceManagerORanImpl.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/DeviceManagerORanImpl.java @@ -23,7 +23,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkEleme import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class DeviceManagerORanImpl implements AutoCloseable { +public class DeviceManagerORanImpl implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerORanImpl.class); private static final String APPLICATION_NAME = "DeviceManagerORan"; diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/NtsNetworkElement.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/NtsNetworkElement.java index 8f4d0909f..15f906d6c 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/NtsNetworkElement.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/NtsNetworkElement.java @@ -44,14 +44,13 @@ public class NtsNetworkElement implements NetworkElement { private final DataProvider databaseService; NtsNetworkElement(NetconfAccessor netconfAccess, DataProvider databaseService) { - LOG.info("Create {}",NtsNetworkElement.class.getSimpleName()); + LOG.info("Create {}", NtsNetworkElement.class.getSimpleName()); this.netconfAccessor = netconfAccess; this.databaseService = databaseService; } @Override - public void deregister() { - } + public void deregister() {} @Override public NodeId getNodeId() { @@ -64,12 +63,10 @@ public class NtsNetworkElement implements NetworkElement { } @Override - public void warmstart() { - } + public void warmstart() {} @Override - public void register() { - } + public void register() {} @Override public NetworkElementDeviceType getDeviceType() { diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanChangeNotificationListener.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanChangeNotificationListener.java index e0c133e13..43bfeedaa 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanChangeNotificationListener.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanChangeNotificationListener.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; /** * Listener for change notifications */ -public class ORanChangeNotificationListener implements IetfNetconfNotificationsListener { +public class ORanChangeNotificationListener implements IetfNetconfNotificationsListener { private static final Logger log = LoggerFactory.getLogger(ORanChangeNotificationListener.class); diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElement.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElement.java index 83e840184..8b8a9bdb4 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElement.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElement.java @@ -53,7 +53,7 @@ public class ORanNetworkElement implements NetworkElement { private @NonNull final ORanFaultNotificationListener oRanFaultListener; ORanNetworkElement(NetconfAccessor netconfAccess, DataProvider databaseService) { - log.info("Create {}",ORanNetworkElement.class.getSimpleName()); + log.info("Create {}", ORanNetworkElement.class.getSimpleName()); this.netconfAccessor = netconfAccess; this.databaseService = databaseService; @@ -73,7 +73,8 @@ public class ORanNetworkElement implements NetworkElement { List<Component> componentList = hardware.getComponent(); if (componentList != null) { for (Component component : componentList) { - databaseService.writeInventory( oRanMapper.getInternalEquipment(netconfAccessor.getNodeId(), component)); + databaseService + .writeInventory(oRanMapper.getInternalEquipment(netconfAccessor.getNodeId(), component)); } } } @@ -91,11 +92,10 @@ public class ORanNetworkElement implements NetworkElement { log.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), accessData.getNodeId().getValue()); - InstanceIdentifier<Hardware> hardwareIID = - InstanceIdentifier.builder(clazzPac).build(); + InstanceIdentifier<Hardware> hardwareIID = InstanceIdentifier.builder(clazzPac).build(); - Hardware res = accessData.getTransactionUtils().readData(accessData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, - hardwareIID); + Hardware res = accessData.getTransactionUtils().readData(accessData.getDataBroker(), + LogicalDatastoreType.OPERATIONAL, hardwareIID); return res; } @@ -114,7 +114,7 @@ public class ORanNetworkElement implements NetworkElement { } if (oRanFaultListenerRegistrationResult != null) { this.oRanFaultListenerRegistrationResult.close(); - }; + } ; } @@ -129,8 +129,7 @@ public class ORanNetworkElement implements NetworkElement { } @Override - public void warmstart() { - } + public void warmstart() {} @Override public Optional<NetconfAccessor> getAcessor() { diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElementFactory.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElementFactory.java index cf93ba74a..3a557ccbe 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElementFactory.java @@ -35,10 +35,10 @@ public class ORanNetworkElementFactory implements NetworkElementFactory { @Override public Optional<NetworkElement> create(NetconfAccessor acessor, DeviceManagerServiceProvider serviceProvider) { if (acessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)) { - log.info("Create device {} ",ORanNetworkElement.class.getName()); + log.info("Create device {} ", ORanNetworkElement.class.getName()); return Optional.of(new ORanNetworkElement(acessor, serviceProvider.getDataProvider())); } else if (acessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)) { - log.info("Create device {} ",NtsNetworkElement.class.getName()); + log.info("Create device {} ", NtsNetworkElement.class.getName()); return Optional.of(new NtsNetworkElement(acessor, serviceProvider.getDataProvider())); } else { return Optional.empty(); diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanToInternalDataModel.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanToInternalDataModel.java index a2997c0e5..f21645669 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanToInternalDataModel.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanToInternalDataModel.java @@ -1,4 +1,4 @@ -/** +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java index 7e8327a09..48d8e802a 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java @@ -1,14 +1,15 @@ package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; + import java.lang.String; import java.lang.UnsupportedOperationException; /** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. - * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string + * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - + * uint16), or (string - uint32). * - * The reason behind putting it under src/main/java is: - * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent - * loss of user code. + * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be + * finished by the user. This class is generated only once to prevent loss of user code. * */ public class OperatorStateBuilder { diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java index 7c4a63d2b..fb2e5d59d 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java @@ -1,14 +1,15 @@ package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; + import java.lang.String; import java.lang.UnsupportedOperationException; /** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. - * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string + * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - + * uint16), or (string - uint32). * - * The reason behind putting it under src/main/java is: - * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent - * loss of user code. + * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be + * finished by the user. This class is generated only once to prevent loss of user code. * */ public class ResourceBuilder { diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java index 282a6a26d..2f4b5931f 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java @@ -1,14 +1,15 @@ package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; + import java.lang.String; import java.lang.UnsupportedOperationException; /** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. - * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string + * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - + * uint16), or (string - uint32). * - * The reason behind putting it under src/main/java is: - * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent - * loss of user code. + * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be + * finished by the user. This class is generated only once to prevent loss of user code. * */ public class ResourceMatchBuilder { diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java index 81391922d..49e50e004 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java @@ -1,14 +1,15 @@ package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; + import java.lang.String; import java.lang.UnsupportedOperationException; /** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. - * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string + * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - + * uint16), or (string - uint32). * - * The reason behind putting it under src/main/java is: - * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent - * loss of user code. + * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be + * finished by the user. This class is generated only once to prevent loss of user code. * */ public class SeverityWithClearBuilder { diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java index 9f10ae87f..c2a500986 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java +++ b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java @@ -1,14 +1,15 @@ package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911.alarms; + import java.lang.String; import java.lang.UnsupportedOperationException; /** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. - * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string + * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - + * uint16), or (string - uint32). * - * The reason behind putting it under src/main/java is: - * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent - * loss of user code. + * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be + * finished by the user. This class is generated only once to prevent loss of user code. * */ public class ControlMaxAlarmStatusChangesBuilder { diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestDeviceManagerORanImpl.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestDeviceManagerORanImpl.java index 1b5ed9b86..7d7eef57f 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestDeviceManagerORanImpl.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestDeviceManagerORanImpl.java @@ -1,3 +1,20 @@ +/* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * 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.ccsdk.features.sdnr.wt.devicemanager.oran.test; import java.io.File; @@ -6,65 +23,59 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; - import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.DeviceManagerORanImpl; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.ORanNetworkElementFactory; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class TestDeviceManagerORanImpl { - private static Path KARAF_ETC = Paths.get("etc"); - private static final Logger LOG = LoggerFactory.getLogger(TestDeviceManagerORanImpl.class); - DeviceManagerORanImpl devMgrOran; - - @Before - public void init() throws InterruptedException, IOException { - /*System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName()); + private static Path KARAF_ETC = Paths.get("etc"); + private static final Logger LOG = LoggerFactory.getLogger(TestDeviceManagerORanImpl.class); + DeviceManagerORanImpl devMgrOran; + + @Before + public void init() throws InterruptedException, IOException { + /*System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName()); Path etc = KARAF_ETC; - delete(etc); - + delete(etc); + System.out.println("Create empty:" + etc.toString()); Files.createDirectories(etc);*/ - } - - @Test - public void test() throws Exception { - devMgrOran = new DeviceManagerORanImpl(); - /*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); - */ - - - } - - @After - public void cleanUp() throws Exception { - devMgrOran.close(); - } - - private static void delete(Path etc) throws IOException { + } + + @Test + public void test() throws Exception { + devMgrOran = new DeviceManagerORanImpl(); + /*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); + */ + + + } + + @After + public void cleanUp() throws Exception { + devMgrOran.close(); + } + + private static void delete(Path etc) throws IOException { if (Files.exists(etc)) { System.out.println("Found, removing:" + etc.toString()); delete(etc.toFile()); diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestHardwareClass.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestHardwareClass.java index caa4e6463..c8a000bde 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestHardwareClass.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestHardwareClass.java @@ -1,3 +1,20 @@ +/* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * 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.ccsdk.features.sdnr.wt.devicemanager.oran.test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.HardwareClass; diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanChangeNotificationListener.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanChangeNotificationListener.java index a7cd28d3e..7709298e0 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanChangeNotificationListener.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanChangeNotificationListener.java @@ -41,47 +41,47 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; public class TestORanChangeNotificationListener { - private static final String NODEID = "node1"; + private static final String NODEID = "node1"; - @Test - public void test() { + @Test + public void test() { - NetconfAccessor netconfAccessor = mock(NetconfAccessor.class); - DataProvider databaseService = mock(DataProvider.class); - ORanChangeNotificationListener notifListener = new ORanChangeNotificationListener(netconfAccessor, - databaseService); - when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID)); - Iterable<? extends PathArgument> pathArguments = Arrays.asList(new PathArgument() { + NetconfAccessor netconfAccessor = mock(NetconfAccessor.class); + DataProvider databaseService = mock(DataProvider.class); + ORanChangeNotificationListener notifListener = + new ORanChangeNotificationListener(netconfAccessor, databaseService); + when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID)); + Iterable<? extends PathArgument> pathArguments = Arrays.asList(new PathArgument() { - @Override - public int compareTo(PathArgument arg0) { - return 0; - } + @Override + public int compareTo(PathArgument arg0) { + return 0; + } - @Override - public Class<? extends DataObject> getType() { - return DataObject.class; - } - }); - InstanceIdentifier<?> target = InstanceIdentifier.create(pathArguments); + @Override + public Class<? extends DataObject> getType() { + return DataObject.class; + } + }); + InstanceIdentifier<?> target = InstanceIdentifier.create(pathArguments); - notifListener.onNetconfConfigChange(createNotification(EditOperationType.Create,target)); - EventlogEntity event = new EventlogBuilder().setNodeId(NODEID) - .setNewValue(String.valueOf(EditOperationType.Create)).setObjectId(target.toString()).build(); - verify(databaseService).writeEventLog(event); + notifListener.onNetconfConfigChange(createNotification(EditOperationType.Create, target)); + EventlogEntity event = new EventlogBuilder().setNodeId(NODEID) + .setNewValue(String.valueOf(EditOperationType.Create)).setObjectId(target.toString()).build(); + verify(databaseService).writeEventLog(event); - } + } - /** - * @param type - * @return - */ - private static NetconfConfigChange createNotification(EditOperationType type,InstanceIdentifier<?> target) { - NetconfConfigChange change = mock(NetconfConfigChange.class); - - @SuppressWarnings("null") - final @NonNull List<Edit> edits = Arrays.asList(new EditBuilder().setOperation(type).setTarget(target).build()); - when(change.nonnullEdit()).thenReturn(edits); - return change; - } + /** + * @param type + * @return + */ + private static NetconfConfigChange createNotification(EditOperationType type, InstanceIdentifier<?> target) { + NetconfConfigChange change = mock(NetconfConfigChange.class); + + @SuppressWarnings("null") + final @NonNull List<Edit> edits = Arrays.asList(new EditBuilder().setOperation(type).setTarget(target).build()); + when(change.nonnullEdit()).thenReturn(edits); + return change; + } } diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanFaultNotificationListener.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanFaultNotificationListener.java index e67ec5430..d486f6735 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanFaultNotificationListener.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanFaultNotificationListener.java @@ -22,9 +22,9 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.ORanFaultNotifica public class TestORanFaultNotificationListener { - @Test - public void test() { - ORanFaultNotificationListener faultListener = new ORanFaultNotificationListener(); - faultListener.onAlarmNotif(null); - } + @Test + public void test() { + ORanFaultNotificationListener faultListener = new ORanFaultNotificationListener(); + faultListener.onAlarmNotif(null); + } } diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanNetworkElement.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanNetworkElement.java index 98589159a..675499aed 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanNetworkElement.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanNetworkElement.java @@ -56,8 +56,8 @@ public class TestORanNetworkElement { NodeId nNodeId = new NodeId("nSky"); when(accessor.getCapabilites()).thenReturn(capabilities); - when (accessor.getNodeId()).thenReturn(nNodeId); - when (accessor.getTransactionUtils()).thenReturn(new TransactionUtilsMock()); + when(accessor.getNodeId()).thenReturn(nNodeId); + when(accessor.getTransactionUtils()).thenReturn(new TransactionUtilsMock()); DataProvider dataProvider = mock(DataProvider.class); when(serviceProvider.getDataProvider()).thenReturn(dataProvider); diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanNetworkElementFactory.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanNetworkElementFactory.java index f972f8e58..2614e4dd7 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanNetworkElementFactory.java @@ -36,50 +36,50 @@ import org.opendaylight.yangtools.yang.common.QName; public class TestORanNetworkElementFactory { - static NetconfAccessor accessor; - static DeviceManagerServiceProvider serviceProvider; - static Capabilities capabilities; - QName qCapability; + static NetconfAccessor accessor; + static DeviceManagerServiceProvider serviceProvider; + static Capabilities capabilities; + QName qCapability; - @BeforeClass - public static void init() throws InterruptedException, IOException { - capabilities = mock(Capabilities.class); - accessor = mock(NetconfAccessorMock.class); - serviceProvider = mock(DeviceManagerServiceProvider.class); - - when(accessor.getCapabilites()).thenReturn(capabilities); - when(serviceProvider.getDataProvider()).thenReturn(null); + @BeforeClass + public static void init() throws InterruptedException, IOException { + capabilities = mock(Capabilities.class); + accessor = mock(NetconfAccessorMock.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); - - } + when(accessor.getCapabilites()).thenReturn(capabilities); + when(serviceProvider.getDataProvider()).thenReturn(null); - @Test - public void testCreateORANHWComponent() throws Exception { - when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false); - ORanNetworkElementFactory factory = new ORanNetworkElementFactory(); - assertTrue((factory.create(accessor, serviceProvider)).isPresent()); - } - @Test - public void testCreateSimulator() throws Exception { - when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(true); - ORanNetworkElementFactory factory = new ORanNetworkElementFactory(); - assertTrue(factory.create(accessor, serviceProvider).isPresent()); - } - - @Test - public void testCreateNone() throws Exception { - when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false); - ORanNetworkElementFactory factory = new ORanNetworkElementFactory(); - assertTrue(!(factory.create(accessor, serviceProvider).isPresent())); - } - - @After - public void cleanUp() throws Exception { + } - } + @Test + public void testCreateORANHWComponent() throws Exception { + when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false); + ORanNetworkElementFactory factory = new ORanNetworkElementFactory(); + assertTrue((factory.create(accessor, serviceProvider)).isPresent()); + } + + @Test + public void testCreateSimulator() throws Exception { + when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(true); + ORanNetworkElementFactory factory = new ORanNetworkElementFactory(); + assertTrue(factory.create(accessor, serviceProvider).isPresent()); + } + + @Test + public void testCreateNone() throws Exception { + when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false); + ORanNetworkElementFactory factory = new ORanNetworkElementFactory(); + assertTrue(!(factory.create(accessor, serviceProvider).isPresent())); + } + + @After + public void cleanUp() throws Exception { + + } } diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanToInternalDataModel.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanToInternalDataModel.java index c6411523f..e5efb1b40 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanToInternalDataModel.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/TestORanToInternalDataModel.java @@ -41,46 +41,46 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.test.TestHardwareClass public class TestORanToInternalDataModel { - NodeId nodeId; - Component component; + NodeId nodeId; + Component component; - @SuppressWarnings("unchecked") - @Before - public void init() throws InterruptedException, IOException { - nodeId = mock(NodeId.class); - component = mock(Component.class); + @SuppressWarnings("unchecked") + @Before + public void init() throws InterruptedException, IOException { + nodeId = mock(NodeId.class); + component = mock(Component.class); - when(nodeId.getValue()).thenReturn("ORan-1000"); - when(component.getParent()).thenReturn("Shelf"); - when(component.getParentRelPos()).thenReturn(0); - when(component.getUuid()).thenReturn(new Uuid("0Aabcdef-0abc-0cfD-0abC-0123456789AB")); + when(nodeId.getValue()).thenReturn("ORan-1000"); + when(component.getParent()).thenReturn("Shelf"); + when(component.getParentRelPos()).thenReturn(0); + when(component.getUuid()).thenReturn(new Uuid("0Aabcdef-0abc-0cfD-0abC-0123456789AB")); - List<String> list = new ArrayList<String>(); - list.add("Card-01A"); - list.add("Card-01B"); + List<String> list = new ArrayList<String>(); + list.add("Card-01A"); + list.add("Card-01B"); - when (component.getContainsChild()).thenReturn(list); - when (component.getName()).thenReturn("Nokia"); - when (component.getDescription()).thenReturn("ORAN Network Element NO-456"); - Class<? extends HardwareClass> hwClass = TestHardwareClass.class; - Mockito.<Class<? extends HardwareClass>>when(component.getXmlClass()).thenReturn(hwClass); - - DateAndTime dt = new DateAndTime("2020-02-05T12:30:45.283Z"); - when (component.getMfgDate()).thenReturn(dt); - - } + when(component.getContainsChild()).thenReturn(list); + when(component.getName()).thenReturn("Nokia"); + when(component.getDescription()).thenReturn("ORAN Network Element NO-456"); + Class<? extends HardwareClass> hwClass = TestHardwareClass.class; + Mockito.<Class<? extends HardwareClass>>when(component.getXmlClass()).thenReturn(hwClass); - @Test - public void test() throws Exception { - ORanToInternalDataModel model = new ORanToInternalDataModel(); - model.getInternalEquipment(nodeId, component); - assertEquals(component.getUuid().getValue(), "0Aabcdef-0abc-0cfD-0abC-0123456789AB"); - assertEquals(component.getMfgDate().getValue(), "2020-02-05T12:30:45.283Z"); + DateAndTime dt = new DateAndTime("2020-02-05T12:30:45.283Z"); + when(component.getMfgDate()).thenReturn(dt); - } + } - @After - public void cleanUp() throws Exception { + @Test + public void test() throws Exception { + ORanToInternalDataModel model = new ORanToInternalDataModel(); + model.getInternalEquipment(nodeId, component); + assertEquals(component.getUuid().getValue(), "0Aabcdef-0abc-0cfD-0abC-0123456789AB"); + assertEquals(component.getMfgDate().getValue(), "2020-02-05T12:30:45.283Z"); - } + } + + @After + public void cleanUp() throws Exception { + + } } diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/mock/NetconfConfigChangeMock.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/mock/NetconfConfigChangeMock.java index c1991dc47..e31aac8fd 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/mock/NetconfConfigChangeMock.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/mock/NetconfConfigChangeMock.java @@ -29,34 +29,34 @@ import org.opendaylight.yangtools.yang.binding.DataContainer; public class NetconfConfigChangeMock implements NetconfConfigChange { - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - - @Override - public <E$$ extends Augmentation<NetconfConfigChange>> @Nullable E$$ augmentation(Class<E$$> augmentationType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable ChangedBy getChangedBy() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable Datastore getDatastore() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Edit> getEdit() { - List<Edit> list = new ArrayList<Edit>(); - return list; - } + @Override + public Class<? extends DataContainer> getImplementedInterface() { + // TODO Auto-generated method stub + return null; + } + + @Override + public <E$$ extends Augmentation<NetconfConfigChange>> @Nullable E$$ augmentation(Class<E$$> augmentationType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable ChangedBy getChangedBy() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable Datastore getDatastore() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Edit> getEdit() { + List<Edit> list = new ArrayList<Edit>(); + return list; + } } diff --git a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/mock/TransactionUtilsMock.java b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/mock/TransactionUtilsMock.java index 0ae9b4a77..d23227d7f 100644 --- a/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/mock/TransactionUtilsMock.java +++ b/sdnr/wt/devicemanager-oran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/test/mock/TransactionUtilsMock.java @@ -29,19 +29,19 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class TransactionUtilsMock implements TransactionUtils { - @Override - public <T extends DataObject> @Nullable T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType, - InstanceIdentifier<T> iid) { - // TODO Auto-generated method stub - return null; - } + @Override + public <T extends DataObject> @Nullable T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType, + InstanceIdentifier<T> iid) { + // TODO Auto-generated method stub + return null; + } - @Override - public <T extends DataObject> @Nullable T readDataOptionalWithStatus(DataBroker dataBroker, - LogicalDatastoreType dataStoreType, InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication, - AtomicReference<String> statusIndicator) { - // TODO Auto-generated method stub - return null; - } + @Override + public <T extends DataObject> @Nullable T readDataOptionalWithStatus(DataBroker dataBroker, + LogicalDatastoreType dataStoreType, InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication, + AtomicReference<String> statusIndicator) { + // TODO Auto-generated method stub + return null; + } } |