use of org.opendaylight.netconf.notifications.NetconfNotification in project netconf by opendaylight.
the class NotificationsTransformUtilTest method testTransformFromDOM.
@Test
public void testTransformFromDOM() throws Exception {
final NetconfNotification netconfNotification = new NetconfNotification(XmlUtil.readXmlToDocument(INNER_NOTIFICATION), DATE);
XMLUnit.setIgnoreWhitespace(true);
compareXml(EXPECTED_NOTIFICATION, netconfNotification.toString());
}
use of org.opendaylight.netconf.notifications.NetconfNotification in project netconf by opendaylight.
the class NotificationsTransformUtilTest method testTransform.
@Test
public void testTransform() throws Exception {
final NetconfCapabilityChangeBuilder netconfCapabilityChangeBuilder = new NetconfCapabilityChangeBuilder();
netconfCapabilityChangeBuilder.setAddedCapability(Lists.newArrayList(new Uri("uri1"), new Uri("uri1")));
netconfCapabilityChangeBuilder.setDeletedCapability(Lists.newArrayList(new Uri("uri4"), new Uri("uri3")));
final NetconfCapabilityChange capabilityChange = netconfCapabilityChangeBuilder.build();
final NetconfNotification transform = UTIL.transform(capabilityChange, DATE, SchemaPath.create(true, NetconfCapabilityChange.QNAME));
final String serialized = XmlUtil.toString(transform.getDocument());
compareXml(EXPECTED_NOTIFICATION, serialized);
}
use of org.opendaylight.netconf.notifications.NetconfNotification in project netconf by opendaylight.
the class NetconfServerSession method sendMessage.
@Override
public ChannelFuture sendMessage(final NetconfMessage netconfMessage) {
final ChannelFuture channelFuture = super.sendMessage(netconfMessage);
if (netconfMessage instanceof NetconfNotification) {
outNotification++;
sessionListener.onNotification(this, (NetconfNotification) netconfMessage);
}
// delayed close was set, close after the message was sent
if (delayedClose) {
channelFuture.addListener(future -> close());
}
return channelFuture;
}
use of org.opendaylight.netconf.notifications.NetconfNotification in project netconf by opendaylight.
the class NetconfServerSessionListenerTest method testOnNotification.
@Test
public void testOnNotification() throws Exception {
listener.onNotification(session, new NetconfNotification(XmlUtil.readXmlToDocument("<notification/>")));
verify(monitoringListener).onSessionEvent(argThat(sessionEventIs(SessionEvent.Type.NOTIFICATION)));
}
use of org.opendaylight.netconf.notifications.NetconfNotification in project netconf by opendaylight.
the class NetconfServerSessionTest method testSendNotification.
@Test
public void testSendNotification() throws Exception {
doNothing().when(listener).onNotification(any(), any());
final Document msgDoc = XmlUtil.readXmlToDocument("<notification></notification>");
final NetconfNotification notif = new NetconfNotification(msgDoc);
session.sendMessage(notif);
channel.runPendingTasks();
final Object o = channel.readOutbound();
assertEquals(notif, o);
verify(listener).onNotification(session, notif);
}
Aggregations