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.concurrent.Promise;
16 import java.util.Optional;
17 import org.junit.Test;
18 import org.opendaylight.netconf.api.NetconfSessionListenerFactory;
19 import org.opendaylight.netconf.common.impl.DefaultNetconfTimer;
21 public class NetconfClientSessionNegotiatorFactoryTest {
23 public void testGetSessionNegotiator() throws Exception {
24 NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class);
25 final var timer = new DefaultNetconfTimer();
26 NetconfSessionListenerFactory<NetconfClientSessionListener> listenerFactory =
27 mock(NetconfSessionListenerFactory.class);
28 doReturn(sessionListener).when(listenerFactory).getSessionListener();
30 Channel channel = mock(Channel.class);
31 Promise<NetconfClientSession> promise = mock(Promise.class);
32 NetconfClientSessionNegotiatorFactory negotiatorFactory = new NetconfClientSessionNegotiatorFactory(timer,
33 Optional.empty(), 200L);
35 NetconfClientSessionNegotiator sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory,
37 assertNotNull(sessionNegotiator);