Enforce checkstyle and findbug 02/66902/2
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 5 Jan 2018 16:13:11 +0000 (17:13 +0100)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 5 Jan 2018 16:13:11 +0000 (17:13 +0100)
under openconfig-state

Change-Id: I01cca3a4b084691449da90f64cfe55d370a99db9
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
bgp/openconfig-state/pom.xml
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/GlobalUtil.java
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/NeighborUtil.java
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/PeerGroupUtil.java
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/StateProviderImpl.java
bgp/openconfig-state/src/test/java/org/opendaylight/protocol/bgp/state/GlobalUtilTest.java
bgp/openconfig-state/src/test/java/org/opendaylight/protocol/bgp/state/NeighborUtilTest.java
bgp/openconfig-state/src/test/java/org/opendaylight/protocol/bgp/state/PeerGroupUtilTest.java
bgp/openconfig-state/src/test/java/org/opendaylight/protocol/bgp/state/StateProviderImplTest.java

index 45b51dd68930aa871429c573cdf331cf3ade4e07..272b213956521c83ec0a7257e2022dc9db3411f5 100644 (file)
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <configuration>
+                    <failOnError>true</failOnError>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
index ac2d59a23107b254ca81182fdb96f58030135ff1..287ca3db5fa98f9a4921919b55907cfb92bf6aa9 100644 (file)
@@ -32,65 +32,69 @@ public final class GlobalUtil {
     }
 
     /**
-     * Build Openconfig Global containing RIB group stats from a list of BGP RIB State
+     * Build Openconfig Global containing RIB group stats from a list of BGP RIB State.
      *
-     * @param ribState containing RIb Operational State
+     * @param ribState             containing RIb Operational State
      * @param bgpTableTypeRegistry BGP TableType Registry
-     * @return
+     * @return Global containing state
      */
     @Nonnull
     public static Global buildGlobal(final BGPRIBState ribState,
-        final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
-        return  new GlobalBuilder().setState(buildState(ribState))
-            .setAfiSafis(new AfiSafisBuilder().setAfiSafi(buildAfisSafis(ribState, bgpTableTypeRegistry)).build())
-            .build();
+            final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
+        return new GlobalBuilder().setState(buildState(ribState))
+                .setAfiSafis(new AfiSafisBuilder().setAfiSafi(buildAfisSafis(ribState, bgpTableTypeRegistry)).build())
+                .build();
     }
 
     /**
-     * Build per AFI SAFI Openconfig Global State containing RIB group stats from a list of BGP RIB State
-     * @param ribState containing RIb Operational State
+     * Build per AFI SAFI Openconfig Global State containing RIB group stats from a list of BGP RIB State.
+     *
+     * @param ribState             containing RIb Operational State
      * @param bgpTableTypeRegistry BGP TableType Registry
      * @return List containing per afi/safi operational state
      */
     public static List<AfiSafi> buildAfisSafis(final BGPRIBState ribState,
-        final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
+            final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
         return ribState.getPathsCount().keySet().stream()
-            .map(tk -> buildAfiSafi(ribState, tk, bgpTableTypeRegistry))
-            .collect(Collectors.toList());
+                .map(tk -> buildAfiSafi(ribState, tk, bgpTableTypeRegistry))
+                .collect(Collectors.toList());
     }
 
     /**
-     * Build Openconfig Global State
+     * Build Openconfig Global State.
+     *
      * @param ribState containing RIb Operational State
      * @return Openconfig Global State
      */
-    public static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.State buildState(
-        final BGPRIBState ribState) {
+    public static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base
+            .State buildState(final BGPRIBState ribState) {
         return new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.StateBuilder()
-            .setAs(ribState.getAs())
-            .setRouterId(ribState.getRouteId())
-            .setTotalPaths(ribState.getTotalPathsCount())
-            .setTotalPrefixes(ribState.getTotalPrefixesCount())
-            .build();
+                .setAs(ribState.getAs())
+                .setRouterId(ribState.getRouteId())
+                .setTotalPaths(ribState.getTotalPathsCount())
+                .setTotalPrefixes(ribState.getTotalPrefixesCount())
+                .build();
     }
 
     /**
+     * Build Afi Safi containing State.
      *
-     * @param ribState containing RIb Operational State
-     * @param tablesKey table Key
+     * @param ribState             containing RIb Operational State
+     * @param tablesKey            table Key
      * @param bgpTableTypeRegistry BGP TableType Registry
      * @return Afi Safi Operational State
      */
     public static AfiSafi buildAfiSafi(final BGPRIBState ribState, final TablesKey tablesKey,
-        final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
+            final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
         final Optional<Class<? extends AfiSafiType>> optAfiSafi = bgpTableTypeRegistry.getAfiSafiType(tablesKey);
         if (!optAfiSafi.isPresent()) {
             return null;
         }
         final State state = new StateBuilder()
-            .addAugmentation(GlobalAfiSafiStateAugmentation.class, new GlobalAfiSafiStateAugmentationBuilder()
-                .setTotalPaths(ribState.getPathCount(tablesKey)).setTotalPrefixes(ribState.getPrefixesCount(tablesKey))
-                .build()).build();
+                .addAugmentation(GlobalAfiSafiStateAugmentation.class, new GlobalAfiSafiStateAugmentationBuilder()
+                        .setTotalPaths(ribState.getPathCount(tablesKey))
+                        .setTotalPrefixes(ribState.getPrefixesCount(tablesKey))
+                        .build()).build();
         return new AfiSafiBuilder().setAfiSafiName(optAfiSafi.get()).setState(state).build();
     }
 }
