2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.netconf.it;
10 import io.netty.channel.EventLoopGroup;
11 import io.netty.channel.nio.NioEventLoopGroup;
12 import io.netty.util.HashedWheelTimer;
13 import org.junit.After;
14 import org.junit.Before;
15 import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
16 import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer;
17 import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher;
18 import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory;
19 import org.opendaylight.controller.netconf.impl.SessionIdProvider;
20 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl;
21 import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService;
23 public class AbstractNetconfConfigTest extends AbstractConfigTest {
25 protected EventLoopGroup nettyThreadgroup;
26 private HashedWheelTimer hashedWheelTimer;
29 public void setUpAbstractNetconfConfigTest() {
30 nettyThreadgroup = new NioEventLoopGroup();
31 hashedWheelTimer = new HashedWheelTimer();
35 protected NetconfServerDispatcher createDispatcher(
36 NetconfOperationServiceFactoryListenerImpl factoriesListener, SessionMonitoringService sessionMonitoringService,
37 DefaultCommitNotificationProducer commitNotifier) {
38 SessionIdProvider idProvider = new SessionIdProvider();
40 NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
41 hashedWheelTimer, factoriesListener, idProvider, 5000, commitNotifier, sessionMonitoringService);
43 NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(
44 serverNegotiatorFactory);
45 return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
50 public void cleanUpTimer() {
51 hashedWheelTimer.stop();
52 nettyThreadgroup.shutdownGracefully();