Fix most bgp-parser-impl checkstyle 51/78751/3
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 13 Dec 2018 11:59:10 +0000 (12:59 +0100)
committerRobert Varga <nite@hq.sk>
Thu, 13 Dec 2018 14:48:47 +0000 (14:48 +0000)
This fixes all but one violation.

Change-Id: I4b34e87cc43946f9bddd485f57573355d076bebf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
41 files changed:
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BGPActivator.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPOpenMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPUpdateMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/AddPathCapabilityHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/As4CapabilityHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/CapabilityParameterParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/GracefulCapabilityHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AigpAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AsPathAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AsPathSegmentParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/ClusterIdAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/CommunitiesAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/CommunityUtil.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MultiExitDiscriminatorAttributeParser.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/AddPathCapabilityHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/ComplementaryTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/GracefulCapabilityHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/IPv6NextHopTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/LlGracefulCapabilityHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/MultiProtocolCapabilityHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/OpenTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/ParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AggregatorAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AsPathAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/ClusterIdAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/CommunitiesAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/ExtendedCommunitiesAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LocalPreferenceAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MultiExitDiscriminatorAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/NextHopAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/OriginatorIdAttributeParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/UnrecognizedAttributesSerializerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/AsTwoOctetSpecificEcHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/EncapsulationECTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/Generic4OctASEcHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/Ipv4SpecificEcHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/LinkBandwidthECTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/OpaqueEcHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/RouteOrigin4OctectASEcHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/RouteOriginAsTwoOctetEcHandlerTest.java

index 75f3ea1cc5f5c8a0360e77460a95ef15fa9356ff..306c8362a3b027b38548d60fec34a38c7037d247 100755 (executable)
@@ -283,7 +283,8 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
                 twoOctetSpecificEcHandler.getSubType(), twoOctetSpecificEcHandler));
         regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(false),
                 twoOctetSpecificEcHandler.getSubType(), twoOctetSpecificEcHandler));
-        regs.add(context.registerExtendedCommunitySerializer(AsSpecificExtendedCommunityCase.class, twoOctetSpecificEcHandler));
+        regs.add(context.registerExtendedCommunitySerializer(AsSpecificExtendedCommunityCase.class,
+                twoOctetSpecificEcHandler));
 
         final Ipv4SpecificEcHandler ipv4SpecificEcHandler = new Ipv4SpecificEcHandler();
         regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(true),
@@ -349,8 +350,7 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerExtendedCommunitySerializer(As4RouteTargetExtendedCommunityCase.class, rt4ASHandler));
 
         final RouteOrigin4OctectASEcHandler rOrig4Oct = new RouteOrigin4OctectASEcHandler();
-        regs.add(context.registerExtendedCommunityParser(rOrig4Oct.getType(true)
-                , rOrig4Oct.getSubType(), rOrig4Oct));
+        regs.add(context.registerExtendedCommunityParser(rOrig4Oct.getType(true), rOrig4Oct.getSubType(), rOrig4Oct));
         regs.add(context.registerExtendedCommunitySerializer(As4RouteOriginExtendedCommunityCase.class, rOrig4Oct));
 
         final EncapsulationEC encapsulationECHandler = new EncapsulationEC();
index 6e15108d1ac668681e4c5f79c64b535a3cbc67b2..6155c25d8f38d4121de0796d56ae661a98f2b78b 100644 (file)
@@ -98,7 +98,7 @@ public final class BGPOpenMessageParser implements MessageParser, MessageSeriali
     }
 
     /**
-     * Parses given byte array to BGP Open message
+     * Parses given byte array to BGP Open message.
      *
      * @param body byte array representing BGP Open message, without header
      * @param messageLength the length of the message
index 275489cdd74d80718af481c5e1804b3a2e6cc54a..a1c89c7e240f6472a07287827f97afd4cf5e5523 100755 (executable)
@@ -146,13 +146,7 @@ public final class BGPUpdateMessageParser implements MessageParser, MessageSeria
         }
         final Optional<BGPTreatAsWithdrawException> withdrawCause;
         if (totalPathAttrLength > 0) {
-            final ParsedAttributes attributes;
-            try {
-                attributes = this.reg.parseAttributes(buffer.readSlice(totalPathAttrLength), constraint);
-            } catch (final RuntimeException | BGPParsingException e) {
-                // Catch everything else and turn it into a BGPDocumentedException
-                throw new BGPDocumentedException("Could not parse BGP attributes.", BGPError.MALFORMED_ATTR_LIST, e);
-            }
+            final ParsedAttributes attributes = parseAttributes(buffer, totalPathAttrLength, constraint);
             builder.setAttributes(attributes.getAttributes());
             withdrawCause = attributes.getWithdrawCause();
         } else {
@@ -182,12 +176,21 @@ public final class BGPUpdateMessageParser implements MessageParser, MessageSeria
         return msg;
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
+    private ParsedAttributes parseAttributes(final ByteBuf buffer, final int totalPathAttrLength,
+            final PeerSpecificParserConstraint constraint) throws BGPDocumentedException {
+        try {
+            return reg.parseAttributes(buffer.readSlice(totalPathAttrLength), constraint);
+        } catch (final RuntimeException | BGPParsingException e) {
+            // Catch everything else and turn it into a BGPDocumentedException
+            throw new BGPDocumentedException("Could not parse BGP attributes.", BGPError.MALFORMED_ATTR_LIST, e);
+        }
+    }
+
     /**
-     * Check for presence of well known mandatory path attributes
-     * ORIGIN, AS_PATH and NEXT_HOP in Update message
+     * Check for presence of well known mandatory path attributes ORIGIN, AS_PATH and NEXT_HOP in Update message.
      *
      * @param message Update message
-     * @throws BGPDocumentedException
      */
     private static void checkMandatoryAttributesPresence(final Update message) throws BGPDocumentedException {
         requireNonNull(message, "Update message cannot be null");
index cc3bc0c8526f8959a8e4db6b1b4a9534e2696fef..bc67c87e0276d936482edbade3b3b1eda6dd771f 100644 (file)
@@ -96,11 +96,12 @@ public class AddPathCapabilityHandler implements CapabilityParser, CapabilitySer
             }
             final SendReceive sendReceive = SendReceive.forValue(buffer.readUnsignedByte());
             if (sendReceive != null) {
-                families.add(new AddressFamiliesBuilder().setAfi(afi).setSafi(safi).setSendReceive(sendReceive).build());
+                families.add(new AddressFamiliesBuilder().setAfi(afi).setSafi(safi).setSendReceive(sendReceive)
+                    .build());
             }
         }
-        return new CParametersBuilder().addAugmentation(CParameters1.class,new CParameters1Builder().setAddPathCapability(
-            new AddPathCapabilityBuilder().setAddressFamilies(families).build()).build()).build();
+        return new CParametersBuilder().addAugmentation(CParameters1.class,new CParameters1Builder()
+            .setAddPathCapability(new AddPathCapabilityBuilder().setAddressFamilies(families).build()).build()).build();
     }
 
 }
index 311da546b7aa55221c66acf3b151d0b3364ce181..0b02cb1f07b9f6e5ad1da8bf0ecac3d898d86974 100644 (file)
@@ -9,8 +9,6 @@ package org.opendaylight.protocol.bgp.parser.impl.message.open;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.spi.CapabilityParser;
 import org.opendaylight.protocol.bgp.parser.spi.CapabilitySerializer;
 import org.opendaylight.protocol.bgp.parser.spi.CapabilityUtil;
@@ -22,9 +20,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 
 public final class As4CapabilityHandler implements CapabilityParser, CapabilitySerializer {
     public static final int CODE = 65;
+
     @Override
-    public CParameters parseCapability(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
-        return new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(buffer.readUnsignedInt())).build()).build();
+    public CParameters parseCapability(final ByteBuf buffer) {
+        return new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder()
+            .setAsNumber(new AsNumber(buffer.readUnsignedInt())).build()).build();
     }
 
     @Override
