Fix most bgp-parser-spi checkstyle violations 47/78747/3
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 13 Dec 2018 10:53:37 +0000 (11:53 +0100)
committerRobert Varga <nite@hq.sk>
Thu, 13 Dec 2018 14:48:47 +0000 (14:48 +0000)
These violations have been piling up, clean most of them up.

Change-Id: I3f42f7d49028117b81b9963ab3efa750082cc7db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
56 files changed:
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/AbstractMessageRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/AttributeRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/AttributeSerializer.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/AttributeUtil.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/BGPExtensionProviderContext.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/BgpPrefixSidTlvParser.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/BgpPrefixSidTlvRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/BgpPrefixSidTlvSerializer.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/BgpPrefixSidTlvUtil.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/CapabilitySerializer.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MessageParser.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MessageRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MessageUtil.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MultiPathSupport.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MultiPathSupportUtil.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MultiprotocolCapabilitiesUtil.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/NextHopParserSerializer.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/NlriParser.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/NlriRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/NlriSerializer.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/PathIdUtil.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/RevisedErrorHandling.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/Abstract4OctetAsExtendedCommunity.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/AbstractTwoOctetAsExtendedCommunity.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/ExtendedCommunityParser.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/ExtendedCommunityRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/ExtendedCommunityUtil.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/Inet4SpecificExtendedCommunityCommonUtil.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/MultiPathSupportImpl.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/ServiceLoaderBGPExtensionProviderContext.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleAddressFamilyRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleBGPExtensionProviderContext.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleBGPExtensionProviderContextActivator.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleBgpPrefixSidTlvRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleCapabilityRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleExtendedCommunityRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleMessageRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleNlriRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleParameterRegistry.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleSubsequentAddressFamilyRegistry.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/AbstractMessageRegistryTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/MultiPathSupportUtilTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/PathIdUtilTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/UtilsTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/AbstractIpv4ExtendedCommunityTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/AbstractOpaqueExtendedCommunityTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/AbstractTwoOctetAsExtendedCommunityTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/ExtendedCommunityUtilTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/Inet4SpecificExtendedCommunityCommonUtilTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/BgpTestActivator.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/MultiPathSupportImplTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/PeerSpecificParserConstraintImplTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/ServiceLoaderBGPExtensionProviderContextTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleExtendedCommunityRegistryTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleRegistryTest.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/UnrecognizedAttributesTest.java

index 37e5e52b5834978dcb54fcef03f66c90a5d82667..834adca4e353c18586f0ab992b0596b688255c2b 100644 (file)
@@ -26,7 +26,7 @@ public abstract class AbstractMessageRegistry implements MessageRegistry {
     protected abstract Notification parseBody(int type, ByteBuf body, int messageLength,
             PeerSpecificParserConstraint constraint) throws BGPDocumentedException;
 
-    protected abstract void serializeMessageImpl(final Notification message, final ByteBuf buffer);
+    protected abstract void serializeMessageImpl(Notification message, ByteBuf buffer);
 
     static {
         MARKER = new byte[MessageUtil.MARKER_LENGTH];
@@ -38,7 +38,8 @@ public abstract class AbstractMessageRegistry implements MessageRegistry {
             throws BGPDocumentedException, BGPParsingException {
         Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes cannot be null or empty.");
         Preconditions.checkArgument(buffer.readableBytes() >= MessageUtil.COMMON_HEADER_LENGTH,
-                "Too few bytes in passed array. Passed: %s. Expected: >= %s.", buffer.readableBytes(), MessageUtil.COMMON_HEADER_LENGTH);
+                "Too few bytes in passed array. Passed: %s. Expected: >= %s.", buffer.readableBytes(),
+                MessageUtil.COMMON_HEADER_LENGTH);
         final byte[] marker = ByteArray.readBytes(buffer, MessageUtil.MARKER_LENGTH);
 
         if (!Arrays.equals(marker, MARKER)) {
@@ -50,19 +51,22 @@ public abstract class AbstractMessageRegistry implements MessageRegistry {
         final int messageType = UnsignedBytes.toInt(typeBytes);
 
         if (messageLength < MessageUtil.COMMON_HEADER_LENGTH) {
-            throw BGPDocumentedException.badMessageLength("Message length field not within valid range.", messageLength);
+            throw BGPDocumentedException.badMessageLength("Message length field not within valid range.",
+                messageLength);
         }
 
         if (messageLength - MessageUtil.COMMON_HEADER_LENGTH != buffer.readableBytes()) {
-            throw new BGPParsingException("Size doesn't match size specified in header. Passed: " + buffer.readableBytes()
-                    + "; Expected: " + (messageLength - MessageUtil.COMMON_HEADER_LENGTH) + ". ");
+            throw new BGPParsingException("Size doesn't match size specified in header. Passed: "
+                    + buffer.readableBytes() + "; Expected: " + (messageLength - MessageUtil.COMMON_HEADER_LENGTH)
+                    + ". ");
         }
 
         final ByteBuf msgBody = buffer.readSlice(messageLength - MessageUtil.COMMON_HEADER_LENGTH);
 
         final Notification msg = parseBody(messageType, msgBody, messageLength, constraint);
         if (msg == null) {
-            throw new BGPDocumentedException("Unhandled message type " + messageType, BGPError.BAD_MSG_TYPE, new byte[] { typeBytes });
+            throw new BGPDocumentedException("Unhandled message type " + messageType, BGPError.BAD_MSG_TYPE,
+                new byte[] { typeBytes });
         }
         return msg;
     }
index f67f945d5e50393a08802d01ddd5a429040baa80..548ffd45a351df11c354eb81ef2b4aefa631fb8a 100644 (file)
@@ -16,11 +16,12 @@ import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 
 /**
- *
+ * Attribute serializer/deserializer registry, exposing the capability to parse BGP attributes as a whole.
  */
 public interface AttributeRegistry {
     /**
      * Parse BGP Attribute from buffer.
+     *
      * @param buffer Input buffer.
      * @param constraints Peer specific constraint.
      * @return Decoded BGP Attribute.
@@ -32,6 +33,7 @@ public interface AttributeRegistry {
 
     /**
      * Serialize BGP Attribute to buffer.
+     *
      * @param attribute Input BGP Attribute.
      * @param byteAggregator Output buffer.
      */
index ea5191751ccbff287d6d29ee74a6062426b46449..64f02f2048967b5152ac8f4f7b559d8db9ff3ab2 100644 (file)
@@ -12,6 +12,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 
 public interface AttributeSerializer {
 
-    void serializeAttribute(final Attributes attribute,final ByteBuf byteAggregator);
+    void serializeAttribute(Attributes attribute, ByteBuf byteAggregator);
 
 }
index 1f28e38df4b2c7a57e789957565fb9512f33d743..bb33c980dda1f849b717d695b2b3fa1e320a1a42 100644 (file)
@@ -26,15 +26,15 @@ public final class AttributeUtil {
      * Adds header to attribute value. If the length of the attribute value exceeds one-byte length field,
      * set EXTENDED bit and write length as 2B field.
      *
-     * @param flags
+     * @param flags attribute flags
      * @param type of the attribute
      * @param value attribute value
      * @param buffer ByteBuf where the attribute will be copied with its header
      */
     public static void formatAttribute(final int flags, final int type, final ByteBuf value, final ByteBuf buffer) {
         final int length = value.writerIndex();
-        final boolean extended = (length > MAX_ATTR_LENGTH_FOR_SINGLE_BYTE) ? true : false;
-        buffer.writeByte((extended) ? (flags | EXTENDED) : flags);
+        final boolean extended = length > MAX_ATTR_LENGTH_FOR_SINGLE_BYTE ? true : false;
+        buffer.writeByte(extended ? flags | EXTENDED : flags);
         buffer.writeByte(type);
         if (extended) {
             buffer.writeShort(length);
index 95b89c1c881d0170e94917058a13f2fa4fdba5c1..cea856d10902de2db2055277b3149070e4f19be5 100644 (file)
@@ -31,11 +31,13 @@ public interface BGPExtensionProviderContext extends BGPExtensionConsumerContext
 
     AutoCloseable registerAttributeParser(int attributeType, AttributeParser parser);
 
-    AutoCloseable registerAttributeSerializer(Class<? extends DataObject> attributeClass, AttributeSerializer serializer);
+    AutoCloseable registerAttributeSerializer(Class<? extends DataObject> attributeClass,
+            AttributeSerializer serializer);
 
     AutoCloseable registerCapabilityParser(int capabilityType, CapabilityParser parser);
 
-    AutoCloseable registerCapabilitySerializer(Class<? extends DataObject> capabilityClass, CapabilitySerializer serializer);
+    AutoCloseable registerCapabilitySerializer(Class<? extends DataObject> capabilityClass,
+            CapabilitySerializer serializer);
 
     AutoCloseable registerMessageParser(int messageType, MessageParser parser);
 
@@ -43,22 +45,24 @@ public interface BGPExtensionProviderContext extends BGPExtensionConsumerContext
 
     AutoCloseable registerBgpPrefixSidTlvParser(int tlvType, BgpPrefixSidTlvParser parser);
 
-    AutoCloseable registerBgpPrefixSidTlvSerializer(Class<? extends BgpPrefixSidTlv> tlvClass, BgpPrefixSidTlvSerializer serializer);
+    AutoCloseable registerBgpPrefixSidTlvSerializer(Class<? extends BgpPrefixSidTlv> tlvClass,
+            BgpPrefixSidTlvSerializer serializer);
 
     AutoCloseable registerNlriParser(Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi,
-        NlriParser parser, final NextHopParserSerializer nextHopHandler, final Class<? extends CNextHop> cNextHopClass,
-        final Class<? extends CNextHop>... cNextHopClassList);
+        NlriParser parser, NextHopParserSerializer nextHopHandler, Class<? extends CNextHop> cnextHopClass,
+        Class<? extends CNextHop>... cnextHopClassList);
 
     AutoCloseable registerNlriSerializer(Class<? extends DataObject> nlriClass, NlriSerializer serializer);
 
     AutoCloseable registerParameterParser(int parameterType, ParameterParser parser);
 
-    AutoCloseable registerParameterSerializer(Class<? extends BgpParameters> paramClass, ParameterSerializer serializer);
+    AutoCloseable registerParameterSerializer(Class<? extends BgpParameters> paramClass,
+            ParameterSerializer serializer);
 
-    AutoCloseable registerExtendedCommunitySerializer(final Class<? extends ExtendedCommunity> extendedCommunityClass,
-        final ExtendedCommunitySerializer serializer);
+    AutoCloseable registerExtendedCommunitySerializer(Class<? extends ExtendedCommunity> extendedCommunityClass,
+        ExtendedCommunitySerializer serializer);
 
-    AutoCloseable registerExtendedCommunityParser(final int type, final int subtype, final ExtendedCommunityParser parser);
+    AutoCloseable registerExtendedCommunityParser(int type, int subtype, ExtendedCommunityParser parser);
 
     /**
      * Get the context-wide cache for a particular object type.
index de306ff2151f5d617bba4f53bbc900911e40f1a0..b31a13316f18605c02afcba238e5de72e16d2d2a 100644 (file)
@@ -15,7 +15,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
  */
 public interface BgpPrefixSidTlvParser {
     /**
-     * Method for parsing specific types of TLVs from incoming buffer
+     * Method for parsing specific types of TLVs from incoming buffer.
      *
      * @param buffer with TLV bytes
      * @return instance of specific TLV
index db9e1fe2c6bb9fbfee0078fcfbbf1312edceca9f..3245be4613465340bd4a7b9b69c946444a8c5ef1 100644 (file)
@@ -11,11 +11,12 @@ import io.netty.buffer.ByteBuf;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.BgpPrefixSidTlv;
 
 /**
- * BGP prefix SID TLVs registry for encoding/decoding
+ * BGP prefix SID TLVs registry for encoding/decoding.
  */
 public interface BgpPrefixSidTlvRegistry {
     /**
-     * Decode incoming TLV
+     * Decode incoming TLV.
+     *
      * @param type number of TLV
      * @param buffer contains bytes of TLV
      * @return instance of specific TLV
@@ -23,7 +24,8 @@ public interface BgpPrefixSidTlvRegistry {
     BgpPrefixSidTlv parseBgpPrefixSidTlv(int type, ByteBuf buffer);
 
     /**
-     * Encode TLV instance
+     * Encode TLV instance.
+     *
      * @param tlv instance
      * @param bytes encoded TLV outcome
      */
index 02a35ae95203953e50ebc1f28a132c048089709a..ced7a209a4664936acab06bb8d402cf3bf5fa499 100644 (file)
@@ -15,7 +15,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
  */
 public interface BgpPrefixSidTlvSerializer {
     /**
-     * Method for serializing specific types of TLVs from incoming buffer
+     * Method for serializing specific types of TLVs from incoming buffer.
      *
      * @param tlv instance
      * @param bytes outcome serialized TLV
index c9b81e69c58320843dea2a8ded9fc037ee399ed2..19a492f4808859329de71051645ae0b2b9983775 100644 (file)
@@ -16,7 +16,7 @@ public final class BgpPrefixSidTlvUtil {
     }
 
     /**
-     * Utilized method for serialization of BGP prefix SID TLV
+     * Utilized method for serialization of BGP prefix SID TLV.
      *
      * @param type of TLV
      * @param value of TLV
index 4c8f5215c9adfe4b34945e32ecd2f92b95e4fa04..56170ba644f40f2f64ec7602c16e83b59cc5ab22 100644 (file)
@@ -11,5 +11,5 @@ import io.netty.buffer.ByteBuf;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.open.message.bgp.parameters.optional.capabilities.CParameters;
 
 public interface CapabilitySerializer {
-    void serializeCapability(final CParameters capability, final ByteBuf byteAggregator);
+    void serializeCapability(CParameters capability, ByteBuf byteAggregator);
 }
index 7d461d41375e888840ab319554ad61073e478a8f..2fc06bb21ed80ce92061d8ab0ed934fdf0515723 100644 (file)
@@ -24,7 +24,6 @@ public interface MessageParser {
      * @param messageLength Length of the BGP message.
      * @param constraint Peer specific constraints, implementations may ignore them.
      * @return Parsed BGP Message body.
-     * @throws BGPDocumentedException
      */
     @Nonnull Notification parseMessageBody(@Nonnull ByteBuf body, int messageLength,
             @Nullable PeerSpecificParserConstraint constraint) throws BGPDocumentedException;
index 6db2b4fd891811b5a85cede06d9c70c125ac05eb..6b565acbabdc34711ec64cbb9dba128297a624cd 100644 (file)
@@ -15,8 +15,7 @@ import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 /**
- * BGP Message codec registry, provides services
- * to encode/decode messages.
+ * BGP Message codec registry, provides services to encode/decode messages.
  */
 public interface MessageRegistry {
     /**
@@ -24,8 +23,6 @@ public interface MessageRegistry {
      * @param bytes Input buffer with encoded message.
      * @param constraint Peer specific constraint.
      * @return Parsed BGP message.
-     * @throws BGPDocumentedException
-     * @throws BGPParsingException
      */
     @Nonnull Notification parseMessage(@Nonnull ByteBuf bytes, @Nullable PeerSpecificParserConstraint constraint)
             throws BGPDocumentedException, BGPParsingException;
@@ -36,5 +33,4 @@ public interface MessageRegistry {
      * @param buffer Output buffer where message is to be written.
      */
     void serializeMessage(@Nonnull Notification message, @Nonnull ByteBuf buffer);
-
 }
index d30b8a96050b9f984b8845e9cdabc505412a18b5..ad231c119e34d9fdf988132ffbf6c7a89920da85 100755 (executable)
@@ -51,7 +51,7 @@ public final class MessageUtil {
     }
 
     /**
-     * Check for NLRI attribute in Update message
+     * Check for NLRI attribute in Update message.
      *
      * @param message Update message
      * @return true if any prefix or MP-REACH-NLRI attribute is present, false otherwise
@@ -66,7 +66,7 @@ public final class MessageUtil {
     }
 
     /**
-     * Finds MP-REACH-NLRI in Update message attributes
+     * Finds MP-REACH-NLRI in Update message attributes.
      *
      * @param attrs Update message attributes
      * @return MP-REACH-NLRI if present in the attributes, null otherwise
@@ -83,7 +83,7 @@ public final class MessageUtil {
     }
 
     /**
-     * Finds MP-UNREACH-NLRI in Update message attributes
+     * Finds MP-UNREACH-NLRI in Update message attributes.
      *
      * @param attrs Update message attributes
      * @return MP-UNREACH-NLRI if present in the attributes, null otherwise
index 4af953d7660159b3c0ac81df0a48108bd5cf8423..fe32a9d840a5d1c30d2901d2506cc70693d315df 100644 (file)
@@ -5,22 +5,19 @@
  * 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.spi;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType;
 
 /**
- * Holds user specific add-path constraints per AFI/SAFI (table type)
- *
+ * Holds user specific add-path constraints per AFI/SAFI (table type).
  */
 public interface MultiPathSupport extends PeerConstraint {
-
     /**
      * Check if requested AFI/SAFI is supported.
-     * @param tableType
+     *
+     * @param tableType Table type to check
      * @return True if the table type is supported.
      */
     boolean isTableTypeSupported(BgpTableType tableType);
-
 }
index 19c6703c847c98da2804c320c7c34e6a6d5cc0bc..9d3107967450d6f1d0c689ffa02a9d70ee14e004 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.spi;
 
 import static java.util.Objects.requireNonNull;
@@ -27,14 +26,13 @@ public final class MultiPathSupportUtil {
      * @param afiSafi Required AFI/SAFI
      * @return True if AFI/SAFI is supported.
      */
-    public static boolean isTableTypeSupported(@Nullable final PeerSpecificParserConstraint constraints, @Nonnull final BgpTableType afiSafi) {
+    public static boolean isTableTypeSupported(@Nullable final PeerSpecificParserConstraint constraints,
+            @Nonnull final BgpTableType afiSafi) {
         requireNonNull(afiSafi);
         if (constraints != null) {
             final Optional<MultiPathSupport> peerConstraint = constraints.getPeerConstraint(MultiPathSupport.class);
             return peerConstraint.isPresent() && peerConstraint.get().isTableTypeSupported(afiSafi);
         }
         return false;
-
     }
-
 }
index 8d54a7d6b817c57944b3c2c4f7fe30dbe9715f2e..a3cb6e481a6a85fbb91ce9de7334b6d4726750c4 100644 (file)
@@ -27,14 +27,18 @@ public final class MultiprotocolCapabilitiesUtil {
     private static final Logger LOG = LoggerFactory.getLogger(MultiprotocolCapabilitiesUtil.class);
 
     public static final CParameters RR_CAPABILITY = new CParametersBuilder().addAugmentation(CParameters1.class,
-        new CParameters1Builder().setRouteRefreshCapability(new RouteRefreshCapabilityBuilder().build()).build()).build();
+        new CParameters1Builder().setRouteRefreshCapability(new RouteRefreshCapabilityBuilder().build()).build())
+            .build();
 
     private static final int RESERVED = 1;
 
-    private MultiprotocolCapabilitiesUtil() { throw new UnsupportedOperationException(); }
+    private MultiprotocolCapabilitiesUtil() {
+        throw new UnsupportedOperationException();
+    }
 
-    public static void serializeMPAfiSafi(final AddressFamilyRegistry afiReg, final SubsequentAddressFamilyRegistry safiReg,
-        final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi, final ByteBuf capBuffer) {
+    public static void serializeMPAfiSafi(final AddressFamilyRegistry afiReg,
+            final SubsequentAddressFamilyRegistry safiReg, final Class<? extends AddressFamily> afi,
+            final Class<? extends SubsequentAddressFamily> safi, final ByteBuf capBuffer) {
         final Integer afival = afiReg.numberForClass(afi);
         Preconditions.checkArgument(afival != null, "Unhandled address family " + afi);
         capBuffer.writeShort(afival);
@@ -46,7 +50,8 @@ public final class MultiprotocolCapabilitiesUtil {
         capBuffer.writeByte(safival);
     }
 
-    public static Optional<BgpTableType> parseMPAfiSafi(final ByteBuf buffer, final AddressFamilyRegistry afiReg, final SubsequentAddressFamilyRegistry safiReg) {
+    public static Optional<BgpTableType> parseMPAfiSafi(final ByteBuf buffer, final AddressFamilyRegistry afiReg,
+            final SubsequentAddressFamilyRegistry safiReg) {
         final int afiVal = buffer.readUnsignedShort();
         final Class<? extends AddressFamily> afi = afiReg.classForFamily(afiVal);
         if (afi == null) {
index db9249fa9bdff4295ef5658757d15afb805b33cf..0d55090c841a90b57325251f2a44e6415af017dc 100644 (file)
@@ -15,28 +15,26 @@ import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.CNextHop;
 
 /**
- * Handles Next Hop, by default use {@link NextHopUtil}
- * which is handles Ipv4 and Ipv6 Next hop.
+ * Handles Next Hop, by default use {@link NextHopUtil} which is handles Ipv4 and Ipv6 Next hop.
  */
 public interface NextHopParserSerializer {
     /**
-     * Parse Next hop from buffer,
+     * Parse Next hop from buffer.
      *
      * @param buffer Encoded Next Hop in ByteBuf.
      * @return CNextHop
-     * @throws BGPParsingException
      */
-    default CNextHop parseNextHop(@Nonnull ByteBuf buffer) throws BGPParsingException {
+    default CNextHop parseNextHop(@Nonnull final ByteBuf buffer) throws BGPParsingException {
         return NextHopUtil.parseNextHop(buffer);
     }
 
     /**
-     * Serialize Next Hop
+     * Serialize Next Hop.
      *
-     * @param cNextHop Next Hop container
+     * @param cnextHop Next Hop container
      * @param byteAggregator return Encoded Next Hop in ByteBuf
      */
-    default void serializeNextHop(@Nonnull CNextHop cNextHop, @Nonnull final ByteBuf byteAggregator) {
-        NextHopUtil.serializeNextHop(cNextHop, byteAggregator);
+    default void serializeNextHop(@Nonnull final CNextHop cnextHop, @Nonnull final ByteBuf byteAggregator) {
+        NextHopUtil.serializeNextHop(cnextHop, byteAggregator);
     }
 }
index 084257b52def49bd974ea6aab9bdcbd4b56fffc5..2bff6a2cf52dd46b3f50c951be75f286dc0b161e 100644 (file)
@@ -26,11 +26,9 @@ public interface NlriParser {
      * @param constraint Peer specific constraints.
      * @throws BGPParsingException exception.
      */
-    void parseNlri(
-            @Nonnull final ByteBuf nlri,
-            @Nonnull final MpReachNlriBuilder builder,
-            @Nullable final PeerSpecificParserConstraint constraint)
-            throws BGPParsingException;
+    void parseNlri(@Nonnull ByteBuf nlri, @Nonnull MpReachNlriBuilder builder,
+            @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
+
     /**
      * Parse MP UN_REACH NLRI from buffer.
      *
@@ -39,9 +37,6 @@ public interface NlriParser {
      * @param constraint Peer specific constraints.
      * @throws BGPParsingException exception.
      */
-    void parseNlri(
-            @Nonnull final ByteBuf nlri,
-            @Nonnull final MpUnreachNlriBuilder builder,
-            @Nullable final PeerSpecificParserConstraint constraint)
-            throws BGPParsingException;
+    void parseNlri(@Nonnull ByteBuf nlri, @Nonnull MpUnreachNlriBuilder builder,
+            @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
 }
index e4f6e2a41796f592971750791302499aa45291e9..db711df6d9a972b682d6e18be1f1f944fdc13344 100644 (file)
@@ -15,35 +15,32 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlri;
 
 /**
- * The codec registry for BGP NLRI, offers
- * services for NLRI encoding/decoding.
- *
+ * The codec registry for BGP NLRI, offers services for NLRI encoding/decoding.
  */
 public interface NlriRegistry {
     /**
      * Decode MP REACH NLRI Attribute.
+     *
      * @param buffer Input buffer.
      * @param constraint Peer specific constraint.
      * @return Parsed reach NLRI.
-     * @throws BGPParsingException
      */
-    @Nonnull MpReachNlri parseMpReach(
-            @Nonnull ByteBuf buffer,
-            @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
+    @Nonnull MpReachNlri parseMpReach(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraint)
+            throws BGPParsingException;
 
     /**
      * Decode MP REACH NLRI Attribute.
+     *
      * @param buffer Input buffer.
      * @param constraint Peer specific constraint.
      * @return Parsed unreach NLRI.
-     * @throws BGPParsingException
      */
-    @Nonnull MpUnreachNlri parseMpUnreach(
-            @Nonnull ByteBuf buffer,
-            @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
+    @Nonnull MpUnreachNlri parseMpUnreach(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraint)
+            throws BGPParsingException;
 
     /**
      * Encode BGP MP REACH NLRI Attribute.
+     *
      * @param mpReachNlri Input reach NLRI.
      * @param byteAggregator Output buffer.
      */
@@ -51,6 +48,7 @@ public interface NlriRegistry {
 
     /**
      * Encode BGP MP UNREACH NLRI Attribute.
+     *
      * @param mpUnreachNlri Input unreach NLRI.
      * @param byteAggregator Output buffer.
      */
@@ -58,6 +56,7 @@ public interface NlriRegistry {
 
     /**
      * Get all available NLRI encoders.
+     *
      * @return Iterable of NLRI serializers.
      */
     Iterable<NlriSerializer> getSerializers();
index 0f4d7e441ccaa0895dfde46406c6d7204e44e603..5b3eaaf9205189fd54373246fa67326a4d7c6991 100644 (file)
@@ -8,11 +8,9 @@
 package org.opendaylight.protocol.bgp.parser.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 
 public interface NlriSerializer {
 
-    void serializeAttribute(final Attributes attribute, final ByteBuf byteAggregator);
-
+    void serializeAttribute(Attributes attribute, ByteBuf byteAggregator);
 }
index 92723a7575d12a3380895912660593cc8f5622ff..67848ca66c181734cdf20e7deb99bf60c89d8746 100644 (file)
@@ -56,7 +56,7 @@ public final class PathIdUtil {
     }
 
     /**
-     * Extract PathId from route change received
+     * Extract PathId from route change received.
      *
      * @param data    Data containing the path Id
      * @param pathNii Path Id NodeIdentifier specific per each Rib support
index f58f4a9903784d209d9ec9ca071fd4abd78b2e9b..537a2111031e889fac0e867b4fdc2704c728b5f4 100644 (file)
@@ -42,7 +42,7 @@ public enum RevisedErrorHandling {
     /**
      * Determine Revised Error Handling from the contents of a {@link PeerSpecificParserConstraint}.
      *
-     * @param constraint
+     * @param constraint Peer-specific constraint
      * @return Revised Error Handling treatment message/attributes should receive.
      */
     public static RevisedErrorHandling from(final @Nullable PeerSpecificParserConstraint constraint) {
index 28ee18e9a96494282ee433aa188f9c6651790c04..6c712d081d2bed020edf29e0c0cc06e85395e6f1 100644 (file)
@@ -5,19 +5,16 @@
  * 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.spi.extended.community;
 
-public abstract class Abstract4OctetAsExtendedCommunity implements ExtendedCommunityParser, ExtendedCommunitySerializer {
+public abstract class Abstract4OctetAsExtendedCommunity implements ExtendedCommunityParser,
+        ExtendedCommunitySerializer {
 
     private static final int TRANSITIVE_TYPE = 2;
     private static final int NON_TRANSITIVE_TYPE = 66;
 
     @Override
     public int getType(final boolean isTransitive) {
-        if (isTransitive) {
-            return TRANSITIVE_TYPE;
-        }
-        return NON_TRANSITIVE_TYPE;
+        return isTransitive ? TRANSITIVE_TYPE : NON_TRANSITIVE_TYPE;
     }
 }
index a7757b736f7977b4af44db996d654ab403f7513f..0405cd153533515bc38f1897074569f9462db874 100644 (file)
@@ -5,11 +5,10 @@
  * 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.spi.extended.community;
 
-
-public abstract class AbstractTwoOctetAsExtendedCommunity implements ExtendedCommunityParser, ExtendedCommunitySerializer {
+public abstract class AbstractTwoOctetAsExtendedCommunity implements ExtendedCommunityParser,
+        ExtendedCommunitySerializer {
 
     private static final int TYPE = 0;
 
index b482e4bbd9f3881788630d2a31932d267765bba1..eb2981562b1b8f3336a236979a497c6f011b01a6 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.spi.extended.community;
 
 import io.netty.buffer.ByteBuf;
@@ -14,18 +13,14 @@ import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity;
 
 /**
- * The Extended Community value parser (ByteBuf to ExtendedCommunity)
- *
+ * The Extended Community value parser (ByteBuf to ExtendedCommunity).
  */
 public interface ExtendedCommunityParser {
-
     /**
      * Parses the Extended Community value encoded in the buffer.
+     *
      * @param buffer ByteBuf
      * @return Decoded Extended Community value.
-     * @throws BGPDocumentedException
-     * @throws BGPParsingException
      */
     ExtendedCommunity parseExtendedCommunity(ByteBuf buffer) throws BGPDocumentedException, BGPParsingException;
-
 }
index 299c126cde94c352af2dbde22ecc8fcef3f85e90..5de2ecffb726f9fa0bea29930a130f0d3aa19111 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.spi.extended.community;
 
 import io.netty.buffer.ByteBuf;
@@ -15,25 +14,22 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 
 /**
  * The Extended Communities registry.
- *
  */
 public interface ExtendedCommunityRegistry {
-
     /**
      * Parses the Extended Community.
+     *
      * @param buffer ByteBuf
      * @return Decoded ExtendedCommunity or null if the parser for such Extended Community type/sub-type is not present.
-     * @throws BGPDocumentedException
-     * @throws BGPParsingException
      */
     ExtendedCommunities parseExtendedCommunity(ByteBuf buffer) throws BGPDocumentedException, BGPParsingException;
 
     /**
      * Serializes the Extended Community.
+     *
      * @param extendedCommunity ExtendedCommunity to be encoded.
-     * @param byteAggregator ByteBuf, where the Extended Community is serialized,
-     *  if a serialized is not present for such Extended Community type, no bytes are written into output buffer.
+     * @param byteAggregator ByteBuf, where the Extended Community is serialized, if a serialized is not present for
+     *                       such Extended Community type, no bytes are written into output buffer.
      */
     void serializeExtendedCommunity(ExtendedCommunities extendedCommunity, ByteBuf byteAggregator);
-
 }
index 6546f8b4665039c7cf17deee6cbbaaef58076b93..d5552816d7978b1a13c06ef67245bbfb1c34bc3e 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.protocol.bgp.parser.spi.extended.community;
 
 /**
  * The utility functions related to the extended communities.
- *
  */
 public final class ExtendedCommunityUtil {
 
@@ -22,9 +21,11 @@ public final class ExtendedCommunityUtil {
 
     /**
      * Sets transitivity flag for the Extended Community type.
+     *
      * @param type Extended Community Type
      * @param isTransitive Extended Community transitivity
-     * @return Extended Community type with a transitivity flag set if isTransitive false, otherwise returns unchanged type.
+     * @return Extended Community type with a transitivity flag set if isTransitive false, otherwise returns unchanged
+     *         type.
      */
     public static int setTransitivity(final int type, final boolean isTransitive) {
         return isTransitive ? type : ExtendedCommunityUtil.toNonTransitiveType(type);
@@ -32,6 +33,7 @@ public final class ExtendedCommunityUtil {
 
     /**
      * Check the Extended Community type for transitivity.
+     *
      * @param type Extended Community Type
      * @return True if input type is transitive, false if the type is non-transitive
      */
@@ -42,5 +44,4 @@ public final class ExtendedCommunityUtil {
     private static int toNonTransitiveType(final int type) {
         return type | NON_TRANS;
     }
-
 }
index c4c78f62ee38dd08bf979abb692a4f04cef9de5c..d98251a4dfbb4e99e7718e68deca744de1d03527 100644 (file)
@@ -1,11 +1,10 @@
 /*
- *  Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
  *
- *  This program and the accompanying materials are made available under the
- *  terms of the Eclipse Public License v1.0 which accompanies this distribution,
- *  and is available at http://www.eclipse.org/legal/epl-v10.html
+ * This program and the accompanying materials are made available under the
+ * 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.spi.extended.community;
 
 import static org.opendaylight.protocol.bgp.parser.spi.extended.community.AbstractIpv4ExtendedCommunity.INET_LOCAL_ADMIN_LENGTH;
index 2d7354463af9a79bda416ae35fee5fd3795bc565..2909de8ff2deb4465b009d7e14883701387acd39 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.spi.pojo;
 
 import static java.util.Objects.requireNonNull;
@@ -22,7 +21,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.add.path.capability.AddressFamilies;
 
 public final class MultiPathSupportImpl implements MultiPathSupport {
-
     private final Set<BgpTableType> supportedTables;
 
     private MultiPathSupportImpl(final Set<BgpTableType> supportedTables) {
@@ -37,7 +35,8 @@ public final class MultiPathSupportImpl implements MultiPathSupport {
      * @param addPathCapabilities The remote add-path capabilities list.
      * @return MultiPathSupport instance.
      */
-    public static MultiPathSupport createParserMultiPathSupport(@Nonnull final List<AddressFamilies> addPathCapabilities) {
+    public static MultiPathSupport createParserMultiPathSupport(
+            @Nonnull final List<AddressFamilies> addPathCapabilities) {
         requireNonNull(addPathCapabilities);
         final Set<BgpTableType> support = addPathCapabilities
             .stream()
@@ -51,5 +50,4 @@ public final class MultiPathSupportImpl implements MultiPathSupport {
     public boolean isTableTypeSupported(final BgpTableType tableType) {
         return this.supportedTables.contains(tableType);
     }
-
 }
index 267d167c4e8f75c743de14fab5d91e012d7bf13b..ec438322d8fec7e646f9dedfd4ec84cb60762eab 100644 (file)
@@ -13,24 +13,17 @@ import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
 
 public final class ServiceLoaderBGPExtensionProviderContext {
     private static final class Holder {
-        private static final BGPExtensionProviderContext INSTANCE;
+        private static final BGPExtensionProviderContext INSTANCE = create();
 
         private Holder() {
         }
-
-        static {
-            try {
-                INSTANCE = create();
-            } catch (final Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
     }
 
     public static BGPExtensionProviderContext create() {
         final BGPExtensionProviderContext ctx = new SimpleBGPExtensionProviderContext();
 
-        final ServiceLoader<BGPExtensionProviderActivator> loader = ServiceLoader.load(BGPExtensionProviderActivator.class);
+        final ServiceLoader<BGPExtensionProviderActivator> loader = ServiceLoader.load(
+            BGPExtensionProviderActivator.class);
         for (final BGPExtensionProviderActivator a : loader) {
             a.start(ctx);
         }
index c99eab19dc154e6f48d9210792dd49c078d71a94..10e146195070ee8348e1cb535c6e4423c6ecdffd 100644 (file)
@@ -12,7 +12,8 @@ import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
 import org.opendaylight.protocol.util.Values;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
 
-final class SimpleAddressFamilyRegistry extends AbstractFamilyRegistry<AddressFamily, Integer> implements AddressFamilyRegistry {
+final class SimpleAddressFamilyRegistry extends AbstractFamilyRegistry<AddressFamily, Integer>
+        implements AddressFamilyRegistry {
     AutoCloseable registerAddressFamily(final Class<? extends AddressFamily> clazz, final int number) {
         Preconditions.checkArgument(number >= 0 && number <= Values.UNSIGNED_SHORT_MAX_VALUE);
         return super.registerFamily(clazz, number);
index 460e94a26443c48239b34f6c6e9274141b90320b..557e9d30ee7894a25e80b15d4eb22567c5485f4c 100644 (file)
@@ -36,7 +36,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
-public class SimpleBGPExtensionProviderContext extends SimpleBGPExtensionConsumerContext implements BGPExtensionProviderContext {
+public class SimpleBGPExtensionProviderContext extends SimpleBGPExtensionConsumerContext
+        implements BGPExtensionProviderContext {
 
     public static final int DEFAULT_MAXIMUM_CACHED_OBJECTS = 100000;
 
@@ -77,7 +78,8 @@ public class SimpleBGPExtensionProviderContext extends SimpleBGPExtensionConsume
     }
 
     @Override
-    public AutoCloseable registerAttributeSerializer(final Class<? extends DataObject> attributeClass, final AttributeSerializer serializer) {
+    public AutoCloseable registerAttributeSerializer(final Class<? extends DataObject> attributeClass,
+            final AttributeSerializer serializer) {
         return this.getAttributeRegistry().registerAttributeSerializer(attributeClass, serializer);
     }
 
@@ -87,7 +89,8 @@ public class SimpleBGPExtensionProviderContext extends SimpleBGPExtensionConsume
     }
 
     @Override
-    public AutoCloseable registerCapabilitySerializer(final Class<? extends DataObject> capabilityClass, final CapabilitySerializer serializer) {
+    public AutoCloseable registerCapabilitySerializer(final Class<? extends DataObject> capabilityClass,
+            final CapabilitySerializer serializer) {
         return this.getCapabilityRegistry().registerCapabilitySerializer(capabilityClass, serializer);
     }
 
@@ -97,19 +100,23 @@ public class SimpleBGPExtensionProviderContext extends SimpleBGPExtensionConsume
     }
 
     @Override
-    public AutoCloseable registerMessageSerializer(final Class<? extends Notification> messageClass, final MessageSerializer serializer) {
+    public AutoCloseable registerMessageSerializer(final Class<? extends Notification> messageClass,
+            final MessageSerializer serializer) {
         return this.getMessageRegistry().registerMessageSerializer(messageClass, serializer);
     }
 
     @Override
-    public AutoCloseable registerNlriParser(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi,
-        final NlriParser parser, final NextHopParserSerializer nextHopParserSerializer, final Class<? extends
-            CNextHop> cNextHopClass, final Class<? extends CNextHop>... cNextHopClassList) {
-        return this.getNlriRegistry().registerNlriParser(afi, safi, parser, nextHopParserSerializer, cNextHopClass, cNextHopClassList);
+    public AutoCloseable registerNlriParser(final Class<? extends AddressFamily> afi,
+            final Class<? extends SubsequentAddressFamily> safi, final NlriParser parser,
+            final NextHopParserSerializer nextHopParserSerializer, final Class<? extends CNextHop> cnextHopClass,
+            final Class<? extends CNextHop>... cnextHopClassList) {
+        return this.getNlriRegistry().registerNlriParser(afi, safi, parser, nextHopParserSerializer, cnextHopClass,
+            cnextHopClassList);
     }
 
     @Override
-    public AutoCloseable registerNlriSerializer(final Class<? extends DataObject> nlriClass, final NlriSerializer serializer) {
+    public AutoCloseable registerNlriSerializer(final Class<? extends DataObject> nlriClass,
+            final NlriSerializer serializer) {
         return this.getNlriRegistry().registerNlriSerializer(nlriClass, serializer);
     }
 
@@ -119,12 +126,14 @@ public class SimpleBGPExtensionProviderContext extends SimpleBGPExtensionConsume
     }
 
     @Override
-    public AutoCloseable registerParameterSerializer(final Class<? extends BgpParameters> paramClass, final ParameterSerializer serializer) {
+    public AutoCloseable registerParameterSerializer(final Class<? extends BgpParameters> paramClass,
+            final ParameterSerializer serializer) {
         return this.getParameterRegistry().registerParameterSerializer(paramClass, serializer);
     }
 
     @Override
-    public AutoCloseable registerSubsequentAddressFamily(final Class<? extends SubsequentAddressFamily> clazz, final int number) {
+    public AutoCloseable registerSubsequentAddressFamily(final Class<? extends SubsequentAddressFamily> clazz,
+            final int number) {
         return this.getSubsequentAddressFamilyRegistry().registerSubsequentAddressFamily(clazz, number);
     }
 
@@ -134,13 +143,16 @@ public class SimpleBGPExtensionProviderContext extends SimpleBGPExtensionConsume
     }
 
     @Override
-    public AutoCloseable registerExtendedCommunitySerializer(final Class<? extends ExtendedCommunity> extendedCommunityClass,
+    public AutoCloseable registerExtendedCommunitySerializer(
+            final Class<? extends ExtendedCommunity> extendedCommunityClass,
             final ExtendedCommunitySerializer serializer) {
-        return this.getExtendedCommunityRegistry().registerExtendedCommunitySerializer(extendedCommunityClass, serializer);
+        return this.getExtendedCommunityRegistry().registerExtendedCommunitySerializer(extendedCommunityClass,
+            serializer);
     }
 
     @Override
-    public AutoCloseable registerExtendedCommunityParser(final int type, final int subtype, final ExtendedCommunityParser parser) {
+    public AutoCloseable registerExtendedCommunityParser(final int type, final int subtype,
+            final ExtendedCommunityParser parser) {
         return this.getExtendedCommunityRegistry().registerExtendedCommunityParser(type, subtype, parser);
     }
 
@@ -150,7 +162,8 @@ public class SimpleBGPExtensionProviderContext extends SimpleBGPExtensionConsume
     }
 
     @Override
-    public AutoCloseable registerBgpPrefixSidTlvSerializer(final Class<? extends BgpPrefixSidTlv> tlvClass, final BgpPrefixSidTlvSerializer serializer) {
+    public AutoCloseable registerBgpPrefixSidTlvSerializer(final Class<? extends BgpPrefixSidTlv> tlvClass,
+            final BgpPrefixSidTlvSerializer serializer) {
         return this.getBgpPrefixSidTlvRegistry().registerBgpPrefixSidTlvSerializer(tlvClass, serializer);
     }
 }
index c0108eee31581c93b3772ede520b6212fbb257a8..8553bdbb8adea47a6da1870a390568f980260c12 100644 (file)
@@ -35,7 +35,7 @@ public class SimpleBGPExtensionProviderContextActivator implements AutoCloseable
     public void start() {
         LOG.debug("Starting {} BGPExtensionProviderActivator instances", this.extensionActivators.size());
 
-        for(final BGPExtensionProviderActivator e : this.extensionActivators) {
+        for (final BGPExtensionProviderActivator e : this.extensionActivators) {
             e.start(this.providerContext);
         }
     }
@@ -44,7 +44,7 @@ public class SimpleBGPExtensionProviderContextActivator implements AutoCloseable
     public void close() {
         LOG.debug("Stopping {} BGPExtensionProviderActivator instances", this.extensionActivators.size());
 
-        for(final BGPExtensionProviderActivator e : this.extensionActivators) {
+        for (final BGPExtensionProviderActivator e : this.extensionActivators) {
             e.stop();
         }
     }
index a8424be5a2873e18d9ea3d8dfc823fc0d8945e35..9d1a683a3c13706c6b20c332a9e8a7656f155b83 100644 (file)
@@ -21,14 +21,16 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public final class SimpleBgpPrefixSidTlvRegistry implements BgpPrefixSidTlvRegistry {
 
-    private final HandlerRegistry<DataContainer, BgpPrefixSidTlvParser, BgpPrefixSidTlvSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, BgpPrefixSidTlvParser, BgpPrefixSidTlvSerializer> handlers =
+            new HandlerRegistry<>();
 
     AutoCloseable registerBgpPrefixSidTlvParser(final int tlvType, final BgpPrefixSidTlvParser parser) {
         Preconditions.checkArgument(tlvType >= 0 && tlvType <= Values.UNSIGNED_BYTE_MAX_VALUE);
         return this.handlers.registerParser(tlvType, parser);
     }
 
-    AutoCloseable registerBgpPrefixSidTlvSerializer(final Class<? extends BgpPrefixSidTlv> tlvClass, final BgpPrefixSidTlvSerializer serializer) {
+    AutoCloseable registerBgpPrefixSidTlvSerializer(final Class<? extends BgpPrefixSidTlv> tlvClass,
+            final BgpPrefixSidTlvSerializer serializer) {
         return this.handlers.registerSerializer(tlvClass, serializer);
     }
 
@@ -39,7 +41,8 @@ public final class SimpleBgpPrefixSidTlvRegistry implements BgpPrefixSidTlvRegis
             return null;
         }
         final int length = buffer.readUnsignedShort();
-        Preconditions.checkState(length <= buffer.readableBytes(), "Length of BGP prefix SID TLV exceeds readable bytes of income.");
+        Preconditions.checkState(length <= buffer.readableBytes(),
+                "Length of BGP prefix SID TLV exceeds readable bytes of income.");
         return parser.parseBgpPrefixSidTlv(buffer.readBytes(length));
     }
 
@@ -53,5 +56,4 @@ public final class SimpleBgpPrefixSidTlvRegistry implements BgpPrefixSidTlvRegis
         serializer.serializeBgpPrefixSidTlv(tlv, valueBuf);
         BgpPrefixSidTlvUtil.formatBgpPrefixSidTlv(serializer.getType(), valueBuf, bytes);
     }
-
 }
index 5ca4269d64f1ec19a0f0a529a25b97fb0421f32e..5649360c2bf842f7fbbaed16a33bd91badb5b520 100644 (file)
@@ -21,19 +21,22 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 final class SimpleCapabilityRegistry implements CapabilityRegistry {
-    private final HandlerRegistry<DataContainer, CapabilityParser, CapabilitySerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, CapabilityParser, CapabilitySerializer> handlers =
+            new HandlerRegistry<>();
 
     AutoCloseable registerCapabilityParser(final int messageType, final CapabilityParser parser) {
         Preconditions.checkArgument(messageType >= 0 && messageType <= Values.UNSIGNED_BYTE_MAX_VALUE);
         return this.handlers.registerParser(messageType, parser);
     }
 
-    AutoCloseable registerCapabilitySerializer(final Class<? extends DataObject> paramClass, final CapabilitySerializer serializer) {
+    AutoCloseable registerCapabilitySerializer(final Class<? extends DataObject> paramClass,
+            final CapabilitySerializer serializer) {
         return this.handlers.registerSerializer(paramClass, serializer);
     }
 
     @Override
-    public CParameters parseCapability(final int type, final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    public CParameters parseCapability(final int type, final ByteBuf buffer) throws BGPDocumentedException,
+            BGPParsingException {
         final CapabilityParser parser = this.handlers.getParser(type);
         if (parser == null) {
             return null;
@@ -42,7 +45,7 @@ final class SimpleCapabilityRegistry implements CapabilityRegistry {
     }
 
     @Override
-    public void serializeCapability(final CParameters capability, ByteBuf bytes) {
+    public void serializeCapability(final CParameters capability, final ByteBuf bytes) {
         for (CapabilitySerializer s : this.handlers.getAllSerializers()) {
             s.serializeCapability(capability, bytes);
         }
index 100a96c43fdbc056c2c7ef48353b064868bf4a60..d12445232174caf08c81b9af7e8c553843aaf022 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.spi.pojo;
 
 import static org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityUtil.isTransitive;
@@ -33,10 +32,11 @@ final class SimpleExtendedCommunityRegistry implements ExtendedCommunityRegistry
 
     private static final int EXTENDED_COMMUNITY_LENGTH = 6;
 
-    private final HandlerRegistry<DataContainer, ExtendedCommunityParser, ExtendedCommunitySerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, ExtendedCommunityParser, ExtendedCommunitySerializer> handlers =
+            new HandlerRegistry<>();
 
     private static int createKey(final int type, final int subtype) {
-        return (type << Byte.SIZE) | subtype;
+        return type << Byte.SIZE | subtype;
     }
 
     @Override
@@ -58,22 +58,26 @@ final class SimpleExtendedCommunityRegistry implements ExtendedCommunityRegistry
 
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunities extendedCommunity, final ByteBuf byteAggregator) {
-        final ExtendedCommunitySerializer serializer = this.handlers.getSerializer(extendedCommunity.getExtendedCommunity().getImplementedInterface());
+        final ExtendedCommunitySerializer serializer = this.handlers.getSerializer(extendedCommunity
+            .getExtendedCommunity().getImplementedInterface());
         if (serializer == null) {
             return;
         }
-        ByteBufWriteUtil.writeUnsignedByte(Shorts.checkedCast(serializer.getType(extendedCommunity.isTransitive())), byteAggregator);
+        ByteBufWriteUtil.writeUnsignedByte(Shorts.checkedCast(serializer.getType(extendedCommunity.isTransitive())),
+            byteAggregator);
         ByteBufWriteUtil.writeUnsignedByte(Shorts.checkedCast(serializer.getSubType()), byteAggregator);
         serializer.serializeExtendedCommunity(extendedCommunity.getExtendedCommunity(), byteAggregator);
     }
 
     synchronized AutoCloseable registerExtendedCommunitySerializer(
-            final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity> extendedCommunityClass,
+            final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329
+                    .extended.community.ExtendedCommunity> extendedCommunityClass,
             final ExtendedCommunitySerializer serializer) {
         return this.handlers.registerSerializer(extendedCommunityClass, serializer);
     }
 
-    synchronized AutoCloseable registerExtendedCommunityParser(final int type, final int subtype, final ExtendedCommunityParser parser) {
+    synchronized AutoCloseable registerExtendedCommunityParser(final int type, final int subtype,
+            final ExtendedCommunityParser parser) {
         checkTypes(type, subtype);
         return this.handlers.registerParser(createKey(type, subtype), parser);
     }
@@ -81,7 +85,8 @@ final class SimpleExtendedCommunityRegistry implements ExtendedCommunityRegistry
     private static void checkTypes(final int type, final int subtype) {
         Preconditions.checkArgument(type >= 0 && type <= UNSIGNED_BYTE_MAX_VALUE, "Illegal extended-community type %s",
                 type);
-        Preconditions.checkArgument(subtype >= 0 && subtype <= UNSIGNED_BYTE_MAX_VALUE, "Illegal extended-community sub-type %s", subtype);
+        Preconditions.checkArgument(subtype >= 0 && subtype <= UNSIGNED_BYTE_MAX_VALUE,
+                "Illegal extended-community sub-type %s", subtype);
     }
 
 }
index e8f036d1a5d7497691bc18f05a58a8cd53cfcd0b..7c0902cddde7f7adc5851e815373051ada47e01b 100644 (file)
@@ -44,7 +44,8 @@ final class SimpleMessageRegistry extends AbstractMessageRegistry {
         return this.handlers.registerParser(messageType, parser);
     }
 
-    AutoCloseable registerMessageSerializer(final Class<? extends Notification> messageClass, final MessageSerializer serializer) {
+    AutoCloseable registerMessageSerializer(final Class<? extends Notification> messageClass,
+            final MessageSerializer serializer) {
         return this.handlers.registerSerializer(messageClass, serializer);
     }
 }
index ff1497e1604463fd4b9b36adb26cbb8ad66bb37c..1270c36a1f54d16d9d1c1464276c516db80e2496 100644 (file)
@@ -55,7 +55,7 @@ final class SimpleNlriRegistry implements NlriRegistry {
     private final SubsequentAddressFamilyRegistry safiReg;
     private final AddressFamilyRegistry afiReg;
 
-    public SimpleNlriRegistry(final AddressFamilyRegistry afiReg, final SubsequentAddressFamilyRegistry safiReg) {
+    SimpleNlriRegistry(final AddressFamilyRegistry afiReg, final SubsequentAddressFamilyRegistry safiReg) {
         this.afiReg = requireNonNull(afiReg);
         this.safiReg = requireNonNull(safiReg);
     }
@@ -67,8 +67,8 @@ final class SimpleNlriRegistry implements NlriRegistry {
         return new BgpTableTypeImpl(afi, safi);
     }
 
-    synchronized AutoCloseable registerNlriSerializer(final Class<? extends DataObject> nlriClass, final
-        NlriSerializer serializer){
+    synchronized AutoCloseable registerNlriSerializer(final Class<? extends DataObject> nlriClass,
+            final NlriSerializer serializer) {
         final NlriSerializer prev = this.serializers.get(nlriClass);
         Preconditions.checkState(prev == null, "Serializer already bound to class " + prev);
 
@@ -87,8 +87,8 @@ final class SimpleNlriRegistry implements NlriRegistry {
 
     synchronized AutoCloseable registerNlriParser(final Class<? extends AddressFamily> afi,
         final Class<? extends SubsequentAddressFamily> safi, final NlriParser parser,
-        final NextHopParserSerializer nextHopSerializer, final Class<? extends CNextHop> cNextHopClass,
-        final Class<? extends CNextHop>... cNextHopClassList) {
+        final NextHopParserSerializer nextHopSerializer, final Class<? extends CNextHop> cnextHopClass,
+        final Class<? extends CNextHop>... cnextHopClassList) {
         final BgpTableType key = createKey(afi, safi);
         final NlriParser prev = this.handlers.get(key);
         Preconditions.checkState(prev == null, "AFI/SAFI is already bound to parser " + prev);
@@ -96,11 +96,11 @@ final class SimpleNlriRegistry implements NlriRegistry {
         this.handlers.put(key, parser);
         this.nextHopParsers.put(key,nextHopSerializer);
 
-        if (cNextHopClass != null) {
-            final Entry<Class<? extends CNextHop>, BgpTableType> nhKey = new SimpleEntry<>(cNextHopClass, key);
+        if (cnextHopClass != null) {
+            final Entry<Class<? extends CNextHop>, BgpTableType> nhKey = new SimpleEntry<>(cnextHopClass, key);
             this.nextHopSerializers.put(nhKey, nextHopSerializer);
-            for (final Class<? extends CNextHop> cNextHop : cNextHopClassList) {
-                final Entry<Class<? extends CNextHop>, BgpTableType> nhKeys = new SimpleEntry<>(cNextHop, key);
+            for (final Class<? extends CNextHop> cnextHop : cnextHopClassList) {
+                final Entry<Class<? extends CNextHop>, BgpTableType> nhKeys = new SimpleEntry<>(cnextHop, key);
                 this.nextHopSerializers.put(nhKeys, nextHopSerializer);
             }
         }
@@ -112,13 +112,13 @@ final class SimpleNlriRegistry implements NlriRegistry {
                 synchronized (lock) {
                     SimpleNlriRegistry.this.handlers.remove(key);
                     SimpleNlriRegistry.this.nextHopParsers.remove(key);
-                    if (cNextHopClass != null) {
+                    if (cnextHopClass != null) {
                         final Entry<Class<? extends CNextHop>, BgpTableType> nhKey
-                                = new SimpleEntry<>(cNextHopClass, key);
+                                = new SimpleEntry<>(cnextHopClass, key);
                         SimpleNlriRegistry.this.nextHopSerializers.remove(nhKey);
-                        for (final Class<? extends CNextHop> cNextHop : cNextHopClassList) {
+                        for (final Class<? extends CNextHop> cnextHop : cnextHopClassList) {
                             final Entry<Class<? extends CNextHop>, BgpTableType> nhKeys
-                                    = new SimpleEntry<>(cNextHop, key);
+                                    = new SimpleEntry<>(cnextHop, key);
                             SimpleNlriRegistry.this.nextHopSerializers.remove(nhKeys);
                         }
                     }
index ac84dc98e898bf1ab5f578fc0e60d2879e182461..fa83e509da1f38f94ea33d9c7afa2689b322e551 100644 (file)
@@ -20,19 +20,22 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 final class SimpleParameterRegistry implements ParameterRegistry {
-    private final HandlerRegistry<DataContainer, ParameterParser, ParameterSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, ParameterParser, ParameterSerializer> handlers =
+            new HandlerRegistry<>();
 
     AutoCloseable registerParameterParser(final int messageType, final ParameterParser parser) {
         Preconditions.checkArgument(messageType >= 0 && messageType <= Values.UNSIGNED_BYTE_MAX_VALUE);
         return this.handlers.registerParser(messageType, parser);
     }
 
-    AutoCloseable registerParameterSerializer(final Class<? extends BgpParameters> paramClass, final ParameterSerializer serializer) {
+    AutoCloseable registerParameterSerializer(final Class<? extends BgpParameters> paramClass,
+            final ParameterSerializer serializer) {
         return this.handlers.registerSerializer(paramClass, serializer);
     }
 
     @Override
-    public BgpParameters parseParameter(final int parameterType, final ByteBuf buffer) throws BGPParsingException, BGPDocumentedException {
+    public BgpParameters parseParameter(final int parameterType, final ByteBuf buffer) throws BGPParsingException,
+            BGPDocumentedException {
         final ParameterParser parser = this.handlers.getParser(parameterType);
         if (parser == null) {
             return null;
@@ -40,7 +43,8 @@ final class SimpleParameterRegistry implements ParameterRegistry {
         return parser.parseParameter(buffer);
     }
 
-    public void serializeParameter(final BgpParameters parameter, ByteBuf bytes) {
+    @Override
+    public void serializeParameter(final BgpParameters parameter, final ByteBuf bytes) {
         final ParameterSerializer serializer = this.handlers.getSerializer(parameter.getImplementedInterface());
         if (serializer == null) {
             return;
index 14ba1c175cb94e1feea1963125b39d894d7ab0a8..785568c39ef8e0ca3bfba0e396c7288880e99079 100644 (file)
@@ -7,16 +7,17 @@
  */
 package org.opendaylight.protocol.bgp.parser.spi.pojo;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
 
 import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
 import org.opendaylight.protocol.util.Values;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
 
-final class SimpleSubsequentAddressFamilyRegistry extends AbstractFamilyRegistry<SubsequentAddressFamily, Integer> implements
-        SubsequentAddressFamilyRegistry {
-    AutoCloseable registerSubsequentAddressFamily(final Class<? extends SubsequentAddressFamily> clazz, final int number) {
-        Preconditions.checkArgument(number >= 0 && number <= Values.UNSIGNED_BYTE_MAX_VALUE);
+final class SimpleSubsequentAddressFamilyRegistry extends AbstractFamilyRegistry<SubsequentAddressFamily, Integer>
+        implements SubsequentAddressFamilyRegistry {
+    AutoCloseable registerSubsequentAddressFamily(final Class<? extends SubsequentAddressFamily> clazz,
+            final int number) {
+        checkArgument(number >= 0 && number <= Values.UNSIGNED_BYTE_MAX_VALUE);
         return super.registerFamily(clazz, number);
     }
 
index beb6b287b09a49d6e89c04a44e09907fcc53ddd5..e22fcfa489f9e95efca80734d745fe5393c1c73c 100644 (file)
@@ -26,15 +26,17 @@ import org.opendaylight.yangtools.yang.binding.Notification;
 
 public class AbstractMessageRegistryTest {
 
-    public static final byte[] keepAliveBMsg = 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) 0x13, (byte) 0x04 };
+    public 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) 0x00, (byte) 0x13, (byte) 0x04
+    };
 
     private final AbstractMessageRegistry registry = new AbstractMessageRegistry() {
 
         @Override
         protected void serializeMessageImpl(final Notification message, final ByteBuf buffer) {
-            buffer.writeBytes(keepAliveBMsg);
+            buffer.writeBytes(KEEPALIVE_BMSG);
         }
 
         @Override
@@ -49,17 +51,19 @@ public class AbstractMessageRegistryTest {
         final Notification keepAlive = new KeepaliveBuilder().build();
         final ByteBuf buffer = Unpooled.buffer();
         this.registry.serializeMessage(keepAlive, buffer);
-        assertArrayEquals(keepAliveBMsg, ByteArray.getAllBytes(buffer));
+        assertArrayEquals(KEEPALIVE_BMSG, ByteArray.getAllBytes(buffer));
 
-        final Notification not = this.registry.parseMessage(Unpooled.copiedBuffer(keepAliveBMsg), null);
+        final Notification not = this.registry.parseMessage(Unpooled.copiedBuffer(KEEPALIVE_BMSG), null);
         assertTrue(not instanceof Keepalive);
     }
 
     @Test
     public void testIncompleteMarker() {
-        final byte[] testBytes = new byte[] { (byte) 0x00, (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 };
+        final byte[] testBytes = new byte[] {
+            (byte) 0x00, (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
+        };
         try {
             this.registry.parseMessage(Unpooled.copiedBuffer(testBytes), null);
             Assert.fail();
@@ -71,9 +75,11 @@ public class AbstractMessageRegistryTest {
 
     @Test
     public void testInvalidLength() {
-        final byte[] testBytes = 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) 0x12, (byte) 0x04 };
+        final byte[] testBytes = 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) 0x12, (byte) 0x04
+        };
         try {
             this.registry.parseMessage(Unpooled.copiedBuffer(testBytes), null);
             Assert.fail();
@@ -85,9 +91,11 @@ public class AbstractMessageRegistryTest {
 
     @Test
     public void testInvalidSpecifiedSize() {
-        final byte[] testBytes = 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) 0x13, (byte) 0x04, (byte) 0x04 };
+        final byte[] testBytes = 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) 0x13, (byte) 0x04, (byte) 0x04
+        };
         try {
             this.registry.parseMessage(Unpooled.copiedBuffer(testBytes), null);
             Assert.fail();
@@ -99,7 +107,8 @@ public class AbstractMessageRegistryTest {
 
     @Test
     public void testBGPHeaderParser() throws Exception {
-        final MessageRegistry msgReg = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getMessageRegistry();
+        final MessageRegistry msgReg = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance()
+                .getMessageRegistry();
         try {
             msgReg.parseMessage(Unpooled.copiedBuffer(new byte[] { (byte) 0, (byte) 0 }), null);
             fail("Exception should have occured.");
@@ -110,7 +119,8 @@ public class AbstractMessageRegistryTest {
 
     @Test
     public void testMessageParser() throws Exception {
-        final MessageRegistry msgReg = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getMessageRegistry();
+        final MessageRegistry msgReg = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance()
+                .getMessageRegistry();
         String ex = "";
         try {
             msgReg.serializeMessage(null, Unpooled.EMPTY_BUFFER);
index c08a4b8e27a32d99488e0c74ab983f91148575cc..be21d50ff09d8940b512fb48343e4cce81065740 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.spi;
 
 import java.util.Optional;
@@ -22,7 +21,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 
 public class MultiPathSupportUtilTest {
 
-    private static final BgpTableType AFI_SAFI = new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
+    private static final BgpTableType AFI_SAFI = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+        UnicastSubsequentAddressFamily.class);
 
     @Mock
     private PeerSpecificParserConstraint constraints;
@@ -60,9 +60,8 @@ public class MultiPathSupportUtilTest {
         Assert.assertFalse(MultiPathSupportUtil.isTableTypeSupported(null, AFI_SAFI));
     }
 
-    @Test(expected=NullPointerException.class)
+    @Test(expected = NullPointerException.class)
     public void testIsTableTypeSupportedNPE() {
         MultiPathSupportUtil.isTableTypeSupported(null, null);
     }
-
 }
index 46da1909ba51d852481d51463f8b73a358696088..c6563ebd68953e2bd7fb4612e53fa50fac0af181 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.spi;
 
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
@@ -60,22 +59,22 @@ public class PathIdUtilTest {
 
     @Test
     public void testExtractPathId() {
-        final NodeIdentifier NII = new NodeIdentifier(QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet", "2015-03-05", "path-id").intern());
+        final NodeIdentifier NII = new NodeIdentifier(QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
+            "2015-03-05", "path-id").intern());
         final long pathIdValue = 0;
-        final ContainerNode cont = ImmutableContainerNodeSchemaAwareBuilder.create().withNodeIdentifier(NII).
-            addChild(new ImmutableLeafNodeBuilder<>().withNodeIdentifier(NII).withValue(pathIdValue).build()).build();
+        final ContainerNode cont = ImmutableContainerNodeSchemaAwareBuilder.create().withNodeIdentifier(NII).addChild(
+            new ImmutableLeafNodeBuilder<>().withNodeIdentifier(NII).withValue(pathIdValue).build()).build();
         Assert.assertEquals(pathIdValue, PathIdUtil.extractPathId(cont, NII).longValue());
     }
 
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testReadPathIdBufferNull() {
         PathIdUtil.readPathId(null);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testReadPathIdBufferEmpty() {
         PathIdUtil.readPathId(this.buffer);
     }
-
 }
index 4d8fdcd1a2976ea7d530d6964ff93b7538363a63..d2ac332cb2d364b26437ffe7609257bef3be06a5 100644 (file)
@@ -57,9 +57,10 @@ public class UtilsTest {
     @Test
     public void testMessageUtil() {
         final byte[] result = new byte[] { UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
-            UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
-            UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
-            UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, 0, 23, 3, 32, 5, 14, 21 };
+            UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
+            UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
+            UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
+            UnsignedBytes.MAX_VALUE, 0, 23, 3, 32, 5, 14, 21 };
         final ByteBuf formattedMessage = Unpooled.buffer();
         MessageUtil.formatMessage(3, Unpooled.wrappedBuffer(new byte[] { 32, 5, 14, 21 }), formattedMessage);
         assertArrayEquals(result, ByteArray.getAllBytes(formattedMessage));
@@ -98,12 +99,14 @@ public class UtilsTest {
     public void testMultiprotocolCapabilitiesUtil() throws BGPParsingException {
         final byte[] bytes = new byte[] {0, 1, 0, 1};
         final ByteBuf bytesBuf = Unpooled.copiedBuffer(bytes);
-        final BgpTableType parsedAfiSafi = MultiprotocolCapabilitiesUtil.parseMPAfiSafi(bytesBuf, this.afiReg, this.safiReg).get();
+        final BgpTableType parsedAfiSafi = MultiprotocolCapabilitiesUtil.parseMPAfiSafi(bytesBuf, this.afiReg,
+            this.safiReg).get();
         assertEquals(Ipv4AddressFamily.class, parsedAfiSafi.getAfi());
         assertEquals(UnicastSubsequentAddressFamily.class, parsedAfiSafi.getSafi());
 
         final ByteBuf serializedAfiSafi = Unpooled.buffer(4);
-        MultiprotocolCapabilitiesUtil.serializeMPAfiSafi(this.afiReg, this.safiReg, Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, serializedAfiSafi);
+        MultiprotocolCapabilitiesUtil.serializeMPAfiSafi(this.afiReg, this.safiReg, Ipv4AddressFamily.class,
+            UnicastSubsequentAddressFamily.class, serializedAfiSafi);
         assertArrayEquals(bytes, serializedAfiSafi.array());
     }
 
@@ -111,7 +114,8 @@ public class UtilsTest {
     public void testUnsupportedAfi() {
         final byte[] bytes = new byte[] {0, 2, 0, 1};
         final ByteBuf bytesBuf = Unpooled.copiedBuffer(bytes);
-        final Optional<BgpTableType> parsedAfiSafi = MultiprotocolCapabilitiesUtil.parseMPAfiSafi(bytesBuf, this.afiReg, this.safiReg);
+        final Optional<BgpTableType> parsedAfiSafi = MultiprotocolCapabilitiesUtil.parseMPAfiSafi(bytesBuf, this.afiReg,
+            this.safiReg);
         Assert.assertFalse(parsedAfiSafi.isPresent());
     }
 
@@ -119,11 +123,12 @@ public class UtilsTest {
     public void testUnsupportedSafi() {
         final byte[] bytes = new byte[] {0, 1, 0, 3};
         final ByteBuf bytesBuf = Unpooled.copiedBuffer(bytes);
-        final Optional<BgpTableType> parsedAfiSafi = MultiprotocolCapabilitiesUtil.parseMPAfiSafi(bytesBuf, this.afiReg, this.safiReg);
+        final Optional<BgpTableType> parsedAfiSafi = MultiprotocolCapabilitiesUtil.parseMPAfiSafi(bytesBuf, this.afiReg,
+            this.safiReg);
         Assert.assertFalse(parsedAfiSafi.isPresent());
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testAttributeUtilPrivateConstructor() throws Throwable {
         final Constructor<AttributeUtil> c = AttributeUtil.class.getDeclaredConstructor();
         c.setAccessible(true);
@@ -134,7 +139,7 @@ public class UtilsTest {
         }
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testCapabilityUtilPrivateConstructor() throws Throwable {
         final Constructor<CapabilityUtil> c = CapabilityUtil.class.getDeclaredConstructor();
         c.setAccessible(true);
@@ -145,7 +150,7 @@ public class UtilsTest {
         }
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testMessageUtilPrivateConstructor() throws Throwable {
         final Constructor<MessageUtil> c = MessageUtil.class.getDeclaredConstructor();
         c.setAccessible(true);
@@ -156,7 +161,7 @@ public class UtilsTest {
         }
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testParameterUtilPrivateConstructor() throws Throwable {
         final Constructor<ParameterUtil> c = ParameterUtil.class.getDeclaredConstructor();
         c.setAccessible(true);
index 43ce1efee44e140241d5eefca1d856ec6b4a01dc..f760629cd6db43f8f22937c3cbab9be25fea8080 100644 (file)
@@ -5,14 +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.spi.extended.community;
 
 import io.netty.buffer.ByteBuf;
 import org.junit.Assert;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity;
 
 public class AbstractIpv4ExtendedCommunityTest {
@@ -21,19 +18,21 @@ public class AbstractIpv4ExtendedCommunityTest {
     public void testGetType() {
         final AbstractIpv4ExtendedCommunity abstractIpv4ExtendedCommunity = new AbstractIpv4ExtendedCommunity() {
             @Override
-            public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
+            public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity,
+                    final ByteBuf byteAggregator) {
             }
+
             @Override
             public int getSubType() {
                 return 0;
             }
+
             @Override
-            public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+            public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
                 return null;
             }
         };
         Assert.assertEquals(1, abstractIpv4ExtendedCommunity.getType(true));
         Assert.assertEquals(65, abstractIpv4ExtendedCommunity.getType(false));
     }
-
 }
index c86c32e18454cedb70fef5e398fe0584f360e958..99df5bcdccb57b86c6ebb7c51c472d6a64670c45 100644 (file)
@@ -5,14 +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.spi.extended.community;
 
 import io.netty.buffer.ByteBuf;
 import org.junit.Assert;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity;
 
 public class AbstractOpaqueExtendedCommunityTest {
@@ -20,22 +17,22 @@ public class AbstractOpaqueExtendedCommunityTest {
     @Test
     public void testGetType() {
         final AbstractOpaqueExtendedCommunity abstractOpaqueExtendedCommunity = new AbstractOpaqueExtendedCommunity() {
-
             @Override
-            public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
+            public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity,
+                    final ByteBuf byteAggregator) {
             }
+
             @Override
             public int getSubType() {
                 return 0;
             }
 
             @Override
-            public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+            public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
                 return null;
             }
         };
         Assert.assertEquals(3, abstractOpaqueExtendedCommunity.getType(true));
         Assert.assertEquals(67, abstractOpaqueExtendedCommunity.getType(false));
     }
-
 }
index 4468c7de856c9ece799d1f4326511bb96a7e27ea..b1da4441926205d67e99805e085b76c5edfa222b 100644 (file)
@@ -10,24 +10,25 @@ package org.opendaylight.protocol.bgp.parser.spi.extended.community;
 import io.netty.buffer.ByteBuf;
 import org.junit.Assert;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity;
 
 public class AbstractTwoOctetAsExtendedCommunityTest {
-
     @Test
     public void testGetType() {
-        final AbstractTwoOctetAsExtendedCommunity abstractTwoOctetAsExtendedCommunity = new AbstractTwoOctetAsExtendedCommunity() {
+        final AbstractTwoOctetAsExtendedCommunity abstractTwoOctetAsExtendedCommunity =
+                new AbstractTwoOctetAsExtendedCommunity() {
             @Override
-            public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
+            public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity,
+                    final ByteBuf byteAggregator) {
             }
+
             @Override
             public int getSubType() {
                 return 0;
             }
+
             @Override
-            public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+            public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)  {
                 return null;
             }
         };
index 1620c2d2be80c4a2bd1de2640f8269d31a75432e..4a116f4f587ab3683d5a292d2d109c69742d83b9 100644 (file)
@@ -17,7 +17,7 @@ import org.junit.Test;
 
 public class ExtendedCommunityUtilTest {
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testPrivateConstructor() throws Throwable {
         final Constructor<ExtendedCommunityUtil> c = ExtendedCommunityUtil.class.getDeclaredConstructor();
         c.setAccessible(true);
index eb61ed842be2852c95f18e4126af79de3ff36ca0..bc0edb6d090dbf055a39dafe260cdf656b347180 100644 (file)
@@ -1,11 +1,10 @@
 /*
- *  Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
  *
- *  This program and the accompanying materials are made available under the
- *  terms of the Eclipse Public License v1.0 which accompanies this distribution,
- *  and is available at http://www.eclipse.org/legal/epl-v10.html
+ * This program and the accompanying materials are made available under the
+ * 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.spi.extended.community;
 
 import io.netty.buffer.ByteBuf;
@@ -18,13 +17,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 
 public class Inet4SpecificExtendedCommunityCommonUtilTest {
     private static final byte[] INPUT = {
-            12, 51, 2, 5, 21, 45
+        12, 51, 2, 5, 21, 45
     };
 
     @Test
     public void testHandle() {
-        final Inet4SpecificExtendedCommunityCommon expected
-                = new Inet4SpecificExtendedCommunityCommonBuilder()
+        final Inet4SpecificExtendedCommunityCommon expected = new Inet4SpecificExtendedCommunityCommonBuilder()
                 .setGlobalAdministrator(new Ipv4Address("12.51.2.5"))
                 .setLocalAdministrator(new byte[]{21, 45}).build();
 
@@ -36,5 +34,4 @@ public class Inet4SpecificExtendedCommunityCommonUtilTest {
         Inet4SpecificExtendedCommunityCommonUtil.serializeCommon(expected, output);
         Assert.assertArrayEquals(INPUT, output.array());
     }
-
-}
\ No newline at end of file
+}
index fe3ac1e049bbd6b7793f3d3bd320eb4641819774..fc0f661d9ad053b20919cca568e4f19024985eb0 100644 (file)
@@ -129,10 +129,12 @@ public class BgpTestActivator extends AbstractBGPExtensionProviderActivator {
         this.nextHopParserSerializer = new NextHopParserSerializer() {
             @Override
             public CNextHop parseNextHop(final ByteBuf buffer) throws BGPParsingException {
-                return new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("127.0.0.1")).build()).build();
+                return new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
+                    .setGlobal(new Ipv4Address("127.0.0.1")).build()).build();
             }
+
             @Override
-            public void serializeNextHop(final CNextHop cNextHop, final ByteBuf byteAggregator) {
+            public void serializeNextHop(final CNextHop cnextHop, final ByteBuf byteAggregator) {
                 final byte[] mpReachBytes = {
                     0x7f, 0x00, 0x00, 0x01
                 };
@@ -163,33 +165,38 @@ public class BgpTestActivator extends AbstractBGPExtensionProviderActivator {
 
             doReturn(null).when(this.paramParser).parseParameter(any(ByteBuf.class));
             doReturn(EMPTY).when(this.paramParser).toString();
-            Mockito.doNothing().when(this.paramSerializer).serializeParameter(any(BgpParameters.class), any(ByteBuf.class));
+            Mockito.doNothing().when(this.paramSerializer).serializeParameter(any(BgpParameters.class),
+                any(ByteBuf.class));
             doReturn(EMPTY).when(this.paramSerializer).toString();
 
             doReturn(null).when(this.capaParser).parseCapability(any(ByteBuf.class));
             doReturn(EMPTY).when(this.capaParser).toString();
-            Mockito.doNothing().when(this.capaSerializer).serializeCapability(any(CParameters.class), any(ByteBuf.class));
+            Mockito.doNothing().when(this.capaSerializer).serializeCapability(any(CParameters.class),
+                any(ByteBuf.class));
             doReturn(EMPTY).when(this.capaSerializer).toString();
 
             doReturn(null).when(this.sidTlvParser).parseBgpPrefixSidTlv(any(ByteBuf.class));
             doReturn(EMPTY).when(this.sidTlvParser).toString();
-            Mockito.doNothing().when(this.sidTlvSerializer).serializeBgpPrefixSidTlv(any(BgpPrefixSidTlv.class), any(ByteBuf.class));
+            Mockito.doNothing().when(this.sidTlvSerializer).serializeBgpPrefixSidTlv(any(BgpPrefixSidTlv.class),
+                any(ByteBuf.class));
             doReturn(EMPTY).when(this.sidTlvSerializer).toString();
             doReturn(0).when(this.sidTlvSerializer).getType();
 
-            doReturn(mock(Notification.class)).when(this.msgParser).parseMessageBody(any(ByteBuf.class), Mockito.anyInt(),
-                any(PeerSpecificParserConstraint.class));
+            doReturn(mock(Notification.class)).when(this.msgParser).parseMessageBody(any(ByteBuf.class),
+                Mockito.anyInt(), any(PeerSpecificParserConstraint.class));
             doReturn(EMPTY).when(this.msgParser).toString();
-            Mockito.doNothing().when(this.msgSerializer).serializeMessage(any(Notification.class), any(ByteBuf.class));
+            Mockito.doNothing().when(this.msgSerializer).serializeMessage(any(Notification.class),
+                any(ByteBuf.class));
             doReturn(EMPTY).when(this.msgSerializer).toString();
 
-            Mockito.doNothing().when(this.nlriParser).parseNlri(any(ByteBuf.class), any(MpUnreachNlriBuilder.class), any());
-            Mockito.doNothing().when(this.nlriParser).parseNlri(any(ByteBuf.class), any(MpReachNlriBuilder.class), any());
+            Mockito.doNothing().when(this.nlriParser).parseNlri(any(ByteBuf.class), any(MpUnreachNlriBuilder.class),
+                any());
+            Mockito.doNothing().when(this.nlriParser).parseNlri(any(ByteBuf.class), any(MpReachNlriBuilder.class),
+                any());
             doReturn(EMPTY).when(this.nlriParser).toString();
 
         } catch (BGPDocumentedException | BGPParsingException | BGPTreatAsWithdrawException e) {
             Assert.fail();
         }
     }
-
 }
index 0abaf61c762e58ca623346fc212bdc1534bc845e..b6bfefb0f922fdb25aa78de941cdb53ccd5f9980 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.spi.pojo;
 
 import com.google.common.collect.Lists;
@@ -25,7 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 
 public class MultiPathSupportImplTest {
 
-    @Test(expected=NullPointerException.class)
+    @Test(expected = NullPointerException.class)
     public void testcreateParserMultiPathSupportNull() {
         MultiPathSupportImpl.createParserMultiPathSupport(null);
     }
@@ -33,10 +32,14 @@ public class MultiPathSupportImplTest {
     @Test
     public void testIsTableTypeSupported() {
         final List<AddressFamilies> supportedTables = Lists.newArrayList();
-        final BgpTableType ipv4Unicast = new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
-        final BgpTableType ipv4L3vpn = new BgpTableTypeImpl(Ipv4AddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class);
-        final BgpTableType ipv6Unicast = new BgpTableTypeImpl(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class);
-        final BgpTableType ipv6L3vpn = new BgpTableTypeImpl(Ipv6AddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class);
+        final BgpTableType ipv4Unicast = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+            UnicastSubsequentAddressFamily.class);
+        final BgpTableType ipv4L3vpn = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+            MplsLabeledVpnSubsequentAddressFamily.class);
+        final BgpTableType ipv6Unicast = new BgpTableTypeImpl(Ipv6AddressFamily.class,
+            UnicastSubsequentAddressFamily.class);
+        final BgpTableType ipv6L3vpn = new BgpTableTypeImpl(Ipv6AddressFamily.class,
+            MplsLabeledVpnSubsequentAddressFamily.class);
         supportedTables.add(createAddPathCapability(ipv4Unicast, SendReceive.Send));
         supportedTables.add(createAddPathCapability(ipv4L3vpn, SendReceive.Receive));
         supportedTables.add(createAddPathCapability(ipv6Unicast, SendReceive.Both));
@@ -49,7 +52,8 @@ public class MultiPathSupportImplTest {
     }
 
     private static AddressFamilies createAddPathCapability(final BgpTableType afisafi, final SendReceive mode) {
-        return new AddressFamiliesBuilder().setAfi(afisafi.getAfi()).setSafi(afisafi.getSafi()).setSendReceive(mode).build();
+        return new AddressFamiliesBuilder().setAfi(afisafi.getAfi()).setSafi(afisafi.getSafi()).setSendReceive(mode)
+                .build();
     }
 
 }
index 5e80029363c2a3ce01547a006a9d98ae6e9206fa..0aebc0d9e5a66e28b555513f426c5d2e570f0b19 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.spi.pojo;
 
 import java.util.Collections;
@@ -18,7 +17,8 @@ import org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraintProv
 
 public class PeerSpecificParserConstraintImplTest {
 
-    private static final MultiPathSupport ADD_PATH_CONSTRAINT = MultiPathSupportImpl.createParserMultiPathSupport(Collections.emptyList());
+    private static final MultiPathSupport ADD_PATH_CONSTRAINT = MultiPathSupportImpl.createParserMultiPathSupport(
+        Collections.emptyList());
 
     private PeerSpecificParserConstraintProvider constraints;
 
@@ -38,7 +38,7 @@ public class PeerSpecificParserConstraintImplTest {
         Assert.assertFalse(this.constraints.addPeerConstraint(MultiPathSupport.class, ADD_PATH_CONSTRAINT));
     }
 
-    @Test(expected=NullPointerException.class)
+    @Test(expected = NullPointerException.class)
     public void testProviderNullInput() {
         this.constraints.addPeerConstraint(MultiPathSupport.class, null);
     }
@@ -55,5 +55,4 @@ public class PeerSpecificParserConstraintImplTest {
         final Optional<MultiPathSupport> peerConstraint = this.constraints.getPeerConstraint(MultiPathSupport.class);
         Assert.assertFalse(peerConstraint.isPresent());
     }
-
 }
index 4ea811285cfd7b2c30d02bab427e7b44695fbbe9..e6a1a6c211fd42bc7c6e613bb7a831e6d9283e21 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.spi.pojo;
 
 import java.lang.reflect.Constructor;
@@ -14,9 +13,10 @@ import org.junit.Test;
 
 public class ServiceLoaderBGPExtensionProviderContextTest {
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testPrivateConstructor() throws Throwable {
-        final Constructor<ServiceLoaderBGPExtensionProviderContext> c = ServiceLoaderBGPExtensionProviderContext.class.getDeclaredConstructor();
+        final Constructor<ServiceLoaderBGPExtensionProviderContext> c = ServiceLoaderBGPExtensionProviderContext.class
+                .getDeclaredConstructor();
         c.setAccessible(true);
         try {
             c.newInstance();
index 04a90a15fdc943a6a48d37196ac11ea94520e30c..2653c7739d6f939f06fdae5b5aceae5f4fbbb053 100644 (file)
@@ -5,12 +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.spi.pojo;
 
 import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -90,14 +89,13 @@ public class SimpleExtendedCommunityRegistryTest {
         verify(this.parser, never()).parseExtendedCommunity(any(ByteBuf.class));
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testRegisterParserOutOfRangeType() {
         this.register.registerExtendedCommunityParser(1234, 0, this.parser);
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testRegisterParserOutOfRangeSubType() {
         this.register.registerExtendedCommunityParser(0, 1234, this.parser);
     }
-
 }
index 7289e6717a9bb03b5696f68c37384b19a193ba34..bfbb5ff218712bce8f1a1085d9bb638da6d6ff80 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.spi.pojo;
 
 import static org.junit.Assert.assertArrayEquals;
@@ -61,9 +60,9 @@ public class SimpleRegistryTest {
     private static final PeerSpecificParserConstraint CONSTRAINT;
 
     static {
-        PeerSpecificParserConstraintImpl c = new PeerSpecificParserConstraintImpl();
-        c.addPeerConstraint(MultiPathSupport.class, ADD_PATH_SUPPORT);
-        CONSTRAINT = c;
+        PeerSpecificParserConstraintImpl peerConstraint = new PeerSpecificParserConstraintImpl();
+        peerConstraint.addPeerConstraint(MultiPathSupport.class, ADD_PATH_SUPPORT);
+        CONSTRAINT = peerConstraint;
     }
 
     protected BGPExtensionProviderContext ctx;
@@ -107,7 +106,8 @@ public class SimpleRegistryTest {
         paramReg.serializeParameter(param, buffer);
         paramReg.parseParameter(0, Unpooled.wrappedBuffer(paramBytes));
         verify(this.activator.paramParser, times(1)).parseParameter(any(ByteBuf.class));
-        verify(this.activator.paramSerializer, times(1)).serializeParameter(any(BgpParameters.class), any(ByteBuf.class));
+        verify(this.activator.paramSerializer, times(1)).serializeParameter(any(BgpParameters.class),
+            any(ByteBuf.class));
     }
 
     @Test
@@ -132,7 +132,8 @@ public class SimpleRegistryTest {
 
         final ByteBuf buffer = Unpooled.buffer(tlvBytes.length);
         sidTlvReg.serializeBgpPrefixSidTlv(tlv, buffer);
-        verify(this.activator.sidTlvSerializer, times(1)).serializeBgpPrefixSidTlv(any(BgpPrefixSidTlv.class), any(ByteBuf.class));
+        verify(this.activator.sidTlvSerializer, times(1)).serializeBgpPrefixSidTlv(any(BgpPrefixSidTlv.class),
+            any(ByteBuf.class));
 
         sidTlvReg.parseBgpPrefixSidTlv(BgpTestActivator.TYPE, Unpooled.wrappedBuffer(tlvBytes));
         verify(this.activator.sidTlvParser, times(1)).parseBgpPrefixSidTlv(any(ByteBuf.class));
@@ -183,7 +184,8 @@ public class SimpleRegistryTest {
         final MpReachNlri mpReach = new MpReachNlriBuilder()
             .setAfi(Ipv4AddressFamily.class)
             .setSafi(UnicastSubsequentAddressFamily.class)
-            .setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("127.0.0.1")).build()).build())
+            .setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(
+                new Ipv4Address("127.0.0.1")).build()).build())
             .build();
         final ByteBuf buffer = Unpooled.buffer(mpReachBytes.length);
         nlriReg.serializeMpReach(mpReach, buffer);
@@ -230,11 +232,13 @@ public class SimpleRegistryTest {
         final byte[] mpUnreachBytes = {
             0x00, 0x01, 0x01
         };
-        final MpUnreachNlri mpUnreach = new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build();
+        final MpUnreachNlri mpUnreach = new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class)
+                .setSafi(UnicastSubsequentAddressFamily.class).build();
         final ByteBuf buffer = Unpooled.buffer(mpUnreachBytes.length);
         nlriReg.serializeMpUnReach(mpUnreach, buffer);
         assertArrayEquals(mpUnreachBytes, buffer.array());
         assertEquals(mpUnreach, nlriReg.parseMpUnreach(Unpooled.wrappedBuffer(mpUnreachBytes), CONSTRAINT));
-        verify(this.activator.nlriParser, never()).parseNlri(any(ByteBuf.class), any(MpUnreachNlriBuilder.class), any());
+        verify(this.activator.nlriParser, never()).parseNlri(any(ByteBuf.class), any(MpUnreachNlriBuilder.class),
+            any());
     }
 }
index 9ddc94b7ef58e2d9b917d9f2ce60541148fa81c5..f72cf3bae9d3966de6fda8fb286b128aec59dee1 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.spi.pojo;
 
 import static org.junit.Assert.assertArrayEquals;
@@ -30,7 +29,7 @@ public class UnrecognizedAttributesTest {
     private static final short NON_EXISTENT_TYPE = 0;
     private static final int NON_VALUE_BYTES = 3;
 
-    private static final SimpleAttributeRegistry simpleAttrReg = new SimpleAttributeRegistry();
+    private static final SimpleAttributeRegistry SIMPLE_ATTR_REG = new SimpleAttributeRegistry();
 
     @Rule
     public ExpectedException expException = ExpectedException.none();
@@ -39,15 +38,15 @@ public class UnrecognizedAttributesTest {
     public void testUnrecognizedAttributesWithoutOptionalFlag() throws BGPDocumentedException, BGPParsingException {
         this.expException.expect(BGPDocumentedException.class);
         this.expException.expectMessage("Well known attribute not recognized.");
-        simpleAttrReg.parseAttributes(
+        SIMPLE_ATTR_REG.parseAttributes(
             Unpooled.wrappedBuffer(new byte[] { 0x03, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05 }), null);
     }
 
     @Test
     public void testUnrecognizedAttributes() throws BGPDocumentedException, BGPParsingException {
         final byte[] attributeBytes = { (byte)0xe0, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05 };
-        final List<UnrecognizedAttributes> unrecogAttribs = simpleAttrReg
-            .parseAttributes(Unpooled.wrappedBuffer(attributeBytes), null).getAttributes().getUnrecognizedAttributes();
+        final List<UnrecognizedAttributes> unrecogAttribs = SIMPLE_ATTR_REG.parseAttributes(
+            Unpooled.wrappedBuffer(attributeBytes), null).getAttributes().getUnrecognizedAttributes();
         assertEquals(UNRECOGNIZED_ATTRIBUTE_COUNT, unrecogAttribs.size());
         final UnrecognizedAttributes unrecogAttrib = unrecogAttribs.get(FIRST_ATTRIBUTE);
         final UnrecognizedAttributesKey expectedAttribKey =