import org.junit.Before;
import org.junit.Test;
import org.opendaylight.netconf.api.NetconfMessage;
-import org.opendaylight.netconf.api.messages.NetconfHelloMessage;
+import org.opendaylight.netconf.api.messages.HelloMessage;
import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.nettyutil.handler.ChunkedFramingMechanismEncoder;
import org.opendaylight.netconf.nettyutil.handler.NetconfEXIToMessageDecoder;
import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToMessageDecoder;
import org.opendaylight.netconf.nettyutil.handler.exi.EXIParameters;
import org.opendaylight.netconf.nettyutil.handler.exi.NetconfStartExiMessage;
-import org.opendaylight.netconf.util.test.XmlFileLoader;
+import org.opendaylight.netconf.test.util.XmlFileLoader;
import org.w3c.dom.Document;
public class NetconfClientSessionNegotiatorTest {
- private NetconfHelloMessage helloMessage;
+ private HelloMessage helloMessage;
private ChannelPipeline pipeline;
private ChannelPromise future;
private Channel channel;
@Before
public void setUp() {
- helloMessage = NetconfHelloMessage.createClientHello(Set.of("exi:1.0"), Optional.empty());
+ helloMessage = HelloMessage.createClientHello(Set.of("exi:1.0"), Optional.empty());
pipeline = mockChannelPipeline();
future = mockChannelFuture();
channel = mockChannel();
timeout, 16384);
}
- private static NetconfHelloMessage createHelloMsg(final String name) throws Exception {
+ private static HelloMessage createHelloMsg(final String name) throws Exception {
final InputStream stream = NetconfClientSessionNegotiatorTest.class.getResourceAsStream(name);
- final Document doc = XmlUtil.readXmlToDocument(stream);
-
- return new NetconfHelloMessage(doc);
+ return new HelloMessage(XmlUtil.readXmlToDocument(stream));
}
private static Set<String> createCapabilities(final String name) throws Exception {
- NetconfHelloMessage hello = createHelloMsg(name);
-
- return ImmutableSet.copyOf(NetconfMessageUtil.extractCapabilitiesFromHello(hello.getDocument()));
+ return ImmutableSet.copyOf(NetconfMessageUtil.extractCapabilitiesFromHello(createHelloMsg(name).getDocument()));
}
@Test
negotiator.channelActive(null);
doReturn(null).when(future).cause();
- negotiator.handleMessage(NetconfHelloMessage.createServerHello(Set.of("a", "b"), 10));
+ negotiator.handleMessage(HelloMessage.createServerHello(Set.of("a", "b"), 10));
verify(promise).setSuccess(any());
}
NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, null);
doReturn(null).when(future).cause();
- negotiator.handleMessage(NetconfHelloMessage.createServerHello(Set.of("a", "b"), 10));
+ negotiator.handleMessage(HelloMessage.createServerHello(Set.of("a", "b"), 10));
negotiator.channelActive(null);
verify(promise).setSuccess(any());
}
ChannelHandlerContext handlerContext = mock(ChannelHandlerContext.class);
doReturn(pipeline).when(handlerContext).pipeline();
- negotiator.handleMessage(NetconfHelloMessage.createServerHello(Set.of("exi:1.0"), 10));
+ negotiator.handleMessage(HelloMessage.createServerHello(Set.of("exi:1.0"), 10));
Document expectedResult = XmlFileLoader.xmlFileToDocument("netconfMessages/rpc-reply_ok.xml");
channelInboundHandlerAdapter.channelRead(handlerContext, new NetconfMessage(expectedResult));