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
9 package org.opendaylight.netconf.client;
11 import static org.junit.Assert.assertNotNull;
12 import static org.mockito.Mockito.doReturn;
13 import static org.mockito.Mockito.mock;
15 import com.google.common.base.Optional;
16 import io.netty.channel.Channel;
17 import io.netty.util.HashedWheelTimer;
18 import io.netty.util.Timer;
19 import io.netty.util.concurrent.Promise;
20 import org.junit.Test;
21 import org.opendaylight.netconf.api.NetconfSessionListenerFactory;
23 public class NetconfClientSessionNegotiatorFactoryTest {
25 public void testGetSessionNegotiator() throws Exception {
26 NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class);
27 Timer timer = new HashedWheelTimer();
28 NetconfSessionListenerFactory<NetconfClientSessionListener> listenerFactory =
29 mock(NetconfSessionListenerFactory.class);
30 doReturn(sessionListener).when(listenerFactory).getSessionListener();
32 Channel channel = mock(Channel.class);
33 Promise<NetconfClientSession> promise = mock(Promise.class);
34 NetconfClientSessionNegotiatorFactory negotiatorFactory = new NetconfClientSessionNegotiatorFactory(timer,
35 Optional.absent(), 200L);
37 NetconfClientSessionNegotiator sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory,
39 assertNotNull(sessionNegotiator);