aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-02-03 15:03:14 +0100
committerDan Timoney <dtimoney@att.com>2021-02-05 22:56:53 +0000
commit95264d6d078e4d07e147369b007ae2c9791769c8 (patch)
tree2ec5ff4f3973ee5f3c42fec8de49abfda3e67a22 /sdnr
parentf7cc6a1daa39f583494dc0a71b89e1a1317a0a2b (diff)
Migrate common-yang and devicemanager
Migrate common-yang and devicemanager to Aluminium Issue-ID: CCSDK-3132 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: I441029206fc41e2207d20e0c62f1d6a3a1254def Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr')
-rwxr-xr-xsdnr/wt/common-yang/iana-crypt-hash/pom.xml2
-rwxr-xr-xsdnr/wt/common-yang/ietf-alarms/pom.xml6
-rwxr-xr-xsdnr/wt/common-yang/onap/pom.xml2
-rwxr-xr-xsdnr/wt/common-yang/pom.xml5
-rwxr-xr-xsdnr/wt/common-yang/rfc7317-ietf-system/pom.xml2
-rwxr-xr-xsdnr/wt/common-yang/rfc8341/pom.xml2
-rw-r--r--sdnr/wt/devicemanager/feature/pom.xml3
-rwxr-xr-xsdnr/wt/devicemanager/installer/pom.xml2
-rw-r--r--sdnr/wt/devicemanager/model/pom.xml2
-rw-r--r--sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NetconfNetworkElementService.java4
-rwxr-xr-xsdnr/wt/devicemanager/pom.xml2
-rw-r--r--sdnr/wt/devicemanager/provider/pom.xml22
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java10
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java5
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java3
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java21
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java27
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java10
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java61
19 files changed, 133 insertions, 58 deletions
diff --git a/sdnr/wt/common-yang/iana-crypt-hash/pom.xml b/sdnr/wt/common-yang/iana-crypt-hash/pom.xml
index 816ffc9cc..67bb4ae80 100755
--- a/sdnr/wt/common-yang/iana-crypt-hash/pom.xml
+++ b/sdnr/wt/common-yang/iana-crypt-hash/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/common-yang/ietf-alarms/pom.xml b/sdnr/wt/common-yang/ietf-alarms/pom.xml
index 2f02e061c..8d02fc9d8 100755
--- a/sdnr/wt/common-yang/ietf-alarms/pom.xml
+++ b/sdnr/wt/common-yang/ietf-alarms/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -39,9 +39,9 @@
<name>ccsdk-features :: ${project.artifactId}</name>
<dependencies>
- <dependency>
+ <dependency>
<groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
<artifactId>rfc6991-ietf-yang-types</artifactId>
- </dependency>
+ </dependency>
</dependencies>
</project>
diff --git a/sdnr/wt/common-yang/onap/pom.xml b/sdnr/wt/common-yang/onap/pom.xml
index 6913fef0c..43b9423a2 100755
--- a/sdnr/wt/common-yang/onap/pom.xml
+++ b/sdnr/wt/common-yang/onap/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/common-yang/pom.xml b/sdnr/wt/common-yang/pom.xml
index 7bc886b4f..64e327bd9 100755
--- a/sdnr/wt/common-yang/pom.xml
+++ b/sdnr/wt/common-yang/pom.xml
@@ -27,12 +27,12 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>common-yang</artifactId>
+ <artifactId>sdnr-wt-common-yang</artifactId>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
@@ -45,4 +45,5 @@
<module>rfc7317-ietf-system</module>
<module>ietf-alarms</module>
</modules>
+
</project>
diff --git a/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml b/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml
index 25d92c1a0..baeba1c23 100755
--- a/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml
+++ b/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/common-yang/rfc8341/pom.xml b/sdnr/wt/common-yang/rfc8341/pom.xml
index 4f7e9ef87..e2feda195 100755
--- a/sdnr/wt/common-yang/rfc8341/pom.xml
+++ b/sdnr/wt/common-yang/rfc8341/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager/feature/pom.xml b/sdnr/wt/devicemanager/feature/pom.xml
index 3684462b2..0a00829fe 100644
--- a/sdnr/wt/devicemanager/feature/pom.xml
+++ b/sdnr/wt/devicemanager/feature/pom.xml
@@ -23,13 +23,14 @@
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager/installer/pom.xml b/sdnr/wt/devicemanager/installer/pom.xml
index fb59b7453..010d4d154 100755
--- a/sdnr/wt/devicemanager/installer/pom.xml
+++ b/sdnr/wt/devicemanager/installer/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager/model/pom.xml b/sdnr/wt/devicemanager/model/pom.xml
index 251005dce..3a031f193 100644
--- a/sdnr/wt/devicemanager/model/pom.xml
+++ b/sdnr/wt/devicemanager/model/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NetconfNetworkElementService.java b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NetconfNetworkElementService.java
index 80a7e2f07..8cfb43d02 100644
--- a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NetconfNetworkElementService.java
+++ b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NetconfNetworkElementService.java
@@ -24,9 +24,9 @@ import org.opendaylight.yangtools.concepts.Registration;
public interface NetconfNetworkElementService extends Registration, DeviceManagerService {
- /** Register factory class for network-element handler **/
+ /** Register factory class for network-element handler for binding api**/
@NonNull
- <L extends NetworkElementFactory> FactoryRegistration<L> registerNetworkElementFactory(@NonNull L factory);
+ <L extends NetworkElementFactory> FactoryRegistration<L> registerBindingNetworkElementFactory(@NonNull L factory);
/** Get Devicemanager service **/
DeviceManagerServiceProvider getServiceProvider();
diff --git a/sdnr/wt/devicemanager/pom.xml b/sdnr/wt/devicemanager/pom.xml
index 37d4679b5..cdc0a5349 100755
--- a/sdnr/wt/devicemanager/pom.xml
+++ b/sdnr/wt/devicemanager/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager/provider/pom.xml b/sdnr/wt/devicemanager/provider/pom.xml
index 92643fb57..7194836dd 100644
--- a/sdnr/wt/devicemanager/provider/pom.xml
+++ b/sdnr/wt/devicemanager/provider/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -47,7 +47,6 @@
</licenses>
<properties>
- <checkstyle.skip>true</checkstyle.skip> <!-- POM configuration -->
<maven.javadoc.skip>true</maven.javadoc.skip>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
<buildtime>${maven.build.timestamp} UTC</buildtime>
@@ -120,12 +119,12 @@
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
- <artifactId>akka-actor_2.12</artifactId>
+ <artifactId>akka-actor_2.13</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
- <artifactId>akka-cluster_2.12</artifactId>
+ <artifactId>akka-cluster_2.13</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
@@ -153,6 +152,21 @@
<artifactId>jackson-databind</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-runtime</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java
index d84764e89..e15a577b7 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java
@@ -17,12 +17,13 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-
import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.ArchiveCleanProvider;
@@ -34,9 +35,6 @@ import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
public class ArchiveCleanService implements AutoCloseable, IConfigChangedListener, Runnable, ClusterSingletonService {
private static final Logger LOG = LoggerFactory.getLogger(ArchiveCleanService.class);
@@ -132,7 +130,8 @@ public class ArchiveCleanService implements AutoCloseable, IConfigChangedListene
public void close() throws Exception {
this.esConfig.unregisterConfigChangedListener(this);
this.scheduler.shutdown();
- this.cssRegistration.close();
+ if (this.cssRegistration != null)
+ this.cssRegistration.close();
}
@Override
@@ -141,7 +140,6 @@ public class ArchiveCleanService implements AutoCloseable, IConfigChangedListene
+ "ArchiveLifetimeSeconds=" + esConfig.getArchiveLifetimeSeconds() + "]";
}
- @SuppressWarnings("null")
@Override
public @NonNull ServiceGroupIdentifier getIdentifier() {
return IDENT;
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
index 4fe7d180e..49c678ebc 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
@@ -23,7 +23,6 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
@@ -228,10 +227,10 @@ public class ConnectionStatusHousekeepingService
this.cfg.unregisterConfigChangedListener(this);
}
this.scheduler.shutdown();
- this.cssRegistration2.close();
+ if (this.cssRegistration2 != null)
+ this.cssRegistration2.close();
}
- @SuppressWarnings("null")
@Override
public @NonNull ServiceGroupIdentifier getIdentifier() {
return IDENT;
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
index f3112fbe3..fd2929f1a 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
@@ -278,7 +278,7 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa
}
@Override
- public @NonNull <L extends NetworkElementFactory> FactoryRegistration<L> registerNetworkElementFactory(
+ public @NonNull <L extends NetworkElementFactory> FactoryRegistration<L> registerBindingNetworkElementFactory(
@NonNull L factory) {
LOG.info("Factory registration {}", factory.getClass().getName());
@@ -419,5 +419,4 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa
return this.vesCollectorClient;
}
-
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java
index 81a740305..bc44543e8 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java
@@ -17,8 +17,9 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
+import javax.xml.bind.JAXBException;
import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventInputBuilder;
@@ -40,7 +41,7 @@ public class WebSocketServiceClientImpl2 implements WebSocketServiceClientIntern
/**
* New: Implementation of Websocket notification processor.
- *
+ *
* @param websocketmanagerService2 to be used
*/
public WebSocketServiceClientImpl2(WebsocketmanagerService websocketmanagerService2) {
@@ -52,18 +53,18 @@ public class WebSocketServiceClientImpl2 implements WebSocketServiceClientIntern
@Override
public <T extends MwtNotificationBase & GetEventType> void sendViaWebsockets(@NonNull String nodeName,
@NonNull T notificationXml) {
- LOG.info("Send websocket event {} for mountpoint {}", notificationXml.getClass().getSimpleName(), nodeName);
+ LOG.debug("Send websocket event {} for mountpoint {}", notificationXml.getClass().getSimpleName(), nodeName);
+ WebsocketEventInputBuilder wsBuilder = new WebsocketEventInputBuilder();
+ wsBuilder.setNodeName(nodeName);
+ wsBuilder.setEventType(notificationXml.getEventType());
try {
- WebsocketEventInputBuilder wsBuilder = new WebsocketEventInputBuilder();
- wsBuilder.setNodeName(nodeName);
- wsBuilder.setEventType(notificationXml.getEventType());
wsBuilder.setXmlEvent(xmlMapper.getXmlString(notificationXml));
Future<RpcResult<WebsocketEventOutput>> result = websocketmanagerService.websocketEvent(wsBuilder.build());
- LOG.info("Send websocket result: {}", result.get().getResult().getResponse());
- } catch (Exception e) {
- LOG.warn("Can not send websocket event {} for mountpoint {} {}", notificationXml.getClass().getSimpleName(),
- nodeName, e.toString());
+ if (result != null)
+ LOG.trace("Send websocket result: {}", result == null ? "null" : result.get().getResult().getResponse());
+ } catch (JAXBException | InterruptedException | ExecutionException e) {
+ LOG.warn("Can not send websocket event {} for mountpoint {} {}", notificationXml, nodeName, e.toString());
}
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java
index 8a2b9f1fa..62bd50de5 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java
@@ -6,9 +6,9 @@
* =================================================================================================
* 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
@@ -25,25 +25,20 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class XmlMapper {
+ @SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(XmlMapper.class);
- public String getXmlString(MwtNotificationBase base) {
+ public String getXmlString(MwtNotificationBase base) throws JAXBException {
String xml;
JAXBContext jaxbContext;
- try {
- jaxbContext = JAXBContext.newInstance(AttributeValueChangedNotificationXml.class,
- ObjectCreationNotificationXml.class, ObjectDeletionNotificationXml.class,
- ProblemNotificationXml.class);
- Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
- jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ jaxbContext = JAXBContext.newInstance(AttributeValueChangedNotificationXml.class,
+ ObjectCreationNotificationXml.class, ObjectDeletionNotificationXml.class, ProblemNotificationXml.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
+ jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- StringWriter stringWriter = new StringWriter();
- jaxbMarshaller.marshal(base, stringWriter);
- xml = stringWriter.toString();
- } catch (JAXBException e) {
- LOG.warn("Problem in marshalling xml file {}", e);
- xml = null;
- }
+ StringWriter stringWriter = new StringWriter();
+ jaxbMarshaller.marshal(base, stringWriter);
+ xml = stringWriter.toString();
return xml;
}
}
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);
+ }
+
+}