X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FMessageParserTest.java;h=baf2d7d761373a4dfb00895eed62a4d16b0470ee;hb=ded776339aa23cdd5fadc0b8cc393172120572c6;hp=3b88a231083fa50a1a1f6e7326d6a8d3fc6f0d29;hpb=e6bcd06e610be274e8f2df901b61789bb17c442a;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageParserTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageParserTest.java index 3b88a23108..baf2d7d761 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageParserTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageParserTest.java @@ -26,6 +26,7 @@ import org.opendaylight.controller.netconf.util.handler.FramingMechanismHandlerF import org.opendaylight.controller.netconf.util.handler.NetconfMessageAggregator; import org.opendaylight.controller.netconf.util.handler.NetconfMessageChunkDecoder; import org.opendaylight.controller.netconf.util.messages.FramingMechanism; +import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants; import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory; import org.opendaylight.controller.netconf.util.messages.NetconfMessageHeader; import org.opendaylight.controller.netconf.util.test.XmlFileLoader; @@ -55,24 +56,24 @@ public class MessageParserTest { Queue messages = testChunkChannel.outboundMessages(); assertFalse(messages.isEmpty()); - int msgLength = msgFactory.put(this.msg).length; - int chunkCount = msgLength / NetconfMessageFactory.MAX_CHUNK_SIZE; - if ((msgLength % NetconfMessageFactory.MAX_CHUNK_SIZE) != 0) { + int msgLength = this.msgFactory.put(this.msg).length; + int chunkCount = msgLength / NetconfMessageConstants.MAX_CHUNK_SIZE; + if ((msgLength % NetconfMessageConstants.MAX_CHUNK_SIZE) != 0) { chunkCount++; } for (int i = 1; i <= chunkCount; i++) { ByteBuf recievedOutbound = (ByteBuf) messages.poll(); - int exptHeaderLength = NetconfMessageFactory.MAX_CHUNK_SIZE; + int exptHeaderLength = NetconfMessageConstants.MAX_CHUNK_SIZE; if (i == chunkCount) { - exptHeaderLength = msgLength - (NetconfMessageFactory.MAX_CHUNK_SIZE * (i - 1)); - byte[] eom = new byte[NetconfMessageFactory.endOfChunk.length]; - recievedOutbound.getBytes(recievedOutbound.readableBytes() - NetconfMessageFactory.endOfChunk.length, + exptHeaderLength = msgLength - (NetconfMessageConstants.MAX_CHUNK_SIZE * (i - 1)); + byte[] eom = new byte[NetconfMessageConstants.endOfChunk.length]; + recievedOutbound.getBytes(recievedOutbound.readableBytes() - NetconfMessageConstants.endOfChunk.length, eom); - assertArrayEquals(NetconfMessageFactory.endOfChunk, eom); + assertArrayEquals(NetconfMessageConstants.endOfChunk, eom); } - byte[] header = new byte[String.valueOf(exptHeaderLength).length() + NetconfMessageHeader.MIN_HEADER_LENGTH - - 1]; + byte[] header = new byte[String.valueOf(exptHeaderLength).length() + + NetconfMessageConstants.MIN_HEADER_LENGTH - 1]; recievedOutbound.getBytes(0, header); NetconfMessageHeader messageHeader = new NetconfMessageHeader(); messageHeader.fromBytes(header); @@ -97,9 +98,9 @@ public class MessageParserTest { testChunkChannel.writeOutbound(this.msg); ByteBuf recievedOutbound = (ByteBuf) testChunkChannel.readOutbound(); - byte[] eom = new byte[NetconfMessageFactory.endOfMessage.length]; - recievedOutbound.getBytes(recievedOutbound.readableBytes() - NetconfMessageFactory.endOfMessage.length, eom); - assertArrayEquals(NetconfMessageFactory.endOfMessage, eom); + byte[] eom = new byte[NetconfMessageConstants.endOfMessage.length]; + recievedOutbound.getBytes(recievedOutbound.readableBytes() - NetconfMessageConstants.endOfMessage.length, eom); + assertArrayEquals(NetconfMessageConstants.endOfMessage, eom); testChunkChannel.writeInbound(recievedOutbound); NetconfMessage receivedMessage = (NetconfMessage) testChunkChannel.readInbound();