Enforce pcep-spi checkstyle 43/78843/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 17 Dec 2018 16:23:09 +0000 (17:23 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 17 Dec 2018 17:59:01 +0000 (18:59 +0100)
This is trivial conversion, removing reflection-based tests
and killing unneeded final's and splitting long lines.

Change-Id: I158060d63cb59c387428897af9dc47efaf56dcee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
62 files changed:
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey128SubobjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey32SubobjectParser.java
pcep/spi/pom.xml
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractEROPathKeySubobjectParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectSerializer.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EnterpriseSpecificInformationParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelSerializer.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectHeaderImpl.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectSerializer.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPDeserializerException.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPErrorIdentifier.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPErrors.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionProviderContext.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPMessageConstants.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PSTUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectSerializer.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvSerializer.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/UnknownObject.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationObjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationTlvRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectSerializer.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/AbstractPCEPExtensionProviderActivator.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/ServiceLoaderPCEPExtensionProviderContext.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleEROSubobjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleMessageRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContextActivator.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationObjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationTlvRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectRegistry.java
pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/APITest.java
pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParserTest.java
pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsTest.java
pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/RegistryTest.java
pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/UtilsTest.java

index 0a3978812ad189c37818d6955eb5a0d3ceb8a858..db11074f7db785576e268a4780d4681bda7006a2 100644 (file)
@@ -20,9 +20,9 @@ public final class EROPathKey128SubobjectParser extends AbstractEROPathKeySubobj
     }
 
     @Override
-    protected void checkContentLenght(final int lenght) throws PCEPDeserializerException {
-        if (lenght != CONTENT128_LENGTH) {
-            throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + lenght + "; Expected: >"
+    protected void checkContentLength(final int length) throws PCEPDeserializerException {
+        if (length != CONTENT128_LENGTH) {
+            throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + length + "; Expected: >"
                 + CONTENT128_LENGTH + ".");
         }
     }
index dc22e536676140adc634256af4eef5c1e979ed31..fda2a5736aacbd30ba71705a0fb974cdf0b860ba 100644 (file)
@@ -20,9 +20,9 @@ public final class EROPathKey32SubobjectParser extends AbstractEROPathKeySubobje
     }
 
     @Override
-    protected void checkContentLenght(final int lenght) throws PCEPDeserializerException {
-        if (lenght != CONTENT_LENGTH) {
-            throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + lenght + "; Expected: >"
+    protected void checkContentLength(final int length) throws PCEPDeserializerException {
+        if (length != CONTENT_LENGTH) {
+            throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + length + "; Expected: >"
                 + CONTENT_LENGTH + ".");
         }
     }
index 8a2a641cf66cfa85b3481b52a1017369c9a9799a..d14df44b251250f3f68fc62df2b368bcfca69914 100644 (file)
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <violationSeverity>warn</violationSeverity>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 
index e93f57ad684846d3e9640e7e3c05da530ef12de9..5bfc1ef9f332ea47264dee45b6604c77ef54e1cd 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.pcep.spi;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedShort;
 
-import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
@@ -22,7 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKeyBuilder;
 
 /**
- * Parser for {@link PathKey}
+ * Parser for {@link PathKey}.
  */
 public abstract class AbstractEROPathKeySubobjectParser implements EROSubobjectParser, EROSubobjectSerializer {
 
@@ -33,14 +32,15 @@ public abstract class AbstractEROPathKeySubobjectParser implements EROSubobjectP
     protected static final int CONTENT128_LENGTH = 2 + PCE128_ID_F_LENGTH;
     protected static final int CONTENT_LENGTH = 2 + PCE_ID_F_LENGTH;
 
-    protected abstract byte[] readPceId(final ByteBuf buffer);
+    protected abstract byte[] readPceId(ByteBuf buffer);
 
-    protected abstract void checkContentLenght(final int i) throws PCEPDeserializerException;
+    protected abstract void checkContentLength(int length) throws PCEPDeserializerException;
 
     @Override
     public final Subobject parseSubobject(final ByteBuf buffer, final boolean loose) throws PCEPDeserializerException {
-        Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
-        checkContentLenght(buffer.readableBytes());
+        checkArgument(buffer != null && buffer.isReadable(),
+                "Array of bytes is mandatory. Can't be null or empty.");
+        checkContentLength(buffer.readableBytes());
         final int pathKey = buffer.readUnsignedShort();
         final byte[] pceId = readPceId(buffer);
         final PathKeyBuilder pBuilder = new PathKeyBuilder();
@@ -54,17 +54,19 @@ public abstract class AbstractEROPathKeySubobjectParser implements EROSubobjectP
 
     @Override
     public final void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
-        Preconditions.checkArgument(subobject.getSubobjectType() instanceof PathKeyCase, "Unknown subobject instance. Passed %s. Needed PathKey.",
-            subobject.getSubobjectType().getClass());
+        checkArgument(subobject.getSubobjectType() instanceof PathKeyCase,
+            "Unknown subobject instance. Passed %s. Needed PathKey.", subobject.getSubobjectType().getClass());
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route
-            .subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
-        Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
-        Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
+            .subobjects.subobject.type.path.key._case.PathKey pk =
+            ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
+        checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
         final byte[] pceID = pk.getPceId().getValue();
-        Preconditions.checkArgument(pceID.length == PCE_ID_F_LENGTH || pceID.length == PCE128_ID_F_LENGTH, "PceId 32/128 Bit required.");
+        checkArgument(pceID.length == PCE_ID_F_LENGTH || pceID.length == PCE128_ID_F_LENGTH,
+                "PceId 32/128 Bit required.");
         final ByteBuf body = Unpooled.buffer();
         writeUnsignedShort(pk.getPathKey().getValue(), body);
         body.writeBytes(pceID);
-        EROSubobjectUtil.formatSubobject(pceID.length == PCE_ID_F_LENGTH ? TYPE_32 : TYPE_128, subobject.isLoose(), body, buffer);
+        EROSubobjectUtil.formatSubobject(pceID.length == PCE_ID_F_LENGTH ? TYPE_32 : TYPE_128, subobject.isLoose(),
+                body, buffer);
     }
 }
index 32b06a0e05c713d82c72763f2398f1d4a4f176e4..7a7e9707aa833115eeb44d52f8b0d554e65fc54f 100644 (file)
@@ -70,8 +70,8 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
         final List<Object> objs = new ArrayList<>();
         while (bytes.isReadable()) {
             if (bytes.readableBytes() < COMMON_OBJECT_HEADER_LENGTH) {
-                throw new PCEPDeserializerException("Too few bytes in passed array. Passed: " + bytes.readableBytes() + " Expected: >= "
-                        + COMMON_OBJECT_HEADER_LENGTH + ".");
+                throw new PCEPDeserializerException("Too few bytes in passed array. Passed: " + bytes.readableBytes()
+                    + " Expected: >= " + COMMON_OBJECT_HEADER_LENGTH + ".");
             }
             final int objClass = bytes.readUnsignedByte();
 
@@ -81,8 +81,8 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
             final int objLength = bytes.readUnsignedShort();
 
             if (bytes.readableBytes() < objLength - COMMON_OBJECT_HEADER_LENGTH) {
-                throw new PCEPDeserializerException("Too few bytes in passed array. Passed: " + bytes.readableBytes() + " Expected: >= "
-                        + objLength + ".");
+                throw new PCEPDeserializerException("Too few bytes in passed array. Passed: " + bytes.readableBytes()
+                    + " Expected: >= " + objLength + ".");
             }
             // copy bytes for deeper parsing
             final ByteBuf bytesToPass = bytes.readSlice(objLength - COMMON_OBJECT_HEADER_LENGTH);
@@ -91,7 +91,8 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
 
             if (VendorInformationUtil.isVendorInformationObject(objClass, objType)) {
                 final EnterpriseNumber enterpriseNumber = new EnterpriseNumber(bytesToPass.readUnsignedInt());
-                final Optional<? extends Object> obj = this.registry.parseVendorInformationObject(enterpriseNumber, header, bytesToPass);
+                final Optional<? extends Object> obj = this.registry.parseVendorInformationObject(enterpriseNumber,
+                    header, bytesToPass);
                 if (obj.isPresent()) {
                     objs.add(obj.get());
                 }
@@ -107,22 +108,23 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
         return objs;
     }
 
-    public static Message createErrorMsg(final PCEPErrors e, final Optional<Rp> rp) {
+    public static Message createErrorMsg(final PCEPErrors err, final Optional<Rp> rp) {
         final PcerrMessageBuilder msgBuilder = new PcerrMessageBuilder();
         if (rp.isPresent()) {
-            msgBuilder.setErrorType(new RequestCaseBuilder().setRequest(new RequestBuilder().setRps(Collections.singletonList(new RpsBuilder().setRp(
-                    rp.get()).build())).build()).build());
+            msgBuilder.setErrorType(new RequestCaseBuilder().setRequest(new RequestBuilder().setRps(
+                Collections.singletonList(new RpsBuilder().setRp(rp.get()).build())).build()).build());
         }
         return new PcerrBuilder().setPcerrMessage(
                 msgBuilder.setErrors(Collections.singletonList(new ErrorsBuilder().setErrorObject(
-                    new ErrorObjectBuilder().setType(e.getErrorType()).setValue(
-                        e.getErrorValue()).build()).build())).build()).build();
+                    new ErrorObjectBuilder().setType(err.getErrorType()).setValue(
+                        err.getErrorValue()).build()).build())).build()).build();
     }
 
-    protected abstract Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException;
+    protected abstract Message validate(List<Object> objects, List<Message> errors) throws PCEPDeserializerException;
 
     @Override
