X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-netty-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fnettyutil%2Fhandler%2FNetconfHelloMessageToXMLEncoderTest.java;fp=opendaylight%2Fnetconf%2Fnetconf-netty-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fnettyutil%2Fhandler%2FNetconfHelloMessageToXMLEncoderTest.java;h=0000000000000000000000000000000000000000;hb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4;hp=375448ee66c4b97af2f21123815226e582047c9c;hpb=b2e81149739c87f0ecc2ce7f06448d7a5d3162b8;p=controller.git diff --git a/opendaylight/netconf/netconf-netty-util/src/test/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfHelloMessageToXMLEncoderTest.java b/opendaylight/netconf/netconf-netty-util/src/test/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfHelloMessageToXMLEncoderTest.java deleted file mode 100644 index 375448ee66..0000000000 --- a/opendaylight/netconf/netconf-netty-util/src/test/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfHelloMessageToXMLEncoderTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.nettyutil.handler; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertThat; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.ChannelHandlerContext; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.opendaylight.controller.config.util.xml.XmlUtil; -import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessage; -import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader; - -public class NetconfHelloMessageToXMLEncoderTest { - - @Mock - private ChannelHandlerContext ctx; - - @Before - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - @Test - public void testEncode() throws Exception { - final NetconfMessage msg = new NetconfHelloMessage(XmlUtil.readXmlToDocument(""), - NetconfHelloMessageAdditionalHeader.fromString("[tomas;10.0.0.0:10000;tcp;client;]")); - final ByteBuf destination = Unpooled.buffer(); - new NetconfHelloMessageToXMLEncoder().encode(ctx, msg, destination); - - final String encoded = new String(destination.array()); - assertThat(encoded, containsString("[tomas;10.0.0.0:10000;tcp;client;]")); - assertThat(encoded, containsString("")); - } - - @Test - public void testEncodeNoHeader() throws Exception { - final NetconfMessage msg = new NetconfHelloMessage(XmlUtil.readXmlToDocument("")); - final ByteBuf destination = Unpooled.buffer(); - new NetconfHelloMessageToXMLEncoder().encode(ctx, msg, destination); - - final String encoded = new String(destination.array()); - assertThat(encoded, not(containsString("[tomas;10.0.0.0:10000;tcp;client;]"))); - assertThat(encoded, containsString("")); - } - - @Test(expected = IllegalStateException.class) - public void testEncodeNotHello() throws Exception { - final NetconfMessage msg = new NetconfMessage(XmlUtil.readXmlToDocument("")); - new NetconfHelloMessageToXMLEncoder().encode(ctx, msg, null); - } -} \ No newline at end of file