X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FSSHNetconfClientLiveTest.java;fp=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FSSHNetconfClientLiveTest.java;h=0000000000000000000000000000000000000000;hp=1357201f5754d75ee6d7b4874aa78f6a6ceb48d7;hb=490e58f15373444b94642aebb2afbec9a62b9a57;hpb=1d159b16ac23b4935ed6a0df683558ab42cd6f2c diff --git a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java deleted file mode 100644 index 1357201f57..0000000000 --- a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.netconf.client; - -import io.netty.channel.nio.NioEventLoopGroup; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.opendaylight.controller.netconf.util.handler.ssh.authentication.LoginPassword; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -@Ignore -public class SSHNetconfClientLiveTest { - private static final Logger logger = LoggerFactory.getLogger(SSHNetconfClientLiveTest.class); - - NioEventLoopGroup nettyThreadgroup; - NetconfSshClientDispatcher netconfClientDispatcher; - InetSocketAddress address; - final int connectionAttempts = 10, attemptMsTimeout = 1000; - final int connectionTimeoutMillis = 20000; - - @Before - public void setUp() { - nettyThreadgroup = new NioEventLoopGroup(); - - netconfClientDispatcher = new NetconfSshClientDispatcher(new LoginPassword( - System.getProperty("username"), System.getProperty("password")), - nettyThreadgroup, nettyThreadgroup, connectionTimeoutMillis); - - address = new InetSocketAddress(System.getProperty("host"), Integer.parseInt(System.getProperty("port"))); - } - - @Ignore - @Test - public void test() throws Exception { - //runnable.run(); - } - - @Test - public void testInExecutor() throws Exception { - int threads = 4; - ExecutorService executorService = Executors.newFixedThreadPool(threads); - try { - for (int i= 0;i< threads;i++) { - InetSocketAddress address = new InetSocketAddress(System.getProperty("host"), - Integer.parseInt(System.getProperty("port"))); - NetconfRunnable runnable = new NetconfRunnable(address); - executorService.execute(runnable); - } - executorService.shutdown(); - executorService.awaitTermination(1, TimeUnit.MINUTES); - - - } finally { - executorService.shutdownNow(); - } - } - - class NetconfRunnable implements Runnable { - private final InetSocketAddress address; - - NetconfRunnable(InetSocketAddress address) { - this.address = address; - } - - @Override - public void run() { - try (NetconfClient netconfClient = new NetconfClient(address.toString(), address, connectionAttempts, - attemptMsTimeout, netconfClientDispatcher);) { - logger.info("OK {}", address); - } catch (InterruptedException | IOException e) { - logger.error("Failed {}", address, e); - } - } - }; -}