X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-netty-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnettyutil%2Fhandler%2FNetconfChunkAggregatorTest.java;h=9c5a83e625919a64f15dbd7ebf903fc7c5e67435;hb=refs%2Fchanges%2F19%2F101919%2F3;hp=5d692b2fcf35274c2c2899ecc9db7268dc3621e0;hpb=b48e597dad44046da6af9ada1b22df0b51aa3a9a;p=netconf.git diff --git a/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregatorTest.java b/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregatorTest.java index 5d692b2fcf..9c5a83e625 100644 --- a/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregatorTest.java +++ b/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregatorTest.java @@ -13,12 +13,9 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.List; -import org.junit.BeforeClass; import org.junit.Test; public class NetconfChunkAggregatorTest { - private static final String CHUNKED_MESSAGE = "\n#4\n" + "" + "\n##\n"; - public static final String EXPECTED_MESSAGE = "\n" + " \n" + ""; private static final String CHUNKED_MESSAGE_ONE = "\n#101\n" + EXPECTED_MESSAGE + "\n##\n"; - private static NetconfChunkAggregator agr; - - @BeforeClass - public static void setUp() throws Exception { - agr = new NetconfChunkAggregator(); - } + private final NetconfChunkAggregator agr = new NetconfChunkAggregator(4096); @Test public void testMultipleChunks() throws Exception { - final List output = new ArrayList<>(); - final ByteBuf input = Unpooled.copiedBuffer(CHUNKED_MESSAGE.getBytes(StandardCharsets.UTF_8)); + final var output = new ArrayList<>(); + final var input = Unpooled.copiedBuffer(CHUNKED_MESSAGE.getBytes(StandardCharsets.UTF_8)); agr.decode(null, input, output); assertEquals(1, output.size()); - final ByteBuf chunk = (ByteBuf) output.get(0); + final var chunk = (ByteBuf) output.get(0); assertEquals(EXPECTED_MESSAGE, chunk.toString(StandardCharsets.UTF_8)); } @Test public void testOneChunks() throws Exception { - final List output = new ArrayList<>(); - final ByteBuf input = Unpooled.copiedBuffer(CHUNKED_MESSAGE_ONE.getBytes(StandardCharsets.UTF_8)); + final var output = new ArrayList<>(); + final var input = Unpooled.copiedBuffer(CHUNKED_MESSAGE_ONE.getBytes(StandardCharsets.UTF_8)); agr.decode(null, input, output); assertEquals(1, output.size());