2 * Copyright (c) 2014 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.netconf.client;
10 import static org.junit.Assert.assertNotNull;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
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;
22 public class NetconfClientSessionNegotiatorFactoryTest {
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();
31 Channel channel = mock(Channel.class);
32 Promise<NetconfClientSession> promise = mock(Promise.class);
33 NetconfClientSessionNegotiatorFactory negotiatorFactory = new NetconfClientSessionNegotiatorFactory(timer,
34 Optional.empty(), 200L);
36 NetconfClientSessionNegotiator sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory,
38 assertNotNull(sessionNegotiator);