-    public final Message parseMessage(final ByteBuf buffer, final List<Message> errors) throws PCEPDeserializerException {
+    public final Message parseMessage(final ByteBuf buffer, final List<Message> errors)
+            throws PCEPDeserializerException {
         requireNonNull(buffer, "Buffer may not be null");
 
         // Parse objects first
@@ -132,7 +134,8 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
         return validate(objs, errors);
     }
 
-    protected final void serializeVendorInformationObjects(final List<VendorInformationObject> viObjects, final ByteBuf buffer) {
+    protected final void serializeVendorInformationObjects(final List<VendorInformationObject> viObjects,
+            final ByteBuf buffer) {
         if (viObjects != null) {
             for (final VendorInformationObject viObject : viObjects) {
                 this.registry.serializeVendorInformationObject(viObject, buffer);
index f6999e16ece31bc8a7c36fc4695708a00400ccdd..22c89d600c2075aafad1fe11c99909117c5af6b9 100644 (file)
@@ -46,7 +46,8 @@ public abstract class AbstractObjectWithTlvsParser<T> extends CommonObjectParser
             final int type = bytes.readUnsignedShort();
             final int length = bytes.readUnsignedShort();
             if (length > bytes.readableBytes()) {
-                throw new PCEPDeserializerException("Wrong length specified. Passed: " + length + "; Expected: <= " + bytes.readableBytes()
+                throw new PCEPDeserializerException("Wrong length specified. Passed: " + length + "; Expected: <= "
+            + bytes.readableBytes()
                     + ".");
             }
             final ByteBuf tlvBytes = bytes.readSlice(length);
@@ -54,14 +55,15 @@ public abstract class AbstractObjectWithTlvsParser<T> extends CommonObjectParser
 
             if (VendorInformationUtil.isVendorInformationTlv(type)) {
                 final EnterpriseNumber enterpriseNumber = new EnterpriseNumber(tlvBytes.readUnsignedInt());
-                final Optional<VendorInformationTlv> viTlv = this.viTlvReg.parseVendorInformationTlv(enterpriseNumber, tlvBytes);
-                if(viTlv.isPresent()) {
+                final Optional<VendorInformationTlv> viTlv = this.viTlvReg.parseVendorInformationTlv(enterpriseNumber,
+                    tlvBytes);
+                if (viTlv.isPresent()) {
                     LOG.trace("Parsed VENDOR-INFORMATION TLV {}.", viTlv.get());
                     viTlvs.add(viTlv.get());
                 }
             } else {
                 final Tlv tlv = this.tlvReg.parseTlv(type, tlvBytes);
-                if(tlv != null) {
+                if (tlv != null) {
                     LOG.trace("Parsed PCEP TLV {}.", tlv);
                     addTlv(builder, tlv);
                 }
@@ -82,7 +84,7 @@ public abstract class AbstractObjectWithTlvsParser<T> extends CommonObjectParser
         // FIXME: No TLVs by default, fallback to augments
     }
 
-    protected abstract void addVendorInformationTlvs(final T builder, final List<VendorInformationTlv> tlvs);
+    protected abstract void addVendorInformationTlvs(T builder, List<VendorInformationTlv> tlvs);
 
     protected final void serializeVendorInformationTlvs(final List<VendorInformationTlv> tlvs, final ByteBuf buffer) {
         if (tlvs != null) {
index fc2ec4c96c4b28c7f373341af6eb3d62af41ee7d..3f653f9bef8533018ed6d7a42d090da5c9cbb9c9 100644 (file)
@@ -14,5 +14,5 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
  * Explicit Route Object Parser.
  */
 public interface EROSubobjectParser {
-    Subobject parseSubobject(final ByteBuf buffer, final boolean loose) throws PCEPDeserializerException;
+    Subobject parseSubobject(ByteBuf buffer, boolean loose) throws PCEPDeserializerException;
 }
index ccd6e4eb8ecabdb2688f9f73fd00ba6438652251..6dd6c2b52b55dbcb3f75af9b5234d0b139101436 100644 (file)
@@ -23,8 +23,7 @@ public interface EROSubobjectRegistry {
      * @return null if the parser for this subobject could not be found
      * @throws PCEPDeserializerException if the parsing did not succeed
      */
-    Subobject parseSubobject(final int subobjectType, final ByteBuf buffer, final boolean loose)
-        throws PCEPDeserializerException;
+    Subobject parseSubobject(int subobjectType, ByteBuf buffer, boolean loose) throws PCEPDeserializerException;
 
     /**
      * Find serializer for given subobject. Delegates parsing to found serializer.
@@ -32,5 +31,5 @@ public interface EROSubobjectRegistry {
      * @param subobject to be parsed
      * @param buffer    buffer where the serialized subobject will be parsed
      */
-    void serializeSubobject(final Subobject subobject, final ByteBuf buffer);
+    void serializeSubobject(Subobject subobject, ByteBuf buffer);
 }
index c0cfb5719d4ef4974a0416e399ff10016a9f9cf2..6c6276d00cdd3470b66ebda86eca41e8fe94e102 100644 (file)
@@ -14,5 +14,5 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
  * Explicit Route Object Serializer.
  */
 public interface EROSubobjectSerializer {
-    void serializeSubobject(final Subobject subobject, final ByteBuf buffer);
+    void serializeSubobject(Subobject subobject, ByteBuf buffer);
 }
index 0ef9ae7f062fa151cc5e094fbea49c8795e10ba1..0596583d6f28e16b6572f6068c3a186a64b5e799 100644 (file)
@@ -16,7 +16,6 @@ public final class EROSubobjectUtil {
     private static final int LOOSE_BIT = 7;
 
     private EROSubobjectUtil() {
-        throw new UnsupportedOperationException();
     }
 
     public static void formatSubobject(final int type, final Boolean loose, final ByteBuf body, final ByteBuf buffer) {
index d570c16eed76be200ad0a2401c4bc77dc7594d39..1bcaa1c77d65472d04cdd8c4b8acabe1b63968cb 100644 (file)
@@ -5,19 +5,18 @@
  * 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.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.EnterpriseSpecificInformation;
 
 public interface EnterpriseSpecificInformationParser {
 
-    void serializeEnterpriseSpecificInformation(final EnterpriseSpecificInformation enterpriseSpecificInformation, final ByteBuf buffer);
+    void serializeEnterpriseSpecificInformation(EnterpriseSpecificInformation enterpriseSpecificInformation,
+            ByteBuf buffer);
 
-    EnterpriseSpecificInformation parseEnterpriseSpecificInformation(final ByteBuf buffer) throws PCEPDeserializerException;
+    EnterpriseSpecificInformation parseEnterpriseSpecificInformation(ByteBuf buffer) throws PCEPDeserializerException;
 
     EnterpriseNumber getEnterpriseNumber();
 }
index 232d5ec2396f05fa636d321b9b5d0ff150bab9cd..381bc9a73ff32c3b606b1ef0f6dce4324c4dcc00 100644 (file)
@@ -8,9 +8,8 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
 
 public interface LabelParser {
-    LabelType parseLabel(final ByteBuf buffer) throws PCEPDeserializerException;
+    LabelType parseLabel(ByteBuf buffer) throws PCEPDeserializerException;
 }
index 0253be6b690ad03e4209e25bb9f5b21ce7026f70..06dd76116f826f1564a87adeb75354d5b856d377 100644 (file)
@@ -8,19 +8,18 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
 
 public interface LabelRegistry {
     /**
      * Finds parser for given label C-type in the registry. Delegates parsing to found parser.
      *
-     * @param cType label type, key in parser registry
+     * @param ctype label type, key in parser registry
      * @param buffer label wrapped in ByteBuf
      * @return null if the parser for this label could not be found
      * @throws PCEPDeserializerException if the parsing did not succeed
      */
-    LabelType parseLabel(final int cType, final ByteBuf buffer) throws PCEPDeserializerException;
+    LabelType parseLabel(int ctype, ByteBuf buffer) throws PCEPDeserializerException;
 
     /**
      * Find serializer for given label. Delegates parsing to found serializer.
@@ -30,5 +29,5 @@ public interface LabelRegistry {
      * @param label to be parsed
      * @param buffer buffer where the serialized label will be parsed
      */
-    void serializeLabel(final boolean unidirectional, final boolean global, final LabelType label, final ByteBuf buffer);
+    void serializeLabel(boolean unidirectional, boolean global, LabelType label, ByteBuf buffer);
 }
index c805616308f35d572fa286e6ef9a0b4aa3ce06be..d481f83397b9b60f8cea439efdf4a2e98cc35f2e 100644 (file)
@@ -8,10 +8,9 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
 
 public interface LabelSerializer {
 
-    void serializeLabel(boolean unidirectional, boolean global, final LabelType subobject, final ByteBuf buffer);
+    void serializeLabel(boolean unidirectional, boolean global, LabelType subobject, ByteBuf buffer);
 }
index 1144a8b22f059f738c71985d4912903d422c5dc2..cd8f7dbcc9f6d91a39b59485ec55f3a5c63790d4 100644 (file)
@@ -18,10 +18,10 @@ public final class LabelUtil {
     private static final int GLOBAL = 7;
 
     private LabelUtil() {
-        throw new UnsupportedOperationException();
     }
 
-    public static void formatLabel(final int type, final Boolean unidirectional, final Boolean global, final ByteBuf body, final ByteBuf buffer) {
+    public static void formatLabel(final int type, final Boolean unidirectional, final Boolean global,
+            final ByteBuf body, final ByteBuf buffer) {
         final BitArray reserved = new BitArray(FLAGS_SIZE);
         reserved.set(UNIDIRECTIONAL, unidirectional);
         reserved.set(GLOBAL, global);
index f4243d79808e819460e88a1c76efed404eb1b5b6..d2e4e7b01a60cdc9df52dd607708f5fe2208edfe 100644 (file)
@@ -8,11 +8,9 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import java.util.List;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
 
 public interface MessageParser {
-    Message parseMessage(final ByteBuf buffer, final List<Message> errors) throws PCEPDeserializerException;
+    Message parseMessage(ByteBuf buffer, List<Message> errors) throws PCEPDeserializerException;
 }
index 9eb8c7038971e2bff774c31b197872a19cee2e5b..2b5ed015bcf9c4dc1c90d24dc07a8d9fed64ad88 100644 (file)
@@ -8,9 +8,7 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import java.util.List;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
 
 public interface MessageRegistry {
@@ -23,7 +21,7 @@ public interface MessageRegistry {
      * @return null if the parser for this message could not be found
      * @throws PCEPDeserializerException if the parsing did not succeed
      */
-    Message parseMessage(final int messageType, final ByteBuf buffer, final List<Message> errors) throws PCEPDeserializerException;
+    Message parseMessage(int messageType, ByteBuf buffer, List<Message> errors) throws PCEPDeserializerException;
 
     /**
      * Find serializer for given message. Delegates parsing to found serializer.
@@ -31,5 +29,5 @@ public interface MessageRegistry {
      * @param message to be parsed
      * @param buffer byte buffer that will be filled with serialized message
      */
-    void serializeMessage(final Message message, final ByteBuf buffer);
+    void serializeMessage(Message message, ByteBuf buffer);
 }
index 8ca36b2fd0b55011f3348a3c46b5e4d9f86110aa..3d194834b23aa7b9852cde48b14eadfae37fe755 100644 (file)
@@ -15,12 +15,11 @@ public final class MessageUtil {
     private static final int VERSION_SF_LENGTH = 3;
 
     private MessageUtil() {
-        throw new UnsupportedOperationException();
     }
 
     public static void formatMessage(final int messageType, final ByteBuf body, final ByteBuf out) {
         final int msgLength = body.writerIndex();
-        out.writeByte(PCEPMessageConstants.PCEP_VERSION << (Byte.SIZE - VERSION_SF_LENGTH));
+        out.writeByte(PCEPMessageConstants.PCEP_VERSION << Byte.SIZE - VERSION_SF_LENGTH);
         out.writeByte(messageType);
         out.writeShort(msgLength + PCEPMessageConstants.COMMON_HEADER_LENGTH);
         Preconditions.checkState(out.writerIndex() == PCEPMessageConstants.COMMON_HEADER_LENGTH);
index 91c86dd4b0950108ec0df21050d78b1d0f44b85d..237d297b3ec2e1482fb68fbebc929f8744b04ca5 100644 (file)
@@ -11,7 +11,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 /**
- * Header parser for PCEP object
+ * Header parser for PCEP object.
  */
 public class ObjectHeaderImpl implements ObjectHeader {
 
@@ -40,12 +40,10 @@ public class ObjectHeaderImpl implements ObjectHeader {
 
     @Override
     public String toString() {
-        final String objectHeader = "ObjectHeader [objClass=" +
-                ", processed=" +
-                this.processed +
-                ", ignored=" +
-                this.ignored +
-                "]";
+        final String objectHeader = "ObjectHeader [objClass="
+                + ", processed=" + this.processed
+                + ", ignored=" + this.ignored
+                + "]";
         return objectHeader;
     }
 
@@ -53,8 +51,8 @@ public class ObjectHeaderImpl implements ObjectHeader {
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((this.ignored == null) ? 0 : this.ignored.hashCode());
-        result = prime * result + ((this.processed == null) ? 0 : this.processed.hashCode());
+        result = prime * result + (this.ignored == null ? 0 : this.ignored.hashCode());
+        result = prime * result + (this.processed == null ? 0 : this.processed.hashCode());
         return result;
     }
 
index 2650758cd90d17601b87ed8ab18ff49255ed4b71..50f8fa2b51bc96fea366c9e1cc4ea76b405ad1aa 100644 (file)
@@ -8,12 +8,11 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
 
 public interface ObjectParser {
-    Object parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException;
+    Object parseObject(ObjectHeader header, ByteBuf buffer) throws PCEPDeserializerException;
 
     int getObjectClass();
 
index 241db9f9bb7221e59dc198c2e2c83534f8e23151..00d49cbe620a3810b4202910fcb772a10d407e96 100644 (file)
@@ -22,14 +22,14 @@ public interface ObjectRegistry extends VendorInformationObjectRegistry {
      * @return null if the parser for this object could not be found
      * @throws PCEPDeserializerException if the parsing did not succeed
      */
-    Object parseObject(final int objectClass, final int objectType, final ObjectHeader header, final ByteBuf buffer)
+    Object parseObject(int objectClass, int objectType, ObjectHeader header, ByteBuf buffer)
             throws PCEPDeserializerException;
 
     /**
      * Find serializer for given object. Delegates parsing to found serializer.
      *
      * @param object to be parsed
-     * @param buffer ByteBuf wrapped aroung bytes representing given object
+     * @param buffer ByteBuf wrapped around bytes representing given object
      */
-    void serializeObject(final Object object, final ByteBuf buffer);
+    void serializeObject(Object object, ByteBuf buffer);
 }
index f99fb4be8bc24846d6f189d4a1ca95f69bf6e980..5f9afb03a8ce7e87da4251945f1668c4acae46e9 100644 (file)
@@ -8,15 +8,14 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
 
 public interface ObjectSerializer {
-
     /**
      * Serializes given object to bytes wrapped in given ByteBuf.
+     *
      * @param object PCEP object to be serialized
      * @param buffer ByteBuf wrapper around serialized object
      */
-    void serializeObject(final Object object, final ByteBuf buffer);
+    void serializeObject(Object object, ByteBuf buffer);
 }
index 33d356fd5ce901734ef848defe4067f4fc19dcbd..096481123d2b500fb449cd2d1fdffd95aec67dd6 100644 (file)
@@ -22,17 +22,16 @@ public final class ObjectUtil {
     private static final int IGNORED = 3;
 
     private ObjectUtil() {
-        throw new UnsupportedOperationException();
     }
 
-    public static void formatSubobject(final int objectType, final int objectClass, final Boolean processingRule, final Boolean ignore,
-        final ByteBuf body, final ByteBuf out) {
+    public static void formatSubobject(final int objectType, final int objectClass, final Boolean processingRule,
+            final Boolean ignore, final ByteBuf body, final ByteBuf out) {
         out.writeByte(objectClass);
         final BitArray flags = new BitArray(FLAGS_SIZE);
         flags.set(IGNORED, ignore);
         flags.set(PROCESSED, processingRule);
         final byte flagB = flags.toByte();
-        final int typeByte = objectType << FLAGS_SIZE | (flagB & 0xff);
+        final int typeByte = objectType << FLAGS_SIZE | flagB & 0xff;
         out.writeByte(typeByte);
         out.writeShort(body.writerIndex() + HEADER_SIZE);
         out.writeBytes(body);
index 9495fbccca435f1b247547c74abd7669934eaeb7..92c92b70191ac27c15dffb75e238f2afdb50ad39 100644 (file)
@@ -14,7 +14,7 @@ public class PCEPDeserializerException extends Exception {
     private static final long serialVersionUID = 1L;
 
     /**
-     * Used when no exact error (from rfc or from draft) is specified.
+     * Used when no exact error (from an RFC or from a draft) is specified.
      *
      * @param err error message describing the error that occurred
      */
@@ -26,9 +26,9 @@ public class PCEPDeserializerException extends Exception {
      * Used when we want to pass also the exception that occurred.
      *
      * @param err error message describing the error that occurred
-     * @param e specific exception that occurred
+     * @param cause specific exception that occurred
      */
-    public PCEPDeserializerException(final String err, final Throwable e) {
-        super(err, e);
+    public PCEPDeserializerException(final String err, final Throwable cause) {
+        super(err, cause);
     }
 }
index df8152eb732635bd49208ff501f90a6d3a034ae6..e17a12fa3f5b8adb3bb6decc58dab41708258d04 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.spi;
 import java.io.Serializable;
 
 /**
- * Caret for combination of Error-type and Error-value
+ * Caret for combination of Error-type and Error-value.
  */
 final class PCEPErrorIdentifier implements Serializable {
     private static final long serialVersionUID = 2434590156751699872L;
index 76e7db95469bed367ae45b3e21e011a7a8493b81..cafcce23bf109dbd02ca47dafe4ab32a97b848c0 100644 (file)
@@ -13,10 +13,10 @@ import java.util.Map;
 /**
  * Possible errors listed in RFC5440, RFC 5455 and stateful draft.
  *
- * @see <a href="http://tools.ietf.org/html/rfc5440#section-9.12">PCEP-ERROR Object(RFC5440)</a>, <a href=
- *      "http://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-8.4" >PCEP-ERROR Object(stateful draft)</a>,
- *      <a href="http://tools.ietf.org/html/rfc5455#section-3.6">Error Codes for CLASSTYPE Object(RFC5455)</a>, <a href=
- *      "http://www.ietf.org/id/draft-crabbe-pce-pce-initiated-lsp-00.txt#section-7.1" >PCEP-Error Object</a>
+ * @see <a href="http://tools.ietf.org/html/rfc5440#section-9.12">PCEP-ERROR Object(RFC5440)</a>
+ * @see <a href="http://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-8.4" >PCEP-ERROR Object</a>
+ * @see <a href="http://tools.ietf.org/html/rfc5455#section-3.6">Error Codes for CLASSTYPE Object(RFC5455)</a>
+ * @see <a href="http://www.ietf.org/id/draft-crabbe-pce-pce-initiated-lsp-00.txt#section-7.1" >PCEP-Error Object</a>
  */
 public enum PCEPErrors {
 
@@ -81,23 +81,23 @@ public enum PCEPErrors {
      */
     O_BIT_SET(5, 2),
     /**
-     * Objective function not allowed (request rejected)
+     * Objective function not allowed (request rejected).
      */
     OF_NOT_ALLOWED(5, 3),
     /**
-     * OF bit of the RP object set (request rejected)
+     * OF bit of the RP object set (request rejected).
      */
     OF_BIT_SET(5, 4),
     /**
-     * Global concurrent optimization not allowed (GCO extension)
+     * Global concurrent optimization not allowed (GCO extension).
      */
     GCO_NOT_ALLOWED(5, 5),
     /**
-     * P2MP Path computation is not allowed
+     * P2MP Path computation is not allowed.
      */
     P2MP_COMPUTATION_NOT_ALLOWED(5, 7),
     /**
-     * RP object missing
+     * RP object missing.
      */
     RP_MISSING(6, 1),
     /**
@@ -105,15 +105,15 @@ public enum PCEPErrors {
      */
     RRO_MISSING(6, 2),
     /**
-     * END-POINTS object missing
+     * END-POINTS object missing.
      */
     END_POINTS_MISSING(6, 3),
     /**
-     * LSP cleanup TLV missing
+     * LSP cleanup TLV missing.
      */
     LSP_CLEANUP_TLV_MISSING(6, 13),
     /**
-     * SYMBOLIC-PATH-NAME TLV missing
+     * SYMBOLIC-PATH-NAME TLV missing.
      */
     SYMBOLIC_PATH_NAME_MISSING(6, 14),
     /**
@@ -121,7 +121,7 @@ public enum PCEPErrors {
      */
     SYNC_PATH_COMP_REQ_MISSING(7, 0),
     /**
-     * Unknown request reference
+     * Unknown request reference.
      */
     UNKNOWN_REQ_REF(8, 0),
     /**
@@ -149,11 +149,11 @@ public enum PCEPErrors {
      */
     P_FLAG_NOT_SET(10, 1),
     /**
-     * Insufficient memory (GCO extension)
+     * Insufficient memory (GCO extension).
      */
     INSUFFICIENT_MEMORY(15, 1),
     /**
-     * Global concurrent optimization not supported (GCO extension)
+     * Global concurrent optimization not supported (GCO extension).
      */
     GCO_NOT_SUPPORTED(15, 2),
     /**
@@ -170,31 +170,31 @@ public enum PCEPErrors {
     CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS(12, 3),
 
     /**
-     * The PCE cannot satisfy the request due to insufficient memory
+     * The PCE cannot satisfy the request due to insufficient memory.
      */
     CANNOT_SATISFY_P2MP_REQUEST_DUE_TO_INSUFFISIENT_MEMMORY(16, 1),
     /**
-     * The PCE is not capable of P2MP computation
+     * The PCE is not capable of P2MP computation.
      */
     NOT_CAPPABLE_P2MP_COMPUTATION(16, 2),
     /**
-     * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 2
+     * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 2.
      */
     P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT2(17, 1),
     /**
-     * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 3
+     * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 3.
      */
     P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT3(17, 2),
     /**
-     * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 4
+     * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 4.
      */
     P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT4(17, 3),
     /**
-     * The PCE is not capable to satisfy the request due to inconsistent END-POINTS
+     * The PCE is not capable to satisfy the request due to inconsistent END-POINTS.
      */
     P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_INCONSISTENT_EP(17, 4),
     /**
-     * P2MP Fragmented request failure
+     * P2MP Fragmented request failure.
      */
     P2MP_FRAGMENTATION_FAILRUE(18, 1),
     /**
@@ -216,15 +216,15 @@ public enum PCEPErrors {
      */
     RESOURCE_LIMIT_EXCEEDED(19, 4),
     /**
-     * PCE-initiated LSP limit reached
+     * PCE-initiated LSP limit reached.
      */
     LSP_LIMIT_EXCEEDED(19, 6),
     /**
-     * Delegation for PCE-initiated LSP cannot be revoked
+     * Delegation for PCE-initiated LSP cannot be revoked.
      */
     DELEGATION_NON_REVOKABLE(19, 7),
     /**
-     * Non-zero PLSP-ID in LSP initiation request
+     * Non-zero PLSP-ID in LSP initiation request.
      */
     NON_ZERO_PLSPID(19, 8),
     /**
@@ -241,39 +241,39 @@ public enum PCEPErrors {
      */
     DB_VERSION_TLV_MISSING_WHEN_SYNC_ALLOWED(20, 3),
     /**
-     * A PCC indicates to a PCE that it can not complete the state synchronization,
+     * A PCC indicates to a PCE that it can not complete the state synchronization.
      */
     CANNOT_COMPLETE_STATE_SYNC(20, 5),
     /**
-     * SYMBOLIC-PATH-NAME in use
+     * SYMBOLIC-PATH-NAME in use.
      */
     USED_SYMBOLIC_PATH_NAME(23, 1),
     /**
-     * LSP instantiation error: Unacceptable instantiation parameters
+     * LSP instantiation error: Unacceptable instantiation parameters.
      */
     LSP_UNACC_INST_PARAMS(24, 1),
     /**
-     * LSP instantiation error: Internal error
+     * LSP instantiation error: Internal error.
      */
     LSP_INTERNAL_ERROR(24, 2),
     /**
-     * LSP instantiation error: RSVP signaling error
+     * LSP instantiation error: RSVP signaling error.
      */
     LSP_RSVP_ERROR(24, 3),
     /**
-     * Segment Routing error: ERO subobject with invalid SID value
+     * Segment Routing error: ERO subobject with invalid SID value.
      */
     BAD_LABEL_VALUE(10, 2),
     /**
-     * Segment Routing error: Unsupported number of Segment ERO subobjects
+     * Segment Routing error: Unsupported number of Segment ERO subobjects.
      */
     UNSUPPORTED_NUMBER_OF_SR_ERO_SUBOBJECTS(10, 3),
     /**
-     * Segment Routing error: Bad label format
+     * Segment Routing error: Bad label format.
      */
     BAD_LABEL_FORMAT(10, 4),
     /**
-     * Segment Routing error: Non-identical ERO subobjects
+     * Segment Routing error: Non-identical ERO subobjects.
      */
     NON_IDENTICAL_ERO_SUBOBJECTS(10, 5),
     /**
@@ -289,62 +289,60 @@ public enum PCEPErrors {
      */
     SID_NON_IDENTICAL_RRO_SUBOBJECTS(10, 8),
     /**
-     * Invalid traffic engineering path setup type: Unsupported path setup type
+     * Invalid traffic engineering path setup type: Unsupported path setup type.
      */
     UNSUPPORTED_PST(21, 1),
     /**
-     * Invalid traffic engineering path setup type: Mismatched path setup type
+     * Invalid traffic engineering path setup type: Mismatched path setup type.
      */
     MISMATCHED_PST(21, 2),
     /**
-     * MONITORING object missing
+     * MONITORING object missing.
      */
     MONITORING_OBJECT_MISSING(6, 4),
     /**
-     * Reception of StartTLS after any PCEP exchange
-     * TODO: error code to be assigned by IANA
+     * Reception of StartTLS after any PCEP exchange.
      */
+    // FIXME: error code to be assigned by IANA
     STARTTLS_RCVD_INCORRECTLY(30, 1),
     /**
-     * Reception of non-StartTLS or non-PCErr message
-     * TODO: error code to be assigned by IANA
+     * Reception of non-StartTLS or non-PCErr message.
      */
+    // FIXME: error code to be assigned by IANA
     NON_STARTTLS_MSG_RCVD(30, 2),
     /**
-     * Failure, connection without TLS not possible
-     * TODO: error code to be assigned by IANA
+     * Failure, connection without TLS not possible.
      */
+    // FIXME: error code to be assigned by IANA
     NOT_POSSIBLE_WITHOUT_TLS(30, 3),
     /**
-     * Failure, connection without TLS possible
-     * TODO: error code to be assigned by IANA
+     * Failure, connection without TLS possible.
      */
+    // FIXME: error code to be assigned by IANA
     POSSIBLE_WITHOUT_TLS(30, 4),
     /**
-     * No StartTLS message before StartTLSWait timer expired
-     * TODO: error code to be assigned by IANA
+     * No StartTLS message before StartTLSWait timer expired.
      */
+    // FIXME: error code to be assigned by IANA
     STARTTLS_TIMER_EXP(30, 5),
     /**
-     * LSP is not PCE-initiated
+     * LSP is not PCE-initiated.
      */
     LSP_NOT_PCE_INITIATED(19, 9),
     /**
-     * LSP-DB-VERSION TLV missing
+     * LSP-DB-VERSION TLV missing.
      */
     LSP_DB_VERSION_MISSING(6, 12),
     /**
-     * Attempt to trigger a synchronization when the
-     * PCE triggered synchronization capability has not been advertised.
+     * Attempt to trigger a synchronization when the PCE triggered synchronization capability has not been advertised.
      */
     UNEXPECTED_SYNCHRONIZATION_ATTEMPT(20, 4),
     /**
-     * No sufficient LSP change information for
-     * incremental LSP state synchronization.
+     * No sufficient LSP change information for incremental LSP state synchronization.
      */
     NO_SUFFICIENT_LSP_CHANGE(20, 6),
     /**
-     * Received an invalid LSP DB Version Number
+     * Received an invalid LSP DB Version Number.
      */
     INVALID_LSP_DB_VERSION(20, 7);
 
index 919513479d6718c59575c2a9373948070ce884ae..d39977a18db4fd8c2c5df549766d30f5d46b4927 100644 (file)
@@ -18,11 +18,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 public interface PCEPExtensionProviderContext extends PCEPExtensionConsumerContext {
     AutoCloseable registerLabelSerializer(Class<? extends LabelType> labelClass, LabelSerializer serializer);
 
-    AutoCloseable registerLabelParser(int cType, LabelParser parser);
+    AutoCloseable registerLabelParser(int ctype, LabelParser parser);
 
     AutoCloseable registerEROSubobjectParser(int subobjectType, EROSubobjectParser parser);
 
-    AutoCloseable registerEROSubobjectSerializer(Class<? extends SubobjectType> subobjectClass, EROSubobjectSerializer serializer);
+    AutoCloseable registerEROSubobjectSerializer(Class<? extends SubobjectType> subobjectClass,
+            EROSubobjectSerializer serializer);
 
     AutoCloseable registerMessageParser(int messageType, MessageParser parser);
 
@@ -37,23 +38,26 @@ public interface PCEPExtensionProviderContext extends PCEPExtensionConsumerConte
 
     AutoCloseable registerRROSubobjectParser(int subobjectType, RROSubobjectParser parser);
 
-    AutoCloseable registerRROSubobjectSerializer(
-            Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass,
+    AutoCloseable registerRROSubobjectSerializer(Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params
+            .xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass,
             RROSubobjectSerializer serializer);
 
     AutoCloseable registerTlvSerializer(Class<? extends Tlv> tlvClass, TlvSerializer serializer);
 
     AutoCloseable registerTlvParser(int tlvType, TlvParser parser);
 
-    AutoCloseable registerVendorInformationTlvSerializer(Class<? extends EnterpriseSpecificInformation> esInformationClass, TlvSerializer serializer);
+    AutoCloseable registerVendorInformationTlvSerializer(
+            Class<? extends EnterpriseSpecificInformation> esInformationClass, TlvSerializer serializer);
 
     AutoCloseable registerVendorInformationTlvParser(EnterpriseNumber enterpriseNumber, TlvParser parser);
 
-    AutoCloseable registerXROSubobjectSerializer(Class<? extends SubobjectType> subobjectClass, XROSubobjectSerializer serializer);
+    AutoCloseable registerXROSubobjectSerializer(Class<? extends SubobjectType> subobjectClass,
+            XROSubobjectSerializer serializer);
 
     AutoCloseable registerXROSubobjectParser(int subobjectType, XROSubobjectParser parser);
 
-    AutoCloseable registerVendorInformationObjectSerializer(Class<? extends EnterpriseSpecificInformation> esInformationClass, ObjectSerializer serializer);
+    AutoCloseable registerVendorInformationObjectSerializer(
+            Class<? extends EnterpriseSpecificInformation> esInformationClass, ObjectSerializer serializer);
 
     AutoCloseable registerVendorInformationObjectParser(EnterpriseNumber enterpriseNumber, ObjectParser parser);
 }
index cbc7acaeb2201c03327873d5ab8c5b71170b9a6e..d01c92d0d7566c7458fa67dca16004e3ad044dca 100644 (file)
@@ -7,9 +7,6 @@
  */
 package org.opendaylight.protocol.pcep.spi;
 
-/**
- *
- */
 public final class PCEPMessageConstants {
     /**
      * Length of the common message header, in bytes.
@@ -22,6 +19,5 @@ public final class PCEPMessageConstants {
     public static final int PCEP_VERSION = 1;
 
     private PCEPMessageConstants() {
-        throw new UnsupportedOperationException();
     }
 }
index f1f6b442b716078d0e8c74d03e2c3d2f4a293423..8ffa4311c77b16733ec3d3ea3db191c4030f9039 100644 (file)
@@ -5,20 +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.pcep.spi;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType;
 
 public final class PSTUtil {
     private PSTUtil() {
-        throw new UnsupportedOperationException();
     }
 
     /**
-     *  Check whether Path is setup via RSVP-TE signaling protocol
-     * @param pst
-     * @return  true if setup is via RSVP-TE signaling protocol
+     * Check whether Path is setup via RSVP-TE signaling protocol.
+     *
+     * @param pst Path setup type
+     * @return true if setup is via RSVP-TE signaling protocol
      */
     public static boolean isDefaultPST(final PathSetupType pst) {
         if (pst != null && pst.getPst() != null && pst.getPst() != 0) {
index 477ffc040c137a72ad6d58f9963de39ccb5448d6..09c8f478840163bdb8c578cad69730cbb880a08b 100644 (file)
@@ -22,7 +22,7 @@ public interface RROSubobjectRegistry {
      * @return null if the parser for this subobject could not be found otherwise returns parser
      * @throws PCEPDeserializerException if the parsing did not succeed
      */
-    Subobject parseSubobject(final int type, final ByteBuf buffer) throws PCEPDeserializerException;
+    Subobject parseSubobject(int type, ByteBuf buffer) throws PCEPDeserializerException;
 
     /**
      * Find serializer for given subobject. Delegates parsing to found serializer.
@@ -30,5 +30,5 @@ public interface RROSubobjectRegistry {
      * @param subobject to be parsed
      * @param buffer buffer where the serialized subobject will be parsed
      */
-    void serializeSubobject(final Subobject subobject, final ByteBuf buffer);
+    void serializeSubobject(Subobject subobject, ByteBuf buffer);
 }
index e9d864e44ac1edb34d8edbbba79f28f8eb2fcefa..9e3521e3cbf5f001c81951c5557a737f57b15e3e 100644 (file)
@@ -8,12 +8,11 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.Subobject;
 
 /**
  * Reported Route Object Serializer.
  */
 public interface RROSubobjectSerializer {
-    void serializeSubobject(final Subobject subobject, final ByteBuf buffer);
+    void serializeSubobject(Subobject subobject, ByteBuf buffer);
 }
index f7602325f212c2880f4d194f342781e6c07be585..311e8ab360da95f59d5442e63d05777629f08ed3 100644 (file)
@@ -14,7 +14,6 @@ public final class RROSubobjectUtil {
     private static final int HEADER_SIZE = 2;
 
     private RROSubobjectUtil() {
-        throw new UnsupportedOperationException();
     }
 
     public static void formatSubobject(final int type, final ByteBuf body, final ByteBuf buffer) {
index 0f4c9a751f4c585a461501f9d67d620c89678a6a..0485b3ee5ea009c299ba0a617cf628caad93ca0b 100644 (file)
@@ -8,9 +8,8 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
 
 public interface TlvParser {
-    Tlv parseTlv(final ByteBuf buffer) throws PCEPDeserializerException;
+    Tlv parseTlv(ByteBuf buffer) throws PCEPDeserializerException;
 }
index aaf071202205ccf6da10ce8a5979de9f0a48ab5d..47e341735a5c1106dc515100742158cdb03743b6 100644 (file)
@@ -8,11 +8,10 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
 
 public interface TlvRegistry {
-    Tlv parseTlv(final int type, final ByteBuf buffer) throws PCEPDeserializerException;
+    Tlv parseTlv(int type, ByteBuf buffer) throws PCEPDeserializerException;
 
-    void serializeTlv(final Tlv tlv, final ByteBuf buffer);
+    void serializeTlv(Tlv tlv, ByteBuf buffer);
 }
index e08dd8521faba43814205d7aefb21db2a5a680b5..d3e10957a4adacb9c01495e2fd12bd65cdf70773 100644 (file)
@@ -8,10 +8,9 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
 
 public interface TlvSerializer {
 
-    void serializeTlv(final Tlv tlv, final ByteBuf buffer);
+    void serializeTlv(Tlv tlv, ByteBuf buffer);
 }
index 2d15c8320ec6e5d5fd21e50e135460f5d9034f28..ea286ffadc15c738b47d38445f65a0bc0bf3c8c7 100644 (file)
@@ -16,7 +16,6 @@ public final class TlvUtil {
     public static final int PADDED_TO = 4;
 
     private TlvUtil() {
-        throw new UnsupportedOperationException();
     }
 
     public static void formatTlv(final int type,final ByteBuf body, final ByteBuf out) {
@@ -27,6 +26,6 @@ public final class TlvUtil {
     }
 
     public static int getPadding(final int length, final int padding) {
-        return (padding - (length % padding)) % padding;
+        return (padding - length % padding) % padding;
     }
 }
index 39d9a8e939a82436b8f154df5fd4a5b69b94cf95..5380d206dcdb705a45240844b35772174795375b 100644 (file)
@@ -24,14 +24,14 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
 public final class UnknownObject implements Object {
     private final Object invalidObject;
     private final Errors error;
-    private final PCEPErrors e;
+    private final PCEPErrors err;
 
     public UnknownObject(final PCEPErrors error) {
         this(error, null);
     }
 
     public UnknownObject(final PCEPErrors error, final Object invalidObject) {
-        this.e = requireNonNull(error);
+        this.err = requireNonNull(error);
 
         this.error = new ErrorsBuilder().setErrorObject(
                 new ErrorObjectBuilder().setType(error.getErrorType()).setValue(
@@ -44,7 +44,7 @@ public final class UnknownObject implements Object {
     }
 
     public PCEPErrors getError() {
-        return this.e;
+        return this.err;
     }
 
     public Object getInvalidObject() {
@@ -58,11 +58,11 @@ public final class UnknownObject implements Object {
 
     @Override
     public Boolean isIgnore() {
-        return false;
+        return Boolean.FALSE;
     }
 
     @Override
     public Boolean isProcessingRule() {
-        return false;
+        return Boolean.FALSE;
     }
-}
\ No newline at end of file
+}
index 98daacea30e9e9998ecdb6bcb84e81d6be7830a6..672a314cd80dfa5b4ba6a6f17bebac3edd7d17fd 100644 (file)
@@ -5,11 +5,9 @@
  * 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.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import java.util.Optional;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
@@ -18,8 +16,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 
 public interface VendorInformationObjectRegistry {
 
-    Optional<? extends Object> parseVendorInformationObject(final EnterpriseNumber enterpriseNumber, final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException;
-
-    void serializeVendorInformationObject(final VendorInformationObject viObject, final ByteBuf buffer);
+    Optional<? extends Object> parseVendorInformationObject(EnterpriseNumber enterpriseNumber, ObjectHeader header,
+            ByteBuf buffer) throws PCEPDeserializerException;
 
+    void serializeVendorInformationObject(VendorInformationObject viObject, ByteBuf buffer);
 }
index d7d01d773953b00143f4a55b405ad50454ed9156..259e0b6c36f011dd61fb6b4ccf2cb3e0006795ed 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.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import java.util.Optional;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.tlvs.VendorInformationTlv;
 
 public interface VendorInformationTlvRegistry {
+    Optional<VendorInformationTlv> parseVendorInformationTlv(EnterpriseNumber enterpriseNumber, ByteBuf buffer)
+            throws PCEPDeserializerException;
 
-    Optional<VendorInformationTlv> parseVendorInformationTlv(final EnterpriseNumber enterpriseNumber, final ByteBuf buffer) throws PCEPDeserializerException;
-
-    void serializeVendorInformationTlv(final VendorInformationTlv viTlv, final ByteBuf buffer);
-
+    void serializeVendorInformationTlv(VendorInformationTlv viTlv, ByteBuf buffer);
 }
index ea880449cafe0e137640a06fc5ecfae1c59c8eeb..94853134f473dab5b6feaf5a80aa5dea37e79ec5 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.pcep.spi;
 
 public final class VendorInformationUtil {
@@ -17,7 +16,6 @@ public final class VendorInformationUtil {
     public static final int VENDOR_INFORMATION_OBJECT_TYPE = 1;
 
     private VendorInformationUtil() {
-        throw new UnsupportedOperationException();
     }
 
     public static boolean isVendorInformationTlv(final int type) {
index 72a8956b226ecf985dd980c8a3dbe44e7d04d0c8..acd3ac016b01b26d8f894620b2a1345141055ee0 100644 (file)
@@ -8,9 +8,8 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject;
 
 public interface XROSubobjectParser {
-    Subobject parseSubobject(final ByteBuf buffer, boolean mandatory) throws PCEPDeserializerException;
+    Subobject parseSubobject(ByteBuf buffer, boolean mandatory) throws PCEPDeserializerException;
 }
index e163d081a4d1359a889311d22ece4510bfc57a75..98b7cfa34266f0e910c14b81df0c6261829ec3ad 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject;
 
 public interface XROSubobjectRegistry {
@@ -21,7 +20,7 @@ public interface XROSubobjectRegistry {
      * @return null if the parser for this subobject could not be found
      * @throws PCEPDeserializerException if the parsing did not succeed
      */
-    Subobject parseSubobject(final int type, final ByteBuf buffer, final boolean mandatory) throws PCEPDeserializerException;
+    Subobject parseSubobject(int type, ByteBuf buffer, boolean mandatory) throws PCEPDeserializerException;
 
     /**
      * Find serializer for given subobject. Delegates parsing to found serializer.
@@ -29,5 +28,5 @@ public interface XROSubobjectRegistry {
      * @param subobject to be parsed
      * @param buffer buffer where the serialized subobject will be parsed
      */
-    void serializeSubobject(final Subobject subobject, final ByteBuf buffer);
+    void serializeSubobject(Subobject subobject, ByteBuf buffer);
 }
index 4187335180c4d40139e02d9bda4460491993f08d..8ba32b8e3eecc5fd333d6143a140e9c6c93972cb 100644 (file)
@@ -8,10 +8,9 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject;
 
 public interface XROSubobjectSerializer {
 
-    void serializeSubobject(final Subobject subobject, final ByteBuf buffer);
+    void serializeSubobject(Subobject subobject, ByteBuf buffer);
 }
index be5db483ddb7d20f1cffcd1458c6f69cf1a987da..87dd84cbe91532baff35af2f2d13ff18241ed687 100644 (file)
@@ -16,10 +16,10 @@ public final class XROSubobjectUtil {
     private static final int MANDATORY_BIT = 7;
 
     private XROSubobjectUtil() {
-        throw new UnsupportedOperationException();
     }
 
-    public static void formatSubobject(final int type, final Boolean mandatory, final ByteBuf body, final ByteBuf buffer) {
+    public static void formatSubobject(final int type, final Boolean mandatory, final ByteBuf body,
+            final ByteBuf buffer) {
         if (mandatory == null) {
             buffer.writeByte(type);
         } else {
index 5991ec68919a2a976a37bea5ae40c87a285aea5f..8876fa4c1dc40ca70ecff43b5b3145dace22ecb7 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.protocol.pcep.spi.pojo;
 
+import static com.google.common.base.Preconditions.checkState;
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.base.Preconditions;
 import java.util.List;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
@@ -28,12 +28,13 @@ public abstract class AbstractPCEPExtensionProviderActivator implements AutoClos
 
     @Override
     public final synchronized void start(final PCEPExtensionProviderContext context) {
-        Preconditions.checkState(this.registrations == null);
+        checkState(this.registrations == null);
 
         this.registrations = requireNonNull(startImpl(context));
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public final synchronized void stop() {
         if (this.registrations == null) {
             return;
index aa696fcd7ff0efcfdb8b06c7bd436749bc1c47cd..0fbdc34ac7eadb364c72882fc3fcebe3746984eb 100644 (file)
@@ -13,18 +13,10 @@ import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
 
 public final class ServiceLoaderPCEPExtensionProviderContext extends SimplePCEPExtensionProviderContext {
     private static final class Holder {
-        private static final PCEPExtensionProviderContext INSTANCE;
+        private static final PCEPExtensionProviderContext INSTANCE = create();
 
         private Holder() {
         }
-
-        static {
-            try {
-                INSTANCE = create();
-            } catch (final Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
     }
 
     private ServiceLoaderPCEPExtensionProviderContext() {
@@ -34,7 +26,8 @@ public final class ServiceLoaderPCEPExtensionProviderContext extends SimplePCEPE
     public static PCEPExtensionProviderContext create() {
         final PCEPExtensionProviderContext ctx = new SimplePCEPExtensionProviderContext();
 
-        final ServiceLoader<PCEPExtensionProviderActivator> loader = ServiceLoader.load(PCEPExtensionProviderActivator.class);
+        final ServiceLoader<PCEPExtensionProviderActivator> loader =
+                ServiceLoader.load(PCEPExtensionProviderActivator.class);
         for (final PCEPExtensionProviderActivator a : loader) {
             a.start(ctx);
         }
index 1d8fe9d52b552d3966e17c0d9be27fa22ed28638..0b4a15b8eda8cd681ab0afab5975c6fcf095fd2a 100644 (file)
@@ -8,9 +8,7 @@
 package org.opendaylight.protocol.pcep.spi.pojo;
 
 import com.google.common.base.Preconditions;
-
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.protocol.concepts.HandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
@@ -22,7 +20,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public final class SimpleEROSubobjectRegistry implements EROSubobjectRegistry {
-    private final HandlerRegistry<DataContainer, EROSubobjectParser, EROSubobjectSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, EROSubobjectParser, EROSubobjectSerializer> handlers =
+            new HandlerRegistry<>();
 
     public AutoCloseable registerSubobjectParser(final int subobjectType, final EROSubobjectParser parser) {
         Preconditions.checkArgument(subobjectType >= 0 && subobjectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
@@ -35,7 +34,8 @@ public final class SimpleEROSubobjectRegistry implements EROSubobjectRegistry {
     }
 
     @Override
-    public Subobject parseSubobject(final int type, final ByteBuf buffer, final boolean loose) throws PCEPDeserializerException {
+    public Subobject parseSubobject(final int type, final ByteBuf buffer, final boolean loose)
+            throws PCEPDeserializerException {
         Preconditions.checkArgument(type >= 0 && type <= Values.UNSIGNED_SHORT_MAX_VALUE);
         final EROSubobjectParser parser = this.handlers.getParser(type);
         if (parser == null) {
@@ -46,7 +46,8 @@ public final class SimpleEROSubobjectRegistry implements EROSubobjectRegistry {
 
     @Override
     public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
-        final EROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType().getImplementedInterface());
+        final EROSubobjectSerializer serializer = this.handlers.getSerializer(
+            subobject.getSubobjectType().getImplementedInterface());
         if (serializer == null) {
             return;
         }
index 0d75b08f630e29ed0f9a7c0eea6c90cec9d871b7..6962efa508fff1f7cbe5789c6196da4b120171ed 100644 (file)
@@ -7,10 +7,9 @@
  */
 package org.opendaylight.protocol.pcep.spi.pojo;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.protocol.concepts.HandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.LabelParser;
 import org.opendaylight.protocol.pcep.spi.LabelRegistry;
@@ -23,19 +22,20 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
 public class SimpleLabelRegistry implements LabelRegistry {
     private final HandlerRegistry<DataContainer, LabelParser, LabelSerializer> handlers = new HandlerRegistry<>();
 
-    public AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
-        Preconditions.checkArgument(cType >= 0 && cType <= Values.UNSIGNED_BYTE_MAX_VALUE);
-        return this.handlers.registerParser(cType, parser);
+    public AutoCloseable registerLabelParser(final int ctype, final LabelParser parser) {
+        checkArgument(ctype >= 0 && ctype <= Values.UNSIGNED_BYTE_MAX_VALUE);
+        return this.handlers.registerParser(ctype, parser);
     }
 
-    public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass, final LabelSerializer serializer) {
+    public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass,
+            final LabelSerializer serializer) {
         return this.handlers.registerSerializer(labelClass, serializer);
     }
 
     @Override
-    public LabelType parseLabel(final int cType, final ByteBuf buffer) throws PCEPDeserializerException {
-        Preconditions.checkArgument(cType >= 0 && cType <= Values.UNSIGNED_BYTE_MAX_VALUE);
-        final LabelParser parser = this.handlers.getParser(cType);
+    public LabelType parseLabel(final int ctype, final ByteBuf buffer) throws PCEPDeserializerException {
+        checkArgument(ctype >= 0 && ctype <= Values.UNSIGNED_BYTE_MAX_VALUE);
+        final LabelParser parser = this.handlers.getParser(ctype);
         if (parser == null) {
             return null;
         }
@@ -43,7 +43,8 @@ public class SimpleLabelRegistry implements LabelRegistry {
     }
 
     @Override
-    public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType label, final ByteBuf buffer) {
+    public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType label,
+            final ByteBuf buffer) {
         final LabelSerializer serializer = this.handlers.getSerializer(label.getImplementedInterface());
         if (serializer != null) {
             serializer.serializeLabel(unidirectional, global, label, buffer);
index b4e33f0d5672d8b89a1140bd4f385b857c269a07..7bdf5ecf0b14d4580fac0af8c17cb35ce1e9e099 100644 (file)
@@ -8,11 +8,8 @@
 package org.opendaylight.protocol.pcep.spi.pojo;
 
 import com.google.common.base.Preconditions;
-
 import io.netty.buffer.ByteBuf;
-
 import java.util.List;
-
 import org.opendaylight.protocol.concepts.HandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.MessageParser;
 import org.opendaylight.protocol.pcep.spi.MessageRegistry;
@@ -35,12 +32,14 @@ public final class SimpleMessageRegistry implements MessageRegistry {
         return this.handlers.registerParser(messageType, parser);
     }
 
-    public AutoCloseable registerMessageSerializer(final Class<? extends Message> msgClass, final MessageSerializer serializer) {
+    public AutoCloseable registerMessageSerializer(final Class<? extends Message> msgClass,
+            final MessageSerializer serializer) {
         return this.handlers.registerSerializer(msgClass, serializer);
     }
 
     @Override
-    public Message parseMessage(final int messageType, final ByteBuf buffer, final List<Message> errors) throws PCEPDeserializerException {
+    public Message parseMessage(final int messageType, final ByteBuf buffer, final List<Message> errors)
+            throws PCEPDeserializerException {
         Preconditions.checkArgument(messageType >= 0 && messageType <= Values.UNSIGNED_BYTE_MAX_VALUE);
         final MessageParser parser = this.handlers.getParser(messageType);
         if (parser == null) {
@@ -51,7 +50,7 @@ public final class SimpleMessageRegistry implements MessageRegistry {
     }
 
     @Override
-    public void serializeMessage(Message message, ByteBuf buffer) {
+    public void serializeMessage(final Message message, final ByteBuf buffer) {
         final MessageSerializer serializer = this.handlers.getSerializer(message.getImplementedInterface());
         if (serializer == null) {
             LOG.warn("PCEP serializer for message type {} is not registered.", message.getClass());
index a8cfc2d3d5ea31d2000575e62279e1bcf9576a68..2f0d7bff9e2929c217f4b254a938dcb8db5477e5 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.pcep.spi.pojo;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import java.util.Optional;
@@ -29,35 +31,36 @@ public final class SimpleObjectRegistry implements ObjectRegistry {
     private final HandlerRegistry<DataContainer, ObjectParser, ObjectSerializer> handlers = new HandlerRegistry<>();
 
     private static final int MAX_OBJECT_TYPE = 15;
-    private static final int MAX_OBJECT_CLASS = 4;   
+    private static final int MAX_OBJECT_CLASS = 4;
+
     private final VendorInformationObjectRegistry viRegistry;
 
     public SimpleObjectRegistry(final VendorInformationObjectRegistry viRegistry) {
         this.viRegistry = viRegistry;
-
     }
 
     private static int createKey(final int objectClass, final int objectType) {
         Preconditions.checkArgument(objectClass >= 0 && objectClass <= Values.UNSIGNED_BYTE_MAX_VALUE);
         Preconditions.checkArgument(objectType >= 0 && objectType <= MAX_OBJECT_TYPE);
-        return (objectClass << MAX_OBJECT_CLASS) | objectType;
+        return objectClass << MAX_OBJECT_CLASS | objectType;
     }
 
     public AutoCloseable registerObjectParser(final int objectClass, final int objectType, final ObjectParser parser) {
-        Preconditions.checkArgument(objectClass >= 0 && objectClass <= Values.UNSIGNED_BYTE_MAX_VALUE, "Illegal object class %s",
+        checkArgument(objectClass >= 0 && objectClass <= Values.UNSIGNED_BYTE_MAX_VALUE, "Illegal object class %s",
                 objectClass);
-        Preconditions.checkArgument(objectType >= 0 && objectType <= MAX_OBJECT_TYPE, "Illegal object type %s", objectType);
+        checkArgument(objectType >= 0 && objectType <= MAX_OBJECT_TYPE, "Illegal object type %s", objectType);
         return this.handlers.registerParser(createKey(objectClass, objectType), parser);
     }
 
-    public AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass, final ObjectSerializer serializer) {
+    public AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass,
+            final ObjectSerializer serializer) {
         return this.handlers.registerSerializer(objClass, serializer);
     }
 
     @Override
-    public Object parseObject(final int objectClass, final int objectType, final ObjectHeader header, final ByteBuf buffer)
-            throws PCEPDeserializerException {
-        Preconditions.checkArgument(objectType >= 0 && objectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
+    public Object parseObject(final int objectClass, final int objectType, final ObjectHeader header,
+            final ByteBuf buffer) throws PCEPDeserializerException {
+        checkArgument(objectType >= 0 && objectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
         final ObjectParser parser = this.handlers.getParser(createKey(objectClass, objectType));
 
         if (parser == null) {
@@ -82,7 +85,8 @@ public final class SimpleObjectRegistry implements ObjectRegistry {
             return;
         }
         serializer.serializeObject(object, buffer);
-    }   
+    }
+
     @Override
     public Optional<? extends Object> parseVendorInformationObject(final EnterpriseNumber enterpriseNumber,
             final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
index 962fc6e55d3b3cc7b1861ce59d06ebfa915417fe..737d6bc313707fee947cfb931d7d2b13a85d8275 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.protocol.pcep.spi.pojo;
 
 import javax.annotation.concurrent.ThreadSafe;
-
 import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
@@ -41,9 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
 
-/**
- *
- */
 @ThreadSafe
 public class SimplePCEPExtensionProviderContext implements PCEPExtensionProviderContext {
     private final SimpleLabelRegistry labelReg = new SimpleLabelRegistry();
@@ -97,13 +93,14 @@ public class SimplePCEPExtensionProviderContext implements PCEPExtensionProvider
     }
 
     @Override
-    public final AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass, final LabelSerializer serializer) {
+    public final AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass,
+            final LabelSerializer serializer) {
         return this.labelReg.registerLabelSerializer(labelClass, serializer);
     }
 
     @Override
-    public final AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
-        return this.labelReg.registerLabelParser(cType, parser);
+    public final AutoCloseable registerLabelParser(final int ctype, final LabelParser parser) {
+        return this.labelReg.registerLabelParser(ctype, parser);
     }
 
     @Override
@@ -123,12 +120,14 @@ public class SimplePCEPExtensionProviderContext implements PCEPExtensionProvider
     }
 
     @Override
-    public final AutoCloseable registerMessageSerializer(final Class<? extends Message> msgClass, final MessageSerializer serializer) {
+    public final AutoCloseable registerMessageSerializer(final Class<? extends Message> msgClass,
+            final MessageSerializer serializer) {
         return this.msgReg.registerMessageSerializer(msgClass, serializer);
     }
 
     @Override
-    public final AutoCloseable registerObjectParser(final int objectClass, final int objectType, final ObjectParser parser) {
+    public final AutoCloseable registerObjectParser(final int objectClass, final int objectType,
+            final ObjectParser parser) {
         return this.objReg.registerObjectParser(objectClass, objectType, parser);
     }
 
@@ -138,7 +137,8 @@ public class SimplePCEPExtensionProviderContext implements PCEPExtensionProvider
     }
 
     @Override
-    public final AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass, final ObjectSerializer serializer) {
+    public final AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass,
+            final ObjectSerializer serializer) {
         return this.objReg.registerObjectSerializer(objClass, serializer);
     }
 
@@ -148,8 +148,8 @@ public class SimplePCEPExtensionProviderContext implements PCEPExtensionProvider
     }
 
     @Override
-    public final AutoCloseable registerRROSubobjectSerializer(
-            final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass,
+    public final AutoCloseable registerRROSubobjectSerializer(final Class<? extends org.opendaylight.yang.gen.v1.urn
+            .opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass,
             final RROSubobjectSerializer serializer) {
         return this.rroSubReg.registerSubobjectSerializer(subobjectClass, serializer);
     }
@@ -160,7 +160,8 @@ public class SimplePCEPExtensionProviderContext implements PCEPExtensionProvider
     }
 
     @Override
-    public final AutoCloseable registerTlvSerializer(final Class<? extends Tlv> tlvClass, final TlvSerializer serializer) {
+    public final AutoCloseable registerTlvSerializer(final Class<? extends Tlv> tlvClass,
+            final TlvSerializer serializer) {
         return this.tlvReg.registerTlvSerializer(tlvClass, serializer);
     }
 
@@ -182,18 +183,21 @@ public class SimplePCEPExtensionProviderContext implements PCEPExtensionProvider
     }
 
     @Override
-    public AutoCloseable registerVendorInformationTlvParser(final EnterpriseNumber enterpriseNumber, final TlvParser parser) {
+    public AutoCloseable registerVendorInformationTlvParser(final EnterpriseNumber enterpriseNumber,
+            final TlvParser parser) {
         return this.viTlvReg.registerVendorInformationTlvParser(enterpriseNumber, parser);
     }
 
     @Override
     public AutoCloseable registerVendorInformationObjectSerializer(
-            final Class<? extends EnterpriseSpecificInformation> esInformationClass, final ObjectSerializer serializer) {
+            final Class<? extends EnterpriseSpecificInformation> esInformationClass,
+            final ObjectSerializer serializer) {
         return this.viObjReg.registerVendorInformationObjectSerializer(esInformationClass, serializer);
     }
 
     @Override
-    public AutoCloseable registerVendorInformationObjectParser(final EnterpriseNumber enterpriseNumber, final ObjectParser parser) {
+    public AutoCloseable registerVendorInformationObjectParser(final EnterpriseNumber enterpriseNumber,
+            final ObjectParser parser) {
         return this.viObjReg.registerVendorInformationObjectParser(enterpriseNumber, parser);
     }
 
index 5d02a17d95ebf69930f5a9581a7c245c3888c3b2..ed4a7d73a9981d3967da92c28ecbd7ae0e5de2a2 100644 (file)
@@ -35,7 +35,7 @@ public class SimplePCEPExtensionProviderContextActivator implements AutoCloseabl
     public void start() {
         LOG.debug("Starting {} PCEPExtensionProviderActivator instances", this.extensionActivators.size());
 
-        for(final PCEPExtensionProviderActivator e : this.extensionActivators) {
+        for (final PCEPExtensionProviderActivator e : this.extensionActivators) {
             e.start(this.providerContext);
         }
     }
@@ -44,7 +44,7 @@ public class SimplePCEPExtensionProviderContextActivator implements AutoCloseabl
     public void close() {
         LOG.debug("Stopping {} BGPExtensionProviderActivator instances", this.extensionActivators.size());
 
-        for(final PCEPExtensionProviderActivator e : this.extensionActivators) {
+        for (final PCEPExtensionProviderActivator e : this.extensionActivators) {
             e.stop();
         }
     }
index 3d16f10a49d4bc4c1637122a3f0229b5ccb9008f..86efea2f1abb73f8b9b23343eed30d26be0db6fc 100644 (file)
@@ -7,10 +7,9 @@
  */
 package org.opendaylight.protocol.pcep.spi.pojo;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.protocol.concepts.HandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
@@ -22,10 +21,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public final class SimpleRROSubobjectRegistry implements RROSubobjectRegistry {
-    private final HandlerRegistry<DataContainer, RROSubobjectParser, RROSubobjectSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, RROSubobjectParser, RROSubobjectSerializer> handlers =
+            new HandlerRegistry<>();
 
     public AutoCloseable registerSubobjectParser(final int subobjectType, final RROSubobjectParser parser) {
-        Preconditions.checkArgument(subobjectType >= 0 && subobjectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
+        checkArgument(subobjectType >= 0 && subobjectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
         return this.handlers.registerParser(subobjectType, parser);
     }
 
@@ -36,20 +36,17 @@ public final class SimpleRROSubobjectRegistry implements RROSubobjectRegistry {
 
     @Override
     public Subobject parseSubobject(final int type, final ByteBuf buffer) throws PCEPDeserializerException {
-        Preconditions.checkArgument(type >= 0 && type <= Values.UNSIGNED_SHORT_MAX_VALUE);
+        checkArgument(type >= 0 && type <= Values.UNSIGNED_SHORT_MAX_VALUE);
         final RROSubobjectParser parser = this.handlers.getParser(type);
-        if (parser == null) {
-            return null;
-        }
-        return parser.parseSubobject(buffer);
+        return parser == null ? null : parser.parseSubobject(buffer);
     }
 
     @Override
     public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
-        final RROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType().getImplementedInterface());
-        if (serializer == null) {
-            return;
+        final RROSubobjectSerializer serializer = this.handlers.getSerializer(
+            subobject.getSubobjectType().getImplementedInterface());
+        if (serializer != null) {
+            serializer.serializeSubobject(subobject, buffer);
         }
-        serializer.serializeSubobject(subobject, buffer);
     }
 }
index 7a0c5b663e42f8b55676f6cdba6f6874b3d3deb1..1b718ef93f3426811ff50d3760e61588888cc050 100644 (file)
@@ -8,9 +8,7 @@
 package org.opendaylight.protocol.pcep.spi.pojo;
 
 import com.google.common.base.Preconditions;
-
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.protocol.concepts.HandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.TlvParser;
@@ -20,9 +18,6 @@ import org.opendaylight.protocol.util.Values;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
-/**
- *
- */
 public final class SimpleTlvRegistry implements TlvRegistry {
 
     private final HandlerRegistry<DataContainer, TlvParser, TlvSerializer> handlers = new HandlerRegistry<>();
index 4823ddfb57b38781f11b3938b5dab3c138a83459..7b0775c620bf9f9b5ac7a81bcb4bba335140346c 100644 (file)
@@ -5,13 +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.pcep.spi.pojo;
 
 import com.google.common.primitives.Ints;
-
 import io.netty.buffer.ByteBuf;
-
 import java.util.Optional;
 import org.opendaylight.protocol.concepts.HandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.ObjectParser;
@@ -28,19 +25,22 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public class SimpleVendorInformationObjectRegistry implements VendorInformationObjectRegistry {
-
     private final HandlerRegistry<DataContainer, ObjectParser, ObjectSerializer> handlers = new HandlerRegistry<>();
 
-    public AutoCloseable registerVendorInformationObjectParser(final EnterpriseNumber enterpriseNumber, final ObjectParser parser) {
+    public AutoCloseable registerVendorInformationObjectParser(final EnterpriseNumber enterpriseNumber,
+            final ObjectParser parser) {
         return this.handlers.registerParser(Ints.checkedCast(enterpriseNumber.getValue()), parser);
     }
 
-    public AutoCloseable registerVendorInformationObjectSerializer(final Class<? extends EnterpriseSpecificInformation> esInformationClass, final ObjectSerializer serializer) {
+    public AutoCloseable registerVendorInformationObjectSerializer(
+            final Class<? extends EnterpriseSpecificInformation> esInformationClass,
+            final ObjectSerializer serializer) {
         return this.handlers.registerSerializer(esInformationClass, serializer);
     }
 
     @Override
-    public Optional<? extends Object> parseVendorInformationObject(final EnterpriseNumber enterpriseNumber, final ObjectHeader header, final ByteBuf buffer)
+    public Optional<? extends Object> parseVendorInformationObject(final EnterpriseNumber enterpriseNumber,
+            final ObjectHeader header, final ByteBuf buffer)
             throws PCEPDeserializerException {
         final ObjectParser parser = this.handlers.getParser(Ints.checkedCast(enterpriseNumber.getValue()));
         if (parser == null) {
@@ -54,11 +54,11 @@ public class SimpleVendorInformationObjectRegistry implements VendorInformationO
 
     @Override
     public void serializeVendorInformationObject(final VendorInformationObject viObject, final ByteBuf buffer) {
-        final ObjectSerializer serializer = this.handlers.getSerializer(viObject.getEnterpriseSpecificInformation().getImplementedInterface());
+        final ObjectSerializer serializer = this.handlers.getSerializer(
+            viObject.getEnterpriseSpecificInformation().getImplementedInterface());
         if (serializer == null) {
             return;
         }
         serializer.serializeObject(viObject, buffer);
     }
-
 }
index 23d4be76f47badb2bd49fd57aaf81371260ca15f..f1dbf4d66be5bd510c7bb8f8a8a1dc7bc3428781 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.pcep.spi.pojo;
 
 import com.google.common.primitives.Ints;
@@ -25,16 +24,19 @@ public class SimpleVendorInformationTlvRegistry implements VendorInformationTlvR
 
     private final HandlerRegistry<DataContainer, TlvParser, TlvSerializer> handlers = new HandlerRegistry<>();
 
-    public AutoCloseable registerVendorInformationTlvParser(final EnterpriseNumber enterpriseNumber, final TlvParser parser) {
+    public AutoCloseable registerVendorInformationTlvParser(final EnterpriseNumber enterpriseNumber,
+            final TlvParser parser) {
         return this.handlers.registerParser(Ints.checkedCast(enterpriseNumber.getValue()), parser);
     }
 
-    public AutoCloseable registerVendorInformationTlvSerializer(final Class<? extends EnterpriseSpecificInformation> esInformationClass, final TlvSerializer serializer) {
+    public AutoCloseable registerVendorInformationTlvSerializer(
+            final Class<? extends EnterpriseSpecificInformation> esInformationClass, final TlvSerializer serializer) {
         return this.handlers.registerSerializer(esInformationClass, serializer);
     }
 
     @Override
-    public Optional<VendorInformationTlv> parseVendorInformationTlv(final EnterpriseNumber enterpriseNumber, final ByteBuf buffer) throws PCEPDeserializerException {
+    public Optional<VendorInformationTlv> parseVendorInformationTlv(final EnterpriseNumber enterpriseNumber,
+            final ByteBuf buffer) throws PCEPDeserializerException {
         final TlvParser parser = this.handlers.getParser(Ints.checkedCast(enterpriseNumber.getValue()));
         if (parser == null) {
             return Optional.empty();
@@ -44,12 +46,11 @@ public class SimpleVendorInformationTlvRegistry implements VendorInformationTlvR
 
     @Override
     public void serializeVendorInformationTlv(final VendorInformationTlv viTlv, final ByteBuf buffer) {
-        final TlvSerializer serializer = this.handlers.getSerializer(viTlv.getEnterpriseSpecificInformation().getImplementedInterface());
+        final TlvSerializer serializer = this.handlers.getSerializer(
+            viTlv.getEnterpriseSpecificInformation().getImplementedInterface());
         if (serializer == null) {
             return;
         }
         serializer.serializeTlv(viTlv, buffer);
     }
-
-
 }
index 0902e313b646b4e07382526164a7d10926e35b1c..cb2a4014e00fe073ab7357639a7088241154759d 100644 (file)
@@ -8,9 +8,7 @@
 package org.opendaylight.protocol.pcep.spi.pojo;
 
 import com.google.common.base.Preconditions;
-
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.protocol.concepts.HandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
@@ -22,7 +20,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public final class SimpleXROSubobjectRegistry implements XROSubobjectRegistry {
-    private final HandlerRegistry<DataContainer, XROSubobjectParser, XROSubobjectSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, XROSubobjectParser, XROSubobjectSerializer> handlers =
+            new HandlerRegistry<>();
 
     public AutoCloseable registerSubobjectParser(final int subobjectType, final XROSubobjectParser parser) {
         Preconditions.checkArgument(subobjectType >= 0 && subobjectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
@@ -35,7 +34,8 @@ public final class SimpleXROSubobjectRegistry implements XROSubobjectRegistry {
     }
 
     @Override
-    public Subobject parseSubobject(final int type, final ByteBuf buffer, final boolean mandatory) throws PCEPDeserializerException {
+    public Subobject parseSubobject(final int type, final ByteBuf buffer, final boolean mandatory)
+            throws PCEPDeserializerException {
         Preconditions.checkArgument(type >= 0 && type <= Values.UNSIGNED_SHORT_MAX_VALUE);
         final XROSubobjectParser parser = this.handlers.getParser(type);
         if (parser == null) {
@@ -46,7 +46,8 @@ public final class SimpleXROSubobjectRegistry implements XROSubobjectRegistry {
 
     @Override
     public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
-        final XROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType().getImplementedInterface());
+        final XROSubobjectSerializer serializer = this.handlers.getSerializer(
+            subobject.getSubobjectType().getImplementedInterface());
         if (serializer == null) {
             return;
         }
index 74b4b2adfb69a795d028b20804108cbc731a2bdd..a4f5d6e652df35ae4a0ef080be50b7207415c065 100644 (file)
@@ -23,7 +23,8 @@ public class APITest {
         final PCEPDeserializerException e = new PCEPDeserializerException("Some error message.");
         assertEquals("Some error message.", e.getMessage());
 
-        final PCEPDeserializerException e1 = new PCEPDeserializerException("Some error message.", new IllegalArgumentException());
+        final PCEPDeserializerException e1 = new PCEPDeserializerException("Some error message.",
+            new IllegalArgumentException());
         assertEquals("Some error message.", e1.getMessage());
         assertTrue(e1.getCause() instanceof IllegalArgumentException);
     }
@@ -45,7 +46,8 @@ public class APITest {
         assertFalse(un.isIgnore());
         assertFalse(un.isProcessingRule());
         assertEquals(PCEPErrors.CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS, un.getError());
-        assertEquals(PCEPErrors.CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS.getErrorType(), un.getErrors().get(0).getErrorObject().getType().shortValue());
+        assertEquals(PCEPErrors.CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS.getErrorType(),
+            un.getErrors().get(0).getErrorObject().getType().shortValue());
 
         final Object o = new CCloseBuilder().build();
         UnknownObject unknown = new UnknownObject(PCEPErrors.LSP_RSVP_ERROR, o);
index 5b4bd73da211932cc4dadf7a2e51a064ead33193..50a345bbc9c7f9bc6fb0efdeb92219279ca4f6f7 100644 (file)
@@ -8,18 +8,25 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.only;
+import static org.mockito.Mockito.verify;
 
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcerr;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcrep;
@@ -33,6 +40,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.objects.VendorInformationObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.objects.VendorInformationObjectBuilder;
 
+@RunWith(MockitoJUnitRunner.class)
 public class AbstractMessageParserTest {
 
     private static final EnterpriseNumber EN = new EnterpriseNumber(0L);
@@ -59,9 +67,9 @@ public class AbstractMessageParserTest {
             if (objects.get(0) instanceof VendorInformationObject) {
                 final RepliesBuilder repsBuilder = new RepliesBuilder();
                 repsBuilder.setVendorInformationObject(addVendorInformationObjects(objects));
-                final PcrepBuilder builder = new PcrepBuilder();
-                builder.setPcrepMessage(new PcrepMessageBuilder().setReplies(Lists.newArrayList(repsBuilder.build())).build());
-                return builder.build();
+                return new PcrepBuilder().setPcrepMessage(
+                    new PcrepMessageBuilder().setReplies(Arrays.asList(repsBuilder.build())).build())
+                        .build();
             } else if (objects.get(0) instanceof ErrorObject) {
                 final short errorType = ((ErrorObject) objects.get(0)).getType();
                 final short errorValue = ((ErrorObject) objects.get(0)).getValue();
@@ -73,13 +81,15 @@ public class AbstractMessageParserTest {
 
     @Before
     public void setUp() throws PCEPDeserializerException {
-        MockitoAnnotations.initMocks(this);
         this.object = new ErrorObjectBuilder().setType((short) 1).setValue((short) 1).build();
         this.viObject = new VendorInformationObjectBuilder().setEnterpriseNumber(EN).build();
-        Mockito.doNothing().when(this.registry).serializeVendorInformationObject(Mockito.any(VendorInformationObject.class), Mockito.any(ByteBuf.class));
-        Mockito.doReturn(Optional.of(this.viObject)).when(this.registry).parseVendorInformationObject(Mockito.eq(EN), Mockito.eq(new ObjectHeaderImpl(true, true)), Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.registry).serializeObject(Mockito.any(Object.class), Mockito.any(ByteBuf.class));
-        Mockito.doReturn(this.object).when(this.registry).parseObject(13, 1, new ObjectHeaderImpl(true, true), Unpooled.wrappedBuffer(new byte[] { 0, 0, 1, 1 }));
+        doNothing().when(this.registry).serializeVendorInformationObject(any(VendorInformationObject.class),
+            any(ByteBuf.class));
+        doReturn(Optional.of(this.viObject)).when(this.registry).parseVendorInformationObject(eq(EN),
+            eq(new ObjectHeaderImpl(true, true)), any(ByteBuf.class));
+        doNothing().when(this.registry).serializeObject(any(Object.class), any(ByteBuf.class));
+        doReturn(this.object).when(this.registry).parseObject(13, 1, new ObjectHeaderImpl(true, true),
+            Unpooled.wrappedBuffer(new byte[] { 0, 0, 1, 1 }));
     }
 
     @Test
@@ -88,9 +98,10 @@ public class AbstractMessageParserTest {
         final ByteBuf buffer = Unpooled.buffer();
         a.serializeObject(this.object, buffer);
 
-        Mockito.verify(this.registry, Mockito.only()).serializeObject(Mockito.any(Object.class), Mockito.any(ByteBuf.class));
+        verify(this.registry, only()).serializeObject(any(Object.class), any(ByteBuf.class));
 
-        final Message b = a.parseMessage(Unpooled.wrappedBuffer(new byte[] {0x0D, 0x13, 0, 0x08, 0, 0, 1, 1 }), Collections.emptyList());
+        final Message b = a.parseMessage(Unpooled.wrappedBuffer(new byte[] {0x0D, 0x13, 0, 0x08, 0, 0, 1, 1 }),
+            Collections.emptyList());
 
         assertEquals(this.object, ((Pcerr) b).getPcerrMessage().getErrors().get(0).getErrorObject());
     }
@@ -101,10 +112,13 @@ public class AbstractMessageParserTest {
         final ByteBuf buffer = Unpooled.buffer();
 
         parser.serializeVendorInformationObjects(Lists.newArrayList(this.viObject), buffer);
-        Mockito.verify(this.registry, Mockito.only()).serializeVendorInformationObject(Mockito.any(VendorInformationObject.class), Mockito.any(ByteBuf.class));
+        verify(this.registry, only()).serializeVendorInformationObject(any(VendorInformationObject.class),
+            any(ByteBuf.class));
 
-        final Message msg = parser.parseMessage(Unpooled.wrappedBuffer(new byte[] {0x22, 0x13, 0x00, 0x08, 0, 0, 0, 0 }), Collections.emptyList());
+        final Message msg = parser.parseMessage(
+            Unpooled.wrappedBuffer(new byte[] { 0x22, 0x13, 0x00, 0x08, 0, 0, 0, 0 }), Collections.emptyList());
 
-        assertEquals(this.viObject, ((Pcrep)msg).getPcrepMessage().getReplies().get(0).getVendorInformationObject().get(0));
+        assertEquals(this.viObject, ((Pcrep)msg).getPcrepMessage().getReplies().get(0).getVendorInformationObject()
+            .get(0));
     }
 }
index 4f7b00760405e8dd7426c33e2bb47590e1f3c904..201665afd3b59a8e0d2fca7d828213821070511f 100644 (file)
@@ -8,17 +8,23 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.only;
+import static org.mockito.Mockito.verify;
 
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
@@ -30,6 +36,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.tlvs.VendorInformationTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.tlvs.VendorInformationTlvBuilder;
 
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class AbstractObjectWithTlvsTest {
 
     private static final EnterpriseNumber EN = new EnterpriseNumber(0L);
@@ -46,53 +53,54 @@ public class AbstractObjectWithTlvsTest {
 
     private class Abs extends AbstractObjectWithTlvsParser<TlvsBuilder> {
 
-        protected Abs(TlvRegistry tlvReg, VendorInformationTlvRegistry viTlvReg) {
+        protected Abs(final TlvRegistry tlvReg, final VendorInformationTlvRegistry viTlvReg) {
             super(tlvReg, viTlvReg, 0, 0);
         }
 
         @Override
-        public Object parseObject(ObjectHeader header, ByteBuf buffer) {
+        public Object parseObject(final ObjectHeader header, final ByteBuf buffer) {
             return null;
         }
 
         @Override
-        public void serializeObject(Object object, ByteBuf buffer) {
+        public void serializeObject(final Object object, final ByteBuf buffer) {
         }
 
         @Override
-        public void addTlv(final TlvsBuilder builder, final Tlv tlv) {
-            builder.setOfList((OfList) tlv);
+        public void addTlv(final TlvsBuilder builder, final Tlv newTlv) {
+            builder.setOfList((OfList) newTlv);
         }
 
         @Override
-        protected void addVendorInformationTlvs(TlvsBuilder builder, List<VendorInformationTlv> tlvs) {
+        protected void addVendorInformationTlvs(final TlvsBuilder builder, final List<VendorInformationTlv> tlvs) {
             builder.setVendorInformationTlv(tlvs);
         }
     }
 
     @Before
     public void setUp() throws PCEPDeserializerException {
-        MockitoAnnotations.initMocks(this);
-        this.tlv = new OfListBuilder().setCodes(Lists.newArrayList(new OfId(10))).build();
+        this.tlv = new OfListBuilder().setCodes(Collections.singletonList(new OfId(10))).build();
         this.viTlv = new VendorInformationTlvBuilder().setEnterpriseNumber(EN).build();
-        Mockito.doNothing().when(this.viTlvRegistry).serializeVendorInformationTlv(Mockito.any(VendorInformationTlv.class), Mockito.any(ByteBuf.class));
-        Mockito.doReturn(Optional.of(this.viTlv)).when(this.viTlvRegistry).parseVendorInformationTlv(EN, Unpooled.wrappedBuffer(new byte[0]));
-        Mockito.doNothing().when(this.tlvRegistry).serializeTlv(Mockito.any(Tlv.class), Mockito.any(ByteBuf.class));
-        Mockito.doReturn(this.tlv).when(this.tlvRegistry).parseTlv(4, Unpooled.wrappedBuffer(new byte[] { 5, 6 }));
+        doNothing().when(this.viTlvRegistry).serializeVendorInformationTlv(any(VendorInformationTlv.class),
+            any(ByteBuf.class));
+        doReturn(Optional.of(this.viTlv)).when(this.viTlvRegistry).parseVendorInformationTlv(EN,
+            Unpooled.wrappedBuffer(new byte[0]));
+        doNothing().when(this.tlvRegistry).serializeTlv(any(Tlv.class), any(ByteBuf.class));
+        doReturn(this.tlv).when(this.tlvRegistry).parseTlv(4, Unpooled.wrappedBuffer(new byte[] { 5, 6 }));
     }
 
     @Test
     public void testParseTlvs() throws PCEPDeserializerException {
-        Abs a = new Abs(this.tlvRegistry, this.viTlvRegistry);
+        Abs abs = new Abs(this.tlvRegistry, this.viTlvRegistry);
         ByteBuf buffer = Unpooled.buffer();
-        a.serializeTlv(this.tlv, buffer);
+        abs.serializeTlv(this.tlv, buffer);
 
-        Mockito.verify(this.tlvRegistry, Mockito.only()).serializeTlv(Mockito.any(Tlv.class), Mockito.any(ByteBuf.class));
+        verify(this.tlvRegistry, only()).serializeTlv(any(Tlv.class), any(ByteBuf.class));
 
-        TlvsBuilder b = new TlvsBuilder();
-        a.parseTlvs(b, Unpooled.wrappedBuffer(new byte[] { 0, 4, 0, 2, 5, 6, 0, 0 }));
+        TlvsBuilder builder = new TlvsBuilder();
+        abs.parseTlvs(builder, Unpooled.wrappedBuffer(new byte[] { 0, 4, 0, 2, 5, 6, 0, 0 }));
 
-        assertEquals(this.tlv, b.getOfList());
+        assertEquals(this.tlv, builder.getOfList());
     }
 
     @Test
@@ -101,10 +109,12 @@ public class AbstractObjectWithTlvsTest {
         final ByteBuf buffer = Unpooled.buffer();
 
         parser.serializeVendorInformationTlvs(Lists.newArrayList(this.viTlv), buffer);
-        Mockito.verify(this.viTlvRegistry, Mockito.only()).serializeVendorInformationTlv(Mockito.any(VendorInformationTlv.class), Mockito.any(ByteBuf.class));
+        verify(this.viTlvRegistry, only()).serializeVendorInformationTlv(any(VendorInformationTlv.class),
+            any(ByteBuf.class));
 
         final TlvsBuilder tlvsBuilder = new TlvsBuilder();
-        parser.parseTlvs(tlvsBuilder, Unpooled.wrappedBuffer(new byte[] { 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 }));
+        parser.parseTlvs(tlvsBuilder, Unpooled.wrappedBuffer(
+            new byte[] { 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 }));
         assertEquals(this.viTlv, tlvsBuilder.getVendorInformationTlv().get(0));
     }
 }
index 2a1e0116e57159d76faef75a441551292da31e2b..8ebe7587ba7bea2e58904b317094ec815fa232e6 100644 (file)
@@ -7,6 +7,11 @@
  */
 package org.opendaylight.protocol.pcep.spi;
 
+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 io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
@@ -14,9 +19,9 @@ import java.util.Collections;
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.protocol.pcep.spi.pojo.AbstractPCEPExtensionProviderActivator;
 import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
@@ -44,6 +49,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCase;
 
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class RegistryTest {
 
     @Mock
@@ -105,37 +111,29 @@ public class RegistryTest {
 
     @Before
     public void setUp() throws PCEPDeserializerException {
-        MockitoAnnotations.initMocks(this);
-        Mockito.doReturn(null).when(this.xroParser).parseSubobject(Mockito.any(ByteBuf.class), Mockito.anyBoolean());
-        Mockito.doNothing().when(this.xroSerializer).serializeSubobject(Mockito.any(Subobject.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(null).when(this.rroParser).parseSubobject(Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.rroSerializer).serializeSubobject(Mockito.any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.Subobject.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(null).when(this.eroParser).parseSubobject(Mockito.any(ByteBuf.class), Mockito.anyBoolean());
-        Mockito.doNothing().when(this.eroSerializer).serializeSubobject(Mockito.any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(this.viTlv).when(this.tlvParser).parseTlv(Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.tlvSerializer).serializeTlv(Mockito.any(Tlv.class), Mockito.any(ByteBuf.class));
+        doReturn(null).when(this.xroParser).parseSubobject(any(ByteBuf.class), anyBoolean());
+        doNothing().when(this.xroSerializer).serializeSubobject(any(Subobject.class), any(ByteBuf.class));
 
-        Mockito.doReturn(5).when(this.objectParser).getObjectClass();
-        Mockito.doReturn(1).when(this.objectParser).getObjectType();
-        Mockito.doReturn(new OpenBuilder().build()).when(this.objectParser).parseObject(Mockito.any(ObjectHeader.class), Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.objectSerializer).serializeObject(Mockito.any(Object.class), Mockito.any(ByteBuf.class));
+        doReturn(this.viTlv).when(this.tlvParser).parseTlv(any(ByteBuf.class));
+        doNothing().when(this.tlvSerializer).serializeTlv(any(Tlv.class), any(ByteBuf.class));
 
-        Mockito.doReturn(null).when(this.msgParser).parseMessage(Mockito.any(ByteBuf.class), Mockito.any(List.class));
-        Mockito.doNothing().when(this.msgSerializer).serializeMessage(Mockito.any(Message.class), Mockito.any(ByteBuf.class));
+        doReturn(5).when(this.objectParser).getObjectClass();
+        doReturn(1).when(this.objectParser).getObjectType();
+        doReturn(new OpenBuilder().build()).when(this.objectParser).parseObject(any(ObjectHeader.class),
+            any(ByteBuf.class));
+        doNothing().when(this.objectSerializer).serializeObject(any(Object.class), any(ByteBuf.class));
 
-        Mockito.doReturn(null).when(this.labelParser).parseLabel(Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.labelSerializer).serializeLabel(Mockito.anyBoolean(), Mockito.anyBoolean(), Mockito.any(LabelType.class), Mockito.any(ByteBuf.class));
+        doReturn(null).when(this.msgParser).parseMessage(any(ByteBuf.class), any(List.class));
+        doNothing().when(this.msgSerializer).serializeMessage(any(Message.class), any(ByteBuf.class));
 
-        Mockito.doReturn(this.es).when(this.esi).getEnterpriseSpecificInformation();
+        doNothing().when(this.labelSerializer).serializeLabel(anyBoolean(), anyBoolean(), any(LabelType.class),
+            any(ByteBuf.class));
 
-        Mockito.doReturn(EnterpriseSpecificInformation.class).when(this.es).getImplementedInterface();
+        doReturn(this.es).when(this.esi).getEnterpriseSpecificInformation();
 
-        Mockito.doReturn(this.es).when(this.viTlv).getEnterpriseSpecificInformation();
+        doReturn(this.es).when(this.viTlv).getEnterpriseSpecificInformation();
 
-        Mockito.doReturn(EnterpriseSpecificInformation.class).when(this.es).getImplementedInterface();
+        doReturn(EnterpriseSpecificInformation.class).when(this.es).getImplementedInterface();
     }
 
     @Test
@@ -162,20 +160,27 @@ public class RegistryTest {
         this.regs.add(this.ctx.registerLabelSerializer(Type1LabelCase.class, this.labelSerializer));
 
         this.regs.add(this.ctx.registerVendorInformationObjectParser(new EnterpriseNumber(10L), this.objectParser));
-        this.regs.add(this.ctx.registerVendorInformationObjectSerializer(EnterpriseSpecificInformation.class, this.objectSerializer));
+        this.regs.add(this.ctx.registerVendorInformationObjectSerializer(EnterpriseSpecificInformation.class,
+            this.objectSerializer));
 
         this.regs.add(this.ctx.registerVendorInformationTlvParser(new EnterpriseNumber(12L), this.tlvParser));
-        this.regs.add(this.ctx.registerVendorInformationTlvSerializer(EnterpriseSpecificInformation.class, this.tlvSerializer));
+        this.regs.add(this.ctx.registerVendorInformationTlvSerializer(EnterpriseSpecificInformation.class,
+            this.tlvSerializer));
 
         final ByteBuf buffer = Unpooled.buffer();
         this.ctx.getXROSubobjectHandlerRegistry().parseSubobject(2, buffer, false);
-        this.ctx.getXROSubobjectHandlerRegistry().serializeSubobject(new SubobjectBuilder().setSubobjectType(new AsNumberCaseBuilder().build()).build(), buffer);
+        this.ctx.getXROSubobjectHandlerRegistry().serializeSubobject(new SubobjectBuilder()
+            .setSubobjectType(new AsNumberCaseBuilder().build()).build(), buffer);
 
         this.ctx.getEROSubobjectHandlerRegistry().parseSubobject(3, buffer, true);
-        this.ctx.getEROSubobjectHandlerRegistry().serializeSubobject(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder().setSubobjectType(new AsNumberCaseBuilder().build()).build(), buffer);
+        this.ctx.getEROSubobjectHandlerRegistry().serializeSubobject(new org.opendaylight.yang.gen.v1.urn.opendaylight
+            .params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder()
+            .setSubobjectType(new AsNumberCaseBuilder().build()).build(), buffer);
 
         this.ctx.getRROSubobjectHandlerRegistry().parseSubobject(4, buffer);
-        this.ctx.getRROSubobjectHandlerRegistry().serializeSubobject(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder().setSubobjectType(new IpPrefixCaseBuilder().build()).build(), buffer);
+        this.ctx.getRROSubobjectHandlerRegistry().serializeSubobject(new org.opendaylight.yang.gen.v1.urn.opendaylight
+            .params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder()
+            .setSubobjectType(new IpPrefixCaseBuilder().build()).build(), buffer);
 
         this.ctx.getLabelHandlerRegistry().parseLabel(1, buffer);
         this.ctx.getLabelHandlerRegistry().serializeLabel(true, false, new Type1LabelCaseBuilder().build(), buffer);
@@ -189,7 +194,8 @@ public class RegistryTest {
         this.ctx.getMessageHandlerRegistry().parseMessage(6, buffer, Collections.emptyList());
         this.ctx.getMessageHandlerRegistry().serializeMessage(new KeepaliveBuilder().build(), buffer);
 
-        this.ctx.getVendorInformationObjectRegistry().parseVendorInformationObject(new EnterpriseNumber(10L), new ObjectHeaderImpl(true, false), buffer);
+        this.ctx.getVendorInformationObjectRegistry().parseVendorInformationObject(new EnterpriseNumber(10L),
+            new ObjectHeaderImpl(true, false), buffer);
         this.ctx.getVendorInformationObjectRegistry().serializeVendorInformationObject(this.esi, buffer);
 
         this.ctx.getVendorInformationTlvRegistry().parseVendorInformationTlv(new EnterpriseNumber(12L), buffer);
index 96c2de0c5d04b3eb05543592f91bd00b907d05e1..138ae53e1072626ea6ba161b328ac5e0821c80ee 100644 (file)
@@ -10,11 +10,12 @@ package org.opendaylight.protocol.pcep.spi;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.opendaylight.protocol.pcep.spi.VendorInformationUtil.VENDOR_INFORMATION_OBJECT_CLASS;
+import static org.opendaylight.protocol.pcep.spi.VendorInformationUtil.VENDOR_INFORMATION_OBJECT_TYPE;
+import static org.opendaylight.protocol.pcep.spi.VendorInformationUtil.VENDOR_INFORMATION_TLV_TYPE;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
 
@@ -128,111 +129,16 @@ public class UtilsTest {
 
     @Test
     public void testVendorInformationUtil() {
-        assertTrue(VendorInformationUtil.isVendorInformationTlv(VendorInformationUtil.VENDOR_INFORMATION_TLV_TYPE));
-        assertFalse(VendorInformationUtil.isVendorInformationTlv(VendorInformationUtil.VENDOR_INFORMATION_OBJECT_CLASS));
-
-        assertTrue(VendorInformationUtil.isVendorInformationObject(VendorInformationUtil.VENDOR_INFORMATION_OBJECT_CLASS, VendorInformationUtil.VENDOR_INFORMATION_OBJECT_TYPE));
-        assertFalse(VendorInformationUtil.isVendorInformationObject(VendorInformationUtil.VENDOR_INFORMATION_OBJECT_CLASS, VendorInformationUtil.VENDOR_INFORMATION_TLV_TYPE));
-        assertFalse(VendorInformationUtil.isVendorInformationObject(VendorInformationUtil.VENDOR_INFORMATION_TLV_TYPE, VendorInformationUtil.VENDOR_INFORMATION_OBJECT_TYPE));
-        assertFalse(VendorInformationUtil.isVendorInformationObject(VendorInformationUtil.VENDOR_INFORMATION_OBJECT_TYPE, VendorInformationUtil.VENDOR_INFORMATION_OBJECT_CLASS));
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testVendorInformationUtilPrivateConstructor() throws Throwable {
-        final Constructor<VendorInformationUtil> c = VendorInformationUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testEROSubobjectUtilPrivateConstructor() throws Throwable {
-        final Constructor<EROSubobjectUtil> c = EROSubobjectUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testRROSubobjectUtilPrivateConstructor() throws Throwable {
-        final Constructor<RROSubobjectUtil> c = RROSubobjectUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testTlvUtilPrivateConstructor() throws Throwable {
-        final Constructor<TlvUtil> c = TlvUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testXROSubobjectUtilPrivateConstructor() throws Throwable {
-        final Constructor<XROSubobjectUtil> c = XROSubobjectUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testObjectUtilPrivateConstructor() throws Throwable {
-        final Constructor<ObjectUtil> c = ObjectUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testMessageUtilPrivateConstructor() throws Throwable {
-        final Constructor<MessageUtil> c = MessageUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testLabelUtilPrivateConstructor() throws Throwable {
-        final Constructor<LabelUtil> c = LabelUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testPCEPMessageConstantsPrivateConstructor() throws Throwable {
-        final Constructor<PCEPMessageConstants> c = PCEPMessageConstants.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
+        assertTrue(VendorInformationUtil.isVendorInformationTlv(VENDOR_INFORMATION_TLV_TYPE));
+        assertFalse(VendorInformationUtil.isVendorInformationTlv(VENDOR_INFORMATION_OBJECT_CLASS));
+
+        assertTrue(VendorInformationUtil.isVendorInformationObject(VENDOR_INFORMATION_OBJECT_CLASS,
+            VENDOR_INFORMATION_OBJECT_TYPE));
+        assertFalse(VendorInformationUtil.isVendorInformationObject(VENDOR_INFORMATION_OBJECT_CLASS,
+            VENDOR_INFORMATION_TLV_TYPE));
+        assertFalse(VendorInformationUtil.isVendorInformationObject(VENDOR_INFORMATION_TLV_TYPE,
+            VENDOR_INFORMATION_OBJECT_TYPE));
+        assertFalse(VendorInformationUtil.isVendorInformationObject(VENDOR_INFORMATION_OBJECT_TYPE,
+            VENDOR_INFORMATION_OBJECT_CLASS));
     }
 }