public void testSendNotification() throws Exception {
doNothing().when(listener).onNotification(any(), any());
final Document msgDoc = XmlUtil.readXmlToDocument("<notification></notification>");
- final NetconfNotification msg = new NetconfNotification(msgDoc);
- session.sendMessage(msg);
+ final NetconfNotification notif = new NetconfNotification(msgDoc);
+ session.sendMessage(notif);
channel.runPendingTasks();
final Object o = channel.readOutbound();
- Assert.assertEquals(msg, o);
- verify(listener).onNotification(session, msg);
+ Assert.assertEquals(notif, o);
+ verify(listener).onNotification(session, notif);
}
@Test
public void testToManagementSession() throws Exception {
final NetconfHelloMessageAdditionalHeader header =
new NetconfHelloMessageAdditionalHeader(USER, HOST, PORT, TCP_TRANSPORT, SESSION_ID);
- final EmbeddedChannel channel = new EmbeddedChannel();
- final NetconfServerSession tcpSession = new NetconfServerSession(listener, channel, 1L, header);
+ final EmbeddedChannel ch = new EmbeddedChannel();
+ final NetconfServerSession tcpSession = new NetconfServerSession(listener, ch, 1L, header);
tcpSession.sessionUp();
final Session managementSession = tcpSession.toManagementSession();
Assert.assertEquals(new String(managementSession.getSourceHost().getValue()), HOST);
public void testToManagementSessionUnknownTransport() throws Exception {
final NetconfHelloMessageAdditionalHeader header =
new NetconfHelloMessageAdditionalHeader(USER, HOST, PORT, "http", SESSION_ID);
- final EmbeddedChannel channel = new EmbeddedChannel();
- final NetconfServerSession tcpSession = new NetconfServerSession(listener, channel, 1L, header);
+ final EmbeddedChannel ch = new EmbeddedChannel();
+ final NetconfServerSession tcpSession = new NetconfServerSession(listener, ch, 1L, header);
tcpSession.sessionUp();
tcpSession.toManagementSession();
}
public void testToManagementSessionIpv6() throws Exception {
final NetconfHelloMessageAdditionalHeader header =
new NetconfHelloMessageAdditionalHeader(USER, "::1", PORT, SSH_TRANSPORT, SESSION_ID);
- final EmbeddedChannel channel = new EmbeddedChannel();
- final NetconfServerSession tcpSession = new NetconfServerSession(listener, channel, 1L, header);
+ final EmbeddedChannel ch = new EmbeddedChannel();
+ final NetconfServerSession tcpSession = new NetconfServerSession(listener, ch, 1L, header);
tcpSession.sessionUp();
final Session managementSession = tcpSession.toManagementSession();
Assert.assertEquals(new String(managementSession.getSourceHost().getValue()), "::1");
Assert.assertTrue(NetconfMessageToXMLEncoder.class.equals(encoder.getClass()));
}
-}
\ No newline at end of file
+}