X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-it%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fit%2FAbstractNetconfConfigTest.java;h=d4073e5c178f1748ef71ee8466e70982646dab94;hp=b81f950cb362cf8f810201bfe98c983e1bf0988d;hb=31b7a44c89d1057489338492fcf62a64147bea24;hpb=f776809962df87deeaa533ba995cc6fceba64d0e diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java index b81f950cb3..d4073e5c17 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java @@ -7,22 +7,30 @@ */ package org.opendaylight.controller.netconf.it; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.util.HashedWheelTimer; +import java.net.InetSocketAddress; + import org.junit.After; import org.junit.Before; import org.opendaylight.controller.config.manager.impl.AbstractConfigTest; +import org.opendaylight.controller.netconf.client.SimpleNetconfClientSessionListener; +import org.opendaylight.controller.netconf.client.conf.NetconfClientConfiguration; +import org.opendaylight.controller.netconf.client.conf.NetconfClientConfigurationBuilder; import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer; import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher; import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory; import org.opendaylight.controller.netconf.impl.SessionIdProvider; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl; import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService; +import org.opendaylight.protocol.framework.NeverReconnectStrategy; + +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.util.HashedWheelTimer; +import io.netty.util.concurrent.GlobalEventExecutor; public class AbstractNetconfConfigTest extends AbstractConfigTest { - protected EventLoopGroup nettyThreadgroup; + private EventLoopGroup nettyThreadgroup; private HashedWheelTimer hashedWheelTimer; @Before @@ -31,7 +39,6 @@ public class AbstractNetconfConfigTest extends AbstractConfigTest { hashedWheelTimer = new HashedWheelTimer(); } - protected NetconfServerDispatcher createDispatcher( NetconfOperationServiceFactoryListenerImpl factoriesListener, SessionMonitoringService sessionMonitoringService, DefaultCommitNotificationProducer commitNotifier) { @@ -45,6 +52,13 @@ public class AbstractNetconfConfigTest extends AbstractConfigTest { return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup); } + protected HashedWheelTimer getHashedWheelTimer() { + return hashedWheelTimer; + } + + protected EventLoopGroup getNettyThreadgroup() { + return nettyThreadgroup; + } @After public void cleanUpTimer() { @@ -52,4 +66,13 @@ public class AbstractNetconfConfigTest extends AbstractConfigTest { nettyThreadgroup.shutdownGracefully(); } + public NetconfClientConfiguration getClientConfiguration(final InetSocketAddress tcpAddress, final int timeout) { + final NetconfClientConfigurationBuilder b = NetconfClientConfigurationBuilder.create(); + b.withAddress(tcpAddress); + b.withSessionListener(new SimpleNetconfClientSessionListener()); + b.withReconnectStrategy(new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, + timeout)); + b.withConnectionTimeoutMillis(timeout); + return b.build(); + } }