From: Milos Fabian Date: Thu, 9 Jun 2016 07:10:00 +0000 (+0200) Subject: Fix unit test regression after netty version bump X-Git-Tag: release/boron~132 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=5bbc03c2af2933b1f85bea60fd4c73087c3adb23;p=bgpcep.git Fix unit test regression after netty version bump Fixed: java.lang.UnsupportedOperationException: direct buffer at io.netty.buffer.UnpooledUnsafeDirectByteBuf.array(UnpooledUnsafeDirectByteBuf.java:198) Direct buffer do not have a backing byte array, use utility function instead. Change-Id: I5317255bbbca733181a7dcb477ee30449757f0e7 Signed-off-by: Milos Fabian --- diff --git a/rsvp/spi/src/test/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CommonPathKeyParserTest.java b/rsvp/spi/src/test/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CommonPathKeyParserTest.java index a96e682f6c..fc9a206aea 100644 --- a/rsvp/spi/src/test/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CommonPathKeyParserTest.java +++ b/rsvp/spi/src/test/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CommonPathKeyParserTest.java @@ -9,10 +9,12 @@ package org.opendaylight.protocol.rsvp.parser.spi.subobjects; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; + import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.junit.Before; import org.junit.Test; +import org.opendaylight.protocol.util.ByteArray; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKeyBuilder; @@ -49,7 +51,7 @@ public class CommonPathKeyParserTest { @Test public void testSerialization() { final ByteBuf output = this.parser.serializePathKey(this.key3); - assertArrayEquals(this.bytes, output.readBytes(output.readableBytes()).array()); + assertArrayEquals(this.bytes, ByteArray.readAllBytes(output)); } @Test