index 50bdd91467fe07c799936b8aa5aae41935232ea9..aee7a33afe1a288ec978bb2e0829b0e22f3265c0 100644 (file)
@@ -90,54 +90,54 @@ public final class NeighborUtil {
 
     /**
      * Build a Openconfig Neighbors container with all Neighbors Stats from a list of
-     * BGPPeerGroupState
+     * BGPPeerGroupState.
      *
-     * @param peerStats List of BGPPeerState containing Neighbor state counters
+     * @param peerStats            List of BGPPeerState containing Neighbor state counters
      * @param bgpTableTypeRegistry BGP TableType Registry
      * @return Openconfig Neighbors Stats
      */
     @Nullable
     public static Neighbors buildNeighbors(@Nonnull final List<BGPPeerState> peerStats,
-        @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
+            @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
         if (peerStats.isEmpty()) {
             return null;
         }
         return new NeighborsBuilder().setNeighbor(peerStats.stream()
-            .filter(Objects::nonNull)
-            .map(neighbor -> buildNeighbor(neighbor, bgpTableTypeRegistry))
-            .collect(Collectors.toList())).build();
+                .filter(Objects::nonNull)
+                .map(neighbor -> buildNeighbor(neighbor, bgpTableTypeRegistry))
+                .collect(Collectors.toList())).build();
     }
 
     /**
-     * Build a list of neighbors containing Operational State from a list of BGPPeerState
+     * Build a list of neighbors containing Operational State from a list of BGPPeerState.
      *
      * @param neighbor containing Neighbor state counters
      * @return neighbor containing Neighbor State
      */
     @Nullable
     public static Neighbor buildNeighbor(@Nonnull final BGPPeerState neighbor,
-        @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
+            @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
         return new NeighborBuilder()
-            .setNeighborAddress(neighbor.getNeighborAddress())
-            .setState(buildNeighborState(neighbor.getBGPSessionState(), neighbor.getBGPPeerMessagesState()))
-            .setTimers(buildTimer(neighbor.getBGPTimersState()))
-            .setTransport(buildTransport(neighbor.getBGPTransportState()))
-            .setErrorHandling(buildErrorHandling(neighbor.getBGPErrorHandlingState()))
-            .setGracefulRestart(buildGracefulRestart(neighbor.getBGPGracelfulRestart()))
-            .setAfiSafis(buildAfisSafis(neighbor, bgpTableTypeRegistry))
-            .build();
+                .setNeighborAddress(neighbor.getNeighborAddress())
+                .setState(buildNeighborState(neighbor.getBGPSessionState(), neighbor.getBGPPeerMessagesState()))
+                .setTimers(buildTimer(neighbor.getBGPTimersState()))
+                .setTransport(buildTransport(neighbor.getBGPTransportState()))
+                .setErrorHandling(buildErrorHandling(neighbor.getBGPErrorHandlingState()))
+                .setGracefulRestart(buildGracefulRestart(neighbor.getBGPGracelfulRestart()))
+                .setAfiSafis(buildAfisSafis(neighbor, bgpTableTypeRegistry))
+                .build();
     }
 
     /**
-     * Builds Neighbor State from BGPPeerState counters
+     * Builds Neighbor State from BGPPeerState counters.
      *
-     * @param sessionState BGPPeerState containing Operational state counters
-     * @param bgpPeerMessagesState
+     * @param sessionState         BGPPeerState containing Operational state counters
+     * @param bgpPeerMessagesState message state
      * @return Neighbor State
      */
     @Nullable
     public static State buildNeighborState(@Nullable final BGPSessionState sessionState,
-        final BGPPeerMessagesState bgpPeerMessagesState) {
+            final BGPPeerMessagesState bgpPeerMessagesState) {
         if (sessionState == null && bgpPeerMessagesState == null) {
             return null;
         }
@@ -152,7 +152,7 @@ public final class NeighborUtil {
     }
 
     /**
-     * Builds Neighbor State from BGPPeerState counters
+     * Builds Neighbor State from BGPPeerState counters.
      *
      * @param neighbor BGPPeerState containing Operational state counters
      * @return Timer State
@@ -163,16 +163,16 @@ public final class NeighborUtil {
             return null;
         }
         final NeighborTimersStateAugmentation timerState = new NeighborTimersStateAugmentationBuilder()
-            .setNegotiatedHoldTime(BigDecimal.valueOf(neighbor.getNegotiatedHoldTime()))
-            .setUptime(new Timeticks(neighbor.getUpTime())).build();
+                .setNegotiatedHoldTime(BigDecimal.valueOf(neighbor.getNegotiatedHoldTime()))
+                .setUptime(new Timeticks(neighbor.getUpTime())).build();
 
         return new TimersBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp
-            .neighbor.group.timers.StateBuilder()
-            .addAugmentation(NeighborTimersStateAugmentation.class, timerState).build()).build();
+                .neighbor.group.timers.StateBuilder()
+                .addAugmentation(NeighborTimersStateAugmentation.class, timerState).build()).build();
     }
 
     /**
-     * Builds Transport State from BGPTransportState counters
+     * Builds Transport State from BGPTransportState counters.
      *
      * @param neighbor BGPPeerState containing Operational state counters
      * @return Transport State
@@ -183,16 +183,16 @@ public final class NeighborUtil {
             return null;
         }
         final NeighborTransportStateAugmentation transportState = new NeighborTransportStateAugmentationBuilder()
-            .setLocalPort(neighbor.getLocalPort()).setRemoteAddress(neighbor.getRemoteAddress())
-            .setRemotePort(neighbor.getRemotePort()).build();
+                .setLocalPort(neighbor.getLocalPort()).setRemoteAddress(neighbor.getRemoteAddress())
+                .setRemotePort(neighbor.getRemotePort()).build();
 
         return new TransportBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009
-            .bgp.neighbor.group.transport.StateBuilder()
-            .addAugmentation(NeighborTransportStateAugmentation.class, transportState).build()).build();
+                .bgp.neighbor.group.transport.StateBuilder()
+                .addAugmentation(NeighborTransportStateAugmentation.class, transportState).build()).build();
     }
 
     /**
-     * Builds Error Handling State from BGPPeerState counters
+     * Builds Error Handling State from BGPPeerState counters.
      *
      * @param errorHandlingState BGPErrorHandlingState containing ErrorHandlingState Operational state counters
      * @return Error Handling State
@@ -201,14 +201,14 @@ public final class NeighborUtil {
         if (errorHandlingState == null) {
             return null;
         }
-        return new ErrorHandlingBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.
-            rev151009.bgp.neighbor.group.error.handling.StateBuilder()
-            .addAugmentation(NeighborErrorHandlingStateAugmentation.class,
-                buildErrorHandlingState(errorHandlingState.getErroneousUpdateReceivedCount())).build()).build();
+        return new ErrorHandlingBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
+                .rev151009.bgp.neighbor.group.error.handling.StateBuilder()
+                .addAugmentation(NeighborErrorHandlingStateAugmentation.class,
+                        buildErrorHandlingState(errorHandlingState.getErroneousUpdateReceivedCount())).build()).build();
     }
 
     /**
-     * Builds Graceful Restart containing Graceful Restart State from BGPGracelfulRestartState counters
+     * Builds Graceful Restart containing Graceful Restart State from BGPGracelfulRestartState counters.
      *
      * @param neighbor BGPPeerState containing Operational state counters
      * @return Graceful Restart
@@ -216,30 +216,31 @@ public final class NeighborUtil {
     @Nonnull
     public static GracefulRestart buildGracefulRestart(@Nonnull final BGPGracelfulRestartState neighbor) {
         final NeighborGracefulRestartStateAugmentation gracefulRestartState =
-            new NeighborGracefulRestartStateAugmentationBuilder()
-            .setLocalRestarting(neighbor.isLocalRestarting())
-            .setPeerRestartTime(neighbor.getPeerRestartTime())
-            //.setMode(mode) TBD once implemented
-            .setPeerRestarting(neighbor.isPeerRestarting()).build();
+                new NeighborGracefulRestartStateAugmentationBuilder()
+                        .setLocalRestarting(neighbor.isLocalRestarting())
+                        .setPeerRestartTime(neighbor.getPeerRestartTime())
+                        //.setMode(mode) TBD once implemented
+                        .setPeerRestarting(neighbor.isPeerRestarting()).build();
 
         return new GracefulRestartBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
-            .rev151009.bgp.graceful.restart.graceful.restart.StateBuilder()
-            .addAugmentation(NeighborGracefulRestartStateAugmentation.class, gracefulRestartState).build()).build();
+                .rev151009.bgp.graceful.restart.graceful.restart.StateBuilder()
+                .addAugmentation(NeighborGracefulRestartStateAugmentation.class, gracefulRestartState).build()).build();
     }
 
     /**
-     * Builds  Neighbor Afi Safi containing AfiSafi State
+     * Builds  Neighbor Afi Safi containing AfiSafi State.
      *
      * @param neighbor BGPPeerState containing Operational state counters
      * @return Afi Safis
      */
     public static AfiSafis buildAfisSafis(@Nonnull final BGPPeerState neighbor,
-        @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
-        return new AfiSafisBuilder().setAfiSafi(buildAfisSafisState(neighbor.getBGPAfiSafiState(), bgpTableTypeRegistry)).build();
+            @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
+        return new AfiSafisBuilder().setAfiSafi(buildAfisSafisState(neighbor.getBGPAfiSafiState(),
+                bgpTableTypeRegistry)).build();
     }
 
     /**
-     * Builds  Neighbor State containing Capabilities State, session State
+     * Builds  Neighbor State containing Capabilities State, session State.
      *
      * @return Neighbor State
      */
@@ -248,39 +249,39 @@ public final class NeighborUtil {
         final List<Class<? extends BgpCapability>> supportedCapabilities = buildSupportedCapabilities(neighbor);
         SessionState sessionState = null;
         switch (neighbor.getSessionState()) {
-        case IDLE:
-            sessionState = SessionState.IDLE;
-            break;
-        case UP:
-            sessionState = SessionState.ESTABLISHED;
-            break;
-        case OPEN_CONFIRM:
-            sessionState = SessionState.OPENCONFIRM;
-            break;
-        default:
+            case IDLE:
+                sessionState = SessionState.IDLE;
+                break;
+            case UP:
+                sessionState = SessionState.ESTABLISHED;
+                break;
+            case OPEN_CONFIRM:
+                sessionState = SessionState.OPENCONFIRM;
+                break;
+            default:
         }
         return new NeighborStateAugmentationBuilder().setSupportedCapabilities(supportedCapabilities)
-            .setSessionState(sessionState).build();
+                .setSessionState(sessionState).build();
     }
 
     /**
-     * Builds Bgp Neighbor State containing Message State
+     * Builds Bgp Neighbor State containing Message State.
      *
      * @return BgpNeighborState containing Message State
      */
     @Nonnull
     public static BgpNeighborStateAugmentation buildMessageState(@Nonnull final BGPPeerMessagesState neighbor) {
         return new BgpNeighborStateAugmentationBuilder()
-            .setMessages(new MessagesBuilder()
-                .setReceived(buildMessagesReceived(neighbor))
-                .setSent(buildMessagesSent(neighbor)).build()).build();
+                .setMessages(new MessagesBuilder()
+                        .setReceived(buildMessagesReceived(neighbor))
+                        .setSent(buildMessagesSent(neighbor)).build()).build();
     }
 
     private static Received buildMessagesReceived(@Nonnull final BGPPeerMessagesState neighbor) {
         return new ReceivedBuilder()
-            .setUPDATE(toBigInteger(neighbor.getUpdateMessagesReceivedCount()))
-            .setNOTIFICATION(toBigInteger(neighbor.getNotificationMessagesReceivedCount()))
-            .build();
+                .setUPDATE(toBigInteger(neighbor.getUpdateMessagesReceivedCount()))
+                .setNOTIFICATION(toBigInteger(neighbor.getNotificationMessagesReceivedCount()))
+                .build();
     }
 
     public static BigInteger toBigInteger(final long updateReceivedCounter) {
@@ -289,13 +290,13 @@ public final class NeighborUtil {
 
     private static Sent buildMessagesSent(@Nonnull final BGPPeerMessagesState neighbor) {
         return new SentBuilder()
-            .setUPDATE(toBigInteger(neighbor.getUpdateMessagesSentCount()))
-            .setNOTIFICATION(toBigInteger(neighbor.getNotificationMessagesSentCount()))
-            .build();
+                .setUPDATE(toBigInteger(neighbor.getUpdateMessagesSentCount()))
+                .setNOTIFICATION(toBigInteger(neighbor.getNotificationMessagesSentCount()))
+                .build();
     }
 
     /**
-     * Builds Neighbor Error Handling State
+     * Builds Neighbor Error Handling State.
      *
      * @param erroneousUpdateCount erroneous Update Count
      * @return Error Handling State
@@ -303,71 +304,73 @@ public final class NeighborUtil {
     @Nonnull
     public static NeighborErrorHandlingStateAugmentation buildErrorHandlingState(final long erroneousUpdateCount) {
         return new NeighborErrorHandlingStateAugmentationBuilder()
-            .setErroneousUpdateMessages(erroneousUpdateCount).build();
+                .setErroneousUpdateMessages(erroneousUpdateCount).build();
     }
 
     /**
-     * Build List of afi safi containing State per Afi Safi
+     * Build List of afi safi containing State per Afi Safi.
      *
      * @return AfiSafi List
      */
     @Nonnull
     public static List<AfiSafi> buildAfisSafisState(@Nonnull final BGPAfiSafiState neighbor,
-        @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
+            @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
         final Set<TablesKey> afiSafiJoin = new HashSet<>(neighbor.getAfiSafisAdvertized());
         afiSafiJoin.addAll(neighbor.getAfiSafisReceived());
         return afiSafiJoin.stream().map(tableKey -> buildAfiSafi(neighbor, tableKey, bgpTableTypeRegistry))
-            .filter(Objects::nonNull)
-            .collect(Collectors.toList());
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
     }
 
     private static AfiSafi buildAfiSafi(@Nonnull final BGPAfiSafiState neighbor,
-        @Nonnull final TablesKey tablesKey, @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
+            @Nonnull final TablesKey tablesKey, @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
         final Optional<Class<? extends AfiSafiType>> afiSafi = bgpTableTypeRegistry.getAfiSafiType(tablesKey);
         if (!afiSafi.isPresent()) {
             return null;
         }
 
         return new AfiSafiBuilder().setAfiSafiName(afiSafi.get())
-            .setState(buildAfiSafiState(neighbor, tablesKey, neighbor.isAfiSafiSupported(tablesKey)))
-            .setGracefulRestart(buildAfiSafiGracefulRestartState(neighbor, tablesKey)).build();
+                .setState(buildAfiSafiState(neighbor, tablesKey, neighbor.isAfiSafiSupported(tablesKey)))
+                .setGracefulRestart(buildAfiSafiGracefulRestartState(neighbor, tablesKey)).build();
     }
 
-    private static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.
-        safi.list.afi.safi.State buildAfiSafiState(@Nonnull final BGPAfiSafiState neighbor,
-        @Nonnull final TablesKey tablesKey, final boolean afiSafiSupported) {
+    private static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi
+            .safi.list.afi.safi.State buildAfiSafiState(@Nonnull final BGPAfiSafiState neighbor,
+            @Nonnull final TablesKey tablesKey, final boolean afiSafiSupported) {
         final NeighborAfiSafiStateAugmentationBuilder builder = new NeighborAfiSafiStateAugmentationBuilder();
         builder.setActive(afiSafiSupported);
         if (afiSafiSupported) {
             builder.setPrefixes(new PrefixesBuilder()
-                .setInstalled(neighbor.getPrefixesInstalledCount(tablesKey))
-                .setReceived(neighbor.getPrefixesReceivedCount(tablesKey))
-                .setSent(neighbor.getPrefixesSentCount(tablesKey)).build());
+                    .setInstalled(neighbor.getPrefixesInstalledCount(tablesKey))
+                    .setReceived(neighbor.getPrefixesReceivedCount(tablesKey))
+                    .setSent(neighbor.getPrefixesSentCount(tablesKey)).build());
         }
         return new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi
-            .safi.list.afi.safi.StateBuilder().addAugmentation(NeighborAfiSafiStateAugmentation.class, builder.build()).build();
+                .safi.list.afi.safi.StateBuilder().addAugmentation(NeighborAfiSafiStateAugmentation.class,
+                builder.build()).build();
     }
 
     private static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi
-        .safi.list.afi.safi.GracefulRestart buildAfiSafiGracefulRestartState(@Nonnull final BGPGracelfulRestartState neighbor,
-        @Nonnull final TablesKey tablesKey) {
+            .safi.list.afi.safi.GracefulRestart buildAfiSafiGracefulRestartState(
+            @Nonnull final BGPGracelfulRestartState neighbor, @Nonnull final TablesKey tablesKey) {
         final NeighborAfiSafiGracefulRestartStateAugmentation builder =
-            new NeighborAfiSafiGracefulRestartStateAugmentationBuilder()
-            .setAdvertised(neighbor.isGracefulRestartAdvertized(tablesKey))
-                .setReceived(neighbor.isGracefulRestartReceived(tablesKey)).build();
+                new NeighborAfiSafiGracefulRestartStateAugmentationBuilder()
+                        .setAdvertised(neighbor.isGracefulRestartAdvertized(tablesKey))
+                        .setReceived(neighbor.isGracefulRestartReceived(tablesKey)).build();
         return new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi
-            .safi.list.afi.safi.GracefulRestartBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig
-            .net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder()
-            .addAugmentation(NeighborAfiSafiGracefulRestartStateAugmentation.class, builder).build()).build();
+                .safi.list.afi.safi.GracefulRestartBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig
+                .net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder()
+                .addAugmentation(NeighborAfiSafiGracefulRestartStateAugmentation.class, builder).build()).build();
     }
 
     /**
-     * Builds List of BgpCapability supported capabilities
+     * Builds List of BgpCapability supported capabilities.
      *
      * @return List containing supported capabilities
      */
     @Nonnull
-    public static List<Class<? extends BgpCapability>> buildSupportedCapabilities(@Nonnull final BGPSessionState neighbor) {
+    public static List<Class<? extends BgpCapability>> buildSupportedCapabilities(
+            @Nonnull final BGPSessionState neighbor) {
         final List<Class<? extends BgpCapability>> supportedCapabilities = new ArrayList<>();
         if (neighbor.isAddPathCapabilitySupported()) {
             supportedCapabilities.add(ADDPATHS.class);
index 5336470000d88ab0a153384dbbff4fe3f6dd90e7..4a769a5ca6984407dcbe534c16e0d4cf077d7304 100644 (file)
@@ -30,7 +30,7 @@ public final class PeerGroupUtil {
     }
 
     /**
-     * Build Openconfig PeerGroups containing Peer group stats from a list of BGPPeerGroupState
+     * Build Openconfig PeerGroups containing Peer group stats from a list of BGPPeerGroupState.
      *
      * @param bgpStateConsumer providing BGPPeerGroupState
      * @return PeerGroups containing Peer group stats
@@ -38,35 +38,35 @@ public final class PeerGroupUtil {
     @Nullable
     public static PeerGroups buildPeerGroups(@Nonnull final List<BGPPeerState> bgpStateConsumer) {
         final Map<String, List<BGPPeerState>> peerGroups = bgpStateConsumer.stream()
-            .filter(state -> state.getGroupId() != null)
-            .collect(Collectors.groupingBy(BGPPeerState::getGroupId));
+                .filter(state -> state.getGroupId() != null)
+                .collect(Collectors.groupingBy(BGPPeerState::getGroupId));
         if (peerGroups.isEmpty()) {
             return null;
         }
 
         final List<PeerGroup> peerGroupsList = peerGroups.entrySet().stream()
-            .map(entry -> buildPeerGroupState(entry.getKey(), entry.getValue()))
-            .collect(Collectors.toList());
+                .map(entry -> buildPeerGroupState(entry.getKey(), entry.getValue()))
+                .collect(Collectors.toList());
         return new PeerGroupsBuilder().setPeerGroup(peerGroupsList).build();
     }
 
     /**
-     * Build Openconfig PeerGroup containing Peer group stats from BGPPeerGroupState
+     * Build Openconfig PeerGroup containing Peer group stats from BGPPeerGroupState.
      *
      * @param groupId Peer group Id
-     * @param groups providing state of the group
+     * @param groups  providing state of the group
      * @return PeerGroups containing Peer group stats
      */
     @Nonnull
     public static PeerGroup buildPeerGroupState(@Nonnull final String groupId, @Nonnull List<BGPPeerState> groups) {
         final PeerGroupStateAugmentation groupState = new PeerGroupStateAugmentationBuilder()
-            .setTotalPrefixes(groups.stream().mapToLong(BGPPeerState::getTotalPrefixes).sum())
-            .setTotalPaths(groups.stream().mapToLong(BGPPeerState::getTotalPathsCount).sum())
-            .build();
+                .setTotalPrefixes(groups.stream().mapToLong(BGPPeerState::getTotalPrefixes).sum())
+                .setTotalPaths(groups.stream().mapToLong(BGPPeerState::getTotalPathsCount).sum())
+                .build();
 
         return new PeerGroupBuilder()
-            .setPeerGroupName(groupId)
-            .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.
-                StateBuilder().addAugmentation(PeerGroupStateAugmentation.class, groupState).build()).build();
+                .setPeerGroupName(groupId)
+                .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
+                        .StateBuilder().addAugmentation(PeerGroupStateAugmentation.class, groupState).build()).build();
     }
 }
index 9be2abae50acd574a65f663718ebb50492ba0d48..cf4cb0723a2902ff94cba815bbf364c7c2984de6 100644 (file)
@@ -70,13 +70,14 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
     private ScheduledFuture<?> scheduleTask;
 
     public StateProviderImpl(@Nonnull final DataBroker dataBroker, final int timeout,
-        @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry, @Nonnull final BGPStateConsumer stateCollector,
-        @Nonnull final String networkInstanceName) {
+            @Nonnull final BGPTableTypeRegistryConsumer bgpTableTypeRegistry,
+            @Nonnull final BGPStateConsumer stateCollector,
+            @Nonnull final String networkInstanceName) {
         this.dataBroker = requireNonNull(dataBroker);
         this.bgpTableTypeRegistry = requireNonNull(bgpTableTypeRegistry);
         this.stateCollector = requireNonNull(stateCollector);
         this.networkInstanceIId = InstanceIdentifier.create(NetworkInstances.class)
-            .child(NetworkInstance.class, new NetworkInstanceKey(networkInstanceName));
+                .child(NetworkInstance.class, new NetworkInstanceKey(networkInstanceName));
         this.timeout = timeout;
     }
 
@@ -84,6 +85,7 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
         this.transactionChain = this.dataBroker.createTransactionChain(this);
         final TimerTask task = new TimerTask() {
             @Override
+            @SuppressWarnings("checkstyle:IllegalCatch")
             public void run() {
                 synchronized (StateProviderImpl.this) {
                     final WriteTransaction wTx = StateProviderImpl.this.transactionChain.newWriteOnlyTransaction();
@@ -99,44 +101,44 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
         };
 
         this.scheduleTask = GlobalEventExecutor.INSTANCE.scheduleAtFixedRate(task, 0, this.timeout,
-            TimeUnit.SECONDS);
+                TimeUnit.SECONDS);
     }
 
-    private synchronized void updateBGPStats(final WriteTransaction wTx) {
+    private synchronized void updateBGPStats(final WriteTransaction wtx) {
         final Set<String> oldStats = new HashSet<>(this.instanceIdentifiersCache.keySet());
         this.stateCollector.getRibStats().stream().filter(BGPRIBState::isActive).forEach(bgpStateConsumer -> {
             final KeyedInstanceIdentifier<Rib, RibKey> ribId = bgpStateConsumer.getInstanceIdentifier();
             final List<BGPPeerState> peerStats = this.stateCollector.getPeerStats().stream()
                     .filter(BGPPeerState::isActive).filter(peerState -> ribId.equals(peerState.getInstanceIdentifier()))
                     .collect(Collectors.toList());
-            storeOperationalState(bgpStateConsumer, peerStats, ribId.getKey().getId().getValue(), wTx);
+            storeOperationalState(bgpStateConsumer, peerStats, ribId.getKey().getId().getValue(), wtx);
             oldStats.remove(ribId.getKey().getId().getValue());
         });
-        oldStats.forEach(ribId -> removeStoredOperationalState(ribId, wTx));
+        oldStats.forEach(ribId -> removeStoredOperationalState(ribId, wtx));
     }
 
-    private synchronized void removeStoredOperationalState(final String ribId, final WriteTransaction wTx) {
+    private synchronized void removeStoredOperationalState(final String ribId, final WriteTransaction wtx) {
         final InstanceIdentifier<Bgp> bgpIID = this.instanceIdentifiersCache.remove(ribId);
-        wTx.delete(LogicalDatastoreType.OPERATIONAL, bgpIID);
+        wtx.delete(LogicalDatastoreType.OPERATIONAL, bgpIID);
     }
 
     private synchronized void storeOperationalState(final BGPRIBState bgpStateConsumer,
-        final List<BGPPeerState> peerStats, final String ribId, final WriteTransaction wTx) {
+            final List<BGPPeerState> peerStats, final String ribId, final WriteTransaction wtx) {
         final Global global = GlobalUtil.buildGlobal(bgpStateConsumer, this.bgpTableTypeRegistry);
         final PeerGroups peerGroups = PeerGroupUtil.buildPeerGroups(peerStats);
         final Neighbors neighbors = NeighborUtil.buildNeighbors(peerStats, this.bgpTableTypeRegistry);
         InstanceIdentifier<Bgp> bgpIID = this.instanceIdentifiersCache.get(ribId);
         if (bgpIID == null) {
             final ProtocolKey protocolKey = new ProtocolKey(BGP.class, bgpStateConsumer.getInstanceIdentifier()
-                .getKey().getId().getValue());
+                    .getKey().getId().getValue());
             final KeyedInstanceIdentifier<Protocol, ProtocolKey> protocolIId = this.networkInstanceIId
-                .child(Protocols.class).child(Protocol.class, protocolKey);
+                    .child(Protocols.class).child(Protocol.class, protocolKey);
             bgpIID = protocolIId.augmentation(Protocol1.class).child(Bgp.class);
             this.instanceIdentifiersCache.put(ribId, bgpIID);
         }
 
         final Bgp bgp = new BgpBuilder().setGlobal(global).setNeighbors(neighbors).setPeerGroups(peerGroups).build();
-        wTx.put(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp, WriteTransaction.CREATE_MISSING_PARENTS);
+        wtx.put(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp, WriteTransaction.CREATE_MISSING_PARENTS);
     }
 
     @Override
@@ -153,7 +155,7 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
 
     @Override
     public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction,
-        final Throwable cause) {
+            final Throwable cause) {
         LOG.error("Transaction chain failed {}.", transaction != null ? transaction.getIdentifier() : null, cause);
     }
 
index 3350bbd21450778d76f392124ce8cfab85852c43..c92d5d61ef0249ed604638c8839d793a39323217 100644 (file)
@@ -12,8 +12,6 @@ import static org.junit.Assert.assertNull;
 import static org.mockito.Mockito.doReturn;
 import static org.opendaylight.protocol.bgp.state.StateProviderImplTest.TABLES_KEY;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
@@ -35,17 +33,6 @@ public class GlobalUtilTest {
         doReturn(Optional.empty()).when(this.tableRegistry).getAfiSafiType(Mockito.eq(TABLES_KEY));
     }
 
-    @Test(expected = UnsupportedOperationException.class)
-    public void testGlobalUtilPrivateConstructor() throws Throwable {
-        final Constructor<GlobalUtil> c = GlobalUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
     @Test
     public void testNonSupportedAfiSafi() {
         assertNull(GlobalUtil.buildAfiSafi(this.ribState, TABLES_KEY, this.tableRegistry));
index 9e2be88c911017ec43d8316ca40cdcc311b65ac9..5f5303d83787d560034edfb4bbfcb28ad82a9e53 100644 (file)
@@ -11,17 +11,15 @@ package org.opendaylight.protocol.bgp.state;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.opendaylight.protocol.bgp.state.StateProviderImplTest.TABLES_KEY;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Collections;
 import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
 import org.opendaylight.protocol.bgp.rib.spi.State;
@@ -60,10 +58,10 @@ public class NeighborUtilTest {
         doReturn(false).when(this.sessionState).isAsn32CapabilitySupported();
         doReturn(false).when(this.sessionState).isAddPathCapabilitySupported();
         doReturn(this.state).when(this.sessionState).getSessionState();
-        Mockito.doAnswer(invocation -> NeighborUtilTest.this.state).when(this.sessionState).getSessionState();
+        doAnswer(invocation -> NeighborUtilTest.this.state).when(this.sessionState).getSessionState();
         doReturn(Collections.singleton(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisAdvertized();
         doReturn(Collections.singleton(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisReceived();
-        Mockito.doAnswer(invocation -> NeighborUtilTest.this.afiSafi).when(this.tableRegistry).getAfiSafiType(eq(TABLES_KEY));
+        doAnswer(invocation -> NeighborUtilTest.this.afiSafi).when(this.tableRegistry).getAfiSafiType(eq(TABLES_KEY));
         doReturn(false).when(this.bgpAfiSafiState).isAfiSafiSupported(eq(TABLES_KEY));
         doReturn(false).when(this.bgpAfiSafiState).isGracefulRestartAdvertized(eq(TABLES_KEY));
         doReturn(false).when(this.bgpAfiSafiState).isGracefulRestartReceived(eq(TABLES_KEY));
@@ -71,22 +69,11 @@ public class NeighborUtilTest {
 
     }
 
-    @Test(expected = UnsupportedOperationException.class)
-    public void testNeighborUtilPrivateConstructor() throws Throwable {
-        final Constructor<NeighborUtil> c = NeighborUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
     @Test
     public void testBuildCapabilityState() {
         final NeighborStateAugmentationBuilder expected = new NeighborStateAugmentationBuilder()
-            .setSupportedCapabilities(Collections.emptyList())
-            .setSessionState(SessionState.IDLE);
+                .setSupportedCapabilities(Collections.emptyList())
+                .setSessionState(SessionState.IDLE);
         assertEquals(expected.build(), NeighborUtil.buildCapabilityState(this.sessionState));
 
         this.state = State.OPEN_CONFIRM;
@@ -112,24 +99,24 @@ public class NeighborUtilTest {
     @Test
     public void buildAfisSafisState() {
         assertEquals(Collections.emptyList(),
-            NeighborUtil.buildAfisSafisState(this.bgpAfiSafiState, this.tableRegistry));
+                NeighborUtil.buildAfisSafisState(this.bgpAfiSafiState, this.tableRegistry));
 
         final GracefulRestart graceful = new GracefulRestartBuilder()
-            .setState(new StateBuilder().addAugmentation(NeighborAfiSafiGracefulRestartStateAugmentation.class,
-                new NeighborAfiSafiGracefulRestartStateAugmentationBuilder().setAdvertised(false)
-                    .setReceived(false).build()).build()).build();
+                .setState(new StateBuilder().addAugmentation(NeighborAfiSafiGracefulRestartStateAugmentation.class,
+                        new NeighborAfiSafiGracefulRestartStateAugmentationBuilder().setAdvertised(false)
+                                .setReceived(false).build()).build()).build();
 
         final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi
-            .list.afi.safi.State afiSafiState = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.
-            multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder()
-            .addAugmentation(NeighborAfiSafiStateAugmentation.class, new NeighborAfiSafiStateAugmentationBuilder()
-                .setActive(false).build()).build();
+                .list.afi.safi.State afiSafiState = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
+                .multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder()
+                .addAugmentation(NeighborAfiSafiStateAugmentation.class, new NeighborAfiSafiStateAugmentationBuilder()
+                        .setActive(false).build()).build();
 
         this.afiSafi = Optional.of(IPV4UNICAST.class);
         final AfiSafi expected = new AfiSafiBuilder().setAfiSafiName(this.afiSafi.get())
-            .setState(afiSafiState)
-            .setGracefulRestart(graceful).build();
+                .setState(afiSafiState)
+                .setGracefulRestart(graceful).build();
         assertEquals(Collections.singletonList(expected),
-            NeighborUtil.buildAfisSafisState(this.bgpAfiSafiState, this.tableRegistry));
+                NeighborUtil.buildAfisSafisState(this.bgpAfiSafiState, this.tableRegistry));
     }
 }
\ No newline at end of file
index 86e4db43ebd8128abb5cbcb4b3c226744d15f6c0..ca86f0bb2ea707742e3c17aec5b7c746d6e4e18a 100644 (file)
@@ -11,8 +11,6 @@ package org.opendaylight.protocol.bgp.state;
 import static org.junit.Assert.assertNull;
 import static org.mockito.Mockito.doReturn;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Collections;
 import org.junit.Before;
 import org.junit.Test;
@@ -30,17 +28,6 @@ public class PeerGroupUtilTest {
         doReturn(null).when(this.bgpPeerState).getGroupId();
     }
 
-    @Test(expected = UnsupportedOperationException.class)
-    public void testPeerGroupUtilPrivateConstructor() throws Throwable {
-        final Constructor<PeerGroupUtil> c = PeerGroupUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
     @Test
     public void testNoneGroup() {
         assertNull(PeerGroupUtil.buildPeerGroups(Collections.singletonList(this.bgpPeerState)));
index c8fafa2603e993a5497c97a7afce21fb5b68a3f0..474550c002c482e2099dc3bffe5ca62160ae9a41 100644 (file)
@@ -8,8 +8,10 @@
 
 package org.opendaylight.protocol.bgp.state;
 
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.opendaylight.protocol.util.CheckUtil.checkNotPresentOperational;
 import static org.opendaylight.protocol.util.CheckUtil.readDataOperational;
@@ -26,7 +28,6 @@ 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.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
 import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
@@ -175,20 +176,24 @@ public class StateProviderImplTest extends AbstractConcurrentDataBrokerTest {
         doReturn(this.as).when(this.bgpRibState).getAs();
         doReturn(this.bgpId).when(this.bgpRibState).getRouteId();
 
-        Mockito.doAnswer(invocation -> this.totalPathsCounter.longValue()).when(this.bgpRibState).getTotalPathsCount();
-        Mockito.doAnswer(invocation -> this.totalPrefixesCounter.longValue()).when(this.bgpRibState).getTotalPrefixesCount();
-        Mockito.doAnswer(invocation -> this.totalPathsCounter.longValue()).when(this.bgpRibState).getPathCount(eq(TABLES_KEY));
-        Mockito.doAnswer(invocation -> this.totalPrefixesCounter.longValue()).when(this.bgpRibState).getPrefixesCount(eq(TABLES_KEY));
-        Mockito.doAnswer(invocation -> Collections.singletonMap(TABLES_KEY,
+        doAnswer(invocation -> this.totalPathsCounter.longValue())
+                .when(this.bgpRibState).getTotalPathsCount();
+        doAnswer(invocation -> this.totalPrefixesCounter.longValue())
+                .when(this.bgpRibState).getTotalPrefixesCount();
+        doAnswer(invocation -> this.totalPathsCounter.longValue())
+                .when(this.bgpRibState).getPathCount(eq(TABLES_KEY));
+        doAnswer(invocation -> this.totalPrefixesCounter.longValue())
+                .when(this.bgpRibState).getPrefixesCount(eq(TABLES_KEY));
+        doAnswer(invocation -> Collections.singletonMap(TABLES_KEY,
             this.totalPrefixesCounter.longValue())).when(this.bgpRibState).getPrefixesCount();
-        Mockito.doAnswer(invocation -> Collections.singletonMap(TABLES_KEY,
+        doAnswer(invocation -> Collections.singletonMap(TABLES_KEY,
             this.totalPathsCounter.longValue())).when(this.bgpRibState).getPathsCount();
 
         // Mock Peer
         doReturn("test-group").when(this.bgpPeerState).getGroupId();
         doReturn(iid).when(this.bgpPeerState).getInstanceIdentifier();
-        Mockito.doAnswer(invocation -> this.totalPrefixesCounter.longValue()).when(this.bgpPeerState).getTotalPrefixes();
-        Mockito.doAnswer(invocation -> this.totalPathsCounter.longValue()).when(this.bgpPeerState).getTotalPathsCount();
+        doAnswer(invocation -> this.totalPrefixesCounter.longValue()).when(this.bgpPeerState).getTotalPrefixes();
+        doAnswer(invocation -> this.totalPathsCounter.longValue()).when(this.bgpPeerState).getTotalPathsCount();
         doReturn(this.neighborAddress).when(this.bgpPeerState).getNeighborAddress();
         doReturn(this.bgpSessionState).when(this.bgpPeerState).getBGPSessionState();
         doReturn(this.bgpPeerMessagesState).when(this.bgpPeerState).getBGPPeerMessagesState();
@@ -247,7 +252,7 @@ public class StateProviderImplTest extends AbstractConcurrentDataBrokerTest {
         this.bgpRibStates.add(this.bgpRibState);
         readDataOperational(getDataBroker(), this.bgpInstanceIdentifier, bgpRib -> {
             final Global global = bgpRib.getGlobal();
-            Assert.assertEquals(globalExpected, global);
+            assertEquals(globalExpected, global);
             return bgpRib;
         });
 
@@ -257,7 +262,7 @@ public class StateProviderImplTest extends AbstractConcurrentDataBrokerTest {
         final Global globalExpected2 = buildGlobalExpected(1);
         readDataOperational(getDataBroker(), this.bgpInstanceIdentifier, bgpRib -> {
             final Global global = bgpRib.getGlobal();
-            Assert.assertEquals(globalExpected2, global);
+            assertEquals(globalExpected2, global);
             return bgpRib;
         });
 
@@ -267,7 +272,7 @@ public class StateProviderImplTest extends AbstractConcurrentDataBrokerTest {
         final Global globalExpected3 = buildGlobalExpected(0);
         readDataOperational(getDataBroker(), this.bgpInstanceIdentifier, bgpRib -> {
             final Global global = bgpRib.getGlobal();
-            Assert.assertEquals(globalExpected3, global);
+            assertEquals(globalExpected3, global);
             Assert.assertNull(bgpRib.getNeighbors());
             Assert.assertNull(bgpRib.getPeerGroups());
             return bgpRib;
@@ -289,18 +294,18 @@ public class StateProviderImplTest extends AbstractConcurrentDataBrokerTest {
         readDataOperational(getDataBroker(), this.bgpInstanceIdentifier, bgpRib -> {
             final Neighbors neighbors = bgpRib.getNeighbors();
             Assert.assertNotNull(neighbors);
-            Assert.assertEquals(peerGroupExpected, bgpRib.getPeerGroups().getPeerGroup().get(0));
+            assertEquals(peerGroupExpected, bgpRib.getPeerGroups().getPeerGroup().get(0));
             final Neighbor neighborResult = neighbors.getNeighbor().get(0);
-            Assert.assertEquals(this.neighborAddress, neighborResult.getNeighborAddress());
-            Assert.assertEquals(expectedAfiSafis, neighborResult.getAfiSafis());
-            Assert.assertEquals(expectedErrorHandling, neighborResult.getErrorHandling());
-            Assert.assertEquals(expectedGracefulRestart, neighborResult.getGracefulRestart());
-            Assert.assertEquals(expectedTransport, neighborResult.getTransport());
-            Assert.assertEquals(expectedTimers, neighborResult.getTimers());
-            final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State stateResult =
-                    neighborResult.getState();
-            Assert.assertEquals(expectedBgpNeighborState, stateResult.getAugmentation(BgpNeighborStateAugmentation.class));
-            Assert.assertEquals(BgpNeighborState.SessionState.ESTABLISHED, stateResult
+            assertEquals(this.neighborAddress, neighborResult.getNeighborAddress());
+            assertEquals(expectedAfiSafis, neighborResult.getAfiSafis());
+            assertEquals(expectedErrorHandling, neighborResult.getErrorHandling());
+            assertEquals(expectedGracefulRestart, neighborResult.getGracefulRestart());
+            assertEquals(expectedTransport, neighborResult.getTransport());
+            assertEquals(expectedTimers, neighborResult.getTimers());
+            final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
+                    .State stateResult = neighborResult.getState();
+            assertEquals(expectedBgpNeighborState, stateResult.getAugmentation(BgpNeighborStateAugmentation.class));
+            assertEquals(BgpNeighborState.SessionState.ESTABLISHED, stateResult
                     .getAugmentation(NeighborStateAugmentation.class).getSessionState());
             final List<Class<? extends BgpCapability>> supportedCapabilitiesResult = stateResult
                     .getAugmentation(NeighborStateAugmentation.class).getSupportedCapabilities();
@@ -366,17 +371,17 @@ public class StateProviderImplTest extends AbstractConcurrentDataBrokerTest {
 
     private static ErrorHandling buildErrorHandling() {
         final ErrorHandling errorHandling = new ErrorHandlingBuilder().setState(
-                new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.error.handling.
-                        StateBuilder().setTreatAsWithdraw(false)
+                new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.error
+                        .handling.StateBuilder().setTreatAsWithdraw(false)
                         .addAugmentation(NeighborErrorHandlingStateAugmentation.class,
-                                new NeighborErrorHandlingStateAugmentationBuilder().setErroneousUpdateMessages(1L).build()).build())
-                .build();
+                                new NeighborErrorHandlingStateAugmentationBuilder()
+                                        .setErroneousUpdateMessages(1L).build()).build()).build();
         return errorHandling;
     }
 
     private static Timers buildTimers() {
-        final Timers timers = new TimersBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.
-                bgp.rev151009.bgp.neighbor.group.timers.StateBuilder()
+        final Timers timers = new TimersBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang
+                .bgp.rev151009.bgp.neighbor.group.timers.StateBuilder()
                 .setConnectRetry(BigDecimal.valueOf(30))
                 .setHoldTime(BigDecimal.valueOf(90))
                 .setKeepaliveInterval(BigDecimal.valueOf(30))
@@ -416,18 +421,21 @@ public class StateProviderImplTest extends AbstractConcurrentDataBrokerTest {
         return gracefulRestart;
     }
 
-    private Global buildGlobalExpected(final long PrefixesAndPaths) {
+    private Global buildGlobalExpected(final long prefixesAndPaths) {
         return new GlobalBuilder()
-            .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.
-                StateBuilder().setRouterId(new Ipv4Address(this.bgpId.getValue())).setTotalPrefixes(PrefixesAndPaths)
-                .setTotalPaths(PrefixesAndPaths).setAs(this.as).build())
-            .setAfiSafis(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.
-                AfiSafisBuilder().setAfiSafi(Collections.singletonList(new AfiSafiBuilder()
-                .setAfiSafiName(IPV4UNICAST.class).setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang
-                    .bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder().setEnabled(false)
-                    .addAugmentation(GlobalAfiSafiStateAugmentation.class, new GlobalAfiSafiStateAugmentationBuilder()
-                        .setTotalPaths(PrefixesAndPaths).setTotalPrefixes(PrefixesAndPaths).build()).build()).build()))
-                .build()).build();
+                .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base
+                        .StateBuilder().setRouterId(new Ipv4Address(this.bgpId.getValue()))
+                        .setTotalPrefixes(prefixesAndPaths).setTotalPaths(prefixesAndPaths).setAs(this.as).build())
+                .setAfiSafis(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base
+                        .AfiSafisBuilder().setAfiSafi(Collections.singletonList(new AfiSafiBuilder()
+                        .setAfiSafiName(IPV4UNICAST.class).setState(new org.opendaylight.yang.gen.v1.http.openconfig
+                                .net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder()
+                                .setEnabled(false)
+                                .addAugmentation(GlobalAfiSafiStateAugmentation.class,
+                                        new GlobalAfiSafiStateAugmentationBuilder()
+                                                .setTotalPaths(prefixesAndPaths).setTotalPrefixes(prefixesAndPaths)
+                                                .build()).build()).build()))
+                        .build()).build();
     }
 
     private static PeerGroup buildGroupExpected() {