Initial code drop of netconf protocol implementation
[controller.git] / opendaylight / netconf / netconf-impl / src / test / java / org / opendaylight / controller / netconf / impl / NetconfDispatcherImplTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.impl;
10
11 import java.lang.management.ManagementFactory;
12 import java.net.InetSocketAddress;
13
14 import javax.net.ssl.SSLContext;
15
16 import org.junit.Test;
17 import org.opendaylight.controller.netconf.impl.*;
18 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
19 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl;
20
21 import com.google.common.base.Optional;
22
23 import io.netty.channel.ChannelFuture;
24 import io.netty.util.HashedWheelTimer;
25
26 public class NetconfDispatcherImplTest {
27
28     @Test
29     public void test() throws Exception {
30
31         DefaultCommitNotificationProducer commitNot = new DefaultCommitNotificationProducer(
32                 ManagementFactory.getPlatformMBeanServer());
33         NetconfOperationServiceFactoryListener factoriesListener = new NetconfOperationServiceFactoryListenerImpl();
34
35         SessionIdProvider idProvider = new SessionIdProvider();
36         NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
37                 new HashedWheelTimer(), factoriesListener, idProvider);
38
39         NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
40                 factoriesListener, commitNot, idProvider);
41         NetconfServerDispatcher dispatch = new NetconfServerDispatcher(Optional.<SSLContext> absent(),
42                 serverNegotiatorFactory, listenerFactory);
43
44         InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 8333);
45         ChannelFuture s = dispatch.createServer(addr);
46
47         commitNot.close();
48         dispatch.close();
49     }
50 }