Remove onRemoteSessionFailed()
[netconf.git] / netconf / tools / netconf-testtool / src / main / java / org / opendaylight / netconf / test / tool / client / stress / StressClient.java
index 3832d9e11db1928028fc3748b8771276c4e7865e..ab3dd0694b33c7d944d69955f8223d0fb4973f0e 100644 (file)
@@ -30,10 +30,10 @@ import net.sourceforge.argparse4j.inf.ArgumentParserException;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.api.xml.XmlUtil;
 import org.opendaylight.netconf.client.NetconfClientDispatcherImpl;
+import org.opendaylight.netconf.client.mdsal.NetconfDeviceCommunicator;
+import org.opendaylight.netconf.client.mdsal.api.NetconfSessionPreferences;
+import org.opendaylight.netconf.client.mdsal.api.RemoteDevice;
 import org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandler;
-import org.opendaylight.netconf.sal.connect.api.RemoteDevice;
-import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCommunicator;
-import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
 import org.opendaylight.netconf.test.tool.TestToolUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.CommitInput;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.EditConfigInput;
@@ -174,12 +174,12 @@ public final class StressClient {
                 try {
                     future.get(4L, TimeUnit.MINUTES);
                 } catch (ExecutionException | TimeoutException e) {
-                    throw new RuntimeException(e);
+                    throw new IllegalStateException(e);
                 }
             }
             executorService.shutdownNow();
         } catch (final InterruptedException e) {
-            throw new RuntimeException("Unable to execute requests", e);
+            throw new IllegalStateException("Unable to execute requests", e);
         }
         started.stop();
 
@@ -234,18 +234,14 @@ public final class StressClient {
         final NetconfClientDispatcherImpl netconfClientDispatcher;
         if (params.exi) {
             if (params.legacyFraming) {
-                netconfClientDispatcher = ConfigurableClientDispatcher.createLegacyExi(nioGroup, nioGroup, timer,
-                        null);
+                netconfClientDispatcher = ConfigurableClientDispatcher.createLegacyExi(nioGroup, nioGroup, timer);
             } else {
-                netconfClientDispatcher = ConfigurableClientDispatcher.createChunkedExi(nioGroup, nioGroup, timer,
-                        null);
+                netconfClientDispatcher = ConfigurableClientDispatcher.createChunkedExi(nioGroup, nioGroup, timer);
             }
+        } else if (params.legacyFraming) {
+            netconfClientDispatcher = ConfigurableClientDispatcher.createLegacy(nioGroup, nioGroup, timer);
         } else {
-            if (params.legacyFraming) {
-                netconfClientDispatcher = ConfigurableClientDispatcher.createLegacy(nioGroup, nioGroup, timer, null);
-            } else {
-                netconfClientDispatcher = ConfigurableClientDispatcher.createChunked(nioGroup, nioGroup, timer, null);
-            }
+            netconfClientDispatcher = ConfigurableClientDispatcher.createChunked(nioGroup, nioGroup, timer);
         }
         return netconfClientDispatcher;
     }
@@ -263,8 +259,7 @@ public final class StressClient {
         return null;
     }
 
-    static class LoggingRemoteDevice
-            implements RemoteDevice<NetconfSessionPreferences, NetconfMessage, NetconfDeviceCommunicator> {
+    static class LoggingRemoteDevice implements RemoteDevice<NetconfDeviceCommunicator> {
         @Override
         public void onRemoteSessionUp(final NetconfSessionPreferences remoteSessionCapabilities,
                                       final NetconfDeviceCommunicator netconfDeviceCommunicator) {
@@ -276,15 +271,9 @@ public final class StressClient {
             LOG.info("Session down");
         }
 
-        @Override
-        public void onRemoteSessionFailed(final Throwable throwable) {
-            LOG.info("Session failed");
-        }
-
         @Override
         public void onNotification(final NetconfMessage notification) {
-            LOG.info("Notification received: {}", notification.toString());
+            LOG.info("Notification received: {}", notification);
         }
     }
-
 }