X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fimpl%2FNetconfServerSessionListenerTest.java;h=e7d5bb3e2daa4f3f6f5142bfae31401872c0f738;hb=bb0a5647411830d544b19fb79c35b7e563d12079;hp=af514d195c643344bec4149b944f4d8f94480f0f;hpb=72418928523aeb198af69f9ccc8388ff903a66a0;p=netconf.git
diff --git a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/NetconfServerSessionListenerTest.java b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/NetconfServerSessionListenerTest.java
index af514d195c..e7d5bb3e2d 100644
--- a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/NetconfServerSessionListenerTest.java
+++ b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/NetconfServerSessionListenerTest.java
@@ -25,12 +25,12 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.config.util.xml.XmlUtil;
import org.opendaylight.netconf.api.NetconfMessage;
import org.opendaylight.netconf.api.NetconfTerminationReason;
import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
import org.opendaylight.netconf.api.monitoring.SessionEvent;
import org.opendaylight.netconf.api.monitoring.SessionListener;
+import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.impl.osgi.NetconfOperationRouter;
import org.opendaylight.netconf.notifications.NetconfNotification;
import org.w3c.dom.Document;
@@ -91,15 +91,15 @@ public class NetconfServerSessionListenerTest {
@Test
public void testOnMessage() throws Exception {
- final Document reply = XmlUtil.readXmlToDocument("");
+ final Document reply = XmlUtil.readXmlToDocument("");
doReturn(reply).when(router).onNetconfMessage(any(), any());
- final NetconfMessage msg = new NetconfMessage(XmlUtil.readXmlToDocument(""));
+ final NetconfMessage msg = new NetconfMessage(XmlUtil.readXmlToDocument(""));
listener.onMessage(session, msg);
verify(monitoringListener).onSessionEvent(argThat(sessionEventIs(SessionEvent.Type.IN_RPC_SUCCESS)));
channel.runPendingTasks();
- final NetconfMessage sentMsg = (NetconfMessage) channel.readOutbound();
+ final NetconfMessage sentMsg = channel.readOutbound();
final Diff diff = XMLUnit.compareXML(reply, sentMsg.getDocument());
Assert.assertTrue(diff.toString(), diff.similar());
}
@@ -108,8 +108,8 @@ public class NetconfServerSessionListenerTest {
public void testOnMessageRuntimeFail() throws Exception {
doThrow(new RuntimeException("runtime fail")).when(router).onNetconfMessage(any(), any());
final Document reply =
- XmlUtil.readXmlToDocument("" +
- "");
+ XmlUtil.readXmlToDocument(""
+ + "");
final NetconfMessage msg = new NetconfMessage(reply);
try {
listener.onMessage(session, msg);
@@ -119,28 +119,29 @@ public class NetconfServerSessionListenerTest {
}
}
+ @SuppressWarnings("checkstyle:RegexpSinglelineJava")
@Test
public void testOnMessageDocumentedFail() throws Exception {
final Document reply =
- XmlUtil.readXmlToDocument("\n" +
- "\n" +
- "PROTOCOL\n" +
- "unknown-element\n" +
- "ERROR\n" +
- "Unknown tag bad-rpc in message:\n" +
- "<bad-rpc/>\n" +
- "\n" +
- "\n" +
- "bad-rpc\n" +
- "\n" +
- "\n" +
- "");
+ XmlUtil.readXmlToDocument("\n"
+ + "\n"
+ + "protocol\n"
+ + "unknown-element\n"
+ + "error\n"
+ + "Unknown tag bad-rpc in message:\n"
+ + "<bad-rpc/>\n"
+ + "\n"
+ + "\n"
+ + "bad-rpc\n"
+ + "\n"
+ + "\n"
+ + "");
final NetconfMessage msg = new NetconfMessage(XmlUtil.readXmlToDocument(""));
listener.onMessage(session, msg);
verify(monitoringListener).onSessionEvent(argThat(sessionEventIs(SessionEvent.Type.IN_RPC_FAIL)));
verify(monitoringListener).onSessionEvent(argThat(sessionEventIs(SessionEvent.Type.OUT_RPC_ERROR)));
channel.runPendingTasks();
- final NetconfMessage sentMsg = (NetconfMessage) channel.readOutbound();
+ final NetconfMessage sentMsg = channel.readOutbound();
System.out.println(XmlUtil.toString(sentMsg.getDocument()));
System.out.println(XmlUtil.toString(reply));
final Diff diff = XMLUnit.compareXML(reply, sentMsg.getDocument());
@@ -166,4 +167,4 @@ public class NetconfServerSessionListenerTest {
};
}
-}
\ No newline at end of file
+}