diff options
author | herbert <herbert.eiselt@highstreet-technologies.com> | 2020-02-28 13:19:20 +0100 |
---|---|---|
committer | herbert <herbert.eiselt@highstreet-technologies.com> | 2020-02-28 13:20:47 +0100 |
commit | ac2749ef5c0de23a9874c049e043eb7eda2b1168 (patch) | |
tree | 66ee02e72d69b2810275463a786e3c6b2e8360bb /sdnr/wt/devicemanager-onf/provider/src/test | |
parent | ee75b19ee79f49b28a3137b6dcfdf02d6120f3de (diff) |
Update devicemanager components
Adjust license and add
Issue-ID: SDNC-1091
Signed-off-by: herbert <herbert.eiselt@highstreet-technologies.com>
Change-Id: Ic0eb5ff731c6c9cc982b9867d6731a9e470a9597
Diffstat (limited to 'sdnr/wt/devicemanager-onf/provider/src/test')
10 files changed, 585 insertions, 567 deletions
diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java index f55ef4afc..cda0f5366 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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.onf.ifpac.equipment.test; import static org.junit.Assert.*; diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java index c5107364f..ff2969eac 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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.onf.ifpac.equipment.test; import static org.junit.Assert.*; diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java index 5d14e7d26..cae28f4fe 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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.onf.ifpac.microwave.test; import static org.junit.Assert.*; diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java index 99e426adc..0140eaa59 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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.onf.ifpac.microwave.test; import static org.junit.Assert.*; diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java index 64c857173..e4d89f28f 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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.onf.ifpac.microwave.test; import static org.junit.Assert.*; diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java index 32d9849d8..eac003dac 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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.onf.ifpac.microwave.test; import static org.junit.Assert.*; diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java index 55db66a1a..bf9337291 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * 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.onf.ifpac.test; import static org.junit.Assert.*; diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java index 6713a7821..93e65c0b9 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,20 +14,24 @@ * 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.onf.impl.test; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.io.File; import java.io.IOException; import org.junit.After; +import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev170324; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev180907; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.WrapperMicrowaveModelRev181010; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.DeviceManagerOnfConfiguration; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.ONFCoreNetworkElementFactory; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; @@ -39,61 +43,76 @@ import org.opendaylight.yangtools.yang.common.QName; public class TestONFCoreNetworkElementFactory { - static NetconfAccessor accessor; - static DeviceManagerServiceProvider serviceProvider; - static Capabilities capabilities; - static DataBroker dataBroker; - static NodeId nNodeId; - QName qCapability; - - @BeforeClass - public static void init() throws InterruptedException, IOException { - capabilities = mock(Capabilities.class); - accessor = mock(NetconfAccessor.class); - serviceProvider = mock(DeviceManagerServiceProvider.class); - dataBroker = mock(DataBroker.class); - - when(accessor.getCapabilites()).thenReturn(capabilities); - //when(serviceProvider.getDataProvider()).thenReturn(dataProvider); - nNodeId = new NodeId("nSky"); - when(accessor.getNodeId()).thenReturn(nNodeId); - - - } - - @Test - public void testCreateMWModelRev170324() throws Exception { - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(false); - ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(); - assertTrue((factory.create(accessor, serviceProvider)).isPresent()); - } - - @Test - public void testCreateMWModelRev180907() throws Exception { - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(false); - ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(); - assertTrue(factory.create(accessor, serviceProvider).isPresent()); - } - - @Test - public void testCreateMWModelRev181010() throws Exception { - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(true); - ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(); - assertTrue(factory.create(accessor, serviceProvider).isPresent()); - } - - @After - public void cleanUp() throws Exception { - - } + static NetconfAccessor accessor; + static DeviceManagerServiceProvider serviceProvider; + static Capabilities capabilities; + static DataBroker dataBroker; + static NodeId nNodeId; + static DeviceManagerOnfConfiguration configuration; + QName qCapability; + static File configFile; + + + @BeforeClass + public static void init() throws InterruptedException, IOException { + + capabilities = mock(Capabilities.class); + accessor = mock(NetconfAccessor.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + dataBroker = mock(DataBroker.class); + + configFile = new File("devicemanager.properties"); + ConfigurationFileRepresentation configFileRep = new ConfigurationFileRepresentation(configFile); + configuration = new DeviceManagerOnfConfiguration(configFileRep); + + when(accessor.getCapabilites()).thenReturn(capabilities); + //when(serviceProvider.getDataProvider()).thenReturn(dataProvider); + nNodeId = new NodeId("nSky"); + when(accessor.getNodeId()).thenReturn(nNodeId); + + + } + + @AfterClass + public static void after() { + configFile.delete(); + } + + @Test + public void testCreateMWModelRev170324() throws Exception { + + + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(false); + ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); + assertTrue(factory.create(accessor, serviceProvider).isPresent()); + } + + @Test + public void testCreateMWModelRev180907() throws Exception { + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(false); + ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); + assertTrue(factory.create(accessor, serviceProvider).isPresent()); + } + + @Test + public void testCreateMWModelRev181010() throws Exception { + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(true); + ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); + assertTrue(factory.create(accessor, serviceProvider).isPresent()); + } + + @After + public void cleanUp() throws Exception { + + } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java index a09d6fcfc..ba295f6ce 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,20 +14,18 @@ * 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.onf.ne.test; -import static org.junit.Assert.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.List; -import java.util.Optional; - import org.eclipse.jdt.annotation.Nullable; import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.OnfMicrowaveModel; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.DeviceManagerOnfConfiguration; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.ONFCoreNetworkElement12Basic; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.ONFCoreNetworkElement12Microwave; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; @@ -60,236 +58,238 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class TestONFCoreNetworkElement12Basic { - NetconfAccessor accessor; - DeviceManagerServiceProvider serviceProvider; - Capabilities capabilities; - TransactionUtils transactionUtils; - NetworkElement optionalNe; - OnfMicrowaveModel onfMicrowaveModel; - FaultService faultService; - EquipmentService equipmentService; - - protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier - .builder(NetworkElement.class).build(); - - @Before - public void init() { - accessor = mock(NetconfAccessor.class); - serviceProvider = mock(DeviceManagerServiceProvider.class); - capabilities = mock(Capabilities.class); - transactionUtils = mock(TransactionUtils.class); - onfMicrowaveModel = mock(OnfMicrowaveModel.class); - faultService = mock(FaultService.class); - equipmentService = mock(EquipmentService.class); - - when(accessor.getCapabilites()).thenReturn(capabilities); - when(serviceProvider.getFaultService()).thenReturn(faultService); - when(serviceProvider.getEquipmentService()).thenReturn(equipmentService); - - NodeId nNodeId = new NodeId("nSky"); - when(accessor.getNodeId()).thenReturn(nNodeId); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME)).thenReturn(true); - when(accessor.getTransactionUtils()).thenReturn(transactionUtils); - - } - - @Test - public void test() { - optionalNe = new NetworkElement() { - - @Override - public @Nullable List<Label> getLabel() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Extension> getExtension() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable OperationalState getOperationalState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable LifecycleState getLifecycleState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable AdministrativeState getAdministrativeState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable AdministrativeControl getAdministrativeControl() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Name> getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable UniversalId getUuid() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<LocalId> getLocalId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public <E$$ extends Augmentation<NetworkElement>> @Nullable E$$ augmentation(Class<E$$> augmentationType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Ltp> getLtp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Fd> getFd() { - // TODO Auto-generated method stub - return null; - } - }; - - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, - NETWORKELEMENT_IID)).thenReturn(optionalNe); - - ONFCoreNetworkElement12Basic onfCoreNetworkElement12Basic = new ONFCoreNetworkElement12Basic(accessor, - serviceProvider); - onfCoreNetworkElement12Basic.prepareCheck(); - - /* - * EventlogEntity eventlogEntity = new EventlogEntity() { - * - * @Override public @Nullable String getId() { // TODO Auto-generated method - * stub return null; } - * - * @Override public @Nullable DateAndTime getTimestamp() { // TODO - * Auto-generated method stub return null; } - * - * @Override public @Nullable String getObjectId() { // TODO Auto-generated - * method stub return "ABCD"; } - * - * @Override public @Nullable String getNodeId() { // TODO Auto-generated method - * stub return null; } - * - * @Override public @Nullable Integer getCounter() { // TODO Auto-generated - * method stub return null; } - * - * @Override public @Nullable SourceType getSourceType() { // TODO - * Auto-generated method stub return null; } - * - * @Override public @Nullable String getNewValue() { // TODO Auto-generated - * method stub return null; } - * - * @Override public @Nullable String getAttributeName() { // TODO Auto-generated - * method stub return - * "/network-element/extension[value-name=\"top-level-equipment\"]/value"; // - * "/equipment-pac/equipment-current-problems"; } - * - * @Override public Class<? extends DataContainer> getImplementedInterface() { - * // TODO Auto-generated method stub return null; } }; - * - * onfCoreNetworkElement12Basic.notificationActor(eventlogEntity); - */ - - } - - - @Test - public void test1() - { - when (accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); - - ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = - new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, - onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); - - EventlogEntity eventlogEntity = new EventlogEntity() { - - @Override - public @Nullable String getId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable DateAndTime getTimestamp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getObjectId() { - // TODO Auto-generated method stub - return "ABCD"; - } - - @Override - public @Nullable String getNodeId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable Integer getCounter() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable SourceType getSourceType() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getNewValue() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getAttributeName() { - // TODO Auto-generated method stub - return "/equipment-pac/equipment-current-problems"; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - }; - - onfCoreNetworkElement12MW.notificationActor(eventlogEntity); - } + NetconfAccessor accessor; + DeviceManagerServiceProvider serviceProvider; + Capabilities capabilities; + TransactionUtils transactionUtils; + NetworkElement optionalNe; + OnfMicrowaveModel onfMicrowaveModel; + FaultService faultService; + EquipmentService equipmentService; + DeviceManagerOnfConfiguration configuration; + + protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier + .builder(NetworkElement.class).build(); + + @Before + public void init() { + accessor = mock(NetconfAccessor.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + capabilities = mock(Capabilities.class); + transactionUtils = mock(TransactionUtils.class); + onfMicrowaveModel = mock(OnfMicrowaveModel.class); + faultService = mock(FaultService.class); + equipmentService = mock(EquipmentService.class); + configuration = mock(DeviceManagerOnfConfiguration.class); + + when(accessor.getCapabilites()).thenReturn(capabilities); + when(serviceProvider.getFaultService()).thenReturn(faultService); + when(serviceProvider.getEquipmentService()).thenReturn(equipmentService); + + NodeId nNodeId = new NodeId("nSky"); + when(accessor.getNodeId()).thenReturn(nNodeId); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME)).thenReturn(true); + when(accessor.getTransactionUtils()).thenReturn(transactionUtils); + + } + + @Test + public void test() { + optionalNe = new NetworkElement() { + + @Override + public @Nullable List<Label> getLabel() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Extension> getExtension() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable OperationalState getOperationalState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable LifecycleState getLifecycleState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable AdministrativeState getAdministrativeState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable AdministrativeControl getAdministrativeControl() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Name> getName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable UniversalId getUuid() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<LocalId> getLocalId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public <E$$ extends Augmentation<NetworkElement>> @Nullable E$$ augmentation(Class<E$$> augmentationType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Class<? extends DataContainer> getImplementedInterface() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Ltp> getLtp() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Fd> getFd() { + // TODO Auto-generated method stub + return null; + } + }; + + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + NETWORKELEMENT_IID)).thenReturn(optionalNe); + + ONFCoreNetworkElement12Basic onfCoreNetworkElement12Basic = new ONFCoreNetworkElement12Basic(accessor, + serviceProvider,configuration); + onfCoreNetworkElement12Basic.prepareCheck(); + + /* + * EventlogEntity eventlogEntity = new EventlogEntity() { + * + * @Override public @Nullable String getId() { // TODO Auto-generated method + * stub return null; } + * + * @Override public @Nullable DateAndTime getTimestamp() { // TODO + * Auto-generated method stub return null; } + * + * @Override public @Nullable String getObjectId() { // TODO Auto-generated + * method stub return "ABCD"; } + * + * @Override public @Nullable String getNodeId() { // TODO Auto-generated method + * stub return null; } + * + * @Override public @Nullable Integer getCounter() { // TODO Auto-generated + * method stub return null; } + * + * @Override public @Nullable SourceType getSourceType() { // TODO + * Auto-generated method stub return null; } + * + * @Override public @Nullable String getNewValue() { // TODO Auto-generated + * method stub return null; } + * + * @Override public @Nullable String getAttributeName() { // TODO Auto-generated + * method stub return + * "/network-element/extension[value-name=\"top-level-equipment\"]/value"; // + * "/equipment-pac/equipment-current-problems"; } + * + * @Override public Class<? extends DataContainer> getImplementedInterface() { + * // TODO Auto-generated method stub return null; } }; + * + * onfCoreNetworkElement12Basic.notificationActor(eventlogEntity); + */ + + } + + + @Test + public void test1() + { + when (accessor.getTransactionUtils().readData(accessor.getDataBroker(), + LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); + + ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = + new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, + onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); + + EventlogEntity eventlogEntity = new EventlogEntity() { + + @Override + public @Nullable String getId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable DateAndTime getTimestamp() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getObjectId() { + // TODO Auto-generated method stub + return "ABCD"; + } + + @Override + public @Nullable String getNodeId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable Integer getCounter() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable SourceType getSourceType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getNewValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getAttributeName() { + // TODO Auto-generated method stub + return "/equipment-pac/equipment-current-problems"; + } + + @Override + public Class<? extends DataContainer> getImplementedInterface() { + // TODO Auto-generated method stub + return null; + } + }; + + onfCoreNetworkElement12MW.notificationActor(eventlogEntity); + } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java index 63b31b717..a5462d6f1 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,21 +14,18 @@ * 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.onf.ne.test; -import static org.junit.Assert.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.List; -import java.util.Optional; - import org.eclipse.jdt.annotation.Nullable; import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.OnfMicrowaveModel; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.ONFCoreNetworkElement12Basic; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.DeviceManagerOnfConfiguration; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.ONFCoreNetworkElement12Microwave; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService; @@ -60,260 +57,262 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class TestONFCoreNetworkElement12Microwave { - NetconfAccessor accessor; - DeviceManagerServiceProvider serviceProvider; - Capabilities capabilities; - TransactionUtils transactionUtils; - NetworkElement optionalNe; - OnfMicrowaveModel onfMicrowaveModel; - FaultService faultService; - EquipmentService equipmentService; - - protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier - .builder(NetworkElement.class).build(); - - @Before - public void init() { - accessor = mock(NetconfAccessor.class); - serviceProvider = mock(DeviceManagerServiceProvider.class); - capabilities = mock(Capabilities.class); - transactionUtils = mock(TransactionUtils.class); - onfMicrowaveModel = mock(OnfMicrowaveModel.class); - faultService = mock(FaultService.class); - equipmentService = mock(EquipmentService.class); - - when(accessor.getCapabilites()).thenReturn(capabilities); - when(serviceProvider.getFaultService()).thenReturn(faultService); - when(serviceProvider.getEquipmentService()).thenReturn(equipmentService); - - NodeId nNodeId = new NodeId("nSky"); - when(accessor.getNodeId()).thenReturn(nNodeId); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME)).thenReturn(true); - when(accessor.getTransactionUtils()).thenReturn(transactionUtils); - - } - - @Test - public void test() { - optionalNe = new NetworkElement() { - - @Override - public @Nullable List<Label> getLabel() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Extension> getExtension() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable OperationalState getOperationalState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable LifecycleState getLifecycleState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable AdministrativeState getAdministrativeState() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable AdministrativeControl getAdministrativeControl() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Name> getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable UniversalId getUuid() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<LocalId> getLocalId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public <E$$ extends Augmentation<NetworkElement>> @Nullable E$$ augmentation(Class<E$$> augmentationType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Ltp> getLtp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable List<Fd> getFd() { - // TODO Auto-generated method stub - return null; - } - }; - - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, - NETWORKELEMENT_IID)).thenReturn(optionalNe); - - ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = new ONFCoreNetworkElement12Microwave(accessor, - serviceProvider, onfMicrowaveModel); - onfCoreNetworkElement12MW.prepareCheck(); - - EventlogEntity eventlogEntity = new EventlogEntity() { - - @Override - public @Nullable String getId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable DateAndTime getTimestamp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getObjectId() { - // TODO Auto-generated method stub - return "ABCD"; - } - - @Override - public @Nullable String getNodeId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable Integer getCounter() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable SourceType getSourceType() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getNewValue() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getAttributeName() { - // TODO Auto-generated method stub - return "/network-element/extension[value-name=\"top-level-equipment\"]/value"; // "/equipment-pac/equipment-current-problems"; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - }; - - onfCoreNetworkElement12MW.notificationActor(eventlogEntity); - - } - - - @Test - public void test1() - { - when (accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); - - ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = - new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, - onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); - - EventlogEntity eventlogEntity = new EventlogEntity() { - - @Override - public @Nullable String getId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable DateAndTime getTimestamp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getObjectId() { - // TODO Auto-generated method stub - return "ABCD"; - } - - @Override - public @Nullable String getNodeId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable Integer getCounter() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable SourceType getSourceType() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getNewValue() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getAttributeName() { - // TODO Auto-generated method stub - return "/equipment-pac/equipment-current-problems"; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - }; - - onfCoreNetworkElement12MW.notificationActor(eventlogEntity); - } + NetconfAccessor accessor; + DeviceManagerServiceProvider serviceProvider; + Capabilities capabilities; + TransactionUtils transactionUtils; + NetworkElement optionalNe; + OnfMicrowaveModel onfMicrowaveModel; + FaultService faultService; + EquipmentService equipmentService; + DeviceManagerOnfConfiguration configuration; + + protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier + .builder(NetworkElement.class).build(); + + @Before + public void init() { + accessor = mock(NetconfAccessor.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + capabilities = mock(Capabilities.class); + transactionUtils = mock(TransactionUtils.class); + onfMicrowaveModel = mock(OnfMicrowaveModel.class); + faultService = mock(FaultService.class); + equipmentService = mock(EquipmentService.class); + configuration = mock(DeviceManagerOnfConfiguration.class); + + when(accessor.getCapabilites()).thenReturn(capabilities); + when(serviceProvider.getFaultService()).thenReturn(faultService); + when(serviceProvider.getEquipmentService()).thenReturn(equipmentService); + + NodeId nNodeId = new NodeId("nSky"); + when(accessor.getNodeId()).thenReturn(nNodeId); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME)).thenReturn(true); + when(accessor.getTransactionUtils()).thenReturn(transactionUtils); + + } + + @Test + public void test() { + optionalNe = new NetworkElement() { + + @Override + public @Nullable List<Label> getLabel() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Extension> getExtension() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable OperationalState getOperationalState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable LifecycleState getLifecycleState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable AdministrativeState getAdministrativeState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable AdministrativeControl getAdministrativeControl() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Name> getName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable UniversalId getUuid() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<LocalId> getLocalId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public <E$$ extends Augmentation<NetworkElement>> @Nullable E$$ augmentation(Class<E$$> augmentationType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Class<? extends DataContainer> getImplementedInterface() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Ltp> getLtp() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable List<Fd> getFd() { + // TODO Auto-generated method stub + return null; + } + }; + + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + NETWORKELEMENT_IID)).thenReturn(optionalNe); + + ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = new ONFCoreNetworkElement12Microwave(accessor, + serviceProvider, configuration, onfMicrowaveModel); + onfCoreNetworkElement12MW.prepareCheck(); + + EventlogEntity eventlogEntity = new EventlogEntity() { + + @Override + public @Nullable String getId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable DateAndTime getTimestamp() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getObjectId() { + // TODO Auto-generated method stub + return "ABCD"; + } + + @Override + public @Nullable String getNodeId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable Integer getCounter() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable SourceType getSourceType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getNewValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getAttributeName() { + // TODO Auto-generated method stub + return "/network-element/extension[value-name=\"top-level-equipment\"]/value"; // "/equipment-pac/equipment-current-problems"; + } + + @Override + public Class<? extends DataContainer> getImplementedInterface() { + // TODO Auto-generated method stub + return null; + } + }; + + onfCoreNetworkElement12MW.notificationActor(eventlogEntity); + + } + + + @Test + public void test1() + { + when (accessor.getTransactionUtils().readData(accessor.getDataBroker(), + LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); + + ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = + new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, + onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); + + EventlogEntity eventlogEntity = new EventlogEntity() { + + @Override + public @Nullable String getId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable DateAndTime getTimestamp() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getObjectId() { + // TODO Auto-generated method stub + return "ABCD"; + } + + @Override + public @Nullable String getNodeId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable Integer getCounter() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable SourceType getSourceType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getNewValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getAttributeName() { + // TODO Auto-generated method stub + return "/equipment-pac/equipment-current-problems"; + } + + @Override + public Class<? extends DataContainer> getImplementedInterface() { + // TODO Auto-generated method stub + return null; + } + }; + + onfCoreNetworkElement12MW.notificationActor(eventlogEntity); + } } |