From 71aa687845b198dcfb71921dafbd9dea4655249a Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 3 Jan 2019 19:43:38 +0100 Subject: [PATCH] Ignore NETCONF message document whitespace The transformer we use is specifically allowed to add whitespace, which does not offer us with enough control as to what it is going to be -- making it implementation-dependent. Checking whitespace match actually breaks with Java11, so disable that checking. Change-Id: I8b3b5fa648ea2f13cc069b03ba374975be33e9d9 Signed-off-by: Robert Varga --- .../org/opendaylight/netconf/impl/MessageParserTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/MessageParserTest.java b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/MessageParserTest.java index a8e05a900a..82c42dcb29 100644 --- a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/MessageParserTest.java +++ b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/MessageParserTest.java @@ -21,6 +21,7 @@ import io.netty.channel.embedded.EmbeddedChannel; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Queue; +import org.custommonkey.xmlunit.XMLUnit; import org.junit.Before; import org.junit.Test; import org.opendaylight.netconf.api.NetconfMessage; @@ -88,6 +89,7 @@ public class MessageParserTest { NetconfMessage receivedMessage = testChunkChannel.readInbound(); assertNotNull(receivedMessage); + XMLUnit.setIgnoreWhitespace(true); assertXMLEqual(this.msg.getDocument(), receivedMessage.getDocument()); } @@ -108,10 +110,11 @@ public class MessageParserTest { testChunkChannel.writeInbound(recievedOutbound); NetconfMessage receivedMessage = testChunkChannel.readInbound(); assertNotNull(receivedMessage); + XMLUnit.setIgnoreWhitespace(true); assertXMLEqual(this.msg.getDocument(), receivedMessage.getDocument()); } - private static long getHeaderLength(byte[] bytes) { + private static long getHeaderLength(final byte[] bytes) { byte[] headerStart = new byte[]{(byte) 0x0a, (byte) 0x23}; return Long.parseLong(StandardCharsets.US_ASCII.decode( ByteBuffer.wrap(bytes, headerStart.length, bytes.length - headerStart.length - 1)).toString()); -- 2.36.6