Fix checkstyle issues under rib-spi 01/66901/2
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 5 Jan 2018 15:28:05 +0000 (16:28 +0100)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 5 Jan 2018 15:28:05 +0000 (16:28 +0100)
and enforce findbug

Change-Id: I4bf3cc40aa28636a016dbc97c9bda17284557c63
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
52 files changed:
bgp/rib-spi/pom.xml
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractRIBExtensionProviderActivator.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractRIBSupport.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractRIBSupportRegistration.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AddPathRibSupport.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/BGPSession.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/BGPSessionListener.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/ExportPolicyPeerTracker.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/IdentifierUtils.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/MultiPathAbstractRIBSupport.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/Peer.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/PeerExportGroup.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/PeerRPCs.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/PeerRoleUtil.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBExtensionConsumerContext.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBExtensionProviderActivator.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBExtensionProviderContext.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBSupport.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RibSupportUtils.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RouterIds.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/ServiceLoaderRIBExtensionConsumerContext.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/SimpleRIBExtensionProviderContext.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/SimpleRIBExtensionProviderContextActivator.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPAfiSafiState.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPErrorHandlingState.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPGracelfulRestartState.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPPeerMessagesState.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPPeerState.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPPeerStateConsumer.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPSessionState.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPStateConsumer.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPStateProvider.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPTimersState.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/state/BGPTransportState.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/util/ClusterSingletonServiceRegistrationHelper.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/AbstractRIBSupportTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/AddPathRibSupportTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/IdentifierUtilsTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/MultiPathAbstractRIBSupportTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/PeerExportGroupTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/PeerRoleUtilTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/RibSupportUtilsTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/RouterIdsTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/SimpleRIBExtensionProviderContextActivatorTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/SimpleRIBExtensionTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/TerminationReasonTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/util/ClusterSingletonServiceRegistrationHelperTest.java
bgp/rib-spi/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/bgp/inet/rev150305/ipv4/routes/ipv4/routes/Ipv4Prefixes.java
bgp/rib-spi/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/bgp/inet/rev150305/ipv4/routes/ipv4/routes/Ipv4Route.java
bgp/rib-spi/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/bgp/inet/rev150305/ipv4/routes/ipv4/routes/Ipv4Routes.java
bgp/rib-spi/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/bgp/inet/rev150305/ipv4/routes/ipv4/routes/Ipv4RoutesCase.java
bgp/rib-spi/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/bgp/inet/rev150305/ipv4/routes/ipv4/routes/MultiPathAbstractTest.java

