Fix raw references to Promise
[controller.git] / opendaylight / netconf / netconf-client / src / test / java / org / opendaylight / controller / 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
9 package org.opendaylight.controller.netconf.client;
10
11 import com.google.common.base.Optional;
12 import io.netty.channel.Channel;
13 import io.netty.util.HashedWheelTimer;
14 import io.netty.util.Timer;
15 import io.netty.util.concurrent.Promise;
16 import org.junit.Test;
17 import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader;
18 import org.opendaylight.protocol.framework.SessionListenerFactory;
19 import org.opendaylight.protocol.framework.SessionNegotiator;
20 import static org.junit.Assert.assertNotNull;
21 import static org.mockito.Mockito.doReturn;
22 import static org.mockito.Mockito.mock;
23
24 public class NetconfClientSessionNegotiatorFactoryTest {
25     @Test
26     public void testGetSessionNegotiator() throws Exception {
27         NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class);
28         Timer timer = new HashedWheelTimer();
29         SessionListenerFactory<NetconfClientSessionListener> listenerFactory = mock(SessionListenerFactory.class);
30         doReturn(sessionListener).when(listenerFactory).getSessionListener();
31
32         Channel channel = mock(Channel.class);
33         Promise<NetconfClientSession> promise = mock(Promise.class);
34         NetconfClientSessionNegotiatorFactory negotiatorFactory = new NetconfClientSessionNegotiatorFactory(timer,
35                 Optional.<NetconfHelloMessageAdditionalHeader>absent(), 200L);
36
37         SessionNegotiator<?> sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory, channel, promise);
38         assertNotNull(sessionNegotiator);
39     }
40 }