From 75f4d9e68f48fc830b6999bccaae0c3d65e4a62a Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 27 Jun 2020 15:24:55 +0200 Subject: [PATCH] Cleanup deprecation warnings in bgp/extensions/labeled-unicast Eliminate some leftovers from codegen change. Change-Id: I4599e8239c49e5b7d9c1f9643e7a14f58080e923 Signed-off-by: Robert Varga --- .../unicast/LabeledUnicastIpv4RIBSupport.java | 4 +- .../unicast/LabeledUnicastIpv6RIBSupport.java | 5 +- .../bgp/labeled/unicast/LUNlriParserTest.java | 62 +++++++++++-------- .../LabeledUnicastIpv4RIBSupportTest.java | 3 +- .../LabeledUnicastIpv6RIBSupportTest.java | 3 +- 5 files changed, 42 insertions(+), 35 deletions(-) diff --git a/bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupport.java b/bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupport.java index 1ec7087740..3a76dfb14f 100644 --- a/bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupport.java +++ b/bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupport.java @@ -10,7 +10,6 @@ package org.opendaylight.protocol.bgp.labeled.unicast; import static com.google.common.base.Verify.verify; import java.util.Collection; -import java.util.Collections; import java.util.Map; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; @@ -33,8 +32,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; public final class LabeledUnicastIpv4RIBSupport extends AbstractLabeledUnicastRIBSupport { - private static final LabeledUnicastRoutes EMPTY_CONTAINER - = new LabeledUnicastRoutesBuilder().setLabeledUnicastRoute(Collections.emptyList()).build(); + private static final LabeledUnicastRoutes EMPTY_CONTAINER = new LabeledUnicastRoutesBuilder().build(); private static LabeledUnicastIpv4RIBSupport SINGLETON; private LabeledUnicastIpv4RIBSupport(final BindingNormalizedNodeSerializer mappingService) { diff --git a/bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv6RIBSupport.java b/bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv6RIBSupport.java index 2733c1bb1a..52056246d1 100644 --- a/bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv6RIBSupport.java +++ b/bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv6RIBSupport.java @@ -10,7 +10,6 @@ package org.opendaylight.protocol.bgp.labeled.unicast; import static com.google.common.base.Verify.verify; import java.util.Collection; -import java.util.Collections; import java.util.Map; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; @@ -32,9 +31,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; final class LabeledUnicastIpv6RIBSupport extends AbstractLabeledUnicastRIBSupport { - - private static final LabeledUnicastIpv6Routes EMPTY_CONTAINER - = new LabeledUnicastIpv6RoutesBuilder().setLabeledUnicastRoute(Collections.emptyList()).build(); + private static final LabeledUnicastIpv6Routes EMPTY_CONTAINER = new LabeledUnicastIpv6RoutesBuilder().build(); private static LabeledUnicastIpv6RIBSupport SINGLETON; private LabeledUnicastIpv6RIBSupport(final BindingNormalizedNodeSerializer mappingService) { diff --git a/bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LUNlriParserTest.java b/bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LUNlriParserTest.java index 52cfd04bfa..d3f2ee7d16 100644 --- a/bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LUNlriParserTest.java +++ b/bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LUNlriParserTest.java @@ -38,9 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labe import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1Builder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlri; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlriBuilder; @@ -257,8 +255,9 @@ public class LUNlriParserTest { //test serializer final ByteBuf output = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, - new Attributes1Builder().setMpReachNlri(mpReachExpected).build()).build(), output); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes1Builder().setMpReachNlri(mpReachExpected).build()) + .build(), output); assertArrayEquals(LU_REACH_NLRI_IPV4, ByteArray.readAllBytes(output)); } @@ -285,8 +284,9 @@ public class LUNlriParserTest { //test serializer final ByteBuf output = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, - new Attributes1Builder().setMpReachNlri(mpReachExpected).build()).build(), output); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes1Builder().setMpReachNlri(mpReachExpected).build()) + .build(), output); assertArrayEquals(LU_REACH_NLRI_IPV4_ADD_PATH, ByteArray.readAllBytes(output)); } @@ -329,13 +329,15 @@ public class LUNlriParserTest { //test serializer final ByteBuf output = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, - new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()) + .build(), output); assertArrayEquals(LU_UNREACH_NLRI_IPV4, ByteArray.readAllBytes(output)); final ByteBuf output1 = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, - new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()).build(), output1); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()) + .build(), output1); assertArrayEquals(LU_UNREACH_NLRI_IPV4, ByteArray.readAllBytes(output1)); } @@ -379,13 +381,15 @@ public class LUNlriParserTest { //test serializer final ByteBuf output = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, - new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()) + .build(), output); assertArrayEquals(LU_UNREACH_NLRI_IPV4_ADD_PATH, ByteArray.readAllBytes(output)); final ByteBuf output1 = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, - new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()).build(), output1); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()) + .build(), output1); assertArrayEquals(LU_UNREACH_NLRI_IPV4_ADD_PATH, ByteArray.readAllBytes(output1)); } @@ -413,8 +417,9 @@ public class LUNlriParserTest { //test serializer final ByteBuf output = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, - new Attributes1Builder().setMpReachNlri(mpReachExpected).build()).build(), output); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes1Builder().setMpReachNlri(mpReachExpected).build()) + .build(), output); assertArrayEquals(LU_REACH_NLRI_IPV6, ByteArray.readAllBytes(output)); } @@ -442,8 +447,9 @@ public class LUNlriParserTest { //test serializer final ByteBuf output = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, - new Attributes1Builder().setMpReachNlri(mpReachExpected).build()).build(), output); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes1Builder().setMpReachNlri(mpReachExpected).build()) + .build(), output); assertArrayEquals(LU_REACH_NLRI_IPV6_ADD_PATH, ByteArray.readAllBytes(output)); } @@ -484,13 +490,15 @@ public class LUNlriParserTest { //test serializer final ByteBuf output = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, - new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()) + .build(), output); assertArrayEquals(LU_UNREACH_NLRI_IPV6, ByteArray.readAllBytes(output)); final ByteBuf output1 = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, - new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()).build(), output1); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()) + .build(), output1); assertArrayEquals(LU_UNREACH_NLRI_IPV6, ByteArray.readAllBytes(output1)); } @@ -533,13 +541,15 @@ public class LUNlriParserTest { //test serializer final ByteBuf output = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, - new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()) + .build(), output); assertArrayEquals(LU_UNREACH_NLRI_IPV6_ADD_PATH, ByteArray.readAllBytes(output)); final ByteBuf output1 = Unpooled.buffer(); - parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, - new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()).build(), output1); + parser.serializeAttribute(new AttributesBuilder() + .addAugmentation(new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()) + .build(), output1); assertArrayEquals(LU_UNREACH_NLRI_IPV6_ADD_PATH, ByteArray.readAllBytes(output1)); } } diff --git a/bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupportTest.java b/bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupportTest.java index 707e458ff5..0413dddd1e 100644 --- a/bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupportTest.java +++ b/bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupportTest.java @@ -17,6 +17,7 @@ import io.netty.buffer.Unpooled; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext; @@ -94,7 +95,7 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest