Move netconf-dom-api
[netconf.git] / protocol / netconf-client / src / test / java / org / opendaylight / netconf / client / NetconfClientSessionNegotiatorFactoryTest.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.netconf.client;
9
10 import static org.junit.Assert.assertNotNull;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
13
14 import io.netty.channel.Channel;
15 import io.netty.util.HashedWheelTimer;
16 import io.netty.util.Timer;
17 import io.netty.util.concurrent.Promise;
18 import java.util.Optional;
19 import org.junit.Test;
20 import org.opendaylight.netconf.api.NetconfSessionListenerFactory;
21
22 public class NetconfClientSessionNegotiatorFactoryTest {
23     @Test
24     public void testGetSessionNegotiator() throws Exception {
25         NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class);
26         Timer timer = new HashedWheelTimer();
27         NetconfSessionListenerFactory<NetconfClientSessionListener> listenerFactory =
28                 mock(NetconfSessionListenerFactory.class);
29         doReturn(sessionListener).when(listenerFactory).getSessionListener();
30
31         Channel channel = mock(Channel.class);
32         Promise<NetconfClientSession> promise = mock(Promise.class);
33         NetconfClientSessionNegotiatorFactory negotiatorFactory = new NetconfClientSessionNegotiatorFactory(timer,
34                 Optional.empty(), 200L);
35
36         NetconfClientSessionNegotiator sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory,
37             channel, promise);
38         assertNotNull(sessionNegotiator);
39     }
40 }