X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FNetconfClientSessionNegotiatorFactoryTest.java;fp=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FNetconfClientSessionNegotiatorFactoryTest.java;h=0557a0c26890f0a6c25c178745ea48aa27472f99;hp=0000000000000000000000000000000000000000;hb=3c2b9f44d59d735907ef541d36542443221c5c68;hpb=ce9ca282f8e0eb5a0cd1b97cab882f9f80fa598a diff --git a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactoryTest.java b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactoryTest.java new file mode 100644 index 0000000000..0557a0c268 --- /dev/null +++ b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactoryTest.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.netconf.client; + +import com.google.common.base.Optional; +import io.netty.channel.Channel; +import io.netty.util.HashedWheelTimer; +import io.netty.util.Timer; +import io.netty.util.concurrent.Promise; +import org.apache.sshd.common.SessionListener; +import org.junit.Test; +import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader; +import org.opendaylight.protocol.framework.SessionListenerFactory; +import org.opendaylight.protocol.framework.SessionNegotiator; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +public class NetconfClientSessionNegotiatorFactoryTest { + @Test + public void testGetSessionNegotiator() throws Exception { + NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class); + Timer timer = new HashedWheelTimer(); + SessionListenerFactory listenerFactory = mock(SessionListenerFactory.class); + doReturn(sessionListener).when(listenerFactory).getSessionListener(); + + Channel channel = mock(Channel.class); + Promise promise = mock(Promise.class); + NetconfClientSessionNegotiatorFactory negotiatorFactory = new NetconfClientSessionNegotiatorFactory(timer, + Optional.absent(), 200L); + + SessionNegotiator sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory, channel, promise); + assertNotNull(sessionNegotiator); + } +}