From: Robert Varga Date: Sun, 28 Jun 2020 15:11:45 +0000 (+0200) Subject: Cleanup deprecation warnings in bgp/parser-spi X-Git-Tag: release/aluminium~37 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=f92033e5fb56c6002e5b84f5bc727c575756f5a2;p=bgpcep.git Cleanup deprecation warnings in bgp/parser-spi Eliminate some leftovers from codegen change. Change-Id: I2e7dfc74ef4639e52bfa8887836e9e6c2c9b290e Signed-off-by: Robert Varga --- diff --git a/bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MultiprotocolCapabilitiesUtil.java b/bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MultiprotocolCapabilitiesUtil.java index 88dc5f8432..4ba56732ac 100644 --- a/bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MultiprotocolCapabilitiesUtil.java +++ b/bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MultiprotocolCapabilitiesUtil.java @@ -14,7 +14,6 @@ import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.bgp.parameters.optional.capabilities.CParameters; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.bgp.parameters.optional.capabilities.CParametersBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.CParameters1; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.CParameters1Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.RouteRefreshCapabilityBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.AddressFamily; @@ -23,8 +22,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class MultiprotocolCapabilitiesUtil { - public static final CParameters RR_CAPABILITY = new CParametersBuilder().addAugmentation(CParameters1.class, - new CParameters1Builder().setRouteRefreshCapability(new RouteRefreshCapabilityBuilder().build()).build()) + public static final CParameters RR_CAPABILITY = new CParametersBuilder() + .addAugmentation(new CParameters1Builder() + .setRouteRefreshCapability(new RouteRefreshCapabilityBuilder().build()) + .build()) .build(); private static final Logger LOG = LoggerFactory.getLogger(MultiprotocolCapabilitiesUtil.class); diff --git a/bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/UnrecognizedAttributesTest.java b/bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/UnrecognizedAttributesTest.java index 6ab7ae1ce2..f319059380 100644 --- a/bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/UnrecognizedAttributesTest.java +++ b/bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/UnrecognizedAttributesTest.java @@ -9,13 +9,12 @@ package org.opendaylight.protocol.bgp.parser.spi.pojo; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import io.netty.buffer.Unpooled; import java.util.Map; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.opendaylight.protocol.bgp.parser.BGPDocumentedException; import org.opendaylight.protocol.bgp.parser.BGPParsingException; import org.opendaylight.protocol.util.ByteArray; @@ -31,15 +30,14 @@ public class UnrecognizedAttributesTest { private static final SimpleAttributeRegistry SIMPLE_ATTR_REG = new SimpleAttributeRegistry(); - @Rule - public ExpectedException expException = ExpectedException.none(); - @Test public void testUnrecognizedAttributesWithoutOptionalFlag() throws BGPDocumentedException, BGPParsingException { - this.expException.expect(BGPDocumentedException.class); - this.expException.expectMessage("Well known attribute not recognized."); - SIMPLE_ATTR_REG.parseAttributes( - Unpooled.wrappedBuffer(new byte[] { 0x03, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05 }), null); + final BGPDocumentedException ex = assertThrows(BGPDocumentedException.class, () -> { + SIMPLE_ATTR_REG.parseAttributes( + Unpooled.wrappedBuffer(new byte[] { 0x03, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05 }), null); + }); + + assertEquals("Well known attribute not recognized.", ex.getMessage()); } @Test