index 0e896710c604a997190985dade238c4df5167485..e3d20fe261d2ef34914b20a4376a8b1bf68bfb17 100644 (file)
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <configuration>
+                    <failOnError>true</failOnError>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
index fcc63be4cff61589c3ab67a9ce9724067f2d0b92..b3a457888d65c1b1adba8515e2a31fca2726b2d3 100644 (file)
@@ -32,6 +32,7 @@ public abstract class AbstractRIBExtensionProviderActivator implements AutoClose
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public final synchronized void stopRIBExtensionProvider() {
         if (this.registrations == null) {
             return;
index 058e8490820ead0b714e715b0ab9f35ae3303bc4..bc5d4c63259609f2524678d457f6b78e21e1710d 100644 (file)
@@ -92,19 +92,23 @@ public abstract class AbstractRIBSupport implements RIBSupport {
      * @param safiClass SubsequentAddressFamily
      * @param destinationQname destination Qname
      */
-    protected AbstractRIBSupport(final Class<? extends Routes> cazeClass, final Class<? extends DataObject> containerClass,
-        final Class<? extends Route> listClass, final Class<? extends AddressFamily> afiClass, final Class<? extends SubsequentAddressFamily> safiClass,
+    protected AbstractRIBSupport(final Class<? extends Routes> cazeClass,
+            final Class<? extends DataObject> containerClass,
+        final Class<? extends Route> listClass, final Class<? extends AddressFamily> afiClass,
+            final Class<? extends SubsequentAddressFamily> safiClass,
         final QName destinationQname) {
         final QName qname = BindingReflections.findQName(containerClass).intern();
         this.routesContainerIdentifier = new NodeIdentifier(qname);
-        this.routeAttributesIdentifier = new NodeIdentifier(QName.create(qname, Attributes.QNAME.getLocalName().intern()));
+        this.routeAttributesIdentifier = new NodeIdentifier(QName.create(qname,
+                Attributes.QNAME.getLocalName().intern()));
         this.cazeClass = requireNonNull(cazeClass);
         this.containerClass = requireNonNull(containerClass);
         this.listClass = requireNonNull(listClass);
         this.routeQname = QName.create(qname, BindingReflections.findQName(listClass).intern().getLocalName());
         this.routesListIdentifier = new NodeIdentifier(this.routeQname);
         this.emptyRoutes = Builders.choiceBuilder().withNodeIdentifier(ROUTES).addChild(Builders.containerBuilder()
-            .withNodeIdentifier(routesContainerIdentifier()).withChild(ImmutableNodes.mapNodeBuilder(this.routeQname).build()).build()).build();
+            .withNodeIdentifier(routesContainerIdentifier()).withChild(ImmutableNodes.mapNodeBuilder(this.routeQname)
+                        .build()).build()).build();
         this.afiClass = afiClass;
         this.safiClass = safiClass;
         this.destinationNid = new NodeIdentifier(destinationQname);
@@ -180,14 +184,16 @@ public abstract class AbstractRIBSupport implements RIBSupport {
         final MpUnreachNlriBuilder mb = new MpUnreachNlriBuilder();
         mb.setAfi(this.getAfi());
         mb.setSafi(this.getSafi());
-        mb.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(buildWithdrawnDestination(routes)).build());
+        mb.setWithdrawnRoutes(new WithdrawnRoutesBuilder()
+                .setDestinationType(buildWithdrawnDestination(routes)).build());
         return mb.build();
     }
 
     @Nonnull
-    protected abstract DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes);
+    protected abstract DestinationType buildDestination(@Nonnull Collection<MapEntryNode> routes);
+
     @Nonnull
-    protected abstract DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes);
+    protected abstract DestinationType buildWithdrawnDestination(@Nonnull Collection<MapEntryNode> routes);
 
     /**
      * Return the {@link NodeIdentifier} of the AFI/SAFI-specific container under
@@ -213,8 +219,7 @@ public abstract class AbstractRIBSupport implements RIBSupport {
      * Given the destination as ContainerNode, implementation needs to parse the DOM model
      * from this point onward:
      *
-     * {@code /bgp-mp:mp-unreach-nlri/bgp-mp:withdrawn-routes/bgp-mp:destination-type }
-     *
+     * {@code /bgp-mp:mp-unreach-nlri/bgp-mp:withdrawn-routes/bgp-mp:destination-type}
      * and delete the routes from its RIBs.
      *
      * @param tx DOMDataWriteTransaction to be passed into implementation
@@ -231,8 +236,7 @@ public abstract class AbstractRIBSupport implements RIBSupport {
      * Given the destination as ContainerNode, implementation needs to parse the DOM model
      * from this point onward:
      *
-     * {@code /bgp-mp:mp-reach-nlri/bgp-mp:advertized-routes/bgp-mp:destination-type }
-     *
+     * {@code /bgp-mp:mp-reach-nlri/bgp-mp:advertized-routes/bgp-mp:destination-type}
      * and put the routes to its RIBs.
      *
      * @param tx DOMDataWriteTransaction to be passed into implementation
@@ -246,25 +250,29 @@ public abstract class AbstractRIBSupport implements RIBSupport {
         processDestination(tx, tablePath.node(routesNodeId), destination, attributes, this.putRoute);
     }
 
-    protected abstract void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath, final ContainerNode destination,
-        final ContainerNode attributes, final ApplyRoute applyFunction);
+    protected abstract void processDestination(DOMDataWriteTransaction tx, YangInstanceIdentifier routesPath,
+            ContainerNode destination, ContainerNode attributes, ApplyRoute applyFunction);
 
-    private static ContainerNode getDestination(final DataContainerChild<? extends PathArgument, ?> routes, final NodeIdentifier destinationId) {
+    private static ContainerNode getDestination(final DataContainerChild<? extends PathArgument, ?> routes,
+            final NodeIdentifier destinationId) {
         if (routes instanceof ContainerNode) {
-            final Optional<DataContainerChild<? extends PathArgument, ?>> maybeDestination = ((ContainerNode)routes).getChild(DESTINATION_TYPE);
+            final Optional<DataContainerChild<? extends PathArgument, ?>> maybeDestination =
+                    ((ContainerNode) routes).getChild(DESTINATION_TYPE);
             if (maybeDestination.isPresent()) {
                 final DataContainerChild<? extends PathArgument, ?> destination = maybeDestination.get();
                 if (destination instanceof ChoiceNode) {
-                    final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRet = ((ChoiceNode)destination).getChild(destinationId);
+                    final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRet =
+                            ((ChoiceNode) destination).getChild(destinationId);
                     if (maybeRet.isPresent()) {
                         final DataContainerChild<? extends PathArgument, ?> ret = maybeRet.get();
                         if (ret instanceof ContainerNode) {
-                            return (ContainerNode)ret;
+                            return (ContainerNode) ret;
                         }
 
                         LOG.debug("Specified node {} is not a container, ignoring it", ret);
                     } else {
-                        LOG.debug("Specified container {} is not present in destination {}", destinationId, destination);
+                        LOG.debug("Specified container {} is not present in destination {}",
+                                destinationId, destination);
                     }
                 } else {
                     LOG.warn("Destination {} is not a choice, ignoring it", destination);
@@ -305,18 +313,21 @@ public abstract class AbstractRIBSupport implements RIBSupport {
     }
 
     @Override
-    public final void deleteRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath, final ContainerNode nlri) {
+    public final void deleteRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
+            final ContainerNode nlri) {
         deleteRoutes(tx, tablePath, nlri, ROUTES);
     }
 
     @Override
-    public final void putRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath, final ContainerNode nlri, final ContainerNode attributes) {
+    public final void putRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
+            final ContainerNode nlri, final ContainerNode attributes) {
         putRoutes(tx, tablePath, nlri, attributes, ROUTES);
     }
 
     @Nonnull
     @Override
-    public final Update buildUpdate(final Collection<MapEntryNode> advertised, final Collection<MapEntryNode> withdrawn, final Attributes attr) {
+    public final Update buildUpdate(final Collection<MapEntryNode> advertised, final Collection<MapEntryNode> withdrawn,
+            final Attributes attr) {
         final UpdateBuilder ub = new UpdateBuilder();
         final AttributesBuilder ab = new AttributesBuilder(attr);
         final CNextHop hop = ab.getCNextHop();
@@ -342,8 +353,9 @@ public abstract class AbstractRIBSupport implements RIBSupport {
     }
 
     @Override
-    public final void deleteRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath, final ContainerNode nlri,
-            final NodeIdentifier routesNodeId) {
+    @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
+    public final void deleteRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
+            final ContainerNode nlri, final NodeIdentifier routesNodeId) {
         final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = nlri.getChild(WITHDRAWN_ROUTES);
         if (maybeRoutes.isPresent()) {
             final ContainerNode destination = getDestination(maybeRoutes.get(), destinationContainerIdentifier());
@@ -356,8 +368,8 @@ public abstract class AbstractRIBSupport implements RIBSupport {
     }
 
     @Override
-    public final void putRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath, final ContainerNode nlri,
-            final ContainerNode attributes, final NodeIdentifier routesNodeId) {
+    public final void putRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
+            final ContainerNode nlri, final ContainerNode attributes, final NodeIdentifier routesNodeId) {
         final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = nlri.getChild(ADVERTISED_ROUTES);
         if (maybeRoutes.isPresent()) {
             final ContainerNode destination = getDestination(maybeRoutes.get(), destinationContainerIdentifier());
@@ -371,23 +383,27 @@ public abstract class AbstractRIBSupport implements RIBSupport {
 
     private static final class DeleteRoute implements ApplyRoute {
         @Override
-        public final void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base, final NodeIdentifierWithPredicates routeKey,
-            final DataContainerNode<?> route, final ContainerNode attributes) {
+        public void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base,
+                final NodeIdentifierWithPredicates routeKey, final DataContainerNode<?> route,
+                final ContainerNode attributes) {
             tx.delete(LogicalDatastoreType.OPERATIONAL, base.node(routeKey));
         }
     }
 
     private final class PutRoute implements ApplyRoute {
         @Override
-        public void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base, final NodeIdentifierWithPredicates routeKey,
-            final DataContainerNode<?> route, final ContainerNode attributes) {
+        public void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base,
+                final NodeIdentifierWithPredicates routeKey, final DataContainerNode<?> route,
+                final ContainerNode attributes) {
             // Build the DataContainer data
-            final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> b = ImmutableNodes.mapEntryBuilder();
+            final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> b =
+                    ImmutableNodes.mapEntryBuilder();
             b.withNodeIdentifier(routeKey);
 
             route.getValue().forEach(b::withChild);
             // Add attributes
-            final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> cb = Builders.containerBuilder(attributes);
+            final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> cb =
+                    Builders.containerBuilder(attributes);
             cb.withNodeIdentifier(routeAttributesIdentifier());
             b.withChild(cb.build());
             tx.put(LogicalDatastoreType.OPERATIONAL, base.node(routeKey), b.build());
index 7c51d1979d5aed367eeabb1bdcf0c74288e623c1..59a75bd539c3940d759494c3e054ff66f9ab6f74 100644 (file)
@@ -9,7 +9,8 @@ package org.opendaylight.protocol.bgp.rib.spi;
 
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 
-public abstract class AbstractRIBSupportRegistration<T extends RIBSupport> extends AbstractObjectRegistration<T> implements RIBSupportRegistration<T> {
+public abstract class AbstractRIBSupportRegistration<T extends RIBSupport>
+        extends AbstractObjectRegistration<T> implements RIBSupportRegistration<T> {
     protected AbstractRIBSupportRegistration(final T instance) {
         super(instance);
     }
index 98599036fec00cfda2d6a03094997dbf10929075..242534f6ef998c0f709eadfac0b7c41850cd8e62 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bgp.rib.spi;
 
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -22,33 +23,35 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  */
 interface AddPathRibSupport {
     /**
-     * Extract PathId from route change received
+     * Extract PathId from route change received.
      *
      * @param normalizedNode Path Id Container
      * @return pathId  The path identifier value
      */
-    default Long extractPathId(NormalizedNode<?, ?> normalizedNode) {
+    default Long extractPathId(@Nonnull NormalizedNode<?, ?> normalizedNode) {
         return NON_PATH_ID;
     }
 
     /**
-     * Construct a PathArgument to an AddPathRoute
+     * Construct a PathArgument to an AddPathRoute.
      *
      * @param pathId  The path identifier
      * @param routeId PathArgument leaf path
      * @return routeId PathArgument + pathId or Null in case Add-path is not supported
      */
-    @Nullable default PathArgument getRouteIdAddPath(long pathId, PathArgument routeId) {
+    @Nullable
+    default PathArgument getRouteIdAddPath(long pathId, @Nonnull PathArgument routeId) {
         return null;
     }
 
     /**
-     * Create a new Path Argument for route Key removing remove Path Id from key
-     * For non extension which doesnt support Multiple Path this step is not required
-     * @param routeKeyPathArgument  routeKey Path Argument
+     * Create a new Path Argument for route Key removing remove Path Id from key.
+     * For non extension which doesnt support Multiple Path this step is not required.
+     *
+     * @param routeKeyPathArgument routeKey Path Argument
      * @return new route Key
      */
-    default PathArgument createRouteKeyPathArgument(PathArgument routeKeyPathArgument) {
+    default @Nonnull PathArgument createRouteKeyPathArgument(@Nonnull PathArgument routeKeyPathArgument) {
         return routeKeyPathArgument;
     }
 }
index d8633444af90991fa221b89983e068146d13e9e7..ff6811ec6cc29e77c4aa5546008f470509b0a6a1 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bgp.rib.spi;
 import io.netty.channel.ChannelInboundHandler;
 import java.util.List;
 import java.util.Set;
+import javax.annotation.Nonnull;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType;
@@ -17,9 +18,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 
 /**
  * BGP Session represents the finite state machine in BGP, including timers and its purpose is to create a BGP
- * connection between BGP speakers. Session is automatically started, when TCP connection is created, but can be stopped
- * manually via close method of the {@link java.io.Closeable} interface.
- *
+ * connection between BGP speakers. Session is automatically started, when TCP connection is created,
+ * but can be stopped manually via close method of the {@link java.io.Closeable} interface.
  * If the session is up, it has to redirect messages to/from user. Handles also malformed messages and unknown requests.
  */
 public interface BGPSession extends AutoCloseable, ChannelInboundHandler {
@@ -28,6 +28,7 @@ public interface BGPSession extends AutoCloseable, ChannelInboundHandler {
      *
      * @return Set of tables which it supports.
      */
+    @Nonnull
     Set<BgpTableType> getAdvertisedTableTypes();
 
     /**
@@ -35,6 +36,7 @@ public interface BGPSession extends AutoCloseable, ChannelInboundHandler {
      *
      * @return Peer's BGP Router ID.
      */
+    @Nonnull
     Ipv4Address getBgpId();
 
     /**
@@ -42,12 +44,15 @@ public interface BGPSession extends AutoCloseable, ChannelInboundHandler {
      *
      * @return Peer's AS Number
      */
+    @Nonnull
     AsNumber getAsNumber();
+
     /**
      * Return a list with Add Path tables supported advertised and corresponding SendReceive mode.
      *
      * @return AddPathTables supported
      */
+    @Nonnull
     List<AddressFamilies> getAdvertisedAddPathTableTypes();
 
     /**
@@ -56,6 +61,7 @@ public interface BGPSession extends AutoCloseable, ChannelInboundHandler {
      *
      * @return Set of tables which it supports.
      */
+    @Nonnull
     List<BgpTableType> getAdvertisedGracefulRestartTableTypes();
 
 }
index 0abe78b90afa46f5d3a2ce0e335a5e79e4f51132..18817ac6c1f5476e0a130eaeb549133982de4ff6 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.protocol.bgp.rib.spi;
 
 import java.util.EventListener;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 import org.opendaylight.yangtools.yang.binding.Notification;
@@ -18,39 +20,41 @@ import org.opendaylight.yangtools.yang.binding.Notification;
 public interface BGPSessionListener extends PeerRPCs, EventListener {
 
     /**
-     * Marks synchronization finished for given Table key
+     * Marks synchronization finished for given Table key.
      *
      * @param tablesKey of the table where synchronization finished
      */
-    void markUptodate(final TablesKey tablesKey);
+    void markUptodate(@Nonnull TablesKey tablesKey);
 
     /**
      * Fired when the session was established successfully.
      *
      * @param session Peer address families which we accepted
      */
-    void onSessionUp(BGPSession session);
+    void onSessionUp(@Nonnull BGPSession session);
+
     /**
      * Fired when the session went down because of an IO error. Implementation should take care of closing underlying
      * session.
      *
      * @param session that went down
-     * @param e Exception that was thrown as the cause of session being down
+     * @param exc     Exception that was thrown as the cause of session being down
      */
 
-    void onSessionDown(BGPSession session, Exception e);
+    void onSessionDown(@Nonnull BGPSession session, @Nonnull Exception exc);
+
     /**
      * Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state.
      * Any outstanding queued messages were not sent. The user should not attempt to make any use of the session.
      *
      * @param reason the cause why the session went down
      */
-    void onSessionTerminated(BGPSession session, BGPTerminationReason reason);
+    void onSessionTerminated(@Nullable BGPSession session, @Nonnull BGPTerminationReason reason);
 
     /**
      * Fired when a normal protocol message is received.
      *
      * @param notification Protocol message
      */
-    void onMessage(BGPSession session, Notification notification) throws BGPDocumentedException;
+    void onMessage(@Nonnull BGPSession session, @Nonnull Notification notification) throws BGPDocumentedException;
 }
index 1fe15dfff289d968d55cf0392ef9a6e516a6ea1f..50341b78354eb15ac1482dbe7d2d92417567bf80 100644 (file)
@@ -23,39 +23,48 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
  */
 public interface ExportPolicyPeerTracker {
     /**
-     * Register Peer
-     * @param peerId Peer Id
-     * @param sendReceive send receive add ath configuration of the peer
-     * @param peerPath Yii of the peer
-     * @param peerRole Role of the peer
-     * @param simpleRoutingPolicy
+     * Register Peer.
+     *
+     * @param peerId              Peer Id
+     * @param sendReceive         send receive add ath configuration of the peer
+     * @param peerPath            Yii of the peer
+     * @param peerRole            Role of the peer
+     * @param simpleRoutingPolicy optional
      */
+    @Nonnull
     AbstractRegistration registerPeer(@Nonnull PeerId peerId, @Nullable SendReceive sendReceive,
             @Nonnull YangInstanceIdentifier peerPath, @Nonnull PeerRole peerRole,
-        @Nonnull Optional<SimpleRoutingPolicy> simpleRoutingPolicy);
+            @Nonnull Optional<SimpleRoutingPolicy> simpleRoutingPolicy);
 
     /**
-     * returns PeerExportGroup per role
+     * Returns PeerExportGroup per role.
+     *
      * @param role of desired PeerExportGroup
      * @return PeerExportGroup
      */
+    @Nonnull
     PeerExportGroup getPeerGroup(@Nonnull PeerRole role);
 
     /**
-     * check whether the peer supports the table
+     * Check whether the peer supports the table.
+     *
      * @param peerId of peer
      * @return true if peer supports table
      */
     boolean isTableSupported(@Nonnull PeerId peerId);
 
     /**
+     * Returns roles per PeerID.
+     *
      * @param peerId of peer
      * @return Role of peer
      */
+    @Nullable
     PeerRole getRole(@Nonnull YangInstanceIdentifier peerId);
 
     /**
-     * Check whether Peer supports Add Path
+     * Check whether Peer supports Add Path.
+     *
      * @param peerId of peer
      * @return true if add-path is supported
      */
@@ -63,14 +72,15 @@ public interface ExportPolicyPeerTracker {
 
     /**
      * Flags peers once empty structure has been created, then changes under it can
-     * be applied
+     * be applied.
      *
      * @param peerId of peer
      */
-    void registerPeerAsInitialized(PeerId peerId);
+    void registerPeerAsInitialized(@Nonnull PeerId peerId);
 
     /**
-     * check whether the peer supports the table
+     * Check whether the peer supports the table.
+     *
      * @param peerId of peer
      * @return true if peer supports table
      */
index 0618c2ace4e62750da5caaf63add656b6395dc8a..b07f30e373ba6cfa28dbf66f389c6b5f9a59ba64 100644 (file)
@@ -19,8 +19,10 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 public final class IdentifierUtils {
-    private static final Predicate<PathArgument> IS_PEER = input -> input instanceof NodeIdentifierWithPredicates && Peer.QNAME.equals(input.getNodeType());
-    private static final Predicate<PathArgument> IS_TABLES = input -> input instanceof NodeIdentifierWithPredicates && Tables.QNAME.equals(input.getNodeType());
+    private static final Predicate<PathArgument> IS_PEER = input -> input
+            instanceof NodeIdentifierWithPredicates && Peer.QNAME.equals(input.getNodeType());
+    private static final Predicate<PathArgument> IS_TABLES = input -> input
+            instanceof NodeIdentifierWithPredicates && Tables.QNAME.equals(input.getNodeType());
     private static final QName PEER_ID = QName.create(Peer.QNAME, "peer-id").intern();
 
     private IdentifierUtils() {
@@ -28,13 +30,16 @@ public final class IdentifierUtils {
     }
 
     // FIXME: implement as id.firstIdentifierOf(IS_PEER), null indicating not found
-    private static NodeIdentifierWithPredicates firstKeyOf(final YangInstanceIdentifier id, final Predicate<PathArgument> match) {
+    private static NodeIdentifierWithPredicates firstKeyOf(final YangInstanceIdentifier id,
+            final Predicate<PathArgument> match) {
         final PathArgument ret = id.getPathArguments().stream().filter(match::apply).findFirst().get();
-        Preconditions.checkArgument(ret instanceof NodeIdentifierWithPredicates, "Non-key peer identifier %s", ret);
+        Preconditions.checkArgument(ret instanceof NodeIdentifierWithPredicates,
+                "Non-key peer identifier %s", ret);
         return (NodeIdentifierWithPredicates) ret;
     }
 
-    private static YangInstanceIdentifier firstIdentifierOf(final YangInstanceIdentifier id, final Predicate<PathArgument> match) {
+    private static YangInstanceIdentifier firstIdentifierOf(final YangInstanceIdentifier id,
+            final Predicate<PathArgument> match) {
         final int idx = Iterables.indexOf(id.getPathArguments(), match);
         Preconditions.checkArgument(idx != -1, "Failed to find %s in %s", match, id);
         // we want the element at index idx to be included in the list
index c5cd60502b8c3769f86806e87785549a2b108c92..2264e3873b6c0d9a45fd7a5a9892cd183d3be2a9 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
- * Implements common methods for Advertisement of Multiple Paths on ribSupport
+ * Implements common methods for Advertisement of Multiple Paths on ribSupport.
  */
 public abstract class MultiPathAbstractRIBSupport extends AbstractRIBSupport {
     private final QName routeKeyQname;
@@ -36,17 +36,19 @@ public abstract class MultiPathAbstractRIBSupport extends AbstractRIBSupport {
      * the same model which populates it with route grouping instantiation, and by extension with
      * the route attributes container.
      *
-     * @param cazeClass Binding class of the AFI/SAFI-specific case statement, must not be null
-     * @param containerClass Binding class of the container in routes choice, must not be null.
-     * @param listClass Binding class of the route list, nust not be null;
+     * @param cazeClass          Binding class of the AFI/SAFI-specific case statement, must not be null
+     * @param containerClass     Binding class of the container in routes choice, must not be null.
+     * @param listClass          Binding class of the route list, nust not be null;
      * @param addressFamilyClass address Family Class
-     * @param safiClass SubsequentAddressFamily
-     * @param routeKeyNaming Route Key name (prefix/ route-key / etc..)
-     * @param destinationQname destination Qname
+     * @param safiClass          SubsequentAddressFamily
+     * @param routeKeyNaming     Route Key name (prefix/ route-key / etc..)
+     * @param destinationQname   destination Qname
      */
-    protected MultiPathAbstractRIBSupport(final Class<? extends Routes> cazeClass, final Class<? extends DataObject> containerClass,
-        final Class<? extends Route> listClass, final Class<? extends AddressFamily> addressFamilyClass,
-        final Class<? extends SubsequentAddressFamily> safiClass, final String routeKeyNaming, final QName destinationQname) {
+    protected MultiPathAbstractRIBSupport(final Class<? extends Routes> cazeClass,
+            final Class<? extends DataObject> containerClass,
+            final Class<? extends Route> listClass, final Class<? extends AddressFamily> addressFamilyClass,
+            final Class<? extends SubsequentAddressFamily> safiClass, final String routeKeyNaming,
+            final QName destinationQname) {
         super(cazeClass, containerClass, listClass, addressFamilyClass, safiClass, destinationQname);
         this.routeKeyQname = QName.create(routeQName(), routeKeyNaming).intern();
         this.pathIdQname = QName.create(routeQName(), "path-id").intern();
@@ -68,7 +70,7 @@ public abstract class MultiPathAbstractRIBSupport extends AbstractRIBSupport {
     @Override
     public final Long extractPathId(final NormalizedNode<?, ?> data) {
         final Long pathId = PathIdUtil.extractPathId(data, this.routePathIdNid());
-        if(pathId == null) {
+        if (pathId == null) {
             return PathIdUtil.NON_PATH_ID;
         }
         return pathId;
@@ -82,7 +84,8 @@ public abstract class MultiPathAbstractRIBSupport extends AbstractRIBSupport {
 
     @Override
     public final PathArgument createRouteKeyPathArgument(final PathArgument routeKey) {
-        final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(routeKeyQName(), PathIdUtil.getObjectKey(routeKey, routeKeyQName()));
+        final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(routeKeyQName(),
+                PathIdUtil.getObjectKey(routeKey, routeKeyQName()));
         return new NodeIdentifierWithPredicates(routeQName(), keyValues);
     }
 
index 13ca868915b18ac7fdf732e351f92126564ae7f9..7ec0fbe5fabba6d2bec0b00ed3787c6cc115e096 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.protocol.bgp.rib.spi;
 
 import com.google.common.util.concurrent.ListenableFuture;
+import javax.annotation.Nonnull;
 
 /**
  * Marker interface identifying a BGP peer.
@@ -18,18 +19,21 @@ public interface Peer {
      *
      * @return symbolic name.
      */
+    @Nonnull
     String getName();
 
     /**
-     * Return the peer's BGP identifier as raw bytearray
+     * Return the peer's BGP identifier as raw byte array.
+     *
      * @return byte[] raw identifier
      */
     byte[] getRawIdentifier();
 
     /**
-     *  Close Peers and performs asynchronously DS clean up
+     * Close Peers and performs asynchronously DS clean up.
      *
      * @return future
      */
+    @Nonnull
     ListenableFuture<?> close();
 }
index 81e5a846bbcb53e398a22b6c7a71c2776673b7bd..c682916068902e183aff3d08af8e97fd2bd11b86 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.protocol.bgp.rib.spi;
 
 import java.util.function.BiConsumer;
+import javax.annotation.Nonnull;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -18,6 +19,31 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
  * A collection of peers sharing the same export policy.
  */
 public interface PeerExportGroup {
+    /**
+     * Transform outgoing attributes according to policy per Peer.
+     *
+     * @param role       root Peer role
+     * @param attributes attributes container
+     * @return return attributes container after apply policy
+     */
+    @Nonnull
+    ContainerNode effectiveAttributes(@Nonnull PeerRole role, @Nonnull ContainerNode attributes);
+
+    /**
+     * Returns if peer is present.
+     *
+     * @param routePeerId PeerId
+     * @return true if peer is present on this export group
+     */
+    boolean containsPeer(@Nonnull PeerId routePeerId);
+
+    /**
+     * Applies the given action for each entry in this PeerExportGroup on synchronized mode.
+     *
+     * @param action action to be applied
+     */
+    void forEach(@Nonnull BiConsumer<PeerId, YangInstanceIdentifier> action);
+
     final class PeerExporTuple {
         private final YangInstanceIdentifier yii;
         private final PeerRole role;
@@ -35,27 +61,4 @@ public interface PeerExportGroup {
             return this.role;
         }
     }
-
-    /**
-     * Transform outgoing attributes according to policy per Peer
-     *
-     * @param role root Peer role
-     * @param attributes attributes container
-     * @return return attributes container after apply policy
-     */
-    ContainerNode effectiveAttributes(PeerRole role, ContainerNode attributes);
-
-    /**
-     *
-     * @param routePeerId PeerId
-     * @return true if peer is present on this export group
-     */
-    boolean containsPeer(PeerId routePeerId);
-
-    /**
-     * Applies the given action for each entry in this PeerExportGroup on synchronized mode
-     *
-     * @param action action to be applied
-     */
-    void forEach(BiConsumer<PeerId, YangInstanceIdentifier> action);
 }
index d1a6767e45aee5f90005d2e2f12afe8d2d348907..4636137c63463091bc872d89e02b96e8d122337e 100644 (file)
@@ -8,13 +8,15 @@
 package org.opendaylight.protocol.bgp.rib.spi;
 
 import com.google.common.util.concurrent.ListenableFuture;
+import javax.annotation.Nonnull;
 
 /**
  * Contains all Peer RPC methods related.
  */
 public interface PeerRPCs {
     /**
-     * Release Peer session
+     * Release Peer session.
      */
+    @Nonnull
     ListenableFuture<?> releaseConnection();
 }
index b40a3e5fab7c1ada1c19af5f6995f31fa166bbf0..72f44134481cf78d28df4d53a61234a189779725 100644 (file)
@@ -18,7 +18,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public final class PeerRoleUtil {
-    public static final NodeIdentifier PEER_ROLE_NID = new NodeIdentifier(QName.create(Peer.QNAME, "peer-role").intern());
+    public static final NodeIdentifier PEER_ROLE_NID = new NodeIdentifier(QName.create(Peer.QNAME,
+            "peer-role").intern());
 
     private PeerRoleUtil() {
         throw new UnsupportedOperationException();
@@ -34,16 +35,16 @@ public final class PeerRoleUtil {
 
     public static String roleForString(final PeerRole role) {
         switch (role) {
-        case Ebgp:
-            return "ebgp";
-        case Ibgp:
-            return "ibgp";
-        case RrClient:
-            return "rr-client";
-        case Internal:
-            return "internal";
-        default:
-            throw new IllegalArgumentException("Unhandled role " + role);
+            case Ebgp:
+                return "ebgp";
+            case Ibgp:
+                return "ibgp";
+            case RrClient:
+                return "rr-client";
+            case Internal:
+                return "internal";
+            default:
+                throw new IllegalArgumentException("Unhandled role " + role);
         }
     }
 }
index 8d89c040394663ea2ff74233124177acf43705e3..bed316df481042f1c798740aa7a32d7d18773e32 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrate
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 
 /**
  * Interface for acquiring AdjRIBsIn factories. In order for a model-driven RIB implementation to work correctly, it
@@ -24,28 +24,33 @@ public interface RIBExtensionConsumerContext {
 
     /**
      * Acquire a RIB implementation factory for a AFI/SAFI combination.
+     *
      * @param key AFI/SAFI key
-     * @return RIBSupport instance, or null if the AFI/SAFI is
-     *         not implemented.
+     * @return RIBSupport instance, or null if the AFI/SAFI is not implemented.
      */
-    @Nullable RIBSupport getRIBSupport(@Nonnull TablesKey key);
+    @Nullable
+    RIBSupport getRIBSupport(@Nonnull TablesKey key);
 
     /**
      * Acquire a RIB implementation factory for a AFI/SAFI combination.
-     * @param afi Address Family Identifier
+     *
+     * @param afi  Address Family Identifier
      * @param safi Subsequent Address Family identifier
-     * @return RIBSupport instance, or null if the AFI/SAFI is
-     *         not implemented.
+     * @return RIBSupport instance, or null if the AFI/SAFI is not implemented.
      */
-    @Nullable RIBSupport getRIBSupport(@Nonnull Class<? extends AddressFamily> afi, @Nonnull Class<? extends SubsequentAddressFamily> safi);
+    @Nullable
+    RIBSupport getRIBSupport(@Nonnull Class<? extends AddressFamily> afi,
+        @Nonnull Class<? extends SubsequentAddressFamily> safi);
 
     /**
      * Acquire a RIB implementation factory for a AFI/SAFI combination.
+     *
      * @param key Tables key with AFI/SAFI
      * @return RIBSupport instance, or null if the AFI/SAFI is
-     *         not implemented.
+     *     not implemented.
      */
-    @Nullable RIBSupport getRIBSupport(YangInstanceIdentifier.NodeIdentifierWithPredicates key);
+    @Nullable
+    RIBSupport getRIBSupport(@Nonnull NodeIdentifierWithPredicates key);
 
 
     /**
@@ -54,5 +59,6 @@ public interface RIBExtensionConsumerContext {
      *
      * @return Class loading strategy for loading YANG modeled classes.
      */
-    @Nonnull GeneratedClassLoadingStrategy getClassLoadingStrategy();
+    @Nonnull
+    GeneratedClassLoadingStrategy getClassLoadingStrategy();
 }
\ No newline at end of file
index 5d43c44f237eaecfd1dafcbf468d88d9b0910520..7be48989dd96d05b150b79119e4d39681015816b 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.protocol.bgp.rib.spi;
 
+import javax.annotation.Nonnull;
+
 public interface RIBExtensionProviderActivator {
-    void startRIBExtensionProvider(RIBExtensionProviderContext context);
+    void startRIBExtensionProvider(@Nonnull RIBExtensionProviderContext context);
 
     void stopRIBExtensionProvider();
 }
index 0c50c842fdf0e41b7ea7d7bf21142034d5732e45..dc2e98b4ad9483a16d1a0c7e25e3420f77cd46fd 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.protocol.bgp.rib.spi;
 
+import javax.annotation.Nonnull;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
 
@@ -20,11 +21,13 @@ public interface RIBExtensionProviderContext extends RIBExtensionConsumerContext
     /**
      * Register a RIBSupport instance for a particular AFI/SAFI combination.
      *
-     * @param afi Address Family identifier
-     * @param safi Subsequent Address Family identifier
+     * @param afi     Address Family identifier
+     * @param safi    Subsequent Address Family identifier
      * @param support T RIBSupport instance
      * @return Registration handle. Call {@link RIBSupportRegistration#close()} method to remove it.
      * @throws NullPointerException if any of the arguments is null
      */
-    <T extends RIBSupport> RIBSupportRegistration<T> registerRIBSupport(Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi, T support);
+    <T extends RIBSupport> RIBSupportRegistration<T> registerRIBSupport(
+            @Nonnull Class<? extends AddressFamily> afi,
+            @Nonnull Class<? extends SubsequentAddressFamily> safi, T support);
 }
index 08bcfa8c0bbe6da72e09c57b02fa50f55d1f80e1..83f787113ba45e50c48622438f4b2b3278ac60fd 100644 (file)
@@ -41,7 +41,8 @@ public interface RIBSupport extends AddPathRibSupport {
      *
      * @return Protocol-specific case in the routes choice, may not be null.
      */
-    @Nonnull ChoiceNode emptyRoutes();
+    @Nonnull
+    ChoiceNode emptyRoutes();
 
     /**
      * Return the localized identifier of the attributes route member, as expanded
@@ -49,41 +50,49 @@ public interface RIBSupport extends AddPathRibSupport {
      *
      * @return The attributes identifier, may not be null.
      */
-    @Nonnull NodeIdentifier routeAttributesIdentifier();
+    @Nonnull
+    NodeIdentifier routeAttributesIdentifier();
 
     /**
      * Return class object of the Routes Case statement.
      *
      * @return Class
      */
-    @Nonnull Class<? extends Routes> routesCaseClass();
+    @Nonnull
+    Class<? extends Routes> routesCaseClass();
 
     /**
      * Return class object of the Routes Container statement.
      *
      * @return Class
      */
-    @Nonnull Class<? extends DataObject> routesContainerClass();
+    @Nonnull
+    Class<? extends DataObject> routesContainerClass();
 
     /**
      * Return class object of the Routes List statement.
      *
      * @return Class
      */
-    @Nonnull Class<? extends Route> routesListClass();
+    @Nonnull
+    Class<? extends Route> routesListClass();
 
-    @Nonnull ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects();
-    @Nonnull ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects();
+    @Nonnull
+    ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects();
+
+    @Nonnull
+    ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects();
 
     /**
      * Given the NLRI as ContainerNode, this method should extract withdrawn routes
      * from the DOM model and delete them from RIBs.
      *
-     * @param tx DOMDataWriteTransaction
+     * @param tx        DOMDataWriteTransaction
      * @param tablePath YangInstanceIdentifier
-     * @param nlri ContainerNode DOM representation of NLRI in Update message
+     * @param nlri      ContainerNode DOM representation of NLRI in Update message
      */
-    void deleteRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath, @Nonnull ContainerNode nlri);
+    void deleteRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath,
+            @Nonnull ContainerNode nlri);
 
 
     /**
@@ -95,23 +104,25 @@ public interface RIBSupport extends AddPathRibSupport {
      * For default "bgp-rib" RIBs use {@link #deleteRoutes}
      * </p>
      *
-     * @param tx DOMDataWriteTransaction
-     * @param tablePath YangInstanceIdentifier
-     * @param nlri ContainerNode DOM representation of NLRI in Update message
+     * @param tx           DOMDataWriteTransaction
+     * @param tablePath    YangInstanceIdentifier
+     * @param nlri         ContainerNode DOM representation of NLRI in Update message
      * @param routesNodeId NodeIdentifier of "routes" data node
      */
-    void deleteRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath, @Nonnull ContainerNode nlri, @Nonnull NodeIdentifier routesNodeId);
+    void deleteRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath,
+            @Nonnull ContainerNode nlri, @Nonnull NodeIdentifier routesNodeId);
 
     /**
      * Given the NLRI as ContainerNode, this method should extract advertised routes
      * from the DOM model and put them into RIBs.
      *
-     * @param tx DOMDataWriteTransaction
-     * @param tablePath YangInstanceIdentifier
-     * @param nlri ContainerNode DOM representation of NLRI in Update message
+     * @param tx         DOMDataWriteTransaction
+     * @param tablePath  YangInstanceIdentifier
+     * @param nlri       ContainerNode DOM representation of NLRI in Update message
      * @param attributes ContainerNode
      */
-    void putRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath, @Nonnull ContainerNode nlri, @Nonnull ContainerNode attributes);
+    void putRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath,
+            @Nonnull ContainerNode nlri, @Nonnull ContainerNode attributes);
 
     /**
      * Given the NLRI as ContainerNode, this method should extract advertised routes
@@ -122,14 +133,14 @@ public interface RIBSupport extends AddPathRibSupport {
      * For default "bgp-rib" RIBs use {@link #putRoutes}
      * </p>
      *
-     * @param tx DOMDataWriteTransaction
-     * @param tablePath YangInstanceIdentifier
-     * @param nlri ContainerNode DOM representation of NLRI in Update message
-     * @param attributes ContainerNode
+     * @param tx           DOMDataWriteTransaction
+     * @param tablePath    YangInstanceIdentifier
+     * @param nlri         ContainerNode DOM representation of NLRI in Update message
+     * @param attributes   ContainerNode
      * @param routesNodeId NodeIdentifier of "routes" data node
      */
-    void putRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath, @Nonnull ContainerNode nlri,
-            @Nonnull ContainerNode attributes, @Nonnull NodeIdentifier routesNodeId);
+    void putRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath,
+            @Nonnull ContainerNode nlri, @Nonnull ContainerNode attributes, @Nonnull NodeIdentifier routesNodeId);
 
     /**
      * Returns routes that were modified within this RIB support instance.
@@ -137,16 +148,19 @@ public interface RIBSupport extends AddPathRibSupport {
      * @param routes DataTreeCandidateNode
      * @return collection of modified nodes or empty collection if no node was modified
      */
-    @Nonnull Collection<DataTreeCandidateNode> changedRoutes(@Nonnull DataTreeCandidateNode routes);
+    @Nonnull
+    Collection<DataTreeCandidateNode> changedRoutes(@Nonnull DataTreeCandidateNode routes);
 
     /**
      * Constructs an instance identifier path to routeId.
      *
      * @param routesPath YangInstanceIdentifier base path
-     * @param routeId PathArgument leaf path
+     * @param routeId    PathArgument leaf path
      * @return YangInstanceIdentifier with routesPath + specific RIB support routes path + routeId
      */
-    @Nonnull YangInstanceIdentifier routePath(@Nonnull YangInstanceIdentifier routesPath, @Nonnull PathArgument routeId);
+    @Nonnull
+    YangInstanceIdentifier routePath(@Nonnull YangInstanceIdentifier routesPath,
+            @Nonnull PathArgument routeId);
 
     /**
      * Indicate whether this AFI/SAFI combination is a complex route. Simple routes are those which
@@ -161,20 +175,25 @@ public interface RIBSupport extends AddPathRibSupport {
      * binding-aware format. This needs to be done per each AFI/SAFI.
      *
      * @param advertised Collection of advertised routes in DOM format
-     * @param withdrawn Collection of withdrawn routes in DOM format
-     * @param attr Attributes MpReach is part of Attributes so we need to pass
-     *             it as argument, create new AttributesBuilder with existing
-     *             attributes and add MpReach
+     * @param withdrawn  Collection of withdrawn routes in DOM format
+     * @param attr       Attributes MpReach is part of Attributes so we need to pass
+     *                   it as argument, create new AttributesBuilder with existing
+     *                   attributes and add MpReach
      * @return Update message ready to be sent out
      */
-    @Nonnull Update buildUpdate(@Nonnull Collection<MapEntryNode> advertised, @Nonnull Collection<MapEntryNode> withdrawn, @Nonnull Attributes attr);
+    @Nonnull
+    Update buildUpdate(@Nonnull Collection<MapEntryNode> advertised,
+            @Nonnull Collection<MapEntryNode> withdrawn, @Nonnull Attributes attr);
 
-    @Nonnull Class<? extends AddressFamily> getAfi();
+    @Nonnull
+    Class<? extends AddressFamily> getAfi();
 
-    @Nonnull Class<? extends SubsequentAddressFamily> getSafi();
+    @Nonnull
+    Class<? extends SubsequentAddressFamily> getSafi();
 
     interface ApplyRoute {
-        void apply(DOMDataWriteTransaction tx, YangInstanceIdentifier base, NodeIdentifierWithPredicates routeKey, DataContainerNode<?> route,
-            ContainerNode attributes);
+        void apply(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier base,
+                @Nonnull NodeIdentifierWithPredicates routeKey,
+                @Nonnull DataContainerNode<?> route, ContainerNode attributes);
     }
 }
index 8d2afaebd3a85ee5956b54f86b480125b873eaec..5bb324ab37aaa2220dca05c7937008ff3e979586 100644 (file)
@@ -30,9 +30,9 @@ public final class RibSupportUtils {
     }
 
     /**
-     * Creates Yang Instance Identifier path argument from supplied AFI and SAFI
+     * Creates Yang Instance Identifier path argument from supplied AFI and SAFI.
      *
-     * @param afi Class representing AFI
+     * @param afi  Class representing AFI
      * @param safi Class representing SAFI
      * @return NodeIdentifierWithPredicates of {@link Tables} for specified AFI, SAFI combination.
      */
@@ -42,66 +42,69 @@ public final class RibSupportUtils {
     }
 
     /**
-     * Creates Yang Instance Identifier path argument from supplied AFI and SAFI
+     * Creates Yang Instance Identifier path argument from supplied AFI and SAFI.
      *
-     * @param id QNAME representing node
-     * @param afi Class representing AFI
+     * @param id   QNAME representing node
+     * @param afi  Class representing AFI
      * @param safi Class representing SAFI
      * @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
      */
-    public static NodeIdentifierWithPredicates toYangKey(final QName id, final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
+    public static NodeIdentifierWithPredicates toYangKey(final QName id, final Class<? extends AddressFamily> afi,
+            final Class<? extends SubsequentAddressFamily> safi) {
         final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(
-                        AFI_QNAME, BindingReflections.findQName(afi),
-                        SAFI_QNAME, BindingReflections.findQName(safi));
+                AFI_QNAME, BindingReflections.findQName(afi),
+                SAFI_QNAME, BindingReflections.findQName(safi));
         return new NodeIdentifierWithPredicates(id, keyValues);
     }
 
 
     /**
-     * Creates Yang Instance Identifier path argument from supplied AFI and SAFI
+     * Creates Yang Instance Identifier path argument from supplied AFI and SAFI.
      *
-     * @param id QNAME representing node
-     * @param afi Class representing AFI
+     * @param id   QNAME representing node
+     * @param afi  Class representing AFI
      * @param safi Class representing SAFI
      * @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
      */
     public static NodeIdentifierWithPredicates toYangPathKey(final QName id, final Class<? extends AddressFamily> afi,
-        final Class<? extends SubsequentAddressFamily> safi) {
+            final Class<? extends SubsequentAddressFamily> safi) {
         final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(
-            ADD_PATH_AFI_QNAME, BindingReflections.findQName(afi),
-            ADD_PATH_SAFI_QNAME, BindingReflections.findQName(safi));
+                ADD_PATH_AFI_QNAME, BindingReflections.findQName(afi),
+                ADD_PATH_SAFI_QNAME, BindingReflections.findQName(safi));
         return new NodeIdentifierWithPredicates(id, keyValues);
     }
 
     /**
-     * Creates Yang Instance Identifier path argument from supplied {@link TablesKey}
+     * Creates Yang Instance Identifier path argument from supplied {@link TablesKey}.
      *
      * @param id QNAME representing node
-     * @param k Tables key representing table.
+     * @param tablesKey  Tables key representing table.
      * @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
      */
-    public static NodeIdentifierWithPredicates toYangKey(final QName id, final TablesKey k) {
-        return toYangKey(id, k.getAfi(), k.getSafi());
+    @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
+    public static NodeIdentifierWithPredicates toYangKey(final QName id, final TablesKey tablesKey) {
+        return toYangKey(id, tablesKey.getAfi(), tablesKey.getSafi());
     }
 
     /**
-     * Creates Yang Instance Identifier path argument from supplied {@link TablesKey}
+     * Creates Yang Instance Identifier path argument from supplied {@link TablesKey}.
      *
      * @param id QNAME representing node
-     * @param k  Add PAth Tables key representing table.
+     * @param tablesKey  Add PAth Tables key representing table.
      * @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
      */
-    public static NodeIdentifierWithPredicates toYangKey(final QName id, final SupportedTablesKey k) {
-        return toYangPathKey(id, k.getAfi(), k.getSafi());
+    public static NodeIdentifierWithPredicates toYangKey(final QName id, final SupportedTablesKey tablesKey) {
+        return toYangPathKey(id, tablesKey.getAfi(), tablesKey.getSafi());
     }
 
     /**
-     * Creates Yang Instance Identifier path argument from supplied {@link TablesKey}
+     * Creates Yang Instance Identifier path argument from supplied {@link TablesKey}.
      *
-     * @param k Tables key representing table.
+     * @param tablesKey Tables key representing table.
      * @return NodeIdentifierWithPredicates of {@link Tables} for specified AFI, SAFI combination.
      */
-    public static NodeIdentifierWithPredicates toYangTablesKey(final TablesKey k) {
-        return toYangTablesKey(k.getAfi(), k.getSafi());
+    @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
+    public static NodeIdentifierWithPredicates toYangTablesKey(final TablesKey tablesKey) {
+        return toYangTablesKey(tablesKey.getAfi(), tablesKey.getSafi());
     }
 }
index eaf1411d4949742a34eadc2cabb0e6528903d4ad..66fb2729b757e31d302e4b5c0341dc01fe89581a 100644 (file)
@@ -18,19 +18,21 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 
 public final class RouterIds {
-    private static final LoadingCache<String, UnsignedInteger> ROUTER_IDS = CacheBuilder.newBuilder().weakValues().build(new CacheLoader<String, UnsignedInteger>() {
-        @Override
-        public UnsignedInteger load(final String key) {
-            return UnsignedInteger.fromIntBits(InetAddresses.coerceToInteger(InetAddresses.forString(key)));
-        }
-    });
-    private static final LoadingCache<PeerId, UnsignedInteger> BGP_ROUTER_IDS = CacheBuilder.newBuilder().weakValues().build(new CacheLoader<PeerId, UnsignedInteger>() {
-        @Override
-        public UnsignedInteger load(final PeerId key) {
-            return routerIdForAddress(key.getValue().substring(BGP_PREFIX.length()));
-        }
-    });
+    private static final LoadingCache<String, UnsignedInteger> ROUTER_IDS =
+            CacheBuilder.newBuilder().weakValues().build(new CacheLoader<String, UnsignedInteger>() {
+                @Override
+                public UnsignedInteger load(final String key) {
+                    return UnsignedInteger.fromIntBits(InetAddresses.coerceToInteger(InetAddresses.forString(key)));
+                }
+            });
     private static final String BGP_PREFIX = "bgp://";
+    private static final LoadingCache<PeerId, UnsignedInteger> BGP_ROUTER_IDS =
+            CacheBuilder.newBuilder().weakValues().build(new CacheLoader<PeerId, UnsignedInteger>() {
+                @Override
+                public UnsignedInteger load(final PeerId key) {
+                    return routerIdForAddress(key.getValue().substring(BGP_PREFIX.length()));
+                }
+            });
 
     private RouterIds() {
         throw new UnsupportedOperationException();
index 81fa92bd5b4aa198f5ca9b341ea176f063e647f0..e7c939974dde31ff5104ece55748508ccd98859e 100644 (file)
@@ -9,15 +9,13 @@ package org.opendaylight.protocol.bgp.rib.spi;
 
 import static java.util.Objects.requireNonNull;
 
+import com.google.common.annotations.VisibleForTesting;
 import java.util.ServiceLoader;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- *
- */
-public final class ServiceLoaderRIBExtensionConsumerContext extends SimpleRIBExtensionProviderContext implements AutoCloseable {
+public final class ServiceLoaderRIBExtensionConsumerContext extends SimpleRIBExtensionProviderContext
+        implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(ServiceLoaderRIBExtensionConsumerContext.class);
     private final ServiceLoader<RIBExtensionProviderActivator> loader;
 
@@ -29,14 +27,16 @@ public final class ServiceLoaderRIBExtensionConsumerContext extends SimpleRIBExt
         }
     }
 
-    public static ServiceLoaderRIBExtensionConsumerContext createConsumerContext() {
-        final ServiceLoader<RIBExtensionProviderActivator> loader = ServiceLoader.load(RIBExtensionProviderActivator.class);
-        final ServiceLoaderRIBExtensionConsumerContext ctx = new ServiceLoaderRIBExtensionConsumerContext(loader);
+    @VisibleForTesting
+    static ServiceLoaderRIBExtensionConsumerContext createConsumerContext() {
+        final ServiceLoader<RIBExtensionProviderActivator> loader =
+                ServiceLoader.load(RIBExtensionProviderActivator.class);
 
-        return ctx;
+        return new ServiceLoaderRIBExtensionConsumerContext(loader);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         for (RIBExtensionProviderActivator a : this.loader) {
             try {
index eb91dd0efad3863e4a083f9397461860295da2c4..5a5ff1fb72c3112a3a6a8af232ff2bf174065d60 100644 (file)
@@ -39,8 +39,9 @@ public class SimpleRIBExtensionProviderContext implements RIBExtensionProviderCo
             final Class<? extends SubsequentAddressFamily> safi, final T support) {
         final TablesKey key = new TablesKey(afi, safi);
         final RIBSupport prev = this.supports.putIfAbsent(key, support);
-        Preconditions.checkArgument(prev == null, "AFI %s SAFI %s is already registered with %s", afi, safi, prev);
-        this.domSupports.put(RibSupportUtils.toYangTablesKey(afi,safi), support);
+        Preconditions.checkArgument(prev == null, "AFI %s SAFI %s is already registered with %s",
+                afi, safi, prev);
+        this.domSupports.put(RibSupportUtils.toYangTablesKey(afi, safi), support);
         addClassLoadingSupport(afi, safi, support);
         return new AbstractRIBSupportRegistration<T>(support) {
             @Override
@@ -50,17 +51,18 @@ public class SimpleRIBExtensionProviderContext implements RIBExtensionProviderCo
         };
     }
 
-    private void addClassLoadingSupport(final Class<?> afi, final Class<?> safi, final RIBSupport s) {
-        final Set<YangModuleInfo> moduleInfos =
-                getModuleInfos(afi, safi, s.routesListClass(), s.routesContainerClass(), s.routesCaseClass());
-        if(!moduleInfos.isEmpty()) {
+    private void addClassLoadingSupport(final Class<?> afi, final Class<?> safi, final RIBSupport support) {
+        final Set<YangModuleInfo> moduleInfos = getModuleInfos(afi, safi, support.routesListClass(),
+                support.routesContainerClass(), support.routesCaseClass());
+        if (!moduleInfos.isEmpty()) {
             this.classLoadingStrategy.addModuleInfos(moduleInfos);
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static Set<YangModuleInfo> getModuleInfos(final Class<?>... clazzes) {
         final Set<YangModuleInfo> moduleInfos = new HashSet<>();
-        for(final Class<?> clz : clazzes) {
+        for (final Class<?> clz : clazzes) {
             try {
                 moduleInfos.add(BindingReflections.getModuleInfo(clz));
             } catch (final Exception e) {
@@ -71,7 +73,8 @@ public class SimpleRIBExtensionProviderContext implements RIBExtensionProviderCo
     }
 
     @Override
-    public RIBSupport getRIBSupport(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
+    public RIBSupport getRIBSupport(final Class<? extends AddressFamily> afi,
+            final Class<? extends SubsequentAddressFamily> safi) {
         return getRIBSupport(new TablesKey(afi, safi));
     }
 
@@ -86,6 +89,7 @@ public class SimpleRIBExtensionProviderContext implements RIBExtensionProviderCo
     }
 
     @Override
+    @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
     public RIBSupport getRIBSupport(final NodeIdentifierWithPredicates key) {
         return this.domSupports.get(key);
     }
index 2d91f32102fca1481a95dde06e6bf3b75f49f923..02f22e57716b29918ba7edd68c35546d0aafc1e7 100644 (file)
@@ -15,8 +15,6 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Starts and stops RIBExtensionProviderActivator instances for a RIBExtensionProviderContext.
- *
- * @author Thomas Pantelis
  */
 public final class SimpleRIBExtensionProviderContextActivator implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(SimpleRIBExtensionProviderContextActivator.class);
@@ -33,7 +31,7 @@ public final class SimpleRIBExtensionProviderContextActivator implements AutoClo
     public void start() {
         LOG.info("Starting {} RIBExtensionProviderActivator instances", this.extensionActivators.size());
 
-        for(final RIBExtensionProviderActivator e : this.extensionActivators) {
+        for (final RIBExtensionProviderActivator e : this.extensionActivators) {
             e.startRIBExtensionProvider(this.providerContext);
         }
     }
@@ -42,7 +40,7 @@ public final class SimpleRIBExtensionProviderContextActivator implements AutoClo
     public void close() {
         LOG.info("Stopping {} RIBExtensionProviderActivator instances", this.extensionActivators.size());
 
-        for(final RIBExtensionProviderActivator e : this.extensionActivators) {
+        for (final RIBExtensionProviderActivator e : this.extensionActivators) {
             e.stopRIBExtensionProvider();
         }
     }
index 85e7d8d24248c9fdaec63ec8efc91f4499f0bf85..acaf9069d0f9a36380c7baf945e0a7bd97d6a4ed 100644 (file)
@@ -13,11 +13,11 @@ import javax.annotation.Nonnull;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 
 /**
- * BGP Operational Afi SafiS State
+ * BGP Operational Afi SafiS State.
  */
 public interface BGPAfiSafiState extends BGPGracelfulRestartState {
     /**
-     * is AfiSafi Supported
+     * is AfiSafi Supported.
      *
      * @param tablesKey tables Key
      * @return true if Afi Safi was advertized to and by the neighbor
@@ -25,7 +25,7 @@ public interface BGPAfiSafiState extends BGPGracelfulRestartState {
     boolean isAfiSafiSupported(@Nonnull TablesKey tablesKey);
 
     /**
-     * Prefixes installed per specific tablekey
+     * Prefixes installed per specific tablekey.
      *
      * @param tablesKey tables Key
      * @return count
@@ -33,7 +33,7 @@ public interface BGPAfiSafiState extends BGPGracelfulRestartState {
     long getPrefixesInstalledCount(@Nonnull TablesKey tablesKey);
 
     /**
-     * Prefixed sent to the Peer count
+     * Prefixed sent to the Peer count.
      *
      * @param tablesKey tablesKey Type
      * @return Prefixes sent count
@@ -41,7 +41,7 @@ public interface BGPAfiSafiState extends BGPGracelfulRestartState {
     long getPrefixesSentCount(@Nonnull TablesKey tablesKey);
 
     /**
-     * Prefixed received from the peer count
+     * Prefixed received from the peer count.
      *
      * @param tablesKey tablesKey Type
      * @return Prefixed received count
@@ -49,7 +49,7 @@ public interface BGPAfiSafiState extends BGPGracelfulRestartState {
     long getPrefixesReceivedCount(@Nonnull TablesKey tablesKey);
 
     /**
-     * List of TablesKey - Afi Safi Advertized to the neighbor
+     * List of TablesKey - Afi Safi Advertized to the neighbor.
      *
      * @return TableKeys
      */
@@ -57,7 +57,7 @@ public interface BGPAfiSafiState extends BGPGracelfulRestartState {
     Set<TablesKey> getAfiSafisAdvertized();
 
     /**
-     * List of TablesKey - Afi Safi Advertized by neighbor
+     * List of TablesKey - Afi Safi Advertized by neighbor.
      *
      * @return TableKeys
      */
index 7bea1d2d962d81fb0aa9d29fc8e5a2bdd7fcf73d..09f309d7a328b6b683306303c1275d02b64f8fab 100644 (file)
@@ -9,11 +9,11 @@
 package org.opendaylight.protocol.bgp.rib.spi.state;
 
 /**
- * BGP Operational Error Handling State
+ * BGP Operational Error Handling State.
  */
 public interface BGPErrorHandlingState {
     /**
-     * Erroneous Update Received count
+     * Erroneous Update Received count.
      *
      * @return count
      */
index 5558e2e7d4645dd18fc0fb70ead6af0212dcc108..ced14a9bfc8649068a860f06e9e6e0899fbad502 100644 (file)
@@ -12,11 +12,11 @@ import javax.annotation.Nonnull;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 
 /**
- * BGP Operational Graceful Restart State
+ * BGP Operational Graceful Restart State.
  */
 public interface BGPGracelfulRestartState {
     /**
-     * is Graceful Restart Supported advertized to neighbor
+     * is Graceful Restart Supported advertized to neighbor.
      *
      * @param tablesKey tables Key
      * @return true if Afi Safi was advertized to neighbor
@@ -24,15 +24,15 @@ public interface BGPGracelfulRestartState {
     boolean isGracefulRestartAdvertized(@Nonnull TablesKey tablesKey);
 
     /**
-     * is Graceful Restart Supported advertized by neighbor
+     * is Graceful Restart Supported advertized by neighbor.
      *
      * @param tablesKey tables Key
      * @return true if Afi Safi was advertized by neighbor
      */
-    boolean isGracefulRestartReceived(TablesKey tablesKey);
+    boolean isGracefulRestartReceived(@Nonnull TablesKey tablesKey);
 
     /**
-     * This flag indicates whether the local neighbor is currently restarting
+     * This flag indicates whether the local neighbor is currently restarting.
      *
      * @return local restarting state
      */
@@ -40,7 +40,7 @@ public interface BGPGracelfulRestartState {
 
     /**
      * The period of time (advertised by the peer) that the peer expects a restart of a
-     * BGP session to take
+     * BGP session to take.
      *
      * @return time
      */
@@ -48,7 +48,7 @@ public interface BGPGracelfulRestartState {
 
     /**
      * This flag indicates whether the remote neighbor is currently in the process of
-     * restarting, and hence received routes are currently stale
+     * restarting, and hence received routes are currently stale.
      *
      * @return peer is restarting
      */
index a351d4faa80bad3f37fcc2592c49eefb2cae48ca..56df3b5ccfd07a53bacfb9865c6467190e61f68b 100644 (file)
@@ -9,32 +9,32 @@
 package org.opendaylight.protocol.bgp.rib.spi.state;
 
 /**
- * BGP Peer Messages Operational State
+ * BGP Peer Messages Operational State.
  */
 public interface BGPPeerMessagesState {
     /**
-     * Update Messages Sent count
+     * Update Messages Sent count.
      *
      * @return count
      */
     long getUpdateMessagesSentCount();
 
     /**
-     * Notification Messages Sent count
+     * Notification Messages Sent count.
      *
      * @return count
      */
     long getNotificationMessagesSentCount();
 
     /**
-     * Update Messages Received count
+     * Update Messages Received count.
      *
      * @return count
      */
     long getUpdateMessagesReceivedCount();
 
     /**
-     * Notification Update Messages Received count
+     * Notification Update Messages Received count.
      *
      * @return count
      */
index 4f02eb38570d68473a7f26dbc33743bddb871da9..64368074283a5c4bb74a88f04dfdd9008aed96b7 100644 (file)
@@ -14,7 +14,7 @@ import org.opendaylight.protocol.bgp.rib.RibReference;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 
 /**
- * Representing operational state related to a particular BGP neighbor
+ * Representing operational state related to a particular BGP neighbor.
  * - Counters for BGP messages sent and received from the neighbor
  * - Operational state of timers associated with the BGP neighbor
  * - Operational state of the transport session associated with the BGP neighbor
@@ -25,14 +25,14 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
  */
 public interface BGPPeerState extends RibReference {
     /**
-     * Indicates whether this instance is being actively managed and updated
+     * Indicates whether this instance is being actively managed and updated.
      *
      * @return active
      */
     boolean isActive();
 
     /**
-     * PeerGroup Id
+     * PeerGroup Id.
      *
      * @return PeerGroup Id
      */
@@ -40,7 +40,7 @@ public interface BGPPeerState extends RibReference {
     String getGroupId();
 
     /**
-     * Return Neighbor Key/Address
+     * Return Neighbor Key/Address.
      *
      * @return neighbor Address
      */
@@ -48,7 +48,7 @@ public interface BGPPeerState extends RibReference {
     IpAddress getNeighborAddress();
 
     /**
-     * Paths installed under Effective-Rib-In for a BGP neighbor
+     * Paths installed under Effective-Rib-In for a BGP neighbor.
      * Represented per Prefixes, the cost of calculate paths per each Prefix on Effective-Rib-in is not worth
      * at this point, check comment under incrementPrefixesInstalled
      *
@@ -59,52 +59,63 @@ public interface BGPPeerState extends RibReference {
     }
 
     /**
-     * Prefixes installed under Effective-Rib-In for a BGP neighbor
+     * Prefixes installed under Effective-Rib-In for a BGP neighbor.
      *
      * @return Paths counter
      */
     long getTotalPrefixes();
 
     /**
-     * Error Handling State
+     * Error Handling State.
+     *
      * @return ErrorHandlingState
      */
     @Nonnull
     BGPErrorHandlingState getBGPErrorHandlingState();
 
     /**
-     * Afi Safi Operational State
+     * Afi Safi Operational State.
+     *
      * @return AfiSafiState
      */
     @Nonnull
     BGPAfiSafiState getBGPAfiSafiState();
 
     /**
-     * BGP Session Operational State
+     * BGP Session Operational State.
+     *
      * @return BGPSessionState
      */
-    @Nullable BGPSessionState getBGPSessionState();
+    @Nullable
+    BGPSessionState getBGPSessionState();
 
     /**
-     * BGP Message Operational State
+     * BGP Message Operational State.
+     *
      * @return BGPPeerMessagesState
      */
-    @Nullable BGPPeerMessagesState getBGPPeerMessagesState();
+    @Nullable
+    BGPPeerMessagesState getBGPPeerMessagesState();
 
     /**
-     * BGP Operation Timers State
+     * BGP Operation Timers State.
+     *
      * @return BGPTimersState
      */
-    @Nullable BGPTimersState getBGPTimersState();
+    @Nullable
+    BGPTimersState getBGPTimersState();
 
     /**
-     *  BGP Operational Transport State
+     * BGP Operational Transport State.
+     *
      * @return BGPTransportState
      */
-    @Nullable BGPTransportState getBGPTransportState();
+    @Nullable
+    BGPTransportState getBGPTransportState();
 
     /**
-     * BGP Operational GracelfulRestart State
+     * BGP Operational GracelfulRestart State.
+     *
      * @return BGPGracelfulRestartState
      */
     @Nonnull
index 2b5490ab3e40a925d2026bbd8a3395841f0e7ce2..e0502a6fd38361099b3f70bdbbb4dfcd5ddddd2d 100644 (file)
@@ -11,11 +11,12 @@ package org.opendaylight.protocol.bgp.rib.spi.state;
 import javax.annotation.Nullable;
 
 /**
- *  Interface for acquiring BGP Peer State
+ * Interface for acquiring BGP Peer State.
  */
 public interface BGPPeerStateConsumer {
     /**
-     * Returns Peer Operational State
+     * Returns Peer Operational State.
+     *
      * @return BGP Peer State
      */
     @Nullable
index fd0c2d39c4e7200d95efc5e90b38791334b2dcd1..8c88b1ca98aba92a6f87af3e95978b735b0e896e 100644 (file)
@@ -8,49 +8,51 @@
 
 package org.opendaylight.protocol.bgp.rib.spi.state;
 
+import javax.annotation.Nonnull;
 import org.opendaylight.protocol.bgp.rib.spi.State;
 
 /**
- * BGP Operational Session State
+ * BGP Operational Session State.
  */
 public interface BGPSessionState {
     /**
-     * Internal session state
+     * Internal session state.
      *
      * @return Internal session state
      */
+    @Nonnull
     State getSessionState();
 
     /**
-     * Additional Path capability
+     * Additional Path capability.
      *
      * @return true if supported
      */
     boolean isAddPathCapabilitySupported();
 
     /**
-     * AS 4 Bytes capability
+     * AS 4 Bytes capability.
      *
      * @return true if supported
      */
     boolean isAsn32CapabilitySupported();
 
     /**
-     * Graceful Restart
+     * Graceful Restart.
      *
      * @return true if supported
      */
     boolean isGracefulRestartCapabilitySupported();
 
     /**
-     * Multiprotocol capability
+     * Multiprotocol capability.
      *
      * @return true if supported
      */
     boolean isMultiProtocolCapabilitySupported();
 
     /**
-     * Router Refresh Capability
+     * Router Refresh Capability.
      *
      * @return true if supported
      */
index bc127ac92aace9693edb60b64784187c854a5b7e..5dd42b00b7174f2e72922e2c147dec389a53eaf4 100644 (file)
@@ -9,20 +9,25 @@
 package org.opendaylight.protocol.bgp.rib.spi.state;
 
 import java.util.List;
+import javax.annotation.Nonnull;
 
 /**
- * Provides list with Operational State of BGP RIBs
+ * Provides list with Operational State of BGP RIBs.
  */
 public interface BGPStateConsumer {
     /**
-     * List of Registered BGP Rib States
+     * List of Registered BGP Rib States.
+     *
      * @return ribs stats
      */
+    @Nonnull
     List<BGPRIBState> getRibStats();
 
     /**
-     * List of Registered BGP Peer State
+     * List of Registered BGP Peer State.
+     *
      * @return peers stats
      */
+    @Nonnull
     List<BGPPeerState> getPeerStats();
 }
index 025b3d8515bf8056aa2320a078dd8ffead06c4b1..6f3a0db4c127b97670fb45a30306a6f3659052ce 100644 (file)
@@ -8,31 +8,39 @@
 
 package org.opendaylight.protocol.bgp.rib.spi.state;
 
+import javax.annotation.Nonnull;
+
 /**
- * Provider of BGP Operational state
+ * Provider of BGP Operational state.
  */
 public interface BGPStateProvider {
     /**
-     * register Rib state
+     * register Rib state.
+     *
      * @param bgpState rib State
      */
-    void bind(BGPRIBStateConsumer bgpState);
+    void bind(@Nonnull BGPRIBStateConsumer bgpState);
 
     /**
-     * Unregister Rib state
+     * Unregister Rib state.
+     *
      * @param bgpState Rib/Peer State
      */
-    void unbind(BGPRIBStateConsumer bgpState);
+    void unbind(@Nonnull BGPRIBStateConsumer bgpState);
 
     /**
-     * registerRib/Peer state
+     * registerRib/Peer state.
+     *
      * @param bgpState rib State
      */
-    void bind(BGPPeerStateConsumer bgpState);
+    @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
+    void bind(@Nonnull BGPPeerStateConsumer bgpState);
 
     /**
-     * Unregister Peer state
+     * Unregister Peer state.
+     *
      * @param bgpState Peer State
      */
-    void unbind(BGPPeerStateConsumer bgpState);
+    @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
+    void unbind(@Nonnull BGPPeerStateConsumer bgpState);
 }
index 10be31fdb9f4249eb9fba6f6e64623a970721de8..08629dcf38e97ef01f7d0215562bad708f2d3784 100644 (file)
@@ -9,18 +9,18 @@
 package org.opendaylight.protocol.bgp.rib.spi.state;
 
 /**
- * BGP Operational Timer State
+ * BGP Operational Timer State.
  */
 public interface BGPTimersState {
     /**
-     * Negotiated Hold Time
+     * Negotiated Hold Time.
      *
      * @return Hold Time
      */
     long getNegotiatedHoldTime();
 
     /**
-     * The time (MILLISECONDS) for how long session has been up or on idle state
+     * The time (MILLISECONDS) for how long session has been up or on idle state.
      *
      * @return time
      */
index aad36513c62b61d6e8c9f4ccf6f297cb46a60c0f..94ef5e22a8ec45011c972463b6b22a246a7eea23 100644 (file)
@@ -14,11 +14,11 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 
 /**
- * BGP Operational Transport State
+ * BGP Operational Transport State.
  */
 public interface BGPTransportState {
     /**
-     * Local Port
+     * Local Port.
      *
      * @return port
      */
@@ -26,7 +26,7 @@ public interface BGPTransportState {
     PortNumber getLocalPort();
 
     /**
-     * Remote Address
+     * Remote Address.
      *
      * @return IpAddress
      */
@@ -34,7 +34,7 @@ public interface BGPTransportState {
     IpAddress getRemoteAddress();
 
     /**
-     * Remote Port
+     * Remote Port.
      *
      * @return port
      */
index 8df6f68b230569a71df08cabea7fa17956eb9e81..9c3174ecefc02a5346386c54e8e1a28767fe0097 100644 (file)
@@ -35,12 +35,13 @@ public final class ClusterSingletonServiceRegistrationHelper {
      * execute repeated registration attempts while catching RuntimeException. If registration is not successful,
      * RuntimeException is re-thrown.
      *
-     * @param singletonProvider
-     * @param clusterSingletonService
+     * @param singletonProvider Cluster Singleton Service Provider
+     * @param clusterSingletonService Cluster Singleton Service
      * @param maxAttempts             Upper bound for registration retries count.
      * @param sleepTime               Sleep time between registration retries in milliseconds.
      * @return Registration
      */
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public static ClusterSingletonServiceRegistration registerSingletonService(
         final ClusterSingletonServiceProvider singletonProvider,
         final ClusterSingletonService clusterSingletonService, final int maxAttempts, final int sleepTime) {
@@ -69,8 +70,8 @@ public final class ClusterSingletonServiceRegistrationHelper {
      * RuntimeException is re-thrown. 10 registration attempts will be tried with 10 ms pause between each
      * other.
      *
-     * @param singletonProvider
-     * @param clusterSingletonService
+     * @param singletonProvider Cluster Singleton Service Provider
+     * @param clusterSingletonService Cluster Singleton Service
      * @return Registration
      */
     public static ClusterSingletonServiceRegistration registerSingletonService(final ClusterSingletonServiceProvider
index a3afe8985b7eaa978cc385274da040598015a63b..5ee0feaf5e69db6a014641a862c79ab2530155a8 100644 (file)
@@ -8,6 +8,10 @@
 
 package org.opendaylight.protocol.bgp.rib.spi;
 
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.MockitoAnnotations.initMocks;
+
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
 import java.util.ArrayList;
@@ -19,8 +23,6 @@ import javassist.ClassPool;
 import org.junit.After;
 import org.junit.Before;
 import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
@@ -66,10 +68,14 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 public abstract class AbstractRIBSupportTest {
     protected static final long PATH_ID = 1;
     protected static final Attributes ATTRIBUTES = new AttributesBuilder().build();
-    private static final InstanceIdentifier<LocRib> RIB = InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(new RibId("rib"))).child(LocRib.class).build();
-    private static final InstanceIdentifier<Attributes> ATTRIBUTES_IID = InstanceIdentifier.create(Update.class).child(Attributes.class);
-    private static final InstanceIdentifier<MpUnreachNlri> MP_UNREACH_IID = ATTRIBUTES_IID.augmentation(Attributes2.class).child(MpUnreachNlri.class);
-    private static final InstanceIdentifier<MpReachNlri> MP_REACH_IID = ATTRIBUTES_IID.augmentation(Attributes1.class).child(MpReachNlri.class);
+    private static final InstanceIdentifier<LocRib> RIB = InstanceIdentifier.builder(BgpRib.class)
+            .child(Rib.class, new RibKey(new RibId("rib"))).child(LocRib.class).build();
+    private static final InstanceIdentifier<Attributes> ATTRIBUTES_IID = InstanceIdentifier.create(Update.class)
+            .child(Attributes.class);
+    private static final InstanceIdentifier<MpUnreachNlri> MP_UNREACH_IID = ATTRIBUTES_IID
+            .augmentation(Attributes2.class).child(MpUnreachNlri.class);
+    private static final InstanceIdentifier<MpReachNlri> MP_REACH_IID = ATTRIBUTES_IID.augmentation(Attributes1.class)
+            .child(MpReachNlri.class);
 
     @Mock
     protected DOMDataWriteTransaction tx;
@@ -82,41 +88,51 @@ public abstract class AbstractRIBSupportTest {
 
     protected final void setUpTestCustomizer(final AbstractRIBSupport ribSupport) throws Exception {
         this.abstractRIBSupport = ribSupport;
-        this.moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(this.abstractRIBSupport.routesContainerClass()));
+        this.moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(this.abstractRIBSupport
+                .routesContainerClass()));
         this.mappingService.onGlobalContextUpdated(this.moduleInfoBackedContext.tryToCreateSchemaContext().get());
     }
 
     @Before
     public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        Mockito.doAnswer(invocation -> {
+        initMocks(this);
+        doAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
-            AbstractRIBSupportTest.this.insertedRoutes.add(AbstractRIBSupportTest.this.mappingService.fromNormalizedNode((YangInstanceIdentifier) args[1], (NormalizedNode<?, ?>) args[2]));
+            AbstractRIBSupportTest.this.insertedRoutes.add(AbstractRIBSupportTest.this.mappingService
+                    .fromNormalizedNode((YangInstanceIdentifier) args[1], (NormalizedNode<?, ?>) args[2]));
             return args[1];
-        }).when(this.tx).put(Mockito.any(LogicalDatastoreType.class), Mockito.any(YangInstanceIdentifier.class), Mockito.any(NormalizedNode.class));
+        }).when(this.tx).put(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class),
+                any(NormalizedNode.class));
 
-        Mockito.doAnswer(invocation -> {
+        doAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
-            AbstractRIBSupportTest.this.deletedRoutes.add(AbstractRIBSupportTest.this.mappingService.fromYangInstanceIdentifier((YangInstanceIdentifier) args[1]));
+            AbstractRIBSupportTest.this.deletedRoutes.add(AbstractRIBSupportTest.this.mappingService
+                    .fromYangInstanceIdentifier((YangInstanceIdentifier) args[1]));
             return args[1];
-        }).when(this.tx).delete(Mockito.any(LogicalDatastoreType.class), Mockito.any(YangInstanceIdentifier.class));
+        }).when(this.tx).delete(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class));
         this.deletedRoutes = new ArrayList<>();
         this.insertedRoutes = new ArrayList<>();
 
-        this.mappingService = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(),
-            new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
+        this.mappingService = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy
+                .getTCCLClassLoadingStrategy(),
+            new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator
+                    .create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
         this.moduleInfoBackedContext = ModuleInfoBackedContext.create();
     }
 
     protected final ContainerNode createNlriWithDrawnRoute(final DestinationType destUnreach) {
-        final MpUnreachNlri mpReach = new MpUnreachNlriBuilder().setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(destUnreach).build()).build();
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> result = this.mappingService.toNormalizedNode(MP_UNREACH_IID, mpReach);
+        final MpUnreachNlri mpReach = new MpUnreachNlriBuilder().setWithdrawnRoutes(new WithdrawnRoutesBuilder()
+                .setDestinationType(destUnreach).build()).build();
+        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> result = this.mappingService
+                .toNormalizedNode(MP_UNREACH_IID, mpReach);
         return (ContainerNode) result.getValue();
     }
 
     protected final ContainerNode createNlriAdvertiseRoute(final DestinationType destReach) {
-        final MpReachNlri mpReach = new MpReachNlriBuilder().setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(destReach).build()).build();
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> result = this.mappingService.toNormalizedNode(MP_REACH_IID, mpReach);
+        final MpReachNlri mpReach = new MpReachNlriBuilder().setAdvertizedRoutes(new AdvertizedRoutesBuilder()
+                .setDestinationType(destReach).build()).build();
+        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> result = this.mappingService
+                .toNormalizedNode(MP_REACH_IID, mpReach);
         return (ContainerNode) result.getValue();
     }
 
@@ -153,18 +169,21 @@ public abstract class AbstractRIBSupportTest {
         return this.mappingService.toYangInstanceIdentifier(routesIId).node(getRouteListQname());
     }
 
+    @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
     protected final Collection<MapEntryNode> createRoutes(final DataObject routes) {
-        Preconditions.checkArgument(routes.getImplementedInterface().equals(this.abstractRIBSupport.routesContainerClass()));
+        Preconditions.checkArgument(routes.getImplementedInterface()
+                .equals(this.abstractRIBSupport.routesContainerClass()));
         final InstanceIdentifier<DataObject> routesIId = routesIId();
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNode = this.mappingService.toNormalizedNode(routesIId, routes);
+        final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNode = this.mappingService
+                .toNormalizedNode(routesIId, routes);
         final ContainerNode container = (ContainerNode) normalizedNode.getValue();
         final NodeIdentifier routeNid = new NodeIdentifier(getRouteListQname());
         return ((MapNode) container.getChild(routeNid).get()).getValue();
     }
 
     private QName getRouteListQname() {
-       return QName.create(BindingReflections.findQName(this.abstractRIBSupport.routesContainerClass()),
-           BindingReflections.findQName(this.abstractRIBSupport.routesListClass()).intern().getLocalName());
+        return QName.create(BindingReflections.findQName(this.abstractRIBSupport.routesContainerClass()),
+                BindingReflections.findQName(this.abstractRIBSupport.routesListClass()).intern().getLocalName());
     }
 
     protected final NodeIdentifierWithPredicates createRouteNIWP(final DataObject routes) {
index fa406d5eb3ffb9fceffc47b0806691dfefe638a8..fa8dc0248af298b249c0fd90fa12fe019249daf9 100644 (file)
@@ -18,7 +18,6 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 public class AddPathRibSupportTest {
 
     private static final NodeIdentifier QNAME = new NodeIdentifier(QName.create("test").intern());
-    private static class AddPathRibSupportLocalTest implements AddPathRibSupport{}
 
     @Test
     public void defaultAddPathRibSupport() {
@@ -27,4 +26,7 @@ public class AddPathRibSupportTest {
         assertNull(test.getRouteIdAddPath(NON_PATH_ID, null));
         assertEquals(QNAME, test.createRouteKeyPathArgument(QNAME));
     }
+
+    private static class AddPathRibSupportLocalTest implements AddPathRibSupport {
+    }
 }
index cb1141fa7e527b95ed78d6906ad02f3bb7078119..0ec0df0a455d33dca74faf8ff42095244424c94f 100644 (file)
@@ -10,8 +10,6 @@ package org.opendaylight.protocol.bgp.rib.spi;
 import static org.junit.Assert.assertEquals;
 
 import com.google.common.collect.ImmutableMap;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
@@ -30,25 +28,18 @@ public class IdentifierUtilsTest {
     private static final QName TABLES_KEY_QNAME = QName.create(Tables.QNAME, "tables-key").intern();
     private static final TablesKey TK = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
     private static final PeerId PEER_ID = new PeerId("127.0.0.1");
-    private static final NodeIdentifierWithPredicates NIWP_PEER = new NodeIdentifierWithPredicates(Peer.QNAME, ImmutableMap.of(PEER_ID_QNAME, PEER_ID.getValue()));
-    private static final NodeIdentifierWithPredicates NIWP_TABLE = new NodeIdentifierWithPredicates(Tables.QNAME, ImmutableMap.of(TABLES_KEY_QNAME, TK));
+    private static final NodeIdentifierWithPredicates NIWP_PEER = new NodeIdentifierWithPredicates(Peer.QNAME,
+            ImmutableMap.of(PEER_ID_QNAME, PEER_ID.getValue()));
+    private static final NodeIdentifierWithPredicates NIWP_TABLE = new NodeIdentifierWithPredicates(Tables.QNAME,
+            ImmutableMap.of(TABLES_KEY_QNAME, TK));
     private static final YangInstanceIdentifier YII_PEER;
     private static final YangInstanceIdentifier YII_TABLE;
 
     static {
-        YII_PEER = YangInstanceIdentifier.builder().node(BgpRib.QNAME).node(Peer.QNAME).nodeWithKey(Peer.QNAME, PEER_ID_QNAME, PEER_ID.getValue()).build();
-        YII_TABLE = YangInstanceIdentifier.builder().node(LocRib.QNAME).node(Tables.QNAME).nodeWithKey(Tables.QNAME, TABLES_KEY_QNAME, TK).build();
-    }
-
-    @Test(expected = UnsupportedOperationException.class)
-    public void testPrivateConstructor() throws Throwable {
-        final Constructor<IdentifierUtils> c = IdentifierUtils.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
+        YII_PEER = YangInstanceIdentifier.builder().node(BgpRib.QNAME).node(Peer.QNAME)
+                .nodeWithKey(Peer.QNAME, PEER_ID_QNAME, PEER_ID.getValue()).build();
+        YII_TABLE = YangInstanceIdentifier.builder().node(LocRib.QNAME).node(Tables.QNAME)
+                .nodeWithKey(Tables.QNAME, TABLES_KEY_QNAME, TK).build();
     }
 
     @Test
index 02dbdbdf09fe9d20d36c674f1912a253fe422326..7f8fd961b71e6c311a637a18af6b77a137878cbd 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.protocol.bgp.rib.spi;
 import static junit.framework.TestCase.assertFalse;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 
@@ -84,8 +85,10 @@ public class MultiPathAbstractRIBSupportTest {
     private static final NodeIdentifierWithPredicates PREFIX_NII = new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
         ImmutableMap.of(QName.create(Ipv4Route.QNAME, ROUTE_KEY).intern(), PREFIX));
     private static final MultiPathAbstractTest MULTI_PATH_ABSTRACT_TEST = new MultiPathAbstractTest();
-    private static final TablesKey TABLES_KEY = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
-    private static final YangInstanceIdentifier LOC_RIB_TARGET = YangInstanceIdentifier.create(YangInstanceIdentifier.of(BgpRib.QNAME)
+    private static final TablesKey TABLES_KEY = new TablesKey(Ipv4AddressFamily.class,
+            UnicastSubsequentAddressFamily.class);
+    private static final YangInstanceIdentifier LOC_RIB_TARGET = YangInstanceIdentifier
+            .create(YangInstanceIdentifier.of(BgpRib.QNAME)
         .node(LocRib.QNAME).node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(TABLES_KEY)).getPathArguments());
     private static final NodeIdentifier ROUTES_IDENTIFIER = new NodeIdentifier(Routes.QNAME);
     private static final NodeIdentifier IPV4_ROUTES_IDENTIFIER = new NodeIdentifier(Ipv4Routes.QNAME);
@@ -119,7 +122,8 @@ public class MultiPathAbstractRIBSupportTest {
 
         this.tx = Mockito.mock(DOMDataWriteTransaction.class);
         this.nlri = Mockito.mock(ContainerNode.class);
-        this.attributes = ImmutableContainerNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME
+        this.attributes = ImmutableContainerNodeBuilder.create()
+                .withNodeIdentifier(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME
             .getLocalName().intern()))).build();
         final ContainerNode destination = Mockito.mock(ContainerNode.class);
         final ContainerNode route = Mockito.mock(ContainerNode.class);
@@ -144,13 +148,14 @@ public class MultiPathAbstractRIBSupportTest {
             final Object[] args = invocation.getArguments();
             MultiPathAbstractRIBSupportTest.this.routes.remove(args[1]);
             return args[1];
-        }).when(this.tx).delete(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.any(YangInstanceIdentifier.class));
+        }).when(this.tx).delete(Mockito.eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class));
         doAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
             final NormalizedNode<?, ?> node1 = (NormalizedNode<?, ?>) args[2];
             MultiPathAbstractRIBSupportTest.this.routes.put((YangInstanceIdentifier) args[1], node1);
             return args[1];
-        }).when(this.tx).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.any(YangInstanceIdentifier.class), Mockito.any(NormalizedNode.class));
+        }).when(this.tx).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class),
+                any(NormalizedNode.class));
 
         this.mapEntryNode = Mockito.mock(MapEntryNode.class);
     }
@@ -164,15 +169,16 @@ public class MultiPathAbstractRIBSupportTest {
     @Test
     public void extractPathId() {
         final NodeIdentifier nii = new NodeIdentifier(PATH_ID_QNAME);
-        final ContainerNode cont = ImmutableContainerNodeSchemaAwareBuilder.create().withNodeIdentifier(nii).
-            addChild(new ImmutableLeafNodeBuilder<>().withNodeIdentifier(nii).withValue(PATH_ID).build()).build();
+        final ContainerNode cont = ImmutableContainerNodeSchemaAwareBuilder.create().withNodeIdentifier(nii)
+                .addChild(new ImmutableLeafNodeBuilder<>().withNodeIdentifier(nii).withValue(PATH_ID).build()).build();
         assertEquals((Long) PATH_ID, MULTI_PATH_ABSTRACT_TEST.extractPathId(cont));
     }
 
     @Test
     public void getRouteIdAddPath() {
         final NodeIdentifierWithPredicates routeIdPa =
-            new NodeIdentifierWithPredicates(Ipv4Route.QNAME, ImmutableMap.of(PATH_ID_QNAME, PATH_ID, PREFIX_QNAME, PREFIX));
+            new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
+                    ImmutableMap.of(PATH_ID_QNAME, PATH_ID, PREFIX_QNAME, PREFIX));
         assertEquals(routeIdPa, MULTI_PATH_ABSTRACT_TEST.getRouteIdAddPath(PATH_ID, PREFIX_NII));
 
     }
@@ -204,10 +210,10 @@ public class MultiPathAbstractRIBSupportTest {
 
     @Test
     public void emptyRoutes() throws Exception {
-        final ChoiceNode emptyRoutes = Builders.choiceBuilder().withNodeIdentifier(ROUTES_IDENTIFIER).addChild(Builders.containerBuilder()
-            .withNodeIdentifier(IPV4_ROUTES_IDENTIFIER).withChild(ImmutableNodes.mapNodeBuilder(MULTI_PATH_ABSTRACT_TEST.routeQName()
-            ).build()).build())
-            .build();
+        final ChoiceNode emptyRoutes = Builders.choiceBuilder().withNodeIdentifier(ROUTES_IDENTIFIER)
+                .addChild(Builders.containerBuilder().withNodeIdentifier(IPV4_ROUTES_IDENTIFIER)
+                        .withChild(ImmutableNodes.mapNodeBuilder(MULTI_PATH_ABSTRACT_TEST.routeQName())
+                                .build()).build()).build();
         assertEquals(emptyRoutes, MULTI_PATH_ABSTRACT_TEST.emptyRoutes());
     }
 
@@ -234,12 +240,14 @@ public class MultiPathAbstractRIBSupportTest {
 
     @Test
     public void routeAttributesIdentifier() throws Exception {
-        assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME.getLocalName().intern())), MULTI_PATH_ABSTRACT_TEST.routeAttributesIdentifier());
+        assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME,
+                Attributes.QNAME.getLocalName().intern())), MULTI_PATH_ABSTRACT_TEST.routeAttributesIdentifier());
     }
 
     @Test
     public void routePath() throws Exception {
-        Assert.assertEquals(LOC_RIB_TARGET.node(ROUTES_IDENTIFIER).node(Ipv4Routes.QNAME).node(Ipv4Route.QNAME).node(PREFIX_NII),
+        Assert.assertEquals(LOC_RIB_TARGET.node(ROUTES_IDENTIFIER)
+                        .node(Ipv4Routes.QNAME).node(Ipv4Route.QNAME).node(PREFIX_NII),
             MULTI_PATH_ABSTRACT_TEST.routePath(LOC_RIB_TARGET.node(Routes.QNAME), PREFIX_NII));
     }
 
@@ -265,27 +273,31 @@ public class MultiPathAbstractRIBSupportTest {
 
     @Test
     public void buildUpdate() throws Exception {
-        final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(
-            new Ipv4Address("10.0.0.2")).build()).build();
+        final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
+                .setGlobal(new Ipv4Address("10.0.0.2")).build()).build();
         final Attributes attr = new AttributesBuilder().setCNextHop(nextHop).build();
         final Collection<MapEntryNode> routes = new HashSet<>();
 
         assertEquals(new UpdateBuilder().setAttributes(new AttributesBuilder().build()).build(),
-            MULTI_PATH_ABSTRACT_TEST.buildUpdate(routes, routes, attr));
+                MULTI_PATH_ABSTRACT_TEST.buildUpdate(routes, routes, attr));
 
         routes.add(this.mapEntryNode);
-        final MpReachNlri mpReach = new MpReachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
-            .setCNextHop(nextHop).setAdvertizedRoutes(new AdvertizedRoutesBuilder().build()).build();
-
-        final Attributes attMpR = new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mpReach).build())
-            .build();
-        assertEquals(new UpdateBuilder().setAttributes(attMpR).build(), MULTI_PATH_ABSTRACT_TEST.buildUpdate(routes, Collections.emptySet(), attr));
-
-        final MpUnreachNlri mpUnreach = new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
-            .setWithdrawnRoutes(new WithdrawnRoutesBuilder().build()).build();
-
-        final Attributes attMpU = new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mpUnreach)
-            .build()).build();
-        assertEquals(new UpdateBuilder().setAttributes(attMpU).build(), MULTI_PATH_ABSTRACT_TEST.buildUpdate(Collections.emptySet(), routes, attr));
+        final MpReachNlri mpReach = new MpReachNlriBuilder().setAfi(Ipv4AddressFamily.class)
+                .setSafi(UnicastSubsequentAddressFamily.class)
+                .setCNextHop(nextHop).setAdvertizedRoutes(new AdvertizedRoutesBuilder().build()).build();
+
+        final Attributes attMpR = new AttributesBuilder().addAugmentation(Attributes1.class,
+                new Attributes1Builder().setMpReachNlri(mpReach).build()).build();
+        assertEquals(new UpdateBuilder().setAttributes(attMpR).build(),
+                MULTI_PATH_ABSTRACT_TEST.buildUpdate(routes, Collections.emptySet(), attr));
+
+        final MpUnreachNlri mpUnreach = new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class)
+                .setSafi(UnicastSubsequentAddressFamily.class)
+                .setWithdrawnRoutes(new WithdrawnRoutesBuilder().build()).build();
+
+        final Attributes attMpU = new AttributesBuilder().addAugmentation(Attributes2.class,
+                new Attributes2Builder().setMpUnreachNlri(mpUnreach).build()).build();
+        assertEquals(new UpdateBuilder().setAttributes(attMpU).build(),
+                MULTI_PATH_ABSTRACT_TEST.buildUpdate(Collections.emptySet(), routes, attr));
     }
 }
\ No newline at end of file
index 0f786ad99d7ac5afd7e4dcbadfdb6fac1e9aaaab..c749a4ad9fa3fbdf72bac4e8492a8a41c9f3618a 100644 (file)
@@ -17,7 +17,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 public class PeerExportGroupTest {
     @Test
     public void defaultPeerExportGroupTest() {
-        final  PeerExportGroup.PeerExporTuple peerExportGroup = new PeerExportGroup.PeerExporTuple(YangInstanceIdentifier.EMPTY, PeerRole.Ebgp);
+        final  PeerExportGroup.PeerExporTuple peerExportGroup = new PeerExportGroup
+                .PeerExporTuple(YangInstanceIdentifier.EMPTY, PeerRole.Ebgp);
         assertEquals(PeerRole.Ebgp, peerExportGroup.getRole());
         assertEquals(YangInstanceIdentifier.EMPTY, peerExportGroup.getYii());
     }
index ecc5d639d367877fa054a4dd8b7616f33815930c..c3b79bfac0c961e2a3050b8a5641939931df1e6f 100644 (file)
@@ -11,36 +11,23 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
 import com.google.common.base.Optional;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
 
 public class PeerRoleUtilTest {
-    @Test(expected = UnsupportedOperationException.class)
-    public void testPrivateConstructor() throws Throwable {
-        final Constructor<PeerRoleUtil> c = PeerRoleUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
     @Test
     public void roleForChange() {
         assertNull(PeerRoleUtil.roleForChange(Optional.fromNullable(null)));
         assertEquals(PeerRole.Ebgp, PeerRoleUtil.roleForChange(Optional.of(new ImmutableLeafNodeBuilder<>()
-            .withNodeIdentifier(PeerRoleUtil.PEER_ROLE_NID).withValue("ebgp").build())));
+                .withNodeIdentifier(PeerRoleUtil.PEER_ROLE_NID).withValue("ebgp").build())));
     }
 
     @Test
     public void roleForString() {
-        assertEquals("ebgp",PeerRoleUtil.roleForString(PeerRole.Ebgp));
-        assertEquals("ibgp",PeerRoleUtil.roleForString(PeerRole.Ibgp));
-        assertEquals("rr-client",PeerRoleUtil.roleForString(PeerRole.RrClient));
-        assertEquals("internal",PeerRoleUtil.roleForString(PeerRole.Internal));
+        assertEquals("ebgp", PeerRoleUtil.roleForString(PeerRole.Ebgp));
+        assertEquals("ibgp", PeerRoleUtil.roleForString(PeerRole.Ibgp));
+        assertEquals("rr-client", PeerRoleUtil.roleForString(PeerRole.RrClient));
+        assertEquals("internal", PeerRoleUtil.roleForString(PeerRole.Internal));
     }
 }
\ No newline at end of file
index e361cd98f4faa36bca842da700d2509a64b76950..bbd31d7b3a449e768df39064b4522d67f296a94c 100644 (file)
@@ -13,8 +13,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import com.google.common.collect.ImmutableMap;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.peer.SupportedTables;
@@ -31,41 +29,35 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 public class RibSupportUtilsTest {
     private static final NodeIdentifierWithPredicates NII;
     private static final NodeIdentifierWithPredicates NII_PATH;
-    final Class<? extends AddressFamily> AFI = Ipv4AddressFamily.class;
-    final Class<? extends SubsequentAddressFamily> SAFI = UnicastSubsequentAddressFamily.class;
-    private static final TablesKey TABLE_KEY = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
+    private static final Class<? extends AddressFamily> AFI = Ipv4AddressFamily.class;
+    private static final Class<? extends SubsequentAddressFamily> SAFI = UnicastSubsequentAddressFamily.class;
+    private static final TablesKey TABLE_KEY = new TablesKey(Ipv4AddressFamily.class,
+            UnicastSubsequentAddressFamily.class);
+
     static {
-        final QName afi = QName.create("urn:opendaylight:params:xml:ns:yang:bgp-rib?revision=2017-12-07", "afi");
-        final QName safi = QName.create("urn:opendaylight:params:xml:ns:yang:bgp-rib?revision=2017-12-07", "safi");
-        NII = new NodeIdentifierWithPredicates(SupportedTables.QNAME, ImmutableMap.of(afi, Ipv4AddressFamily.QNAME, safi, UnicastSubsequentAddressFamily.QNAME));
+        final QName afi = QName.create("urn:opendaylight:params:xml:ns:yang:bgp-rib?revision=2017-12-07",
+                "afi");
+        final QName safi = QName.create("urn:opendaylight:params:xml:ns:yang:bgp-rib?revision=2017-12-07",
+                "safi");
+        NII = new NodeIdentifierWithPredicates(SupportedTables.QNAME, ImmutableMap.of(afi, Ipv4AddressFamily.QNAME,
+                safi, UnicastSubsequentAddressFamily.QNAME));
         NII_PATH = new NodeIdentifierWithPredicates(SupportedTables.QNAME,
-            ImmutableMap.of(
-                QName.create("urn:opendaylight:params:xml:ns:yang:bgp-multiprotocol?revision=2017-12-07", "afi"),
-                Ipv4AddressFamily.QNAME,
-                QName.create("urn:opendaylight:params:xml:ns:yang:bgp-multiprotocol?revision=2017-12-07", "safi"),
-                UnicastSubsequentAddressFamily.QNAME)
+                ImmutableMap.of(
+                        QName.create("urn:opendaylight:params:xml:ns:yang:bgp-multiprotocol?revision=2017-12-07",
+                                "afi"), Ipv4AddressFamily.QNAME,
+                        QName.create("urn:opendaylight:params:xml:ns:yang:bgp-multiprotocol?revision=2017-12-07",
+                                "safi"), UnicastSubsequentAddressFamily.QNAME)
         );
     }
 
-    @Test(expected=UnsupportedOperationException.class)
-    public void testPrivateConstructor() throws Throwable {
-        final Constructor<RibSupportUtils> c = RibSupportUtils.class.getDeclaredConstructor(null);
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
     @Test
     public void testYangTablesKey() {
         final NodeIdentifierWithPredicates p = RibSupportUtils.toYangTablesKey(TABLE_KEY);
         final Map<QName, Object> m = p.getKeyValues();
         assertFalse(m.isEmpty());
         assertEquals(Tables.QNAME, p.getNodeType());
-        assertTrue(m.containsValue(BindingReflections.findQName(this.AFI)));
-        assertTrue(m.containsValue(BindingReflections.findQName(this.SAFI)));
+        assertTrue(m.containsValue(BindingReflections.findQName(AFI)));
+        assertTrue(m.containsValue(BindingReflections.findQName(SAFI)));
     }
 
     @Test
@@ -74,16 +66,17 @@ public class RibSupportUtilsTest {
         final Map<QName, Object> m = p.getKeyValues();
         assertFalse(m.isEmpty());
         assertEquals(SupportedTables.QNAME, p.getNodeType());
-        assertTrue(m.containsValue(BindingReflections.findQName(this.AFI)));
-        assertTrue(m.containsValue(BindingReflections.findQName(this.SAFI)));
+        assertTrue(m.containsValue(BindingReflections.findQName(AFI)));
+        assertTrue(m.containsValue(BindingReflections.findQName(SAFI)));
     }
 
     @Test
     public void toYangPathKey() {
-        final NodeIdentifierWithPredicates result = RibSupportUtils.toYangPathKey(SupportedTables.QNAME, this.AFI, this.SAFI);
+        final NodeIdentifierWithPredicates result = RibSupportUtils.toYangPathKey(SupportedTables.QNAME, AFI, SAFI);
         assertEquals(NII_PATH.toString(), result.toString());
 
     }
+
     @Test
     public void toYangKey() {
         final NodeIdentifierWithPredicates result = RibSupportUtils.toYangKey(SupportedTables.QNAME, TABLE_KEY);
index fcbd2cfa2aa584bce3ae7551f32c14b87795992c..9a02c92088af56a08bc66f49837ab56d8f830526 100644 (file)
@@ -17,8 +17,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 
 public class RouterIdsTest {
 
-    UnsignedInteger unsignedRouterId = UnsignedInteger.valueOf(707406378);
-    PeerId peerID = new PeerId("bgp://42.42.42.42");
+    private UnsignedInteger unsignedRouterId = UnsignedInteger.valueOf(707406378);
+    private PeerId peerID = new PeerId("bgp://42.42.42.42");
 
     @Test
     public void testRouterIdForAddress() throws Exception {
index f0e33bcffd95fc394cae11c4fc40c5391c8dc860..7be665a2422daa41d407aa03dfdac604705a55fe 100644 (file)
@@ -18,22 +18,23 @@ import org.junit.Test;
 public class SimpleRIBExtensionProviderContextActivatorTest {
     private static boolean RIBACTIVATED;
 
-    private static class RibActivator extends AbstractRIBExtensionProviderActivator {
-        @Override
-        protected List<AutoCloseable> startRIBExtensionProviderImpl(final RIBExtensionProviderContext context) {
-            RIBACTIVATED = true;
-            return Collections.singletonList(() -> RIBACTIVATED = false);
-        }
-    }
-
     @Test
     public void test() throws Exception {
         final List<RIBExtensionProviderActivator> extensionActivators = Collections.singletonList(new RibActivator());
         final SimpleRIBExtensionProviderContextActivator activator =
-            new SimpleRIBExtensionProviderContextActivator(new SimpleRIBExtensionProviderContext(), extensionActivators);
+                new SimpleRIBExtensionProviderContextActivator(new SimpleRIBExtensionProviderContext(),
+                        extensionActivators);
         activator.start();
         assertTrue(RIBACTIVATED);
         activator.close();
         assertFalse(RIBACTIVATED);
     }
+
+    private static class RibActivator extends AbstractRIBExtensionProviderActivator {
+        @Override
+        protected List<AutoCloseable> startRIBExtensionProviderImpl(final RIBExtensionProviderContext context) {
+            RIBACTIVATED = true;
+            return Collections.singletonList(() -> RIBACTIVATED = false);
+        }
+    }
 }
\ No newline at end of file
index 229ae6269b920a7e504c49332098e062f09c87a1..6bb3216f6ca74b38fd01154a1d62172d09ea6d9b 100644 (file)
@@ -21,7 +21,8 @@ public class SimpleRIBExtensionTest {
 
     @Test
     public void testExtensionProvider() {
-        final ServiceLoaderRIBExtensionConsumerContext ctx = ServiceLoaderRIBExtensionConsumerContext.createConsumerContext();
+        final ServiceLoaderRIBExtensionConsumerContext ctx =
+                ServiceLoaderRIBExtensionConsumerContext.createConsumerContext();
         Assert.assertNull(ctx.getRIBSupport(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class));
         final TestActivator act = new TestActivator();
         act.startRIBExtensionProvider(ctx);
@@ -38,7 +39,8 @@ public class SimpleRIBExtensionTest {
             Mockito.doReturn(Route.class).when(support).routesListClass();
             Mockito.doReturn(DataObject.class).when(support).routesContainerClass();
             Mockito.doReturn(DataObject.class).when(support).routesCaseClass();
-            return Lists.newArrayList((AutoCloseable)context.registerRIBSupport(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, support));
+            return Lists.newArrayList((AutoCloseable)context.registerRIBSupport(Ipv4AddressFamily.class,
+                    UnicastSubsequentAddressFamily.class, support));
         }
     }
 }
index ed62d1f68a9b29ba6bf31a72a81213d48bf64283..872bb2214bfc990dfb78d987fddff60656c6eb59 100644 (file)
@@ -16,8 +16,10 @@ public class TerminationReasonTest {
 
     @Test
     public void testTerminationReason() {
-        assertEquals(BGPError.BAD_PEER_AS.toString(), new BGPTerminationReason(BGPError.BAD_PEER_AS).getErrorMessage());
-        assertEquals("BGPTerminationReason{error=BAD_PEER_AS}", new BGPTerminationReason(BGPError.BAD_PEER_AS).toString());
+        assertEquals(BGPError.BAD_PEER_AS.toString(), new BGPTerminationReason(BGPError.BAD_PEER_AS)
+                .getErrorMessage());
+        assertEquals("BGPTerminationReason{error=BAD_PEER_AS}",
+                new BGPTerminationReason(BGPError.BAD_PEER_AS).toString());
     }
 
 }
index 6ac4382a9bdd7c6b163ec8ccb9d367d1b5ece1c3..53fc2d8f16782f70e6a74e41b3a583f5636618ae 100644 (file)
@@ -8,16 +8,17 @@
 
 package org.opendaylight.protocol.bgp.rib.spi.util;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.mockito.MockitoAnnotations.initMocks;
 import static org.opendaylight.protocol.bgp.rib.spi.util.ClusterSingletonServiceRegistrationHelper.registerSingletonService;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
@@ -33,25 +34,14 @@ public class ClusterSingletonServiceRegistrationHelperTest {
 
     @Before
     public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        Mockito.doReturn(null).when(this.singletonProvider).registerClusterSingletonService(Mockito.any());
-        Mockito.when(this.singletonProvider.registerClusterSingletonService(Mockito.any()))
-            .thenThrow(new RuntimeException())
-            .thenReturn(this.serviceRegistration);
+        initMocks(this);
+        doReturn(null).when(this.singletonProvider).registerClusterSingletonService(any());
+        Mockito.when(this.singletonProvider.registerClusterSingletonService(any()))
+                .thenThrow(new RuntimeException())
+                .thenReturn(this.serviceRegistration);
     }
 
-    @Test(expected=UnsupportedOperationException.class)
-    public void testPrivateConstructor() throws Throwable {
-        final Constructor<ClusterSingletonServiceRegistrationHelper> c = ClusterSingletonServiceRegistrationHelper.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=RuntimeException.class)
+    @Test(expected = RuntimeException.class)
     public void testRegisterSingletonServiceFailure() {
         registerSingletonService(this.singletonProvider, this.clusterSingletonService, 0, 1);
     }
@@ -59,10 +49,10 @@ public class ClusterSingletonServiceRegistrationHelperTest {
     @Test
     public void testRegisterSingletonServiceSuccessfulRetry() {
         final ClusterSingletonServiceRegistration registerSingletonService =
-            registerSingletonService(this.singletonProvider, this.clusterSingletonService, 1, 1);
-        Assert.assertEquals(this.serviceRegistration, registerSingletonService);
+                registerSingletonService(this.singletonProvider, this.clusterSingletonService, 1, 1);
+        assertEquals(this.serviceRegistration, registerSingletonService);
         //first reg. attempt failed, second succeeded
-        Mockito.verify(this.singletonProvider, Mockito.times(2)).registerClusterSingletonService(Mockito.any());
+        verify(this.singletonProvider, Mockito.times(2)).registerClusterSingletonService(any());
     }
 
 }
index 7fa209b5318a479a0776554dd4ec482099befae3..71c7353ba367704b49e1d38b5b567a43b09df1d8 100644 (file)
@@ -11,6 +11,6 @@ package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ine
 import org.opendaylight.yangtools.yang.common.QName;
 
 public interface Ipv4Prefixes {
-    QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
+    QName QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
         "2015-03-05", "ipv4-prefixes").intern();
 }
index 17b3f53ac94086b643eb609e3a47e867dbe247f3..681388b258d5b30d76763d392fdb6cce9042e09e 100644 (file)
@@ -12,6 +12,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yangtools.yang.common.QName;
 
 public interface Ipv4Route extends Route {
-    QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
+    QName QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
         "2015-03-05", "ipv4-route").intern();
 }
index e659b7819b639ed677d16e987fa6c87c01db330e..1406121b1c14318261615bfba1a4f52cd72b5e33 100644 (file)
@@ -12,6 +12,6 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.common.QName;
 
 public interface Ipv4Routes extends DataObject {
-    QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
+    QName QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
         "2015-03-05", "ipv4-routes").intern();
 }
index 6ba3c3c435a86b93969996be44b0834266e66199..dd3b66aeb70396d93816a46a2768a7624e27de1b 100644 (file)
@@ -13,6 +13,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yangtools.yang.common.QName;
 
 public interface Ipv4RoutesCase extends Routes {
-    QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
+    QName QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
         "2015-03-05", "ipv4-routes-case").intern();
 }
index ece95ff7a40fa4b6b076a4ed4f1b687db73850df..ac3939f87963c9728ea8afd684667404c6bac1f0 100644 (file)
@@ -32,7 +32,8 @@ public final class MultiPathAbstractTest extends MultiPathAbstractRIBSupport {
         ImmutableMap.of(QName.create(Ipv4Route.QNAME, ROUTE_KEY).intern(), PREFIX));
 
     public MultiPathAbstractTest() {
-        super(Ipv4RoutesCase.class, Ipv4Routes.class, Ipv4Route.class, Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, ROUTE_KEY, Ipv4Prefixes.QNAME);
+        super(Ipv4RoutesCase.class, Ipv4Routes.class, Ipv4Route.class, Ipv4AddressFamily.class,
+                UnicastSubsequentAddressFamily.class, ROUTE_KEY, Ipv4Prefixes.QNAME);
     }
 
     @Nonnull
@@ -48,8 +49,8 @@ public final class MultiPathAbstractTest extends MultiPathAbstractRIBSupport {
     }
 
     @Override
-    protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath, final ContainerNode destination,
-        final ContainerNode attributes, final ApplyRoute applyFunction) {
+    protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
+            final ContainerNode destination, final ContainerNode attributes, final ApplyRoute applyFunction) {
         applyFunction.apply(tx, routesPath.node(Ipv4Route.QNAME), PREFIX_NII, destination, attributes);
     }