index b7217390effd37fabf54f40f2da649b15b4e1f1a..7c62e6b80b892ce87a4eb912eb3991e8d6e564a8 100644 (file)
@@ -46,7 +46,8 @@ public final class CapabilityParameterParser implements ParameterParser, Paramet
 
     @Override
     public BgpParameters parseParameter(final ByteBuf buffer) throws BGPParsingException, BGPDocumentedException {
-        Preconditions.checkArgument(buffer != null && buffer.readableBytes() != 0, "Byte array cannot be null or empty.");
+        Preconditions.checkArgument(buffer != null && buffer.readableBytes() != 0,
+                "Byte array cannot be null or empty.");
 
         if (LOG.isTraceEnabled()) {
             LOG.trace("Started parsing of BGP Capabilities: {}", Arrays.toString(ByteArray.getAllBytes(buffer)));
@@ -62,7 +63,8 @@ public final class CapabilityParameterParser implements ParameterParser, Paramet
         return new BgpParametersBuilder().setOptionalCapabilities(optionalCapas).build();
     }
 
-    private OptionalCapabilities parseOptionalCapability(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    private OptionalCapabilities parseOptionalCapability(final ByteBuf buffer) throws BGPDocumentedException,
+            BGPParsingException {
         final int capCode = buffer.readUnsignedByte();
         final int capLength = buffer.readUnsignedByte();
         final ByteBuf paramBody = buffer.readSlice(capLength);
index f531f1fc56081023fe896f84a6b700dff31941a6..55a8e1c9e3fcdc8ce3056358b17b6e40782ebe3d 100644 (file)
@@ -63,7 +63,8 @@ public final class GracefulCapabilityHandler implements CapabilityParser, Capabi
     private final AddressFamilyRegistry afiReg;
     private final SubsequentAddressFamilyRegistry safiReg;
 
-    public GracefulCapabilityHandler(final AddressFamilyRegistry afiReg, final SubsequentAddressFamilyRegistry safiReg) {
+    public GracefulCapabilityHandler(final AddressFamilyRegistry afiReg,
+            final SubsequentAddressFamilyRegistry safiReg) {
         this.afiReg = requireNonNull(afiReg);
         this.safiReg = requireNonNull(safiReg);
     }
@@ -150,7 +151,8 @@ public final class GracefulCapabilityHandler implements CapabilityParser, Capabi
                 continue;
             }
             final int flags = buffer.readUnsignedByte();
-            tables.add(new TablesBuilder().setAfi(afi).setSafi(safi).setAfiFlags(new AfiFlags((flags & AFI_FLAG_FORWARDING_STATE) != 0)).build());
+            tables.add(new TablesBuilder().setAfi(afi).setSafi(safi)
+                .setAfiFlags(new AfiFlags((flags & AFI_FLAG_FORWARDING_STATE) != 0)).build());
         }
         cb.setTables(tables);
         return new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder()
index acd2dd0a4a3217370b89aa511c8a17638d30b1f7..04ed7017cd70fa98b3988153046b064c2c71145a 100644 (file)
@@ -10,8 +10,6 @@ package org.opendaylight.protocol.bgp.parser.impl.message.update;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.math.BigInteger;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.spi.AttributeParser;
 import org.opendaylight.protocol.bgp.parser.spi.AttributeSerializer;
 import org.opendaylight.protocol.bgp.parser.spi.AttributeUtil;
@@ -38,20 +36,19 @@ public class AigpAttributeParser implements AttributeParser, AttributeSerializer
 
     @Override
     public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder,
-            PeerSpecificParserConstraint constraint) throws BGPDocumentedException, BGPParsingException {
-        if(!buffer.isReadable()) {
-            return;
+            final PeerSpecificParserConstraint constraint) {
+        if (buffer.isReadable()) {
+            builder.setAigp(new AigpBuilder().setAigpTlv(parseAigpTLV(buffer)).build());
         }
-        builder.setAigp(new AigpBuilder().setAigpTlv(parseAigpTLV(buffer)).build());
     }
 
     @Override
     public void serializeAttribute(final Attributes attribute, final ByteBuf byteAggregator) {
         final Aigp aigpAttribute = attribute.getAigp();
-        if (aigpAttribute == null) {
-            return;
+        if (aigpAttribute != null) {
+            AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE, serializeAigpTLV(aigpAttribute),
+                byteAggregator);
         }
-        AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE, serializeAigpTLV(aigpAttribute), byteAggregator);
     }
 
     /**
@@ -73,10 +70,8 @@ public class AigpAttributeParser implements AttributeParser, AttributeSerializer
     /**
      * Transform AIGP attribute data from instance of Aigp class into byte buffer representation.
      *
-     * @param aigp
-     *          instance of Aigp class
-     * @return
-     *          byte buffer representation or empty buffer if AIGP TLV is null
+     * @param aigp instance of Aigp class
+     * @return byte buffer representation or empty buffer if AIGP TLV is null
      */
     private static ByteBuf serializeAigpTLV(final Aigp aigp) {
         final AigpTlv tlv = aigp.getAigpTlv();
index 2f71d66474b0effeb632e7254de8d8dd5d67a20a..44f34ab7696f5f637776fd71f178472d6ae8d529 100644 (file)
@@ -67,7 +67,8 @@ public final class AsPathAttributeParser extends AbstractAttributeParser impleme
         if (asPath.getSegments() != null) {
             for (final Segments segments : asPath.getSegments()) {
                 if (segments.getAsSequence() != null) {
-                    AsPathSegmentParser.serializeAsList(segments.getAsSequence(), SegmentType.AS_SEQUENCE, segmentsBuffer);
+                    AsPathSegmentParser.serializeAsList(segments.getAsSequence(), SegmentType.AS_SEQUENCE,
+                        segmentsBuffer);
                 } else if (segments.getAsSet() != null) {
                     AsPathSegmentParser.serializeAsList(segments.getAsSet(), SegmentType.AS_SET, segmentsBuffer);
                 } else {
index dad4ebfd5b6034a0cf9687389a038b8dcfd0e0d0..9b84a454bc169060c477ab19119dd9d98ed02f20 100644 (file)
@@ -5,11 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update;
 
 import static org.opendaylight.protocol.bgp.parser.impl.message.update.AsPathSegmentParser.SegmentType.AS_SEQUENCE;
 import static org.opendaylight.protocol.bgp.parser.impl.message.update.AsPathSegmentParser.SegmentType.AS_SET;
+
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -34,28 +34,27 @@ public final class AsPathSegmentParser {
     }
 
     private AsPathSegmentParser() {
-        throw new UnsupportedOperationException();
     }
 
     static int serializeType(final SegmentType type) {
         switch (type) {
-        case AS_SET:
-            return 1;
-        case AS_SEQUENCE:
-            return 2;
-        default:
-            return 0;
+            case AS_SET:
+                return 1;
+            case AS_SEQUENCE:
+                return 2;
+            default:
+                return 0;
         }
     }
 
     static SegmentType parseType(final int type) {
         switch (type) {
-        case 1:
-            return AS_SET;
-        case 2:
-            return AS_SEQUENCE;
-        default:
-            return null;
+            case 1:
+                return AS_SET;
+            case 2:
+                return AS_SEQUENCE;
+            default:
+                return null;
         }
     }
 
@@ -64,7 +63,7 @@ public final class AsPathSegmentParser {
         for (int i = 0; i < count; i++) {
             coll.add(refCache.getSharedReference(new AsNumber(buffer.readUnsignedInt())));
         }
-        return (coll.isEmpty()) ? Collections.emptyList() : coll;
+        return coll.isEmpty() ? Collections.emptyList() : coll;
     }
 
     static void serializeAsList(final List<AsNumber> asList, final SegmentType type, final ByteBuf byteAggregator) {
@@ -74,7 +73,7 @@ public final class AsPathSegmentParser {
         byteAggregator.writeByte(serializeType(type));
         byteAggregator.writeByte(asList.size());
         for (final AsNumber asNumber : asList) {
-            byteAggregator.writeInt( asNumber.getValue().intValue());
+            byteAggregator.writeInt(asNumber.getValue().intValue());
         }
     }
 }
index 6570a499d88a567b4319548a7735116122928aff..b3daa9da97590d804a0bb2d03414bfbfa7fa3d1d 100644 (file)
@@ -51,7 +51,7 @@ public final class ClusterIdAttributeParser extends AbstractAttributeParser impl
         if (readable % Ipv4Util.IP4_LENGTH != 0) {
             throw errorHandling.reportError(BGPError.ATTR_LENGTH_ERROR,
                 "Length of CLUSTER_LIST should be a multiple of 4, but is %s", readable);
-         }
+        }
 
         final int count = readable / Ipv4Util.IP4_LENGTH;
         final List<ClusterIdentifier> list = new ArrayList<>(count);
index ee8520017a8a43222360cd04169f3ee33def06e9..29a42f50ab5f8280e3c31d6d3313328d40c05d4c 100644 (file)
@@ -76,10 +76,9 @@ public final class CommunitiesAttributeParser extends AbstractAttributeParser im
    /**
     * Parse known Community, if unknown, a new one will be created.
     *
-    * @param refCache
+    * @param refCache reference cache
     * @param buffer byte array to be parsed
     * @return new Community
-    * @throws BGPDocumentedException
     */
     private static Community parseCommunity(final ReferenceCache refCache, final ByteBuf buffer)
             throws BGPDocumentedException {
index 8e13945ec3f5faadc6f27de3a6809af214051644..e255c2fdf3b199046c588f2f263172dcd08007e5 100644 (file)
@@ -73,16 +73,6 @@ public final class CommunityUtil {
         return create(this.refCache, asn, semantics);
     }
 
-    /**
-     * Creates a Community from its String representation.
-     *
-     * @param string String representation of a community
-     * @return new Community
-     */
-    public Community valueOf(final String string) {
-        return valueOf(this.refCache, string);
-    }
-
     /**
      * Creates a new Community given AS number value and semantics using generated CommunitiesBuilder.
      *
@@ -98,6 +88,16 @@ public final class CommunityUtil {
         return refCache.getSharedReference(builder.build());
     }
 
+    /**
+     * Creates a Community from its String representation.
+     *
+     * @param string String representation of a community
+     * @return new Community
+     */
+    public Community valueOf(final String string) {
+        return valueOf(this.refCache, string);
+    }
+
     /**
      * Creates a Community from its String representation.
      *
index 6e8c5b5e76cfa37c2f11bbd432e194759f56f258..38a66dedc5d001ab4d05093e9317618091c90c93 100644 (file)
@@ -22,8 +22,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.MultiExitDisc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.MultiExitDiscBuilder;
 
-public final class MultiExitDiscriminatorAttributeParser extends AbstractAttributeParser implements AttributeSerializer {
-
+public final class MultiExitDiscriminatorAttributeParser extends AbstractAttributeParser
+        implements AttributeSerializer {
     public static final int TYPE = 4;
 
     @Override
index fd65c173acfd29638f9de53443063ea9adffd243..92fa3b8e021c6e363f6a5bed89f8ec8731fd5b4c 100644 (file)
@@ -70,10 +70,12 @@ public class AddPathCapabilityHandlerTest {
     @Test
     public void testCapabilityHandler() throws BGPDocumentedException, BGPParsingException {
         final List<AddressFamilies> family = new ArrayList<>();
-        family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI).setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(1)).build());
+        family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI)
+            .setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(1)).build());
 
-        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(
-            new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
+        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setAddPathCapability(
+                new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
 
         final ByteBuf bytes = Unpooled.buffer(6);
         final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safiRegistry);
@@ -84,14 +86,14 @@ public class AddPathCapabilityHandlerTest {
         assertEquals(capabilityToSerialize.hashCode(), newCaps.hashCode());
     }
 
-    @Test(expected=BGPParsingException.class)
+    @Test(expected = BGPParsingException.class)
     public void testAfiException() throws BGPDocumentedException, BGPParsingException {
         final ByteBuf bytes = this.parseWrongBytes.copy();
         final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afirExpection, this.safiRegistry);
         handler.parseCapability(bytes);
     }
 
-    @Test(expected=BGPParsingException.class)
+    @Test(expected = BGPParsingException.class)
     public void testSafiException() throws BGPDocumentedException, BGPParsingException {
         final ByteBuf bytes = this.parseWrongBytes.copy();
         final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safirException);
@@ -100,8 +102,9 @@ public class AddPathCapabilityHandlerTest {
 
     @Test
     public void testSendReceiveIgnored() throws BGPDocumentedException, BGPParsingException {
-        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(
-            new AddPathCapabilityBuilder().setAddressFamilies(new ArrayList<>()).build()).build()).build();
+        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setAddPathCapability(
+                new AddPathCapabilityBuilder().setAddressFamilies(new ArrayList<>()).build()).build()).build();
 
         final ByteBuf bytes = this.parseWrongBytes.copy();
         final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safiRegistry);
@@ -109,39 +112,45 @@ public class AddPathCapabilityHandlerTest {
         assertEquals(capabilityToSerialize.hashCode(), newCaps.hashCode());
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnhandledAfi() {
         final List<AddressFamilies> family = new ArrayList<>();
-        family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI).setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(2)).build());
+        family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI)
+            .setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(2)).build());
 
-        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(
-            new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
+        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setAddPathCapability(
+                new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
 
         final ByteBuf bytes = Unpooled.buffer();
         final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afirExpection, this.safiRegistry);
         handler.serializeCapability(capabilityToSerialize, bytes);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnhandledSafi() {
         final List<AddressFamilies> family = new ArrayList<>();
-        family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI).setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(3)).build());
+        family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI)
+            .setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(3)).build());
 
-        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(
-            new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
+        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setAddPathCapability(
+                new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
 
         final ByteBuf bytes = Unpooled.buffer();
         final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safirException);
         handler.serializeCapability(capabilityToSerialize, bytes);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnhandledSendReceive() {
         final List<AddressFamilies> family = new ArrayList<>();
-        family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI).setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(4)).build());
+        family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI)
+            .setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(4)).build());
 
-        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(
-            new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
+        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setAddPathCapability(
+                new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
 
         final ByteBuf bytes = Unpooled.buffer();
         final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safiRegistry);
@@ -150,8 +159,10 @@ public class AddPathCapabilityHandlerTest {
 
     @Test
     public void noSerializationTest() {
-        final CParameters capabilityNoAugmentation = new CParametersBuilder().addAugmentation(CParameters1.class, null).build();
-        final CParameters capabilityNoMP = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().build()).build();
+        final CParameters capabilityNoAugmentation = new CParametersBuilder().addAugmentation(CParameters1.class, null)
+                .build();
+        final CParameters capabilityNoMP = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().build()).build();
 
         final ByteBuf bytes = Unpooled.buffer();
         final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safirException);
index 44ec82e5120e56e5f26685919f054e295fe553e3..741758e03d5ebb4bd5110a5910f8c098f1f56427 100644 (file)
@@ -74,7 +74,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 public class BGPParserTest {
 
     /**
-     * Used by other tests as well
+     * Used by other tests as well.
      */
     static final List<byte[]> inputBytes = new ArrayList<>();
 
@@ -86,7 +86,7 @@ public class BGPParserTest {
 
     private static final int LENGTH_FIELD_LENGTH = 2;
 
-    private static final String multiPathHexFile = "/bgp-update-multipath.txt";
+    private static final String MULTIPATH_HEX_FILE = "/bgp-update-multipath.txt";
 
     private static List<byte[]> updatesWithMultiplePath;
 
@@ -100,15 +100,15 @@ public class BGPParserTest {
             .getAttributeRegistry());
         for (int i = 1; i <= COUNTER; i++) {
             final String name = "/up" + i + ".bin";
-            try (final InputStream is = BGPParserTest.class.getResourceAsStream(name)){
+            try (InputStream is = BGPParserTest.class.getResourceAsStream(name)) {
                 if (is == null) {
                     throw new IOException("Failed to get resource " + name);
                 }
                 final ByteArrayOutputStream bis = new ByteArrayOutputStream();
                 final byte[] data = new byte[MAX_SIZE];
-                int nRead = 0;
-                while ((nRead = is.read(data, 0, data.length)) != -1) {
-                    bis.write(data, 0, nRead);
+                int numRead = 0;
+                while ((numRead = is.read(data, 0, data.length)) != -1) {
+                    bis.write(data, 0, numRead);
                 }
                 bis.flush();
 
@@ -117,7 +117,7 @@ public class BGPParserTest {
             }
         }
         updatesWithMultiplePath = HexDumpBGPFileParser.parseMessages(BGPParserTest.class.getResourceAsStream(
-            multiPathHexFile));
+            MULTIPATH_HEX_FILE));
         constraint = mock(PeerSpecificParserConstraint.class);
         mpSupport = mock(MultiPathSupport.class);
         Mockito.doReturn(Optional.empty()).when(constraint).getPeerConstraint(Mockito.any());
index 0ab58322d4c7f13c734ad954de2b4c2419d57f8f..db9ee76998837b43c2adbcd96b2a00f3e654a5ce 100644 (file)
@@ -12,12 +12,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotSame;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.List;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.AsPathSegmentParser;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.open.message.bgp.parameters.optional.capabilities.CParameters;
@@ -43,20 +40,23 @@ public class ComplementaryTest {
     @Test
     public void testBGPParameter() {
 
-        final MultiprotocolCapability cap = new MultiprotocolCapabilityBuilder().setAfi(Ipv6AddressFamily.class).setSafi(
-            UnicastSubsequentAddressFamily.class).build();
+        final MultiprotocolCapability cap = new MultiprotocolCapabilityBuilder().setAfi(Ipv6AddressFamily.class)
+                .setSafi(UnicastSubsequentAddressFamily.class).build();
         final CParameters tlv1 = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder()
             .setMultiprotocolCapability(cap).build()).build();
-        final MultiprotocolCapability cap1 = new MultiprotocolCapabilityBuilder().setAfi(Ipv4AddressFamily.class).setSafi(
-            UnicastSubsequentAddressFamily.class).build();
+        final MultiprotocolCapability cap1 = new MultiprotocolCapabilityBuilder().setAfi(Ipv4AddressFamily.class)
+                .setSafi(UnicastSubsequentAddressFamily.class).build();
         final CParameters tlv2 = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder()
             .setMultiprotocolCapability(cap1).build()).build();
 
         final List<Tables> tt = new ArrayList<>();
-        tt.add(new TablesBuilder().setAfi(Ipv6AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build());
-        tt.add(new TablesBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build());
+        tt.add(new TablesBuilder().setAfi(Ipv6AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
+            .build());
+        tt.add(new TablesBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
+            .build());
 
-        final GracefulRestartCapability tlv3 = new GracefulRestartCapabilityBuilder().setRestartFlags(new RestartFlags(Boolean.FALSE)).setRestartTime(0).setTables(tt).build();
+        final GracefulRestartCapability tlv3 = new GracefulRestartCapabilityBuilder().setRestartFlags(
+            new RestartFlags(Boolean.FALSE)).setRestartTime(0).setTables(tt).build();
 
         final CParameters tlv4 = new CParametersBuilder().setAs4BytesCapability(
             new As4BytesCapabilityBuilder().setAsNumber(new AsNumber((long) 40)).build()).build();
@@ -79,7 +79,8 @@ public class ComplementaryTest {
 
         assertEquals(40, tlv4.getAs4BytesCapability().getAsNumber().getValue().longValue());
 
-        assertEquals(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber((long) 40)).build()).build(), tlv4);
+        assertEquals(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(
+            new AsNumber((long) 40)).build()).build(), tlv4);
     }
 
     @Test
@@ -95,15 +96,4 @@ public class ComplementaryTest {
 
         assertEquals(ipv4.getNetworkAddress(), ipv4i.getNetworkAddress());
     }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testAsPathSegmentParserPrivateConstructor() throws Throwable {
-        final Constructor<AsPathSegmentParser> c = AsPathSegmentParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
 }
index 1331c724352bc4a607b8b4b13755303a3c65784b..b42a96ff0cccc25254404cf5dba362b21c910554 100644 (file)
@@ -61,11 +61,11 @@ public class GracefulCapabilityHandlerTest {
         capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
 
         final ByteBuf buffer = Unpooled.buffer(capaBytes.length);
-        handler.serializeCapability( new CParametersBuilder().addAugmentation(CParameters1.class,
+        handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
         Assert.assertArrayEquals(capaBytes, buffer.array());
 
-        Assert.assertEquals( new CParametersBuilder().addAugmentation(CParameters1.class,
+        Assert.assertEquals(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(),
             handler.parseCapability(Unpooled.wrappedBuffer(capaBytes).slice(2, capaBytes.length - 2)));
 
@@ -78,10 +78,10 @@ public class GracefulCapabilityHandlerTest {
         tablesBuilder.setAfiFlags(new AfiFlags(false));
         capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
         buffer.clear();
-        handler.serializeCapability( new CParametersBuilder().addAugmentation(CParameters1.class,
+        handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
         Assert.assertArrayEquals(capaBytes2, buffer.array());
-        Assert.assertEquals( new CParametersBuilder().addAugmentation(CParameters1.class,
+        Assert.assertEquals(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(),
             handler.parseCapability(Unpooled.wrappedBuffer(capaBytes2).slice(2, capaBytes2.length - 2)));
 
@@ -90,7 +90,7 @@ public class GracefulCapabilityHandlerTest {
         capaBuilder.setRestartTime(null);
         capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
         buffer.clear();
-        handler.serializeCapability( new CParametersBuilder().addAugmentation(CParameters1.class,
+        handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
         Assert.assertArrayEquals(capaBytes2, buffer.array());
 
@@ -101,7 +101,7 @@ public class GracefulCapabilityHandlerTest {
         capaBuilder.setRestartFlags(new RestartFlags(false));
         capaBuilder.setRestartTime(0);
         capaBuilder.setTables(Collections.emptyList());
-        Assert.assertEquals( new CParametersBuilder().addAugmentation(CParameters1.class,
+        Assert.assertEquals(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(),
             handler.parseCapability(Unpooled.wrappedBuffer(capaBytes3).slice(2, capaBytes3.length - 2)));
 
@@ -109,7 +109,7 @@ public class GracefulCapabilityHandlerTest {
             (byte) 0x40, (byte) 0x06, (byte) 0x00, (byte) 0x00,
             (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00
         };
-        Assert.assertEquals( new CParametersBuilder().addAugmentation(CParameters1.class,
+        Assert.assertEquals(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(),
             handler.parseCapability(Unpooled.wrappedBuffer(capaBytes4).slice(2, capaBytes4.length - 2)));
         final byte[] capaBytes5 = {
@@ -117,16 +117,18 @@ public class GracefulCapabilityHandlerTest {
         };
         final ByteBuf b = Unpooled.buffer(capaBytes5.length);
 
-        handler.serializeCapability( new CParametersBuilder().addAugmentation(CParameters1.class,
-            new CParameters1Builder().setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build()).build()).build(), b);
+        handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build())
+            .build()).build(), b);
         Assert.assertArrayEquals(capaBytes5, b.array());
         Assert.assertEquals(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder()
-            .setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().setRestartFlags(new RestartFlags(Boolean.FALSE))
+            .setGracefulRestartCapability(new GracefulRestartCapabilityBuilder()
+                .setRestartFlags(new RestartFlags(Boolean.FALSE))
                 .setRestartTime(0).setTables(Collections.emptyList()).build()).build()).build(),
             handler.parseCapability(Unpooled.wrappedBuffer(capaBytes5).slice(2, capaBytes5.length - 2)));
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnhandledAfi() {
         final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(),
             this.ctx.getSubsequentAddressFamilyRegistry());
@@ -142,11 +144,11 @@ public class GracefulCapabilityHandlerTest {
         capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
 
         final ByteBuf buffer = Unpooled.buffer();
-        handler.serializeCapability( new CParametersBuilder().addAugmentation(CParameters1.class,
+        handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnhandledSafi() {
         final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(),
             this.ctx.getSubsequentAddressFamilyRegistry());
@@ -161,11 +163,11 @@ public class GracefulCapabilityHandlerTest {
         capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
 
         final ByteBuf buffer = Unpooled.buffer();
-        handler.serializeCapability( new CParametersBuilder().addAugmentation(CParameters1.class,
+        handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testRestartTimeMinValue() {
         final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(),
             this.ctx.getSubsequentAddressFamilyRegistry());
@@ -180,11 +182,11 @@ public class GracefulCapabilityHandlerTest {
         capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
 
         final ByteBuf buffer = Unpooled.buffer();
-        handler.serializeCapability( new CParametersBuilder().addAugmentation(CParameters1.class,
+        handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testRestartTimeMaxValue() {
         final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(),
             this.ctx.getSubsequentAddressFamilyRegistry());
@@ -199,8 +201,7 @@ public class GracefulCapabilityHandlerTest {
         capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
 
         final ByteBuf buffer = Unpooled.buffer();
-        handler.serializeCapability( new CParametersBuilder().addAugmentation(CParameters1.class,
+        handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
             new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
     }
-
 }
index 68ba17e543eae16fc4bee5001a2e33b02311db63..e4e3528888e290dabc9cfd16f3a98b85f9d235b4 100644 (file)
@@ -17,15 +17,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder;
 
 public class IPv6NextHopTest {
-
     private Ipv6NextHop nextHopA;
     private Ipv6NextHop nextHopB;
 
     @Before
     public void init() {
         this.nextHopA = new Ipv6NextHopBuilder().setGlobal(new Ipv6Address("2001:db8:85a3:0:0:8a2e:370:7331")).build();
-        this.nextHopB = new Ipv6NextHopBuilder().setGlobal(new Ipv6Address("2001:db8:85a3:0:0:8a2e:370:7331")).setLinkLocal(
-                new Ipv6Address("2001:db8:85a3:0:0:8a2e:370:0000")).build();
+        this.nextHopB = new Ipv6NextHopBuilder().setGlobal(new Ipv6Address("2001:db8:85a3:0:0:8a2e:370:7331"))
+                .setLinkLocal(new Ipv6Address("2001:db8:85a3:0:0:8a2e:370:0000")).build();
     }
 
     @Test
index 2ae99f60167f8c4d484758f202196c77b62431ac..dfc6b9a041b3a259d0d4d157c459188007f1ec1f 100644 (file)
@@ -47,14 +47,14 @@ public class LlGracefulCapabilityHandlerTest {
     public void testLongLivedGracefulCapabilityHandler() throws BGPParsingException, BGPDocumentedException {
 
         final byte[] capaBytes = {
-                //header
-                (byte) 0x47, (byte) 0x0e,
-                // Ipv4 Unicast, afiFlags = false, timer = 10
-                (byte) 0x00, (byte) 0x01, (byte) 0x01,
-                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a,
-                // Ipv6 Unicast, afiFlags = true, timer = 160
-                (byte) 0x00, (byte) 0x02, (byte) 0x01,
-                (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0xa0
+            //header
+            (byte) 0x47, (byte) 0x0e,
+            // Ipv4 Unicast, afiFlags = false, timer = 10
+            (byte) 0x00, (byte) 0x01, (byte) 0x01,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a,
+            // Ipv6 Unicast, afiFlags = true, timer = 160
+            (byte) 0x00, (byte) 0x02, (byte) 0x01,
+            (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0xa0
         };
 
         final LlGracefulRestartCapability capability = new LlGracefulRestartCapabilityBuilder()
@@ -82,7 +82,7 @@ public class LlGracefulCapabilityHandlerTest {
                 .slice(2, capaBytes.length - 2)));
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnsupportedAfi() {
         final LlGracefulRestartCapability capability = new LlGracefulRestartCapabilityBuilder()
                 .setTables(Arrays.asList(new TablesBuilder()
@@ -98,7 +98,7 @@ public class LlGracefulCapabilityHandlerTest {
         this.handler.serializeCapability(cParameters, buffer);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnsupportedSafi() {
         final LlGracefulRestartCapability capability = new LlGracefulRestartCapabilityBuilder()
                 .setTables(Arrays.asList(new TablesBuilder()
@@ -114,7 +114,7 @@ public class LlGracefulCapabilityHandlerTest {
         this.handler.serializeCapability(cParameters, buffer);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testMinStaleTime() {
         final LlGracefulRestartCapability capability = new LlGracefulRestartCapabilityBuilder()
                 .setTables(Arrays.asList(new TablesBuilder()
@@ -130,7 +130,7 @@ public class LlGracefulCapabilityHandlerTest {
         this.handler.serializeCapability(cParameters, buffer);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testMaxStaleTime() {
 
         final LlGracefulRestartCapability capability = new LlGracefulRestartCapabilityBuilder()
index 5086267c6e8b58747a5e32f06acca5dc78589058..ee754f2d6f79ae3b7ea513140410ef486b887811 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl;
 
 import static org.junit.Assert.assertEquals;
@@ -31,7 +30,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.UnicastSubsequentAddressFamily;
 
 public class MultiProtocolCapabilityHandlerTest {
-
     private static final Class<Ipv6AddressFamily> AFI = Ipv6AddressFamily.class;
     private static final Class<UnicastSubsequentAddressFamily> SAFI = UnicastSubsequentAddressFamily.class;
 
@@ -62,8 +60,10 @@ public class MultiProtocolCapabilityHandlerTest {
 
     @Test
     public void testCapabilityHandler() throws BGPDocumentedException, BGPParsingException {
-        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(
-            new MultiprotocolCapabilityBuilder().setAfi(MultiProtocolCapabilityHandlerTest.AFI).setSafi(MultiProtocolCapabilityHandlerTest.SAFI).build()).build()).build();
+        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setMultiprotocolCapability(
+            new MultiprotocolCapabilityBuilder().setAfi(MultiProtocolCapabilityHandlerTest.AFI)
+            .setSafi(MultiProtocolCapabilityHandlerTest.SAFI).build()).build()).build();
 
         final ByteBuf bytes = Unpooled.buffer();
         final MultiProtocolCapabilityHandler handler = new MultiProtocolCapabilityHandler(this.afir, this.safir);
@@ -73,33 +73,42 @@ public class MultiProtocolCapabilityHandlerTest {
         assertEquals(capabilityToSerialize.hashCode(), newCaps.hashCode());
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnhandledAfi() {
-        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(
-            new MultiprotocolCapabilityBuilder().setAfi(MultiProtocolCapabilityHandlerTest.AFI).setSafi(MultiProtocolCapabilityHandlerTest.SAFI).build()).build()).build();
+        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setMultiprotocolCapability(
+            new MultiprotocolCapabilityBuilder().setAfi(MultiProtocolCapabilityHandlerTest.AFI)
+            .setSafi(MultiProtocolCapabilityHandlerTest.SAFI).build()).build()).build();
 
         final ByteBuf bytes = Unpooled.buffer();
-        final MultiProtocolCapabilityHandler handler = new MultiProtocolCapabilityHandler(this.afirExpection, this.safir);
+        final MultiProtocolCapabilityHandler handler = new MultiProtocolCapabilityHandler(this.afirExpection,
+            this.safir);
         handler.serializeCapability(capabilityToSerialize, bytes);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testUnhandledSafi() {
-        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(
-            new MultiprotocolCapabilityBuilder().setAfi(MultiProtocolCapabilityHandlerTest.AFI).setSafi(MultiProtocolCapabilityHandlerTest.SAFI).build()).build()).build();
+        final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().setMultiprotocolCapability(
+            new MultiprotocolCapabilityBuilder().setAfi(MultiProtocolCapabilityHandlerTest.AFI)
+            .setSafi(MultiProtocolCapabilityHandlerTest.SAFI).build()).build()).build();
 
         final ByteBuf bytes = Unpooled.buffer();
-        final MultiProtocolCapabilityHandler handler = new MultiProtocolCapabilityHandler(this.afir, this.safirException);
+        final MultiProtocolCapabilityHandler handler = new MultiProtocolCapabilityHandler(this.afir,
+            this.safirException);
         handler.serializeCapability(capabilityToSerialize, bytes);
     }
 
     @Test
     public void noSerializationTest() {
-        final CParameters capabilityNoAugmentation = new CParametersBuilder().addAugmentation(CParameters1.class, null).build();
-        final CParameters capabilityNoMP = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().build()).build();
+        final CParameters capabilityNoAugmentation = new CParametersBuilder().addAugmentation(CParameters1.class, null)
+                .build();
+        final CParameters capabilityNoMP = new CParametersBuilder().addAugmentation(CParameters1.class,
+            new CParameters1Builder().build()).build();
 
         final ByteBuf bytes = Unpooled.buffer();
-        final MultiProtocolCapabilityHandler handler = new MultiProtocolCapabilityHandler(this.afir, this.safirException);
+        final MultiProtocolCapabilityHandler handler = new MultiProtocolCapabilityHandler(this.afir,
+            this.safirException);
         handler.serializeCapability(capabilityNoAugmentation, bytes);
         assertEquals(0, bytes.readableBytes());
         handler.serializeCapability(capabilityNoMP, bytes);
index eeace784b216ce060b8986db2a6091bd372893cd..29f0fe8a0ff74218167d64cf7c8a60475518614b 100644 (file)
@@ -39,17 +39,24 @@ public class OpenTest {
     @Test
     public void testSerializeOpen() throws Exception {
         final List<OptionalCapabilities> optionalCapas = Lists.newArrayList();
-        final OptionalCapabilities optionalCapabilitiesBuilder= new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder()
-            .setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(1000L)).build()).addAugmentation(
-                CParameters1.class, new CParameters1Builder().setGracefulRestartCapability(new GracefulRestartCapabilityBuilder()
-                    .setRestartFlags(new GracefulRestartCapability.RestartFlags(false)).setRestartTime(0).setTables
-                        (Collections.emptyList()).build()).build()).build()).build();
+        final OptionalCapabilities optionalCapabilitiesBuilder = new OptionalCapabilitiesBuilder()
+                .setCParameters(new CParametersBuilder()
+                    .setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(1000L)).build())
+                    .addAugmentation(CParameters1.class, new CParameters1Builder()
+                        .setGracefulRestartCapability(new GracefulRestartCapabilityBuilder()
+                            .setRestartFlags(new GracefulRestartCapability.RestartFlags(false)).setRestartTime(0)
+                            .setTables(Collections.emptyList()).build())
+                        .build())
+                    .build())
+                .build();
         optionalCapas.add(optionalCapabilitiesBuilder);
-        final List<BgpParameters> tlvs = Lists.newArrayList(new BgpParametersBuilder().setOptionalCapabilities(optionalCapas).build());
-        final Open open = new OpenBuilder().setBgpIdentifier(new Ipv4Address("127.0.0.1")).setMyAsNumber(30).setHoldTimer(3).setVersion(
-            new ProtocolVersion((short) 4)).setBgpParameters(tlvs).build();
+        final List<BgpParameters> tlvs = Lists.newArrayList(new BgpParametersBuilder()
+            .setOptionalCapabilities(optionalCapas).build());
+        final Open open = new OpenBuilder().setBgpIdentifier(new Ipv4Address("127.0.0.1")).setMyAsNumber(30)
+                .setHoldTimer(3).setVersion(new ProtocolVersion((short) 4)).setBgpParameters(tlvs).build();
         final ByteBuf msg = Unpooled.buffer();
-        new BGPOpenMessageParser(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getParameterRegistry()).serializeMessage(open, msg);
+        new BGPOpenMessageParser(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getParameterRegistry())
+            .serializeMessage(open, msg);
         final byte[] temp = ByteArray.cutBytes(ByteArray.getAllBytes(msg), 19);
         final Open openResult = new BGPOpenMessageParser(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance()
             .getParameterRegistry()).parseMessageBody(Unpooled.copiedBuffer(temp), temp.length, null);
@@ -58,14 +65,17 @@ public class OpenTest {
         assertEquals(open.getHoldTimer(), openResult.getHoldTimer());
         assertEquals(open.getMyAsNumber(), openResult.getMyAsNumber());
         boolean grace = false;
-        if(openResult.getBgpParameters().get(0).getOptionalCapabilities().get(0).getCParameters().getAs4BytesCapability() != null ) {
+        if (openResult.getBgpParameters().get(0).getOptionalCapabilities().get(0).getCParameters()
+                .getAs4BytesCapability() != null) {
             grace = true;
         }
-        assertEquals(open.getBgpParameters().get(0).getOptionalCapabilities().get(0).getCParameters().getAs4BytesCapability(),
-            openResult.getBgpParameters().get(0).getOptionalCapabilities().get(!grace ? 1 : 0).getCParameters().getAs4BytesCapability());
         assertEquals(open.getBgpParameters().get(0).getOptionalCapabilities().get(0).getCParameters()
-            .augmentation(CParameters1.class)
-            .getGracefulRestartCapability(), openResult.getBgpParameters().get(0).getOptionalCapabilities().get(grace ? 1 : 0).getCParameters()
+            .getAs4BytesCapability(),
+            openResult.getBgpParameters().get(0).getOptionalCapabilities().get(grace ? 0 : 1).getCParameters()
+            .getAs4BytesCapability());
+        assertEquals(open.getBgpParameters().get(0).getOptionalCapabilities().get(0).getCParameters()
+            .augmentation(CParameters1.class).getGracefulRestartCapability(),
+            openResult.getBgpParameters().get(0).getOptionalCapabilities().get(grace ? 1 : 0).getCParameters()
                 .augmentation(CParameters1.class).getGracefulRestartCapability());
 
     }
index 8504fd4a5110f04996d11405ef784af6a9d690a3..0102abb607c97c1db3927793101f5b4382879cd9 100644 (file)
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.net.UnknownHostException;
@@ -43,43 +44,46 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 public class ParserTest {
-
-    private static final byte[] openBMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+    private static final byte[] OPEN_BMSG = new byte[] {
+        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x1d, (byte) 0x01, (byte) 0x04,
-        (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0xb4, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14,
-        (byte) 0x00 };
+        (byte) 0x00, (byte) 0x1d, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0xb4,
+        (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x00
+    };
 
-    private static final byte[] keepAliveBMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+    private static final byte[] KEEPALIVE_BMSG = new byte[] {
+        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x13, (byte) 0x04 };
+        (byte) 0x00, (byte) 0x13, (byte) 0x04
+    };
 
-    private static final byte[] notificationBMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+    private static final byte[] NOTIFICATION_BMSG = new byte[] {
+        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x17, (byte) 0x03, (byte) 0x02,
-        (byte) 0x04, (byte) 0x04, (byte) 0x09 };
+        (byte) 0x00, (byte) 0x17, (byte) 0x03, (byte) 0x02, (byte) 0x04, (byte) 0x04, (byte) 0x09
+    };
 
-    private static final byte[] updMsgWithUnrecognizedAttribute = new byte[] {
+    private static final byte[] UPD_MSG_WITH_UNRECOGNIZED_ATTRIBUTE = new byte[] {
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x79, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x62, (byte) 0x90, (byte) 0x0e, (byte) 0x00, (byte) 0x34, (byte) 0x40, (byte) 0x04, (byte) 0x47,
         (byte) 0x04, (byte) 0x0a, (byte) 0x19, (byte) 0x02, (byte) 0x1b, (byte) 0x00, (byte) 0x00, (byte) 0x01,
         (byte) 0x00, (byte) 0x27, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte)0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x1a, (byte) 0x02,
+        (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x1a, (byte) 0x02,
         (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02,
-        (byte)0x01, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02,
-        (byte) 0x03, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte)0x00,
+        (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02,
+        (byte) 0x03, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x43, (byte) 0x40, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x40, (byte) 0x02, (byte) 0x00,
-        (byte) 0x40, (byte) 0x05, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte)0x64, (byte) 0x00,
+        (byte) 0x40, (byte) 0x05, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte )0x64, (byte) 0x00,
         (byte) 0x63, (byte) 0x19, (byte) 0x04, (byte) 0x02, (byte) 0x00, (byte) 0x08, (byte) 0x4f, (byte) 0x66,
-        (byte) 0x2d, (byte) 0x39, (byte) 0x6b, (byte) 0x2d, (byte) 0x30, (byte)0x33, (byte) 0x04, (byte) 0x03,
+        (byte) 0x2d, (byte) 0x39, (byte) 0x6b, (byte) 0x2d, (byte) 0x30, (byte) 0x33, (byte) 0x04, (byte) 0x03,
         (byte) 0x00, (byte) 0x01, (byte) 0x72, (byte) 0x04, (byte) 0x04, (byte) 0x00, (byte) 0x04, (byte) 0x2b,
         (byte) 0x2b, (byte) 0x2b, (byte) 0x2b
     };
 
     // Update message with one IPv4 prefix NLRI and all mandatory path attributes present
-    private static final byte[] updMsgWithMandatoryAttributesPresent = new byte[] {
+    private static final byte[] UPD_MSG_WITH_MANDATORY_ATTRIBUTES_PRESENT = new byte[] {
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0x00, (byte) 0x38, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1c, (byte) 0x40,
@@ -90,7 +94,7 @@ public class ParserTest {
     };
 
     // Update message with one IPv4 prefix NLRI and all mandatory path attributes except ORIGIN present
-    private static final byte[] updMsgWithOneMandatoryAttributeNotPresent = new byte[] {
+    private static final byte[] UPD_MSG_WITH_ONE_MANDATORY_ATTRIBUTE_NOT_PRESENT = new byte[] {
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0x00, (byte) 0x34, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x18, (byte) 0x40,
@@ -101,7 +105,7 @@ public class ParserTest {
     };
 
     // Update message with one IPv4 prefix NLRI and ORIGIN, AS_PATH and NEXT_HOP mandatory path attributes not present
-    private static final byte[] updMsgWithMultipleMandatoryAttributesNotPresent = new byte[] {
+    private static final byte[] UPD_MSG_WITH_MULTIPLE_MANDATORY_ATTRIBUTES_NOT_PRESENT = new byte[] {
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0x00, (byte) 0x2a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0e, (byte) 0x80,
@@ -110,10 +114,11 @@ public class ParserTest {
         (byte) 0xfe, (byte) 0x03
     };
 
-    private static final byte[] RR_MSG = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+    private static final byte[] RR_MSG = new byte[] {
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x17, (byte) 0x05, (byte) 0x00, (byte) 0x01,
-        (byte) 0x00, (byte) 0x01 };
+        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        (byte) 0x00, (byte) 0x17, (byte) 0x05, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x01
+    };
 
     private static MessageRegistry reg;
 
@@ -124,9 +129,11 @@ public class ParserTest {
 
     @Test
     public void testHeaderErrors() throws BGPParsingException, BGPDocumentedException {
-        byte[] wrong = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        byte[] wrong = new byte[] {
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0xff, (byte) 0x00 };
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+            (byte) 0x00
+        };
         wrong = ByteArray.cutBytes(wrong, 16);
         try {
             ParserTest.reg.parseMessage(Unpooled.copiedBuffer(wrong), null);
@@ -141,9 +148,11 @@ public class ParserTest {
 
     @Test
     public void testBadMsgType() throws BGPParsingException {
-        final byte[] bytes = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        final byte[] bytes = {
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x13, (byte) 0x08 };
+            (byte) 0x00, (byte) 0x13, (byte) 0x08
+        };
         try {
             ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bytes), null);
             fail("Exception should have occured.");
@@ -159,19 +168,19 @@ public class ParserTest {
         final Notification keepAlive = new KeepaliveBuilder().build();
         final ByteBuf buffer = Unpooled.buffer();
         ParserTest.reg.serializeMessage(keepAlive, buffer);
-        assertArrayEquals(keepAliveBMsg, ByteArray.getAllBytes(buffer));
-
-        final Notification m = ParserTest.reg.parseMessage(Unpooled.
-            copiedBuffer(ByteArray.getAllBytes(buffer)), null);
+        assertArrayEquals(KEEPALIVE_BMSG, ByteArray.getAllBytes(buffer));
 
+        final Notification m = ParserTest.reg.parseMessage(Unpooled.copiedBuffer(ByteArray.getAllBytes(buffer)), null);
         assertTrue(m instanceof Keepalive);
     }
 
     @Test
     public void testBadKeepAliveMsg() throws BGPParsingException {
-        final byte[] bytes = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        final byte[] bytes = new byte[] {
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x14, (byte) 0x04, (byte) 0x05 };
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+            (byte) 0x00, (byte) 0x14, (byte) 0x04, (byte) 0x05
+        };
 
         try {
             ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bytes), null);
@@ -191,7 +200,7 @@ public class ParserTest {
             new ProtocolVersion((short) 4)).build();
         final ByteBuf bytes = Unpooled.buffer();
         ParserTest.reg.serializeMessage(open, bytes);
-        assertArrayEquals(openBMsg, ByteArray.getAllBytes(bytes));
+        assertArrayEquals(OPEN_BMSG, ByteArray.getAllBytes(bytes));
 
         final Notification m = ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bytes), null);
 
@@ -204,10 +213,12 @@ public class ParserTest {
 
     @Test
     public void testBadHoldTimeError() throws BGPParsingException {
-        final byte[] bMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        final byte[] bMsg = new byte[] {
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x1d, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x64,
-            (byte) 0x00, (byte) 0x01, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x00 };
+            (byte) 0x00, (byte) 0x1d, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0x01,
+            (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x00
+        };
 
         try {
             ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bMsg), null);
@@ -222,10 +233,12 @@ public class ParserTest {
 
     @Test
     public void testBadMsgLength() throws BGPParsingException {
-        final byte[] bMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        final byte[] bMsg = new byte[] {
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x1b, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x64,
-            (byte) 0x00, (byte) 0xb4, (byte) 0xff, (byte) 0xff, (byte) 0xff };
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+            (byte) 0x00, (byte) 0x1b, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0xb4,
+            (byte) 0xff, (byte) 0xff, (byte) 0xff
+        };
 
         try {
             ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bMsg), null);
@@ -238,10 +251,12 @@ public class ParserTest {
 
     @Test
     public void testBadVersion() throws BGPParsingException {
-        final byte[] bMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        final byte[] bMsg = new byte[] {
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x1d, (byte) 0x01, (byte) 0x08, (byte) 0x00, (byte) 0x64,
-            (byte) 0x00, (byte) 0xb4, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x00 };
+            (byte) 0x00, (byte) 0x1d, (byte) 0x01, (byte) 0x08, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0xb4,
+            (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x00
+        };
 
         try {
             ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bMsg), null);
@@ -260,14 +275,14 @@ public class ParserTest {
             .setErrorSubcode(BGPError.OPT_PARAM_NOT_SUPPORTED.getSubcode()).setData(new byte[] { 4, 9 }).build();
         final ByteBuf bytes = Unpooled.buffer();
         ParserTest.reg.serializeMessage(notMsg, bytes);
-        assertArrayEquals(notificationBMsg, ByteArray.subByte(bytes.array(),0,bytes.writerIndex()));
+        assertArrayEquals(NOTIFICATION_BMSG, ByteArray.subByte(bytes.array(),0,bytes.writerIndex()));
 
-        Notification m = ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bytes), null);
+        Notification msg = ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bytes), null);
 
-        assertTrue(m instanceof Notify);
-        assertEquals(BGPError.OPT_PARAM_NOT_SUPPORTED, BGPError.forValue(((Notify) m).getErrorCode(),
-            ((Notify) m).getErrorSubcode()));
-        assertArrayEquals(new byte[] { 4, 9 }, ((Notify) m).getData());
+        assertTrue(msg instanceof Notify);
+        assertEquals(BGPError.OPT_PARAM_NOT_SUPPORTED, BGPError.forValue(((Notify) msg).getErrorCode(),
+            ((Notify) msg).getErrorSubcode()));
+        assertArrayEquals(new byte[] { 4, 9 }, ((Notify) msg).getData());
 
         notMsg = new NotifyBuilder().setErrorCode(BGPError.CONNECTION_NOT_SYNC.getCode()).setErrorSubcode(
             BGPError.CONNECTION_NOT_SYNC.getSubcode()).build();
@@ -276,19 +291,21 @@ public class ParserTest {
 
         ParserTest.reg.serializeMessage(notMsg, bytes);
 
-        m = ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bytes), null);
+        msg = ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bytes), null);
 
-        assertTrue(m instanceof Notify);
-        assertEquals(BGPError.CONNECTION_NOT_SYNC, BGPError.forValue(((Notify) m).getErrorCode(),
-            ((Notify) m).getErrorSubcode()));
-        assertNull(((Notify) m).getData());
+        assertTrue(msg instanceof Notify);
+        assertEquals(BGPError.CONNECTION_NOT_SYNC, BGPError.forValue(((Notify) msg).getErrorCode(),
+            ((Notify) msg).getErrorSubcode()));
+        assertNull(((Notify) msg).getData());
     }
 
     @Test
     public void testWrongLength() throws BGPParsingException {
-        final byte[] bMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        final byte[] bMsg = new byte[] {
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x14, (byte) 0x03, (byte) 0x02 };
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+            (byte) 0x00, (byte) 0x14, (byte) 0x03, (byte) 0x02
+        };
 
         try {
             ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bMsg), null);
@@ -303,9 +320,11 @@ public class ParserTest {
 
     @Test
     public void testUnrecognizedError() throws BGPParsingException, BGPDocumentedException {
-        final byte[] bMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+        final byte[] bMsg = new byte[] {
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x15, (byte) 0x03, (byte) 0x02, (byte) 0xaa };
+            (byte) 0x00, (byte) 0x15, (byte) 0x03, (byte) 0x02, (byte) 0xaa
+        };
 
         try {
             ParserTest.reg.parseMessage(Unpooled.copiedBuffer(bMsg), null);
@@ -320,7 +339,7 @@ public class ParserTest {
     @Test
     public void testParseUpdMsgWithUnrecognizedAttribute() throws BGPDocumentedException, BGPParsingException {
         try {
-            reg.parseMessage(Unpooled.copiedBuffer(updMsgWithUnrecognizedAttribute), null);
+            reg.parseMessage(Unpooled.copiedBuffer(UPD_MSG_WITH_UNRECOGNIZED_ATTRIBUTE), null);
             fail("Exception should have occured.");
         } catch (final BGPDocumentedException e) {
             assertEquals("Well known attribute not recognized.", e.getMessage());
@@ -333,7 +352,7 @@ public class ParserTest {
     @Test
     public void testParseUpdMsgWithMandatoryAttributesPresent() throws BGPDocumentedException, BGPParsingException {
         try {
-            final Notification msg = reg.parseMessage(Unpooled.copiedBuffer(updMsgWithMandatoryAttributesPresent),
+            final Notification msg = reg.parseMessage(Unpooled.copiedBuffer(UPD_MSG_WITH_MANDATORY_ATTRIBUTES_PRESENT),
                 null);
             assertTrue(msg instanceof Update);
         } catch (final BGPDocumentedException e) {
@@ -345,7 +364,7 @@ public class ParserTest {
     public void testParseUpdMsgWithOneMandatoryAttributeNotPresent()
         throws BGPDocumentedException, BGPParsingException {
         try {
-            reg.parseMessage(Unpooled.copiedBuffer(updMsgWithOneMandatoryAttributeNotPresent), null);
+            reg.parseMessage(Unpooled.copiedBuffer(UPD_MSG_WITH_ONE_MANDATORY_ATTRIBUTE_NOT_PRESENT), null);
             fail("Exception should have occured.");
         } catch (final BGPDocumentedException e) {
             assertEquals(BGPError.MANDATORY_ATTR_MISSING_MSG + "ORIGIN", e.getMessage());
@@ -360,7 +379,7 @@ public class ParserTest {
     public void testParseUpdMsgWithMultipleMandatoryAttributesNotPresent()
         throws BGPDocumentedException, BGPParsingException {
         try {
-            reg.parseMessage(Unpooled.copiedBuffer(updMsgWithMultipleMandatoryAttributesNotPresent), null);
+            reg.parseMessage(Unpooled.copiedBuffer(UPD_MSG_WITH_MULTIPLE_MANDATORY_ATTRIBUTES_NOT_PRESENT), null);
             fail("Exception should have occured.");
         } catch (final BGPDocumentedException e) {
             assertEquals(BGPError.MANDATORY_ATTR_MISSING_MSG + "NEXT_HOP", e.getMessage());
index 895f089deab6a5bb630ed68284c9281c624b4858..8d1feb1785ec8026c77b8289cc356e03a2111527 100644 (file)
@@ -24,10 +24,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.AggregatorBuilder;
 
 public class AggregatorAttributeParserTest {
-
-    private static final byte[] ATTRIBUTE_BYTES = {(byte) 0xC0, (byte) 0x07, (byte) 0x08,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
-            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x01};
+    private static final byte[] ATTRIBUTE_BYTES = {
+        (byte) 0xC0, (byte) 0x07, (byte) 0x08,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x01
+    };
 
     private static final Attributes RESULT = new AttributesBuilder()
             .setAggregator(new AggregatorBuilder()
index bb50a18bef8ba92aa8a047d5bedc682236d70eb2..3c9152e9b4aa409874164e3dbc10f9af3f90a881 100644 (file)
@@ -28,14 +28,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.as.path.SegmentsBuilder;
 
 public class AsPathAttributeParserTest {
-
-    private static final byte[] ATTRIBUTE_BYTES = {(byte) 0x40, (byte) 0x02, (byte) 0x14,
-            (byte) 0x01, (byte) 0x02, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x02, (byte) 0x02, (byte) 0x02,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04};
-    private static final byte[] EMPTY_ATTRIBUTE_BYTES = {(byte) 0x40, (byte) 0x02, (byte) 0x00};
+    private static final byte[] ATTRIBUTE_BYTES = {
+        (byte) 0x40, (byte) 0x02, (byte) 0x14,
+        (byte) 0x01, (byte) 0x02, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x02, (byte) 0x02, (byte) 0x02,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04
+    };
+    private static final byte[] EMPTY_ATTRIBUTE_BYTES = { (byte) 0x40, (byte) 0x02, (byte) 0x00 };
 
     @Test
     public void testAttributeParser() throws BGPParsingException, BGPDocumentedException {
index 9e2723844f1ac0c5ea7b896730e5b42539bc9ab3..35f0349208634b5332a0d6cfce9333c95a3b81a8 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update;
 
 import static org.junit.Assert.assertArrayEquals;
@@ -25,9 +24,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ClusterIdentifier;
 
 public class ClusterIdAttributeParserTest {
-    private static final byte[] clusterIdBytes = {(byte) 0x80, (byte) 0x0A, (byte) 0x08,
-        (byte) 0xC0, (byte) 0xA8, (byte) 0x1, (byte) 0x1,
-        (byte) 0xC0, (byte) 0xA8, (byte) 0x1, (byte) 0x2};
+    private static final byte[] CLUSTER_ID_BYTES = {
+        (byte) 0x80, (byte) 0x0A, (byte) 0x08,
+        (byte) 0xC0, (byte) 0xA8, (byte) 0x1, (byte) 0x1, (byte) 0xC0, (byte) 0xA8, (byte) 0x1, (byte) 0x2
+    };
     ClusterIdAttributeParser parser;
 
     @Before
@@ -42,17 +42,17 @@ public class ClusterIdAttributeParserTest {
         final Ipv4Address ip2 = new Ipv4Address("192.168.1.2");
         list.add(new ClusterIdentifier(ip1));
         list.add(new ClusterIdentifier(ip2));
-        final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster
-            (list).build()).build();
+        final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster(list)
+            .build()).build();
 
 
         final ByteBuf output = Unpooled.buffer();
         this.parser.serializeAttribute(clusterId, output);
 
-        assertArrayEquals(clusterIdBytes, ByteArray.getAllBytes(output));
+        assertArrayEquals(CLUSTER_ID_BYTES, ByteArray.getAllBytes(output));
 
         AttributesBuilder clusterIdOutput = new AttributesBuilder();
-        this.parser.parseAttribute(Unpooled.wrappedBuffer(ByteArray.cutBytes(clusterIdBytes, 3)), clusterIdOutput,
+        this.parser.parseAttribute(Unpooled.wrappedBuffer(ByteArray.cutBytes(CLUSTER_ID_BYTES, 3)), clusterIdOutput,
             null);
         assertEquals(clusterId, clusterIdOutput.build());
     }
@@ -60,8 +60,8 @@ public class ClusterIdAttributeParserTest {
     @Test
     public void testParseEmptyListAttribute() {
         final List<ClusterIdentifier> list = Lists.newArrayList();
-        final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster
-            (list).build()).build();
+        final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster(list)
+            .build()).build();
         final ByteBuf output = Unpooled.buffer();
         this.parser.serializeAttribute(clusterId, output);
         assertEquals(Unpooled.buffer(), output);
index 16469850b7e91dbe90fb64de1b1b1357fa7029e7..6f07fd4f088e147386141a06e319d0287b4a1d8d 100644 (file)
@@ -24,14 +24,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.Communities;
 
 public class CommunitiesAttributeParserTest {
-
-    private static final byte[] CommunitiesBytes = {(byte) 0xC0, (byte) 0x08, (byte) 0x18,
-        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x1,
-        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x2,
-        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x3,
+    private static final byte[] COMMUNITIES_BYTES = {
+        (byte) 0xC0, (byte) 0x08, (byte) 0x18,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x01,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x02,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x03,
         (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x10,
         (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x06,
-        (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x07};
+        (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x07
+    };
 
     @Test
     public void testCommunitiesAttributeParser() throws Exception {
@@ -49,7 +50,7 @@ public class CommunitiesAttributeParserTest {
         final ByteBuf actual = Unpooled.buffer();
         ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAttributeRegistry()
             .serializeAttribute(paBuilder.build(), actual);
-        assertArrayEquals(CommunitiesBytes, ByteArray.getAllBytes(actual));
+        assertArrayEquals(COMMUNITIES_BYTES, ByteArray.getAllBytes(actual));
         final Attributes attributeOut = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance()
             .getAttributeRegistry().parseAttributes(actual, null).getAttributes();
         assertEquals(comms, attributeOut.getCommunities());
index 1cba27daf3c8dbc02fb5bcfaa64a2a2fc75de44f..ec81374d6af69020d879d6ed442a5d63b05cc89f 100644 (file)
@@ -45,16 +45,20 @@ public class ExtendedCommunitiesAttributeParserTest {
 
     @Before
     public void setUp() {
-        final ExtendedCommunityRegistry exReg = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getExtendedCommunityRegistry();
+        final ExtendedCommunityRegistry exReg = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance()
+                .getExtendedCommunityRegistry();
         this.handler = new ExtendedCommunitiesAttributeParser(exReg);
     }
 
     @Test
     public void testExtendedCommunityAttributeParser() throws BGPDocumentedException, BGPParsingException {
-        final RouteOriginExtendedCommunityCase routeOrigin = new RouteOriginExtendedCommunityCaseBuilder().setRouteOriginExtendedCommunity(
-                new RouteOriginExtendedCommunityBuilder().setGlobalAdministrator(new ShortAsNumber(54L)).setLocalAdministrator(
-                        new byte[] { 0, 0, 1, 76 }).build()).build();
-        final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setTransitive(false).setExtendedCommunity(routeOrigin).build();
+        final RouteOriginExtendedCommunityCase routeOrigin = new RouteOriginExtendedCommunityCaseBuilder()
+                .setRouteOriginExtendedCommunity(new RouteOriginExtendedCommunityBuilder()
+                    .setGlobalAdministrator(new ShortAsNumber(54L))
+                    .setLocalAdministrator(new byte[] { 0, 0, 1, 76 }).build())
+                .build();
+        final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setTransitive(false)
+                .setExtendedCommunity(routeOrigin).build();
         final AttributesBuilder attBuilder = new AttributesBuilder();
 
         this.handler.parseAttribute(Unpooled.copiedBuffer(INPUT), attBuilder, null);
@@ -80,7 +84,7 @@ public class ExtendedCommunitiesAttributeParserTest {
     public void testEmptyExtendedCommunityAttributeParser() throws BGPDocumentedException, BGPParsingException {
         final ByteBuf output = Unpooled.buffer();
         this.handler.serializeAttribute(new AttributesBuilder().build(), output);
-        assertEquals( Unpooled.buffer(), output);
+        assertEquals(Unpooled.buffer(), output);
     }
 
     @Test
index 0863f4817f76d7d9c104cf6062f93d553e6f35be..4f4c272cbaac21679f6a1be0a7656def4656e3fe 100644 (file)
@@ -22,9 +22,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.LocalPrefBuilder;
 
 public class LocalPreferenceAttributeParserTest {
-
-    private static final byte[] ATTRIBUTE_BYTES = {(byte) 0x40, (byte) 0x05, (byte) 0x04,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01};
+    private static final byte[] ATTRIBUTE_BYTES = {
+        (byte) 0x40, (byte) 0x05, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01
+    };
 
     private static final Attributes RESULT = new AttributesBuilder()
             .setLocalPref(new LocalPrefBuilder()
index 3b60431f9451254e05b0367a08162696d66f82f4..27cc429a80abce3a64e09afb07af50a294aad395 100644 (file)
@@ -22,9 +22,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.MultiExitDiscBuilder;
 
 public class MultiExitDiscriminatorAttributeParserTest {
-
-    private static final byte[] ATTRIBUTE_BYTES = {(byte) 0x80, (byte) 0x04, (byte) 0x04,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01};
+    private static final byte[] ATTRIBUTE_BYTES = {
+        (byte) 0x80, (byte) 0x04, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01
+    };
 
     private static final Attributes RESULT = new AttributesBuilder()
             .setMultiExitDisc(new MultiExitDiscBuilder().setMed(1L).build()).build();
index fc293381fc9d94bbdb93e64c683e6988f39bd179..e666505928fe560dd25588ccf84b5e9fc82e708d 100644 (file)
@@ -28,17 +28,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 
 public class NextHopAttributeParserTest {
 
-    private static final byte[] IPV4_NEXT_HOP_BYTES = {(byte) 0x40, (byte) 0x03, (byte) 0x04,
-            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
-    private static final byte[] IPV6_NEXT_HOP_BYTES = {(byte) 0x40, (byte) 0x03, (byte) 0x20,
-            (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
-            (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02};
+    private static final byte[] IPV4_NEXT_HOP_BYTES = {
+        (byte) 0x40, (byte) 0x03, (byte) 0x04, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF
+    };
+    private static final byte[] IPV6_NEXT_HOP_BYTES = {
+        (byte) 0x40, (byte) 0x03, (byte) 0x20, (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02
+    };
 
     private static final Attributes IPV4_RESULT = new AttributesBuilder()
             .setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
index 9d02167737b434cdcbc0e5cd993867e4ecf68b5a..921ab08289d4a95b536441717fde16aae5756e28 100644 (file)
@@ -24,8 +24,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 
 public class OriginatorIdAttributeParserTest {
 
-    private static final byte[] ATTRIBUTE_BYTES = {(byte) 0x80, (byte) 0x09, (byte) 0x04,
-            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
+    private static final byte[] ATTRIBUTE_BYTES = {
+        (byte) 0x80, (byte) 0x09, (byte) 0x04, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF
+    };
 
     private static final Attributes RESULT = new AttributesBuilder()
             .setOriginatorId(new OriginatorIdBuilder()
index 352c603664484a4220c0c8f1ef7c4fb848b44d4f..27234154678952a84c61cb75d0ff5faea436c72c 100755 (executable)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update;
 
 import static org.junit.Assert.assertArrayEquals;
@@ -26,19 +25,29 @@ public class UnrecognizedAttributesSerializerTest {
 
     @Test
     public void testUnrecognizedAttributesSerializer() {
-        final byte[] unrecognizedValue1 = { (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35 };
-        final byte[] unrecognizedValue2 = { (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd7, 0x5d, 0x75, (byte)0xd7, 0x5d, 0x75 };
-        final byte[] unrecognizedBytes = { (byte)0xe0, 0x65, 0x0c, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35,
-                                           (byte)0xe0, 0x66, 0x0c, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd7, 0x5d, 0x75, (byte)0xd7, 0x5d, 0x75 };
+        final byte[] unrecognizedValue1 = {
+            (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35
+        };
+        final byte[] unrecognizedValue2 = {
+            (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd7, 0x5d, 0x75, (byte)0xd7, 0x5d, 0x75
+        };
+        final byte[] unrecognizedBytes = {
+            (byte)0xe0, 0x65, 0x0c, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35,
+            (byte)0xd3, 0x5d, 0x35, (byte)0xe0, 0x66, 0x0c, (byte)0xd3, 0x5d, 0x35, (byte)0xd3, 0x5d, 0x35,
+            (byte)0xd7, 0x5d, 0x75, (byte)0xd7, 0x5d, 0x75
+        };
         final List<UnrecognizedAttributes> unrecognizedAttrs = new ArrayList<>();
-        final UnrecognizedAttributes unrecognizedAttribute1 = new UnrecognizedAttributesBuilder().setPartial(true).setTransitive(true).setType((short) 101).setValue(unrecognizedValue1).build();
+        final UnrecognizedAttributes unrecognizedAttribute1 = new UnrecognizedAttributesBuilder().setPartial(true)
+                .setTransitive(true).setType((short) 101).setValue(unrecognizedValue1).build();
         unrecognizedAttrs.add(unrecognizedAttribute1);
-        final UnrecognizedAttributes unrecognizedAttribute2 = new UnrecognizedAttributesBuilder().setPartial(true).setTransitive(true).setType((short) 102).setValue(unrecognizedValue2).build();
+        final UnrecognizedAttributes unrecognizedAttribute2 = new UnrecognizedAttributesBuilder().setPartial(true)
+                .setTransitive(true).setType((short) 102).setValue(unrecognizedValue2).build();
         unrecognizedAttrs.add(unrecognizedAttribute2);
         final Attributes attrs = new AttributesBuilder().setUnrecognizedAttributes(unrecognizedAttrs).build();
 
         final ByteBuf buffer = Unpooled.buffer();
-        ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAttributeRegistry().serializeAttribute(attrs, buffer);
+        ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAttributeRegistry().serializeAttribute(attrs,
+            buffer);
         assertArrayEquals(unrecognizedBytes, ByteArray.readAllBytes(buffer));
     }
 }
index 38e0871b8908d8862e3db58971b73734e9b8b375..e46a17f33aa1abacaf3b8af49631abd3e55e9948 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities;
 
 import io.netty.buffer.ByteBuf;
@@ -29,9 +28,11 @@ public class AsTwoOctetSpecificEcHandlerTest {
     @Test
     public void testHandler() throws BGPDocumentedException, BGPParsingException {
         final AsTwoOctetSpecificEcHandler handler = new AsTwoOctetSpecificEcHandler();
-        final AsSpecificExtendedCommunityCase expected = new AsSpecificExtendedCommunityCaseBuilder().setAsSpecificExtendedCommunity(
-                new AsSpecificExtendedCommunityBuilder().setGlobalAdministrator(new ShortAsNumber(54L)).setLocalAdministrator(
-                        new byte[] { 0, 0, 1, 76 }).build()).build();
+        final AsSpecificExtendedCommunityCase expected = new AsSpecificExtendedCommunityCaseBuilder()
+                .setAsSpecificExtendedCommunity(new AsSpecificExtendedCommunityBuilder()
+                    .setGlobalAdministrator(new ShortAsNumber(54L))
+                    .setLocalAdministrator(new byte[] { 0, 0, 1, 76 }).build())
+                .build();
 
         final ExtendedCommunity exComm = handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
         Assert.assertEquals(expected, exComm);
@@ -40,5 +41,4 @@ public class AsTwoOctetSpecificEcHandlerTest {
         handler.serializeExtendedCommunity(expected, output);
         Assert.assertArrayEquals(INPUT, output.array());
     }
-
 }
index f29c6d9606b25ee3207fa3cf310d9598c87ca3de..22e44ede89ed9c5dde1546ec649b25e34dfa822e 100755 (executable)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities;
 
 import static org.junit.Assert.assertArrayEquals;
@@ -40,9 +39,8 @@ public class EncapsulationECTest {
     public void testParser() throws BGPParsingException, BGPDocumentedException {
         final ByteBuf buffer = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
 
-        final EncapsulationCase expected = new EncapsulationCaseBuilder().setEncapsulationExtendedCommunity(new EncapsulationExtendedCommunityBuilder()
-            .setTunnelType(TUNNEL_TYPE)
-            .build()).build();
+        final EncapsulationCase expected = new EncapsulationCaseBuilder().setEncapsulationExtendedCommunity(
+            new EncapsulationExtendedCommunityBuilder().setTunnelType(TUNNEL_TYPE).build()).build();
         this.parser.serializeExtendedCommunity(expected, buffer);
         assertArrayEquals(RESULT, ByteArray.getAllBytes(buffer));
 
index d999ed2fb165e3afb09078c0e1833e8cd48020da..7de16fbd440fed311c8c956b6108c91fab357b0c 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities;
 
 import static org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.RouteOrigin4OctectASEcHandlerTest.AS_COMMON;
@@ -29,7 +28,7 @@ public final class Generic4OctASEcHandlerTest {
     Generic4OctASEcHandler handler;
 
     @Before
-    public void Setup() {
+    public void before() {
         this.handler = new Generic4OctASEcHandler();
     }
 
@@ -47,8 +46,8 @@ public final class Generic4OctASEcHandlerTest {
         Assert.assertArrayEquals(INPUT, output.array());
     }
 
-    @Test(expected=IllegalArgumentException.class)
-    public void testHandlerError() throws BGPDocumentedException, BGPParsingException {
+    @Test(expected = IllegalArgumentException.class)
+    public void testHandlerError() {
         this.handler.serializeExtendedCommunity(new As4RouteOriginExtendedCommunityCaseBuilder().build(), null);
     }
 }
\ No newline at end of file
index ca3c2803861fc5f046bd6d018766e7e14ea027c5..763389ec53044999e4e6adb6f91dd7fbcefb393c 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 public class Ipv4SpecificEcHandlerTest {
 
     private static final byte[] INPUT = {
-            12, 51, 2, 5, 21, 45
+        12, 51, 2, 5, 21, 45
     };
 
     @Test
index 776492a6e8b3c7551d8482b7186c27bd53cd86a4..232847de0c657ba7cbc2e6c7ff7ad5df086c96d3 100644 (file)
@@ -39,7 +39,8 @@ public class LinkBandwidthECTest {
     public void parserTest() throws BGPParsingException, BGPDocumentedException {
         final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
 
-        final LinkBandwidthCase expected = new LinkBandwidthCaseBuilder().setLinkBandwidthExtendedCommunity(new LinkBandwidthExtendedCommunityBuilder()
+        final LinkBandwidthCase expected = new LinkBandwidthCaseBuilder().setLinkBandwidthExtendedCommunity(
+            new LinkBandwidthExtendedCommunityBuilder()
             .setBandwidth(new Bandwidth(new byte[]{0x00, 0x00, (byte) 0xff, (byte) 0xff}))
             .build()).build();
         this.parser.serializeExtendedCommunity(expected, buff);
index ae99f5a197a135d5c57147334ee1f5da90eb0ed1..c1ef261dd9e7fedfcb4f0d55de49ef383b9e5f3a 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities;
 
 import io.netty.buffer.ByteBuf;
@@ -20,7 +19,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.opaque.extended.community._case.OpaqueExtendedCommunityBuilder;
 
 public class OpaqueEcHandlerTest {
-
     private static final byte[] INPUT = {
         21, 45, 5, 4, 3, 1
     };
@@ -28,8 +26,9 @@ public class OpaqueEcHandlerTest {
     @Test
     public void testHandler() throws BGPDocumentedException, BGPParsingException {
         final OpaqueEcHandler handler = new OpaqueEcHandler();
-        final OpaqueExtendedCommunityCase expected = new OpaqueExtendedCommunityCaseBuilder().setOpaqueExtendedCommunity(
-                new OpaqueExtendedCommunityBuilder().setValue(new byte[] { 21, 45, 5, 4, 3, 1 }).build()).build();
+        final OpaqueExtendedCommunityCase expected = new OpaqueExtendedCommunityCaseBuilder()
+                .setOpaqueExtendedCommunity(new OpaqueExtendedCommunityBuilder()
+                    .setValue(new byte[] { 21, 45, 5, 4, 3, 1 }).build()).build();
 
         final ExtendedCommunity exComm = handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
         Assert.assertEquals(expected, exComm);
@@ -38,5 +37,4 @@ public class OpaqueEcHandlerTest {
         handler.serializeExtendedCommunity(expected, output);
         Assert.assertArrayEquals(INPUT, output.array());
     }
-
 }
index f2bc880a3999fe60b6d40c3fa20bd94dbecf22f2..570f3b40fd081884ad382a3cab67b48066859e68 100644 (file)
@@ -32,10 +32,11 @@ public final class RouteOrigin4OctectASEcHandlerTest {
     };
     public static final As4SpecificCommon AS_COMMON = new As4SpecificCommonBuilder().setAsNumber(new AsNumber(20L))
         .setLocalAdministrator(100).build();
-    RouteOrigin4OctectASEcHandler handler;
+
+    private RouteOrigin4OctectASEcHandler handler;
 
     @Before
-    public void Setup() {
+    public void before() {
         this.handler = new RouteOrigin4OctectASEcHandler();
     }
 
index 297e67983fc00098e63b903453755a18e70ab83f..067b117d9f03d4658463efc4c0389f0c42ba4e42 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities;
 
 import io.netty.buffer.ByteBuf;
@@ -21,7 +20,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.route.origin.extended.community._case.RouteOriginExtendedCommunityBuilder;
 
 public class RouteOriginAsTwoOctetEcHandlerTest {
-
     private static final byte[] INPUT = {
         0, 24, 4, 2, 8, 7
     };
@@ -29,9 +27,11 @@ public class RouteOriginAsTwoOctetEcHandlerTest {
     @Test
     public void testHandler() throws BGPDocumentedException, BGPParsingException {
         final RouteOriginAsTwoOctetEcHandler handler = new RouteOriginAsTwoOctetEcHandler();
-        final RouteOriginExtendedCommunityCase expected = new RouteOriginExtendedCommunityCaseBuilder().setRouteOriginExtendedCommunity(
-                new RouteOriginExtendedCommunityBuilder().setGlobalAdministrator(new ShortAsNumber(24L)).setLocalAdministrator(
-                        new byte[] { 4, 2, 8, 7 }).build()).build();
+        final RouteOriginExtendedCommunityCase expected = new RouteOriginExtendedCommunityCaseBuilder()
+                .setRouteOriginExtendedCommunity(new RouteOriginExtendedCommunityBuilder()
+                    .setGlobalAdministrator(new ShortAsNumber(24L))
+                    .setLocalAdministrator(new byte[] { 4, 2, 8, 7 }).build())
+                .build();
 
         final ExtendedCommunity exComm = handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
         Assert.assertEquals(expected, exComm);
@@ -40,5 +40,4 @@ public class RouteOriginAsTwoOctetEcHandlerTest {
         handler.serializeExtendedCommunity(expected, output);
         Assert.assertArrayEquals(INPUT, output.array());
     }
-
 }