diff options
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src/test')
2 files changed, 69 insertions, 2 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java index 3d64d46ad..a089aa22c 100644 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java @@ -21,7 +21,6 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.test; import static org.junit.Assert.assertTrue; - import java.util.Arrays; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -31,6 +30,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEntityDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEsConfig; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; @@ -126,6 +126,11 @@ public class TestDevicemanager extends Mockito { } @Test + public void testMapping() { + + } + + @Test public void testChangeNotification() { NotificationService n = deviceManager.getNotificationService(); @@ -147,7 +152,8 @@ public class TestDevicemanager extends Mockito { FaultService n = deviceManager.getFaultService(); FaultlogBuilder faultLogEntityBuilder = new FaultlogBuilder(); - n.faultNotification(faultLogEntityBuilder.setNodeId("node1").build()); + n.faultNotification(faultLogEntityBuilder.setNodeId("node1") + .setTimestamp(NetconfTimeStampImpl.getTestpatternDateAndTime()).build()); } diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java new file mode 100644 index 000000000..f79589f62 --- /dev/null +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * 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.test; + +import static org.junit.Assert.fail; +import javax.xml.bind.JAXBException; +import org.eclipse.jdt.annotation.Nullable; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.XmlMapper; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EventlogNotificationBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Eventlog; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; + +@SuppressWarnings("deprecation") +public class TestXmlMapper { + + @Test + public void test() { + XmlMapper xmlMapper = new XmlMapper(); + AttributeValueChangedNotificationXml event = getChangeNotification(new NodeId("NodeTest1"), 2, InternalDateAndTime.getTestpatternDateAndTime(), "ObjTest1", + "AtrributeTest1", "NewTest1"); + + try { + String result = xmlMapper.getXmlString(event); + System.out.println("Mappingresult = "+result); + } catch (JAXBException e) { + e.printStackTrace(); + fail("Problem with xml mapping."); + } + + } + + public AttributeValueChangedNotificationXml getChangeNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp, + @Nullable String objectId, @Nullable String attributeName, @Nullable String newValue) { + Eventlog eventlogEntity = new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, attributeName, newValue).build(); + return new AttributeValueChangedNotificationXml(eventlogEntity); + } + +} |