Merge "change to static function"
authorTomas Cere <tcere@cisco.com>
Tue, 29 Mar 2016 12:12:33 +0000 (12:12 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 29 Mar 2016 12:12:33 +0000 (12:12 +0000)
netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/TestingNetconfClient.java

index 131bea96716334d744e4be6b335f02dcee03fa38..dabe11a3ed9606b42daf45cbde69075cd0787437 100644 (file)
@@ -25,12 +25,12 @@ import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler;
-import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.client.conf.NetconfClientConfiguration;
 import org.opendaylight.netconf.client.conf.NetconfClientConfiguration.NetconfClientProtocol;
 import org.opendaylight.netconf.client.conf.NetconfClientConfigurationBuilder;
+import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler;
+import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
 import org.opendaylight.protocol.framework.NeverReconnectStrategy;
 
 
@@ -47,21 +47,21 @@ public class TestingNetconfClient implements Closeable {
     private final long sessionId;
 
     public TestingNetconfClient(String clientLabel,
-                                 NetconfClientDispatcher netconfClientDispatcher, final NetconfClientConfiguration config) throws InterruptedException {
+                                NetconfClientDispatcher netconfClientDispatcher, final NetconfClientConfiguration config) throws InterruptedException {
         this.label = clientLabel;
         sessionListener = config.getSessionListener();
         Future<NetconfClientSession> clientFuture = netconfClientDispatcher.createClient(config);
-        clientSession = get(clientFuture);//TODO: make static
+        clientSession = get(clientFuture);
         this.sessionId = clientSession.getSessionId();
     }
 
-    private NetconfClientSession get(Future<NetconfClientSession> clientFuture) throws InterruptedException {
+    private static NetconfClientSession get(Future<NetconfClientSession> clientFuture) throws InterruptedException {
         try {
             return clientFuture.get();
         } catch (CancellationException e) {
-            throw new RuntimeException("Cancelling " + this, e);
+            throw new RuntimeException("Cancelling " + TestingNetconfClient.class.getSimpleName(), e);
         } catch (ExecutionException e) {
-            throw new IllegalStateException("Unable to create " + this, e);
+            throw new IllegalStateException("Unable to create " + TestingNetconfClient.class.getSimpleName(), e);
         }
     }