Refactoring of web-sockets in RESTCONF RFC-8040
[netconf.git] / restconf / restconf-nb-rfc8040 / src / test / java / org / opendaylight / restconf / nb / rfc8040 / streams / listeners / NotificationListenerTest.java
index 33328bc2d11a80e0b48a98e6bf015583f6e07c32..8b1ede41166f2e2dc9d986fa36cf9d05f3150148 100644 (file)
@@ -18,7 +18,6 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import org.junit.Before;
@@ -215,14 +214,10 @@ public class NotificationListenerTest {
         return child;
     }
 
-    private String prepareJson(final DOMNotification notificationData, final SchemaPath schemaPathNotifi)
-            throws Exception {
-        final List<SchemaPath> paths = new ArrayList<>();
-        paths.add(schemaPathNotifi);
-        final List<NotificationListenerAdapter> listNotifi =
-                Notificator.createNotificationListener(paths, "stream-name", NotificationOutputType.JSON.toString());
-        final NotificationListenerAdapter notifi = listNotifi.get(0);
-        final String result = notifi.prepareJson(schmeaCtx, notificationData);
+    private String prepareJson(final DOMNotification notificationData, final SchemaPath schemaPathNotifi) {
+        final NotificationListenerAdapter notifiAdapter = ListenersBroker.getInstance().registerNotificationListener(
+                schemaPathNotifi, "stream-name", NotificationOutputType.JSON);
+        final String result = notifiAdapter.prepareJson(schmeaCtx, notificationData);
         return Preconditions.checkNotNull(result);
     }
 }