Fix issues related to checkstyle enforcement on openflow-impl module 45/64045/2
authorDavid Suarez <david.suarez.fuentes@gmail.com>
Sun, 8 Oct 2017 17:04:59 +0000 (19:04 +0200)
committerD Arunprakash <d.arunprakash@ericsson.com>
Tue, 17 Oct 2017 05:07:00 +0000 (10:37 +0530)
This is the last commit. It enforces the checkstyle level to error.

Change-Id: I954f0cbabd68134254e3a05216d6f6f126e33d37
Signed-off-by: David Suarez <david.suarez.fuentes@gmail.com>
51 files changed:
openflowplugin-impl/pom.xml
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/common/MultipartReplyTranslatorUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/MultipartWriterProviderFactory.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/SwitchFeaturesUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/MatchDeserializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/MessageDeserializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/MultipartDeserializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/util/InstructionUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/InstructionSerializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/MatchSerializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/MessageSerializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/MultipartMatchFieldSerializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/MultipartSerializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/MultipartTableFeaturesSerializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/SerializerInjector.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/util/InstructionUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/multilayer/MultiLayerAggregateFlowMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalBundleServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupsBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerGetAsyncConfigService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/SessionStatistics.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/MeterStatisticsToNotificationTransformer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/NodeConnectorStatisticsToNotificationTransformer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/QueueStatisticsToNotificationTransformer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/MultiLayerDirectStatisticsProviderInitializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/SingleLayerDirectStatisticsProviderInitializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtils.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MessageFactory.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/NodeConnectorRefToPortTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/PacketInUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/PathUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/PortTranslatorUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/ThreadPoolLoggingExecutor.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/connection/testutil/MsgGeneratorTestUtils.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/SwitchFeaturesUtilTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/TestFlowHelper.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalBundleServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/MeterDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/MeterDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MessageFactoryTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/PacketInUtilTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/PortTranslatorUtilTest.java

index aade4030aba3abc16f37ce6a295e06ad08f35c45..2406609a05916188438bcb157b9f4b557d4133ee 100644 (file)
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.opendaylight.openflowplugin</groupId>
     <artifactId>openflowplugin-impl</artifactId>
     <packaging>bundle</packaging>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=warning</propertyExpansion>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <!-- This bundle works with Karaf 3 and 4.0 -->
-                        <Import-Package>
-                            org.apache.karaf.shell.commands;version="[3.0.0,4.1)",
-                            org.apache.karaf.shell.console;version="[3.0.0,4.1)",
-                            *
-                        </Import-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.openflowplugin</groupId>
             <artifactId>openflowplugin-common</artifactId>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <!-- This bundle works with Karaf 3 and 4.0 -->
+                        <Import-Package>
+                            org.apache.karaf.shell.commands;version="[3.0.0,4.1)",
+                            org.apache.karaf.shell.console;version="[3.0.0,4.1)",
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
 
index 67fa6fac2459bbeef60578e71b700e07319c5dbf..a9d5646ee473f45a07144bdf5c7bb0831419bd11 100644 (file)
@@ -127,9 +127,12 @@ import org.slf4j.LoggerFactory;
  * Class converts multipart reply messages to the objects that can be then written to datastore using
  * multipart writers.
  */
-public class MultipartReplyTranslatorUtil {
+public final class MultipartReplyTranslatorUtil {
     private static final Logger LOG = LoggerFactory.getLogger(MultipartReplyTranslatorUtil.class);
 
+    private MultipartReplyTranslatorUtil() {
+    }
+
     public static Optional<? extends MultipartReplyBody> translate(
             final OfHeader message,
             final DeviceInfo deviceInfo,
index ba72af1438efc0c822c813b7b09d316c5b35b0b5..adae26e900ef27f3c28316c05eeb9596dd7840e8 100644 (file)
@@ -29,7 +29,10 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 /**
  * Multipart writer provider factory.
  */
-public class MultipartWriterProviderFactory {
+public final class MultipartWriterProviderFactory {
+
+    private MultipartWriterProviderFactory() {
+    }
 
     /**
      * Create default #{@link MultipartWriterProvider}.
index 9429b45e08fe7a135b7d4d21183647997661e9a6..e47b0ab7c997a876397ee1ce42d5c375662bab12 100644 (file)
@@ -585,8 +585,9 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         return useSingleLayerSerialization && getDeviceInfo().getVersion() >= OFConstants.OFP_VERSION_1_3;
     }
 
+    // TODO: exception handling should be fixed by using custom checked exception, never RuntimeExceptions
     @Override
-    @SuppressWarnings("checkstyle:IllegalCatch")
+    @SuppressWarnings({"checkstyle:IllegalCatch", "checkstyle:AvoidHidingCauseExceptionCheck"})
     public void instantiateServiceInstance() {
         lazyTransactionManagerInitialization();
 
@@ -707,8 +708,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                         .filter(Objects::nonNull)
                         .count();
 
-                LOG.debug("Finished filling flow registry with {} flows for node: {}", flowCount, deviceInfo
-                        );
+                LOG.debug("Finished filling flow registry with {} flows for node: {}", flowCount, deviceInfo);
             }
             this.contextChainMastershipWatcher.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState
                     .INITIAL_FLOW_REGISTRY_FILL);
@@ -721,8 +721,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                     LOG.debug("Cancelled filling flow registry with flows for node: {}", deviceInfo);
                 }
             } else {
-                LOG.warn("Failed filling flow registry with flows for node: {} with exception: {}", deviceInfo
-                        , throwable);
+                LOG.warn("Failed filling flow registry with flows for node: {} with exception: {}", deviceInfo,
+                         throwable);
             }
             contextChainMastershipWatcher.onNotAbleToStartMastership(
                     deviceInfo,
index 7612b953255bb83af0f7efb1972c6dc1f8b22898..3f8e0da728a53b610abee9f3509f1720fc04f4b6 100644 (file)
@@ -32,7 +32,7 @@ public final class SwitchFeaturesUtil {
     }
 
     /**
-     * Get singleton instance
+     * Get singleton instance.
      *
      * @return instance
      */
@@ -41,11 +41,13 @@ public final class SwitchFeaturesUtil {
     }
 
     /**
-     * @param features {@link org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput}
+     * Returns the features of the switch.
+     *
+     * @param features
+     * {@link org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput}
      * @return switch features
      */
     public SwitchFeatures buildSwitchFeatures(GetFeaturesOutput features) {
-
         if (swFeaturesBuilders.containsKey(features.getVersion())) {
             LOG.debug("map contains version {}", features.getVersion());
             try {
@@ -57,8 +59,6 @@ public final class SwitchFeaturesUtil {
         } else {
             LOG.warn("unknown version: {}", features.getVersion());
         }
-
         return null;
     }
-
 }
index 7dd3c1506357c792281a780681e98b99633b8e0f..187e77771b15d053651c1555a4b06faa4a32be7a 100644 (file)
@@ -66,7 +66,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 /**
  * Util class for injecting new match entry deserializers into OpenflowJava.
  */
-public class MatchDeserializerInjector {
+public final class MatchDeserializerInjector {
+
+    private MatchDeserializerInjector() {
+    }
 
     /**
      * Injects deserializers into provided
index e586bd76382216c5b17b0b2ecfc5a850204a4518..ccd62b41b7f2c9ca36bff1e45364c676c8a60c02 100644 (file)
@@ -38,7 +38,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
 
-class MessageDeserializerInjector {
+final class MessageDeserializerInjector {
+
+    private MessageDeserializerInjector() {
+    }
 
     /**
      * Injects message deserializers into provided.
@@ -85,7 +88,7 @@ class MessageDeserializerInjector {
      */
     @VisibleForTesting
     static Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>>
-    createInjector(
+        createInjector(
             final DeserializerExtensionProvider provider,
             final short version) {
         return code -> retType -> deserializer -> {
index 840b3ac1633b17c391c61bcdfc6336afa88efa03..3200fc8366bc7e5691eba126d1afcf013d7afc10 100644 (file)
@@ -32,7 +32,10 @@ import org.opendaylight.openflowplugin.impl.protocol.deserialization.multipart.M
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 
-class MultipartDeserializerInjector {
+final class MultipartDeserializerInjector {
+
+    private MultipartDeserializerInjector() {
+    }
 
     /**
      * Injects message deserializers into provided
index 50388d5962b53319c90e46755b2c2d07d6594b97..bb3cf7129a512355038b57129eac6d82977e9ef0 100644 (file)
@@ -22,7 +22,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 /**
  * Utility class for action deserialization.
  */
-public class InstructionUtil {
+public final class InstructionUtil {
+
+    private InstructionUtil() {
+    }
 
     /**
      * Deserialize OpenFlow instruction.
index f7c53aaff6d69cf3309cc127f527b07cad9f7785..74a9cc2b0233d5006b3e66471dbf36ce61b760e1 100644 (file)
@@ -32,7 +32,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 /**
  * Util class for injecting new instruction serializers into OpenflowJava.
  */
-class InstructionSerializerInjector {
+public final class  InstructionSerializerInjector {
+
+    private InstructionSerializerInjector() {
+    }
 
     /**
      * Injects serializers into provided
index 50f45733297710eb5a568376311249506dd4d5b2..456b8e916c7b59332c36b8c04a4362242da2fd89 100644 (file)
@@ -67,7 +67,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 /**
  * Util class for injecting new match serializers into OpenflowJava.
  */
-class MatchSerializerInjector {
+public final class MatchSerializerInjector {
+
+    private MatchSerializerInjector() {
+    }
 
     /**
      * Injects match serializers into provided
index ff1c57ad073b196e6c6aebd837c51f731c508ee2..58c7b35a5357f50a913a297a6d20aad9211cca03 100644 (file)
@@ -32,7 +32,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 /**
  * Util class for injecting new message serializers into OpenflowJava.
  */
-class MessageSerializerInjector {
+final class MessageSerializerInjector {
+
+    private MessageSerializerInjector() {
+    }
 
     /**
      * Injects message serializers into provided
index 69c3eed50b3547cffb64718daad54a6b6bb95090..46d2f7ef32b3d42b051ef8dab9b627d133db1766 100644 (file)
@@ -105,7 +105,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.f
 /**
  * Util class for injecting new multipart match field serializers into OpenflowJava.
  */
-class MultipartMatchFieldSerializerInjector {
+final class MultipartMatchFieldSerializerInjector {
+
+    private MultipartMatchFieldSerializerInjector() {
+    }
 
     /**
      * Injects multipart match field serializers into provided
index dbf61d1eb6cb7a09018703d296e97d909058623f..da138d0b7c7cd8841f73407af7b9a702a52fe57d 100644 (file)
@@ -50,7 +50,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multi
 /**
  * Util class for injecting new multipart serializers into OpenflowJava.
  */
-class MultipartSerializerInjector {
+final class MultipartSerializerInjector {
+
+    private MultipartSerializerInjector() {
+    }
 
     /**
      * Injects multipart serializers into provided
index 0721490600cb0126dd2c052b1919f7df90e4e6e2..bb2b83eb6e280d34bb5a1c03da7a6139f7a49dec 100644 (file)
@@ -48,7 +48,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
 /**
  * Util class for injecting new multipart table features serializers into OpenflowJava.
  */
-class MultipartTableFeaturesSerializerInjector {
+final class MultipartTableFeaturesSerializerInjector {
+
+    private MultipartTableFeaturesSerializerInjector() {
+    }
 
     /**
      * Injects multipart table features serializers into provided
index 330d5fa993eeeccd5a9646472b808fab083c849f..a740ac0ab6cf87174512bab503e94e0c7f003b03 100644 (file)
@@ -13,7 +13,10 @@ import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtens
 /**
  * Util class for injecting new serializers into OpenflowJava.
  */
-public class SerializerInjector {
+public final class SerializerInjector {
+
+    private SerializerInjector() {
+    }
 
     /**
      * Injects serializers into provided
index 95cdb10e14cca685fab2fe20e818be4081f7485a..413c4fdbf4ad01f96b620940e889885b8a3db3ab 100644 (file)
@@ -18,7 +18,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 /**
  * Utility class for instruction serialization.
  */
-public class InstructionUtil {
+public final class InstructionUtil {
+
+    private InstructionUtil() {
+    }
 
     /**
      * Serialize instruction.
index a33f1ebc7c0477c766d65629f3021a7166221d53..a5f203c86809cb0aa798eadab7dfe5ae430611d1 100644 (file)
@@ -63,10 +63,10 @@ public class MultiLayerAggregateFlowMultipartService extends AbstractAggregateFl
 
     @Override
     protected OfHeader buildRequest(final Xid xid,
-                                    final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input)
-                                                                                            throws ServiceException {
-        final MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder =
-                new MultipartRequestAggregateCaseBuilder();
+                                    final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) throws
+            ServiceException {
+        final MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder
+                new MultipartRequestAggregateCaseBuilder();
         final MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
         final short tableId = MoreObjects.firstNonNull(input.getTableId(), OFConstants.OFPTT_ALL);
         mprAggregateRequestBuilder.setTableId(tableId);
@@ -86,8 +86,8 @@ public class MultiLayerAggregateFlowMultipartService extends AbstractAggregateFl
             if (input.getCookieMask() == null) {
                 mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
             } else {
-                mprAggregateRequestBuilder.setCookieMask(MoreObjects.firstNonNull(input.getCookieMask().getValue(),
-                                                                                  OFConstants.DEFAULT_COOKIE_MASK));
+                mprAggregateRequestBuilder.setCookieMask(
+                        MoreObjects.firstNonNull(input.getCookieMask().getValue(), OFConstants.DEFAULT_COOKIE_MASK));
             }
             long outGroup = MoreObjects.firstNonNull(input.getOutGroup(), OFConstants.OFPG_ANY);
             mprAggregateRequestBuilder.setOutGroup(outGroup);
@@ -104,11 +104,10 @@ public class MultiLayerAggregateFlowMultipartService extends AbstractAggregateFl
         FlowCreatorUtil.setWildcardedFlowMatch(version, mprAggregateRequestBuilder);
 
         // Set request body to main multipart request
-        multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder
-            .build());
+        multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
 
-        final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
-            MultipartType.OFPMPAGGREGATE, xid.getValue(), version);
+        final MultipartRequestInputBuilder mprInput = RequestInputUtils
+                .createMultipartHeader(MultipartType.OFPMPAGGREGATE, xid.getValue(), version);
 
         mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
 
@@ -116,31 +115,35 @@ public class MultiLayerAggregateFlowMultipartService extends AbstractAggregateFl
     }
 
     @Override
-    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
-        handleAndReply(final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
+    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> handleAndReply(
+            final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
         return Futures.transform(handleServiceCall(input),
-            (Function<RpcResult<List<MultipartReply>>,
-             RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>) result -> {
+                     (Function<RpcResult<List<MultipartReply>>,
+                             RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>)
+            result -> {
                 if (Preconditions.checkNotNull(result).isSuccessful()) {
-                    final MessageTranslator<MultipartReply, AggregatedFlowStatistics> messageTranslator =
-                        translatorLibrary
-                        .lookupTranslator(new TranslatorKey(getVersion(), MultipartReplyAggregateCase.class.getName()));
-
-                    return RpcResultBuilder
-                        .success(new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder()
-                            .setAggregatedFlowStatistics(result
-                                .getResult()
-                                .stream()
-                                .map(multipartReply -> messageTranslator
-                                    .translate(multipartReply, getDeviceInfo(), null))
-                                .collect(Collectors.toList())))
-                        .build();
+                    final MessageTranslator<MultipartReply, AggregatedFlowStatistics>
+                             messageTranslator = translatorLibrary.lookupTranslator(
+                             new TranslatorKey(getVersion(),
+                                               MultipartReplyAggregateCase.class.getName()));
+
+                    return RpcResultBuilder.success(
+                             new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder()
+                                     .setAggregatedFlowStatistics(result.getResult().stream()
+                                                                          .map(multipartReply ->
+                                                                                       messageTranslator
+                                                                                  .translate(
+                                                                                          multipartReply,
+                                                                                          getDeviceInfo(),
+                                                                                          null))
+                                                                          .collect(Collectors
+                                                                                           .toList())))
+                             .build();
                 }
 
                 return RpcResultBuilder
-                    .<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>failed()
-                    .withRpcErrors(result.getErrors())
-                    .build();
+                             .<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>failed()
+                             .withRpcErrors(result.getErrors()).build();
             });
     }
 }
index e24b40885380cbfc328426b3c5d7e0a0fbf41241..cc84e457af4db2c2087ad8b47446ae54bf63e5a0 100644 (file)
@@ -39,8 +39,8 @@ public class SalBundleServiceImpl implements SalBundleService {
     private final SalExperimenterMessageService experimenterMessageService;
 
     public SalBundleServiceImpl(final SalExperimenterMessageService experimenterMessageService) {
-        this.experimenterMessageService = Preconditions.checkNotNull(experimenterMessageService,
-                "SalExperimenterMessageService can not be null!");
+        this.experimenterMessageService = Preconditions
+                .checkNotNull(experimenterMessageService, "SalExperimenterMessageService can not be null!");
     }
 
     @Override
@@ -48,12 +48,7 @@ public class SalBundleServiceImpl implements SalBundleService {
         final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
         experimenterInputBuilder.setNode(input.getNode());
         experimenterInputBuilder.setExperimenterMessageOfChoice(
-                new BundleControlSalBuilder()
-                        .setSalControlData(
-                                new SalControlDataBuilder(input).build()
-                        )
-                        .build()
-        );
+                new BundleControlSalBuilder().setSalControlData(new SalControlDataBuilder(input).build()).build());
         return experimenterMessageService.sendExperimenter(experimenterInputBuilder.build());
     }
 
@@ -70,16 +65,17 @@ public class SalBundleServiceImpl implements SalBundleService {
         dataBuilder.setBundleProperty(input.getBundleProperty());
         for (Message message : input.getMessages().getMessage()) {
             dataBuilder.setBundleInnerMessage(message.getBundleInnerMessage());
-            experimenterInputBuilder.setExperimenterMessageOfChoice(bundleAddMessageBuilder
-                    .setSalAddMessageData(dataBuilder.build()).build());
-            ListenableFuture<RpcResult<Void>> res = JdkFutureAdapters.listenInPoolThread(
-                    experimenterMessageService.sendExperimenter(experimenterInputBuilder.build()));
+            experimenterInputBuilder.setExperimenterMessageOfChoice(
+                    bundleAddMessageBuilder.setSalAddMessageData(dataBuilder.build()).build());
+            ListenableFuture<RpcResult<Void>> res = JdkFutureAdapters
+                    .listenInPoolThread(experimenterMessageService.sendExperimenter(experimenterInputBuilder.build()));
             partialResults.add(res);
         }
         return processResults(partialResults);
     }
 
-    private static Future<RpcResult<Void>> processResults(final List<ListenableFuture<RpcResult<Void>>> partialResults) {
+    private static Future<RpcResult<Void>> processResults(
+            final List<ListenableFuture<RpcResult<Void>>> partialResults) {
         final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
         Futures.addCallback(Futures.successfulAsList(partialResults), new FutureCallback<List<RpcResult<Void>>>() {
             @Override
@@ -89,7 +85,7 @@ public class SalBundleServiceImpl implements SalBundleService {
                 for (RpcResult<Void> res : results) {
                     if (res == null) {
                         errors.add(RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "BundleExtensionService",
-                                "RpcResult is null."));
+                                                             "RpcResult is null."));
                     } else if (!res.isSuccessful()) {
                         errors.addAll(res.getErrors());
                     }
@@ -103,7 +99,7 @@ public class SalBundleServiceImpl implements SalBundleService {
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable throwable) {
                 RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.failed();
                 result.set(rpcResultBuilder.build());
             }
index 6d9e09b8bf9111f12b142df030f5977f222ef881..b11ded0fa971c756e59adb1a44fbc9000eefda15 100644 (file)
@@ -205,7 +205,7 @@ public class SalFlowServiceImpl implements SalFlowService {
                 .child(Flow.class, new FlowKey(flowDescriptor.getFlowId()));
     }
 
-    private class AddFlowCallback implements FutureCallback<RpcResult<AddFlowOutput>> {
+    private final class AddFlowCallback implements FutureCallback<RpcResult<AddFlowOutput>> {
         private final AddFlowInput input;
         private final FlowRegistryKey flowRegistryKey;
 
@@ -246,7 +246,7 @@ public class SalFlowServiceImpl implements SalFlowService {
         }
     }
 
-    private class RemoveFlowCallback implements FutureCallback<RpcResult<RemoveFlowOutput>> {
+    private final class RemoveFlowCallback implements FutureCallback<RpcResult<RemoveFlowOutput>> {
         private final RemoveFlowInput input;
 
         private RemoveFlowCallback(final RemoveFlowInput input) {
@@ -276,7 +276,7 @@ public class SalFlowServiceImpl implements SalFlowService {
         }
     }
 
-    private class UpdateFlowCallback implements FutureCallback<RpcResult<UpdateFlowOutput>> {
+    private final class UpdateFlowCallback implements FutureCallback<RpcResult<UpdateFlowOutput>> {
         private final UpdateFlowInput input;
 
         private UpdateFlowCallback(UpdateFlowInput input) {
index b9ad4bd85498c0af536767bbb95b5295b7148af6..7a213902603f6eac719194f33f6833f49846c2bd 100644 (file)
@@ -79,26 +79,24 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
             final UpdateGroupInput updateGroupInput = new UpdateGroupInputBuilder(input)
                     .setOriginalGroup(new OriginalGroupBuilder(batchGroup.getOriginalBatchedGroup()).build())
                     .setUpdatedGroup(new UpdatedGroupBuilder(batchGroup.getUpdatedBatchedGroup()).build())
-                    .setGroupRef(createGroupRef(input.getNode(), batchGroup))
-                    .setNode(input.getNode())
-                    .build();
+                    .setGroupRef(createGroupRef(input.getNode(), batchGroup)).setNode(input.getNode()).build();
             resultsLot.add(JdkFutureAdapters.listenInPoolThread(salGroupService.updateGroup(updateGroupInput)));
         }
 
         final Iterable<Group> groups = batchUpdateGroups.stream()
-                .map(BatchGroupInputUpdateGrouping::getUpdatedBatchedGroup)
-                .collect(Collectors.toList());
+                .map(BatchGroupInputUpdateGrouping::getUpdatedBatchedGroup).collect(Collectors.toList());
 
-        final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult =
-                Futures.transform(Futures.allAsList(resultsLot), GroupUtil.<UpdateGroupOutput>createCumulatingFunction(
-                        groups, batchUpdateGroups.size()));
+        final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures
+                .transform(Futures.allAsList(resultsLot),
+                           GroupUtil.<UpdateGroupOutput>createCumulatingFunction(groups, batchUpdateGroups.size()));
 
-        ListenableFuture<RpcResult<UpdateGroupsBatchOutput>> updateGroupsBulkFuture = Futures.transform(
-                commonResult, GroupUtil.GROUP_UPDATE_TRANSFORM);
+        ListenableFuture<RpcResult<UpdateGroupsBatchOutput>> updateGroupsBulkFuture = Futures
+                .transform(commonResult, GroupUtil.GROUP_UPDATE_TRANSFORM);
 
         if (input.isBarrierAfter()) {
-            updateGroupsBulkFuture = BarrierUtil.chainBarrier(updateGroupsBulkFuture, input.getNode(),
-                    transactionService, GroupUtil.GROUP_UPDATE_COMPOSING_TRANSFORM);
+            updateGroupsBulkFuture = BarrierUtil
+                    .chainBarrier(updateGroupsBulkFuture, input.getNode(), transactionService,
+                                  GroupUtil.GROUP_UPDATE_COMPOSING_TRANSFORM);
         }
 
         return updateGroupsBulkFuture;
@@ -110,22 +108,20 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
         final ArrayList<ListenableFuture<RpcResult<AddGroupOutput>>> resultsLot = new ArrayList<>();
         for (BatchAddGroups addGroup : input.getBatchAddGroups()) {
             final AddGroupInput addGroupInput = new AddGroupInputBuilder(addGroup)
-                    .setGroupRef(createGroupRef(input.getNode(), addGroup))
-                    .setNode(input.getNode())
-                    .build();
+                    .setGroupRef(createGroupRef(input.getNode(), addGroup)).setNode(input.getNode()).build();
             resultsLot.add(JdkFutureAdapters.listenInPoolThread(salGroupService.addGroup(addGroupInput)));
         }
 
-        final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult =
-                Futures.transform(Futures.allAsList(resultsLot),
-                        GroupUtil.<AddGroupOutput>createCumulatingFunction(input.getBatchAddGroups()));
+        final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures
+                .transform(Futures.allAsList(resultsLot),
+                           GroupUtil.<AddGroupOutput>createCumulatingFunction(input.getBatchAddGroups()));
 
-        ListenableFuture<RpcResult<AddGroupsBatchOutput>> addGroupsBulkFuture =
-                Futures.transform(commonResult, GroupUtil.GROUP_ADD_TRANSFORM);
+        ListenableFuture<RpcResult<AddGroupsBatchOutput>> addGroupsBulkFuture = Futures
+                .transform(commonResult, GroupUtil.GROUP_ADD_TRANSFORM);
 
         if (input.isBarrierAfter()) {
-            addGroupsBulkFuture = BarrierUtil.chainBarrier(addGroupsBulkFuture, input.getNode(),
-                    transactionService, GroupUtil.GROUP_ADD_COMPOSING_TRANSFORM);
+            addGroupsBulkFuture = BarrierUtil.chainBarrier(addGroupsBulkFuture, input.getNode(), transactionService,
+                                                           GroupUtil.GROUP_ADD_COMPOSING_TRANSFORM);
         }
 
         return addGroupsBulkFuture;
@@ -133,28 +129,26 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
 
     @Override
     public Future<RpcResult<RemoveGroupsBatchOutput>> removeGroupsBatch(final RemoveGroupsBatchInput input) {
-        LOG.trace("Removing groups @ {} : {}",
-                  PathUtil.extractNodeId(input.getNode()),
+        LOG.trace("Removing groups @ {} : {}", PathUtil.extractNodeId(input.getNode()),
                   input.getBatchRemoveGroups().size());
         final ArrayList<ListenableFuture<RpcResult<RemoveGroupOutput>>> resultsLot = new ArrayList<>();
         for (BatchRemoveGroups addGroup : input.getBatchRemoveGroups()) {
             final RemoveGroupInput removeGroupInput = new RemoveGroupInputBuilder(addGroup)
-                    .setGroupRef(createGroupRef(input.getNode(), addGroup))
-                    .setNode(input.getNode())
-                    .build();
+                    .setGroupRef(createGroupRef(input.getNode(), addGroup)).setNode(input.getNode()).build();
             resultsLot.add(JdkFutureAdapters.listenInPoolThread(salGroupService.removeGroup(removeGroupInput)));
         }
 
-        final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult =
-                Futures.transform(Futures.allAsList(resultsLot),
-                        GroupUtil.<RemoveGroupOutput>createCumulatingFunction(input.getBatchRemoveGroups()));
+        final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures
+                .transform(Futures.allAsList(resultsLot),
+                           GroupUtil.<RemoveGroupOutput>createCumulatingFunction(input.getBatchRemoveGroups()));
 
-        ListenableFuture<RpcResult<RemoveGroupsBatchOutput>> removeGroupsBulkFuture =
-                Futures.transform(commonResult, GroupUtil.GROUP_REMOVE_TRANSFORM);
+        ListenableFuture<RpcResult<RemoveGroupsBatchOutput>> removeGroupsBulkFuture = Futures
+                .transform(commonResult, GroupUtil.GROUP_REMOVE_TRANSFORM);
 
         if (input.isBarrierAfter()) {
-            removeGroupsBulkFuture = BarrierUtil.chainBarrier(removeGroupsBulkFuture, input.getNode(),
-                    transactionService, GroupUtil.GROUP_REMOVE_COMPOSING_TRANSFORM);
+            removeGroupsBulkFuture = BarrierUtil
+                    .chainBarrier(removeGroupsBulkFuture, input.getNode(), transactionService,
+                                  GroupUtil.GROUP_REMOVE_COMPOSING_TRANSFORM);
         }
 
         return removeGroupsBulkFuture;
@@ -166,6 +160,6 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
 
     private static GroupRef createGroupRef(final NodeRef nodeRef, final BatchUpdateGroups batchGroup) {
         return GroupUtil.buildGroupPath((InstanceIdentifier<Node>) nodeRef.getValue(),
-                batchGroup.getUpdatedBatchedGroup().getGroupId());
+                                        batchGroup.getUpdatedBatchedGroup().getGroupId());
     }
 }
index c649671e1caddfcec7721e427c1748c17f791046..69f09448a35a2c28cb608ac4a20debfb7cc7c77b 100644 (file)
@@ -27,9 +27,6 @@ public class SingleLayerGetAsyncConfigService extends AbstractSimpleService<GetA
 
     @Override
     protected OfHeader buildRequest(Xid xid, GetAsyncInput input) throws ServiceException {
-        return new GetAsyncInputBuilder()
-                .setVersion(getVersion())
-                .setXid(xid.getValue())
-                .build();
+        return new GetAsyncInputBuilder().setVersion(getVersion()).setXid(xid.getValue()).build();
     }
 }
\ No newline at end of file
index 00568e6e23f349914e3924c6bb29a23f118930dc..763169db8fe474ce57bd738f806b47223ed03ff0 100644 (file)
@@ -75,10 +75,8 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
     StatisticsContextImpl(@Nonnull final DeviceContext deviceContext,
                           @Nonnull final ConvertorExecutor convertorExecutor,
                           @Nonnull final MultipartWriterProvider statisticsWriterProvider,
-                          @Nonnull final ListeningExecutorService executorService,
-                          boolean isStatisticsPollingOn,
-                          boolean isUsingReconciliationFramework,
-                          long statisticsPollingInterval,
+                          @Nonnull final ListeningExecutorService executorService, boolean isStatisticsPollingOn,
+                          boolean isUsingReconciliationFramework, long statisticsPollingInterval,
                           long maximumPollingDelay) {
         this.deviceContext = deviceContext;
         this.devState = Preconditions.checkNotNull(deviceContext.getDeviceState());
@@ -92,8 +90,9 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
         this.isUsingReconciliationFramework = isUsingReconciliationFramework;
 
         statisticsGatheringService = new StatisticsGatheringService<>(this, deviceContext);
-        statisticsGatheringOnTheFlyService = new StatisticsGatheringOnTheFlyService<>(this,
-                deviceContext, convertorExecutor, statisticsWriterProvider);
+        statisticsGatheringOnTheFlyService = new StatisticsGatheringOnTheFlyService<>(this, deviceContext,
+                                                                                      convertorExecutor,
+                                                                                      statisticsWriterProvider);
     }
 
     @Override
@@ -138,15 +137,12 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
     @Override
     public void continueInitializationAfterReconciliation() {
         if (deviceContext.initialSubmitTransaction()) {
-            contextChainMastershipWatcher.onMasterRoleAcquired(
-                    deviceInfo,
-                    ContextChainMastershipState.INITIAL_SUBMIT);
+            contextChainMastershipWatcher.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_SUBMIT);
 
             startGatheringData();
         } else {
-            contextChainMastershipWatcher.onNotAbleToStartMastershipMandatory(
-                    deviceInfo,
-                    "Initial transaction cannot be submitted.");
+            contextChainMastershipWatcher
+                    .onNotAbleToStartMastershipMandatory(deviceInfo, "Initial transaction cannot be submitted.");
         }
     }
 
@@ -217,17 +213,14 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
             StatisticsGatheringUtils.markDeviceStateSnapshotStart(deviceInfo, deviceContext);
 
             // recreate gathering future if it should be recreated
-            final ListenableFuture<Boolean> lastDataGathering = Objects.isNull(future) ||
-                    future.isCancelled() ||
-                    future.isDone() ?
-                    Futures.immediateFuture(Boolean.TRUE) :
-                    future;
+            final ListenableFuture<Boolean> lastDataGathering =
+                    Objects.isNull(future) || future.isCancelled() || future.isDone() ? Futures
+                            .immediateFuture(Boolean.TRUE) : future;
 
             // build statistics gathering future
-            final ListenableFuture<Boolean> newDataGathering = collectingStatType.stream().reduce(
-                    lastDataGathering,
-                    this::statChainFuture,
-                    (a, b) -> Futures.transformAsync(a, result -> b));
+            final ListenableFuture<Boolean> newDataGathering = collectingStatType.stream()
+                    .reduce(lastDataGathering, this::statChainFuture,
+                        (listenableFuture, asyn) -> Futures.transformAsync(listenableFuture, result -> asyn));
 
             // write end timestamp to state snapshot container
             Futures.addCallback(newDataGathering, new FutureCallback<Boolean>() {
@@ -237,8 +230,8 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
                 }
 
                 @Override
-                public void onFailure(final Throwable t) {
-                    if (!(t instanceof TransactionChainClosedException)) {
+                public void onFailure(final Throwable throwable) {
+                    if (!(throwable instanceof TransactionChainClosedException)) {
                         StatisticsGatheringUtils.markDeviceStateSnapshotEnd(deviceInfo, deviceContext, false);
                     }
                 }
@@ -250,7 +243,8 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
 
     private ListenableFuture<Boolean> statChainFuture(final ListenableFuture<Boolean> prevFuture,
                                                       final MultipartType multipartType) {
-        if (ConnectionContext.CONNECTION_STATE.RIP.equals(deviceContext.getPrimaryConnectionContext().getConnectionState())) {
+        if (ConnectionContext.CONNECTION_STATE.RIP
+                .equals(deviceContext.getPrimaryConnectionContext().getConnectionState())) {
             final String errMsg = String
                     .format("Device connection for node %s doesn't exist anymore. Primary connection status : %s",
                             getDeviceInfo().getNodeId(),
@@ -266,15 +260,11 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
             final boolean supported = collectingStatType.contains(multipartType);
 
             // TODO: Refactor twice sending deviceContext into gatheringStatistics
-            return supported ? StatisticsGatheringUtils.gatherStatistics(
-                    onTheFly ? statisticsGatheringOnTheFlyService : statisticsGatheringService,
-                    getDeviceInfo(),
-                    multipartType,
-                    deviceContext,
-                    deviceContext,
-                    convertorExecutor,
-                    statisticsWriterProvider,
-                    executorService) : Futures.immediateFuture(Boolean.FALSE);
+            return supported ? StatisticsGatheringUtils
+                    .gatherStatistics(onTheFly ? statisticsGatheringOnTheFlyService : statisticsGatheringService,
+                                      getDeviceInfo(), multipartType, deviceContext, deviceContext, convertorExecutor,
+                                      statisticsWriterProvider, executorService) : Futures
+                    .immediateFuture(Boolean.FALSE);
         });
     }
 
@@ -284,9 +274,11 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
         }
 
         LOG.info("Starting statistics gathering for node {}", deviceInfo);
-        final StatisticsPollingService statisticsPollingService = new StatisticsPollingService(timeCounter,
-                statisticsPollingInterval, maximumPollingDelay,
-                StatisticsContextImpl.this::gatherDynamicData);
+        final StatisticsPollingService statisticsPollingService =
+                new StatisticsPollingService(timeCounter,
+                                             statisticsPollingInterval,
+                                             maximumPollingDelay,
+                                             StatisticsContextImpl.this::gatherDynamicData);
 
         schedulingEnabled.set(true);
         statisticsPollingService.startAsync();
@@ -297,9 +289,7 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
         LOG.info("Stopping running statistics gathering for node {}", deviceInfo);
         cancelLastDataGathering();
 
-        return Optional
-                .ofNullable(statisticsPollingService.getAndSet(null))
-                .map(StatisticsPollingService::stop)
+        return Optional.ofNullable(statisticsPollingService.getAndSet(null)).map(StatisticsPollingService::stop)
                 .orElseGet(() -> Futures.immediateFuture(null));
     }
 
@@ -317,17 +307,16 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
     }
 
     @VisibleForTesting
-    void setStatisticsGatheringOnTheFlyService(final StatisticsGatheringOnTheFlyService<T> statisticsGatheringOnTheFlyService) {
+    void setStatisticsGatheringOnTheFlyService(
+            final StatisticsGatheringOnTheFlyService<T> statisticsGatheringOnTheFlyService) {
         this.statisticsGatheringOnTheFlyService = statisticsGatheringOnTheFlyService;
     }
 
     private final class InitialSubmitCallback implements FutureCallback<Boolean> {
         @Override
         public void onSuccess(@Nullable final Boolean result) {
-            contextChainMastershipWatcher.onMasterRoleAcquired(
-                    deviceInfo,
-                    ContextChainMastershipState.INITIAL_GATHERING
-            );
+            contextChainMastershipWatcher
+                    .onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_GATHERING);
 
             if (!isUsingReconciliationFramework) {
                 continueInitializationAfterReconciliation();
@@ -336,9 +325,10 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
 
         @Override
         public void onFailure(@Nonnull final Throwable throwable) {
-            contextChainMastershipWatcher.onNotAbleToStartMastershipMandatory(
-                    deviceInfo,
-                    "Initial gathering statistics unsuccessful: " + throwable.getMessage());
+            contextChainMastershipWatcher.onNotAbleToStartMastershipMandatory(deviceInfo,
+                                                                              "Initial gathering statistics "
+                                                                                      + "unsuccessful: "
+                                                                                      + throwable.getMessage());
         }
     }
-}
\ No newline at end of file
+}
index a063a40dfd3e41cc7f1fb4027d5d9e98ce9fe4d5..b84078bdc10e8438c411942309be7e452be45ec0 100644 (file)
@@ -69,70 +69,45 @@ public final class StatisticsGatheringUtils {
     }
 
     static <T extends OfHeader> ListenableFuture<Boolean> gatherStatistics(
-            final StatisticsGatherer<T> statisticsGatheringService,
-            final DeviceInfo deviceInfo,
-            final MultipartType type,
-            final TxFacade txFacade,
-            final DeviceRegistry registry,
-            final ConvertorExecutor convertorExecutor,
-            final MultipartWriterProvider statisticsWriterProvider,
+            final StatisticsGatherer<T> statisticsGatheringService, final DeviceInfo deviceInfo,
+            final MultipartType type, final TxFacade txFacade, final DeviceRegistry registry,
+            final ConvertorExecutor convertorExecutor, final MultipartWriterProvider statisticsWriterProvider,
             final ListeningExecutorService executorService) {
-        return Futures.transformAsync(
-                statisticsGatheringService.getStatisticsOfType(
-                        new EventIdentifier(QUEUE2_REQCTX + type.toString(), deviceInfo.getNodeId().toString()),
-                        type),
-                rpcResult -> executorService.submit(() -> {
-                    final boolean rpcResultIsNull = rpcResult == null;
-
-                    if (!rpcResultIsNull && rpcResult.isSuccessful()) {
-                        LOG.debug("Stats reply successfully received for node {} of type {}",
-                                deviceInfo.getNodeId(), type);
-
-                        // TODO: in case the result value is null then multipart data probably got processed
-                        // TODO: on the fly. This contract should by clearly stated and enforced.
-                        // TODO: Now simple true value is returned
-                        if (Objects.nonNull(rpcResult.getResult()) && !rpcResult.getResult().isEmpty()) {
-                            try {
-                                final List<DataContainer> allMultipartData = rpcResult
-                                        .getResult()
-                                        .stream()
-                                        .map(reply ->  MultipartReplyTranslatorUtil
-                                                .translate(reply, deviceInfo, convertorExecutor, null))
-                                        .filter(java.util.Optional::isPresent)
-                                        .map(java.util.Optional::get)
-                                        .collect(Collectors.toList());
-
-                                return processStatistics(
-                                        type,
-                                        allMultipartData,
-                                        txFacade,
-                                        registry,
-                                        deviceInfo,
-                                        statisticsWriterProvider);
-                            } catch (final Exception e) {
-                                LOG.warn("Stats processing of type {} for node {} failed with error: {}",
-                                        type, deviceInfo, e);
-                            }
-                        } else {
-                            LOG.debug("Stats reply was empty for node {} of type {}", deviceInfo.getNodeId(), type);
-                        }
+        return Futures.transformAsync(statisticsGatheringService.getStatisticsOfType(
+           new EventIdentifier(QUEUE2_REQCTX + type.toString(), deviceInfo.getNodeId().toString()), type),
+            rpcResult -> executorService.submit(() -> {
+                final boolean rpcResultIsNull = rpcResult == null;
+
+                if (!rpcResultIsNull && rpcResult.isSuccessful()) {
+                    LOG.debug("Stats reply successfully received for node {} of type {}", deviceInfo.getNodeId(), type);
+                    // TODO: in case the result value is null then multipart data probably got processed
+                    // TODO: on the fly. This contract should by clearly stated and enforced.
+                    // TODO: Now simple true value is returned
+                    if (Objects.nonNull(rpcResult.getResult()) && !rpcResult.getResult().isEmpty()) {
+                        final List<DataContainer> allMultipartData = rpcResult.getResult().stream()
+                                .map(reply -> MultipartReplyTranslatorUtil
+                                        .translate(reply, deviceInfo, convertorExecutor, null))
+                                .filter(java.util.Optional::isPresent).map(java.util.Optional::get)
+                                .collect(Collectors.toList());
+
+                        return processStatistics(type, allMultipartData, txFacade, registry, deviceInfo,
+                                                 statisticsWriterProvider);
                     } else {
-                        LOG.warn("Stats reply FAILED for node {} of type {}: {}", deviceInfo.getNodeId(), type,
-                                rpcResultIsNull ? "" : rpcResult.getErrors());
+                        LOG.debug("Stats reply was empty for node {} of type {}", deviceInfo.getNodeId(), type);
                     }
-
-                    return false;
-                }));
+                } else {
+                    LOG.warn("Stats reply FAILED for node {} of type {}: {}", deviceInfo.getNodeId(), type,
+                             rpcResultIsNull ? "" : rpcResult.getErrors());
+                }
+                return false;
+            }));
     }
 
-    private static boolean processStatistics(final MultipartType type,
-                                             final List<? extends DataContainer> statistics,
-                                             final TxFacade txFacade,
-                                             final DeviceRegistry deviceRegistry,
+    private static boolean processStatistics(final MultipartType type, final List<? extends DataContainer> statistics,
+                                             final TxFacade txFacade, final DeviceRegistry deviceRegistry,
                                              final DeviceInfo deviceInfo,
                                              final MultipartWriterProvider statisticsWriterProvider) {
-        final InstanceIdentifier<FlowCapableNode> instanceIdentifier = deviceInfo
-                .getNodeInstanceIdentifier()
+        final InstanceIdentifier<FlowCapableNode> instanceIdentifier = deviceInfo.getNodeInstanceIdentifier()
                 .augmentation(FlowCapableNode.class);
 
         switch (type) {
@@ -170,14 +145,12 @@ public final class StatisticsGatheringUtils {
             return true;
         }
 
-        LOG.warn("Stats processing of type {} for node {} "
-                + "failed during write-to-tx step", type, deviceInfo);
+        LOG.warn("Stats processing of type {} for node {} " + "failed during write-to-tx step", type, deviceInfo);
         return false;
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    private static boolean writeStatistics(final MultipartType type,
-                                           final List<? extends DataContainer> statistics,
+    private static boolean writeStatistics(final MultipartType type, final List<? extends DataContainer> statistics,
                                            final DeviceInfo deviceInfo,
                                            final MultipartWriterProvider statisticsWriterProvider) {
         final AtomicBoolean result = new AtomicBoolean(false);
@@ -191,8 +164,8 @@ public final class StatisticsGatheringUtils {
                 }
             }));
         } catch (final Exception ex) {
-            LOG.warn("Stats processing of type {} for node {} "
-                    + "failed during write-to-tx step", type, deviceInfo, ex);
+            LOG.warn("Stats processing of type {} for node {} " + "failed during write-to-tx step", type, deviceInfo,
+                     ex);
         }
 
         return result.get();
@@ -208,26 +181,22 @@ public final class StatisticsGatheringUtils {
         final ReadOnlyTransaction readTx = txFacade.getReadTransaction();
 
         try {
-            Futures.transform(Futures
-                .catchingAsync(readTx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier), Throwable.class,
-                    t -> {
+            Futures.transform(Futures.catchingAsync(readTx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier),
+                                                    Throwable.class, throwable -> {
                         // we wish to close readTx for fallBack
-                        readTx.close();
-                        return Futures.immediateFailedFuture(t);
-                    }), (Function<Optional<FlowCapableNode>, Void>)
-                flowCapNodeOpt -> {
+                    readTx.close();
+                    return Futures.immediateFailedFuture(throwable);
+                }), (Function<Optional<FlowCapableNode>, Void>) flowCapNodeOpt -> {
                     // we have to read actual tables with all information before we set empty Flow list,
                     // merge is expensive and not applicable for lists
                     if (flowCapNodeOpt != null && flowCapNodeOpt.isPresent()) {
                         for (final Table tableData : flowCapNodeOpt.get().getTable()) {
-                            final Table table =
-                                    new TableBuilder(tableData).setFlow(Collections.emptyList()).build();
-                            final InstanceIdentifier<Table> iiToTable =
-                                    instanceIdentifier.child(Table.class, tableData.getKey());
+                            final Table table = new TableBuilder(tableData).setFlow(Collections.emptyList()).build();
+                            final InstanceIdentifier<Table> iiToTable = instanceIdentifier
+                                    .child(Table.class, tableData.getKey());
                             txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL, iiToTable, table);
                         }
                     }
-
                     readTx.close();
                     return null;
                 }).get();
@@ -239,26 +208,24 @@ public final class StatisticsGatheringUtils {
     public static void deleteAllKnownMeters(final TxFacade txFacade,
                                             final InstanceIdentifier<FlowCapableNode> instanceIdentifier,
                                             final DeviceMeterRegistry meterRegistry) {
-        meterRegistry.forEach(meterId -> txFacade
-                .addDeleteToTxChain(
-                        LogicalDatastoreType.OPERATIONAL,
-                        instanceIdentifier.child(Meter.class, new MeterKey(meterId))));
+        meterRegistry.forEach(meterId -> txFacade.addDeleteToTxChain(LogicalDatastoreType.OPERATIONAL,
+                                                                     instanceIdentifier.child(Meter.class,
+                                                                                              new MeterKey(meterId))));
     }
 
     public static void deleteAllKnownGroups(final TxFacade txFacade,
                                             final InstanceIdentifier<FlowCapableNode> instanceIdentifier,
                                             final DeviceGroupRegistry groupRegistry) {
-        groupRegistry.forEach(groupId -> txFacade
-                .addDeleteToTxChain(
-                        LogicalDatastoreType.OPERATIONAL,
-                        instanceIdentifier.child(Group.class, new GroupKey(groupId))));
+        groupRegistry.forEach(groupId -> txFacade.addDeleteToTxChain(LogicalDatastoreType.OPERATIONAL,
+                                                                     instanceIdentifier.child(Group.class,
+                                                                                              new GroupKey(groupId))));
     }
 
     /**
      * Writes snapshot gathering start timestamp + cleans end mark.
      *
      * @param deviceInfo device info
-     * @param txFacade tx manager
+     * @param txFacade   tx manager
      */
     static void markDeviceStateSnapshotStart(final DeviceInfo deviceInfo, final TxFacade txFacade) {
         final InstanceIdentifier<FlowCapableStatisticsGatheringStatus> statusPath = deviceInfo
@@ -267,8 +234,8 @@ public final class StatisticsGatheringUtils {
         final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_AND_TIME_FORMAT);
         final FlowCapableStatisticsGatheringStatus gatheringStatus = new FlowCapableStatisticsGatheringStatusBuilder()
                 .setSnapshotGatheringStatusStart(new SnapshotGatheringStatusStartBuilder()
-                        .setBegin(new DateAndTime(simpleDateFormat.format(new Date())))
-                        .build())
+                                                         .setBegin(new DateAndTime(simpleDateFormat.format(new Date())))
+                                                         .build())
                 .setSnapshotGatheringStatusEnd(null) // TODO: reconsider if really need to clean end mark here
                 .build();
         try {
@@ -285,20 +252,17 @@ public final class StatisticsGatheringUtils {
      * Writes snapshot gathering end timestamp + outcome.
      *
      * @param deviceInfo device info
-     * @param txFacade tx manager
-     * @param succeeded     outcome of currently finished gathering
+     * @param txFacade   tx manager
+     * @param succeeded  outcome of currently finished gathering
      */
     static void markDeviceStateSnapshotEnd(final DeviceInfo deviceInfo, final TxFacade txFacade,
                                            final boolean succeeded) {
-        final InstanceIdentifier<SnapshotGatheringStatusEnd> statusEndPath = deviceInfo
-                .getNodeInstanceIdentifier().augmentation(FlowCapableStatisticsGatheringStatus.class)
-                .child(SnapshotGatheringStatusEnd.class);
+        final InstanceIdentifier<SnapshotGatheringStatusEnd> statusEndPath = deviceInfo.getNodeInstanceIdentifier()
+                .augmentation(FlowCapableStatisticsGatheringStatus.class).child(SnapshotGatheringStatusEnd.class);
 
         final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_AND_TIME_FORMAT);
         final SnapshotGatheringStatusEnd gatheringStatus = new SnapshotGatheringStatusEndBuilder()
-                .setEnd(new DateAndTime(simpleDateFormat.format(new Date())))
-                .setSucceeded(succeeded)
-                .build();
+                .setEnd(new DateAndTime(simpleDateFormat.format(new Date()))).setSucceeded(succeeded).build();
         try {
             txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL, statusEndPath, gatheringStatus);
         } catch (TransactionChainClosedException e) {
index a5208e1966af2e5c960dfa41a63bacbb2ff92116..ef18232d565848e8e0acd8afeb89d4b65b505bc3 100644 (file)
@@ -78,6 +78,7 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag
                 switch (targetWorkMode) {
                     case COLLECTALL:
                         context.enableGathering();
+                        // FIXME: is it a genuine fall through or an error?
                     case FULLYDISABLED:
                         context.disableGathering();
                         break;
@@ -103,8 +104,8 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag
                 .createDefaultProvider(deviceContext);
 
         final StatisticsContext statisticsContext =
-                deviceContext.canUseSingleLayerSerialization() ?
-                        new StatisticsContextImpl<MultipartReply>(
+                deviceContext.canUseSingleLayerSerialization()
+                        new StatisticsContextImpl<MultipartReply>(
                                 deviceContext,
                                 converterExecutor,
                                 statisticsWriterProvider,
index b0d8c68c1ef68503a50666fd09c2f98721082144..29d500d396c7d3d7513e06235bf592fdf3d28fcc 100644 (file)
@@ -14,7 +14,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicLongFieldUpdater;
 
-public class SessionStatistics {
+public final class SessionStatistics {
+
+    private SessionStatistics() {
+    }
 
     private static final Map<String, Map<ConnectionStatus, EventCounter>> SESSION_EVENTS = new HashMap<>();
 
index f595415d1677808a1cb874b27faf16d2f537358e..3b40c01316625c1fe8bbda02d434933ef0042dfe 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 /**
  * Pulled out meter stats to notification transformation.
  */
-public class MeterStatisticsToNotificationTransformer {
+public final class MeterStatisticsToNotificationTransformer {
 
     private MeterStatisticsToNotificationTransformer() {
         // Hide implicit constructor
index ca65a1606fa1e1361798450abe511c4db879f095..d59baeadc1f439af5630b6db257175b0925f7c53 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.n
 /**
  * Pulled out port stats to notification transformation.
  */
-public class NodeConnectorStatisticsToNotificationTransformer {
+public final class NodeConnectorStatisticsToNotificationTransformer {
 
     private NodeConnectorStatisticsToNotificationTransformer() {
         // Hide implicit constructor
index 32649e29ff0c95d36d8ec585b1b0e84ba4c13128..160e9d345beddfda94d36264c9a021a64d74bd6e 100644 (file)
@@ -29,7 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
 /**
  * Pulled out queue stats to notification transformation.
  */
-public class QueueStatisticsToNotificationTransformer {
+public final class QueueStatisticsToNotificationTransformer {
 
     private QueueStatisticsToNotificationTransformer() {
         // Hide implicit constructor
index 0f15aca5bcfb0512be95808c73328ab0754dc5e8..b5e22d3492e51b04cd9b58376bc12b5bf62220e9 100644 (file)
@@ -24,7 +24,10 @@ import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorE
  * #{@link org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider}
  * with all multi-layer services already in.
  */
-public class MultiLayerDirectStatisticsProviderInitializer {
+public final class MultiLayerDirectStatisticsProviderInitializer {
+
+    private MultiLayerDirectStatisticsProviderInitializer() {
+    }
 
     public static OpendaylightDirectStatisticsServiceProvider createProvider(
         final RequestContextStack requestContextStack,
index 60cb5e2e27925b4831ca4c501524d5c11e2ad1e9..5bee4bc1703cf9d3b76d26da8f3ac87b196021ee 100644 (file)
@@ -24,7 +24,10 @@ import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorE
  * #{@link org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider}
  * with all multi-layer services already in.
  */
-public class SingleLayerDirectStatisticsProviderInitializer {
+public final class SingleLayerDirectStatisticsProviderInitializer {
+
+    private SingleLayerDirectStatisticsProviderInitializer() {
+    }
 
     public static OpendaylightDirectStatisticsServiceProvider createProvider(
         final RequestContextStack requestContextStack,
index a31a2a64bb5d0b05630bc70f618ae759da00d62a..fd02344cbcc364cc5d7eef8835b8a34b92830305 100644 (file)
@@ -37,8 +37,7 @@ public class PacketReceivedTranslator implements MessageTranslator<PacketInMessa
     }
 
     @Override
-    public PacketReceived translate(final PacketInMessage input,
-                                    final DeviceInfo deviceInfo,
+    public PacketReceived translate(final PacketInMessage input, final DeviceInfo deviceInfo,
                                     final Object connectionDistinguisher) {
 
         PacketReceivedBuilder packetReceivedBuilder = new PacketReceivedBuilder();
@@ -68,8 +67,8 @@ public class PacketReceivedTranslator implements MessageTranslator<PacketInMessa
         }
 
         if (input.getMatch() != null) {
-            org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match packetInMatch =
-                    getPacketInMatch(input, datapathId);
+            org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match packetInMatch
+                    getPacketInMatch(input, datapathId);
             packetReceivedBuilder.setMatch(packetInMatch);
         }
 
@@ -77,22 +76,22 @@ public class PacketReceivedTranslator implements MessageTranslator<PacketInMessa
     }
 
     @VisibleForTesting
-    org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match
-            getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
+    org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match getPacketInMatch(
+            final PacketInMessage input, final BigInteger datapathId) {
 
-        final VersionDatapathIdConvertorData datapathIdConvertorData =
-                new VersionDatapathIdConvertorData(input.getVersion());
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(
+                input.getVersion());
         datapathIdConvertorData.setDatapathId(datapathId);
 
         final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder>
                 matchOptional = convertorExecutor.convert(input.getMatch(), datapathIdConvertorData);
-        final MatchBuilder matchBuilder = matchOptional.map(matchBuilder1 -> new MatchBuilder(matchBuilder1.build())).orElseGet(MatchBuilder::new);
+        final MatchBuilder matchBuilder = matchOptional.map(matchBuilder1 -> new MatchBuilder(matchBuilder1.build()))
+                .orElseGet(MatchBuilder::new);
 
         final AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match>
-                matchExtensionWrap = MatchExtensionHelper.processAllExtensions(
-                        input.getMatch().getMatchEntry(),
-                        OpenflowVersion.get(input.getVersion()),
-                        MatchPath.PACKETRECEIVED_MATCH);
+                matchExtensionWrap = MatchExtensionHelper
+                .processAllExtensions(input.getMatch().getMatchEntry(), OpenflowVersion.get(input.getVersion()),
+                                      MatchPath.PACKETRECEIVED_MATCH);
 
         if (matchExtensionWrap != null) {
             matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(),
index ba282fa020940bcaa1c7c022a4eed9ece1922e76..c20d978fe5ff244e44407e39ca3533475d59dc17 100644 (file)
@@ -68,7 +68,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
 
-public class MdSalRegistrationUtils {
+public final class MdSalRegistrationUtils {
 
     //TODO: Make one register and one unregister method for all services
     private MdSalRegistrationUtils() {
index fa2587b1db8e4bbaccebf9c64e2d0b33567060fa..7cd6b8e987650e192d526003529f9879dcd1025f 100644 (file)
@@ -19,6 +19,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 public abstract class MessageFactory {
 
     /**
+     * Creates hello input.
+     *
      * @param helloVersion openflow version for hello message to send to switch
      * @param helloXid     transaction id for hello message
      * @return HelloInput without elements
@@ -28,19 +30,8 @@ public abstract class MessageFactory {
     }
 
     /**
-     * @param highestVersion highest openflow version
-     * @param xid            transaction id
-     * @return builder with prepared header
-     */
-    private static HelloInputBuilder prepareHelloInputBuilder(
-            short highestVersion, long xid) {
-        HelloInputBuilder helloInputbuilder = new HelloInputBuilder();
-        helloInputbuilder.setVersion(highestVersion);
-        helloInputbuilder.setXid(xid);
-        return helloInputbuilder;
-    }
-
-    /**
+     * Creates hello input.
+     *
      * @param helloVersion openflow version for hello message to send to switch
      * @param helloXid     transaction id for hello message
      * @param versionOrder list of openflow version in order
@@ -79,6 +70,23 @@ public abstract class MessageFactory {
     }
 
     /**
+     * Builder.
+     *
+     * @param highestVersion highest openflow version
+     * @param xid            transaction id
+     * @return builder with prepared header
+     */
+    private static HelloInputBuilder prepareHelloInputBuilder(
+            short highestVersion, long xid) {
+        HelloInputBuilder helloInputbuilder = new HelloInputBuilder();
+        helloInputbuilder.setVersion(highestVersion);
+        helloInputbuilder.setXid(xid);
+        return helloInputbuilder;
+    }
+
+    /**
+     *  Lists all versions.
+     *
      * @param elements list of versions
      * @return version boolean list
      */
index 40ffe4754422ff8bda1e7baf764494ef1f2e6ecb..cf8ad0ce610fcc7a4d82636a63953ed7808a9f53 100644 (file)
@@ -29,7 +29,11 @@ import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 /**
  * Created by Tomas Slusny on 23.3.2016.
  */
-public class NodeConnectorRefToPortTranslator {
+public final class NodeConnectorRefToPortTranslator {
+
+    private NodeConnectorRefToPortTranslator() {
+    }
+
     /**
      * Converts {@link PacketIn} to {@link NodeConnectorRef}.
      * @param packetIn Packet input
index 8f83119dd13c00eabca69c832816d00729ddf3e2..29f6246033eee18ead744ec5c4a37163597976ff 100644 (file)
@@ -20,21 +20,28 @@ public final class PacketInUtil {
     }
 
     /**
+     * Get MDSAL packet-in reason.
+     *
      * @param reason openflow java packet in reason
      * @return corresponding MD-SAL reason class for given OF-API reason
      */
-    public static Class<? extends PacketInReason> getMdSalPacketInReason(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason reason) {
+    public static Class<? extends PacketInReason> getMdSalPacketInReason(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason reason) {
         Class<? extends PacketInReason> resultReason = PacketInReason.class;
 
-        if (reason.equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason.OFPRNOMATCH)) {
+        if (reason
+                .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason
+                                .OFPRNOMATCH)) {
             resultReason = NoMatch.class;
-        } else if (reason.equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason.OFPRINVALIDTTL)) {
+        } else if (reason
+                .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason
+                                .OFPRINVALIDTTL)) {
             resultReason = InvalidTtl.class;
-        } else if (reason.equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason.OFPRACTION)) {
+        } else if (reason
+                .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason
+                                .OFPRACTION)) {
             resultReason = SendToController.class;
         }
-
         return resultReason;
     }
-
 }
index 3fbbcaa1419a34b79337a5f62dc468fd438621ab..cf9be9e357fa362177699cf16c52216867bfaf32 100644 (file)
@@ -16,7 +16,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 /**
  * Purpose: utility class providing path and {@link InstanceIdentifier} tools.
  */
-public class PathUtil {
+public final class PathUtil {
+
     private PathUtil() {
         throw new IllegalStateException("This class should not be instantiated.");
     }
index 2c8f253dc53d3259e76bd6b310b1257749a87c27..ed236695547a5283ce70c96321d979f2d8d415e6 100644 (file)
@@ -34,7 +34,9 @@ import org.slf4j.LoggerFactory;
 public abstract class PortTranslatorUtil {
     private static final Logger LOG = LoggerFactory.getLogger(PortTranslatorUtil.class);
 
-    public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures translatePortFeatures(final PortFeatures apf) {
+    public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures
+        translatePortFeatures(
+            final PortFeatures apf) {
         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures napf = null;
         if (apf != null) {
             napf = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures(
@@ -60,7 +62,8 @@ public abstract class PortTranslatorUtil {
         return napf;
     }
 
-    public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures translatePortFeatures(
+    public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures
+        translatePortFeatures(
             final PortFeaturesV10 apf) {
         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures napf = null;
         if (apf != null) {
@@ -81,7 +84,7 @@ public abstract class PortTranslatorUtil {
                     apf.is_10gbFd(), //_tenGbFd
                     apf.is_10mbFd(), //_tenMbFd
                     apf.is_10mbHd()//_tenMbHd
-                    );
+            );
         }
         return napf;
     }
@@ -106,28 +109,32 @@ public abstract class PortTranslatorUtil {
         return nstate.build();
     }
 
-    public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig translatePortConfig(final PortConfig pc) {
+    public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig
+        translatePortConfig(
+            final PortConfig pc) {
         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig npc = null;
         if (pc != null) {
-            npc = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig(pc.isNoFwd(),
-                    pc.isNoPacketIn(), pc.isNoRecv(), pc.isPortDown());
+            npc = new org.opendaylight.yang.gen.v1.urn.opendaylight
+                    .flow.types.port.rev130925.PortConfig(pc.isNoFwd(),pc.isNoPacketIn(),pc.isNoRecv(),pc.isPortDown());
         }
         return npc;
     }
 
-    public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig translatePortConfig(
+    public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig
+        translatePortConfig(
             final PortConfigV10 pc) {
         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig npc = null;
         if (pc != null) {
-            npc = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig(pc.isNoFwd(),
-                    pc.isNoPacketIn(), pc.isNoRecv(), pc.isPortDown());
+            npc = new org.opendaylight.yang.gen.v1.urn.opendaylight
+                    .flow.types.port.rev130925.PortConfig(pc.isNoFwd(),pc.isNoPacketIn(),pc.isNoRecv(),pc.isPortDown());
         }
         return npc;
     }
 
-    public static NodeConnectorUpdated translatePort(final Short version, final BigInteger datapathId, final Long portNumber, final PortGrouping port) {
+    public static NodeConnectorUpdated translatePort(final Short version, final BigInteger datapathId,
+                                                     final Long portNumber, final PortGrouping port) {
         OpenflowVersion ofVersion = OpenflowVersion.get(version);
-        NodeConnectorUpdatedBuilder builder = InventoryDataServiceUtil
+        final NodeConnectorUpdatedBuilder builder = InventoryDataServiceUtil
                 .nodeConnectorUpdatedBuilderFromDatapathIdPortNo(datapathId, port.getPortNo(), ofVersion);
         FlowCapableNodeConnectorUpdatedBuilder fcncub = new FlowCapableNodeConnectorUpdatedBuilder();
         if (ofVersion == OpenflowVersion.OF13) {
@@ -162,10 +169,12 @@ public abstract class PortTranslatorUtil {
         return builder.build();
     }
 
-    public static NodeConnectorRemoved translatePortRemoved(final Short version, final BigInteger datapathId, final Long portNumber, final PortGrouping port) {
+    public static NodeConnectorRemoved translatePortRemoved(final Short version, final BigInteger datapathId,
+                                                            final Long portNumber, final PortGrouping port) {
         OpenflowVersion ofVersion = OpenflowVersion.get(version);
         NodeConnectorRemovedBuilder builder = new NodeConnectorRemovedBuilder();
-        builder.setNodeConnectorRef(InventoryDataServiceUtil.nodeConnectorRefFromDatapathIdPortno(datapathId, portNumber, ofVersion));
+        builder.setNodeConnectorRef(
+                InventoryDataServiceUtil.nodeConnectorRefFromDatapathIdPortno(datapathId, portNumber, ofVersion));
         return builder.build();
     }
 }
index 59f9a0d751c54a0287ee22b78a6454e9a67d0e88..7f24b74abe6efdbe9c1cda6dcf01ed1ccef946fc 100644 (file)
@@ -15,13 +15,15 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * threadPoolExecutor implementation logging exceptions thrown by threads
+ * threadPoolExecutor implementation logging exceptions thrown by threads.
  */
 public class ThreadPoolLoggingExecutor extends ThreadPoolExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(ThreadPoolLoggingExecutor.class);
 
     /**
+     * Logging executor.
+     *
      * @param corePoolSize thread pool size
      * @param maximumPoolSize maximum pool size
      * @param keepAliveTime keep alive time
@@ -29,19 +31,18 @@ public class ThreadPoolLoggingExecutor extends ThreadPoolExecutor {
      * @param workQueue task queue
      * @param poolName thread name prefix
      */
-    public ThreadPoolLoggingExecutor(int corePoolSize, int maximumPoolSize,
-                                     long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue,
-            final String poolName) {
+    public ThreadPoolLoggingExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
+                                     BlockingQueue<Runnable> workQueue, final String poolName) {
         super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
-                new ThreadFactoryBuilder().setNameFormat(poolName + "-%d").build());
+              new ThreadFactoryBuilder().setNameFormat(poolName + "-%d").build());
     }
 
     @Override
-    protected void afterExecute(Runnable r, Throwable t) {
-        super.afterExecute(r, t);
+    protected void afterExecute(Runnable runnable, Throwable throwable) {
+        super.afterExecute(runnable, throwable);
         // in case of executing pure Runnable
-        if (t != null) {
-            LOG.warn("thread in pool stopped with error", t);
+        if (throwable != null) {
+            LOG.warn("thread in pool stopped with error", throwable);
         }
     }
 }
index 8cc9dafb5e998537bee562e276e7659d9ebfa753..95d3506a14f28d7e681f706355f66517f19c8ea4 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDesc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDescBuilder;
 
-public class MsgGeneratorTestUtils {
+public final class MsgGeneratorTestUtils {
 
     private MsgGeneratorTestUtils() {
         throw new UnsupportedOperationException("Test Utility class");
index 6f9d591826dcba330fce543cf601e59ba53e0c77..f6dd9445a3fca105ce02f477818291ae38cfb6e7 100644 (file)
@@ -16,10 +16,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
 
 /**
- * Tests for setting switch features for different version of OF plugin
+ * Tests for setting switch features for different version of OF plugin.
  *
  * @author jsebin
- *
  */
 public class SwitchFeaturesUtilTest {
 
@@ -28,9 +27,10 @@ public class SwitchFeaturesUtilTest {
 
 
     /**
-     * initialization of {@link org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder GetFeaturesOutputBuilder}
-     * and {@link SwitchFeaturesUtil SwitchFeaturesUtil}
-     * @throws Exception
+     * Initialization of
+     * {@link org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
+     * .GetFeaturesOutputBuilder GetFeaturesOutputBuilder}
+     * and {@link SwitchFeaturesUtil SwitchFeaturesUtil}.
      */
     @Before
     public void setUp() throws Exception {
@@ -38,9 +38,6 @@ public class SwitchFeaturesUtilTest {
         swUtil = SwitchFeaturesUtil.getInstance();
     }
 
-    /**
-     * @throws Exception
-     */
     @After
     public void tearDown() throws Exception {
         featuresOutputBuilder = null;
@@ -50,7 +47,7 @@ public class SwitchFeaturesUtilTest {
     /**
      * Test method for
      * {@link SwitchFeaturesUtil#buildSwitchFeatures} for OF 1.0 version
-     * and switch feature capabilities
+     * and switch feature capabilities.
      * .
      */
     @Test
index a117d06d1671f73b3542d6f77f8927ffffd46dd2..5404519aab96f80c3477c4cc7b48f8c5b088e8b2 100644 (file)
@@ -64,8 +64,8 @@ public class TransactionChainManagerTest {
     @Before
     public void setUp() throws Exception {
         final ReadOnlyTransaction readOnlyTx = Mockito.mock(ReadOnlyTransaction.class);
-        final CheckedFuture<Optional<Node>, ReadFailedException> noExistNodeFuture =
-                Futures.immediateCheckedFuture(Optional.<Node>absent());
+        final CheckedFuture<Optional<Node>, ReadFailedException> noExistNodeFuture = Futures
+                .immediateCheckedFuture(Optional.<Node>absent());
         Mockito.when(readOnlyTx.read(LogicalDatastoreType.OPERATIONAL, nodeKeyIdent)).thenReturn(noExistNodeFuture);
         Mockito.when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTx);
         Mockito.when(dataBroker.createTransactionChain(Matchers.any(TransactionChainListener.class)))
@@ -98,8 +98,7 @@ public class TransactionChainManagerTest {
     }
 
     /**
-     * test of {@link TransactionChainManager#submitTransaction()}
-     * @throws Exception
+     * Tests transaction submit {@link TransactionChainManager#submitTransaction()}.
      */
     @Test
     public void testSubmitTransaction() throws Exception {
@@ -114,8 +113,7 @@ public class TransactionChainManagerTest {
     }
 
     /**
-     * test of {@link TransactionChainManager#submitTransaction()}: no submit, never enabled
-     * @throws Exception
+     * test of {@link TransactionChainManager#submitTransaction()}: no submit, never enabled.
      */
     @Test
     public void testSubmitTransaction1() throws Exception {
@@ -130,7 +128,9 @@ public class TransactionChainManagerTest {
 
     @Test
     public void testSubmitTransactionFailed() throws Exception {
-        Mockito.when(writeTx.submit()).thenReturn(Futures.<Void, TransactionCommitFailedException>immediateFailedCheckedFuture(new TransactionCommitFailedException("mock")));
+        Mockito.when(writeTx.submit()).thenReturn(
+                Futures.<Void, TransactionCommitFailedException>immediateFailedCheckedFuture(
+                        new TransactionCommitFailedException("mock")));
         final Node data = new NodeBuilder().setId(nodeId).build();
         txChainManager.initialSubmitWriteTransaction();
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
@@ -157,7 +157,8 @@ public class TransactionChainManagerTest {
 
     @Test
     public void testOnTransactionChainFailed() throws Exception {
-        txChainManager.onTransactionChainFailed(txChain, Mockito.mock(AsyncTransaction.class), Mockito.mock(Throwable.class));
+        txChainManager
+                .onTransactionChainFailed(txChain, Mockito.mock(AsyncTransaction.class), Mockito.mock(Throwable.class));
         Mockito.verify(txChain).close();
         Mockito.verify(dataBroker, Mockito.times(2)).createTransactionChain(txChainManager);
     }
@@ -186,8 +187,8 @@ public class TransactionChainManagerTest {
 
     @Test
     public void testDeactivateTransactionChainManagerFailed() throws Exception {
-        Mockito.when(writeTx.submit())
-                .thenReturn(Futures.<Void, TransactionCommitFailedException>immediateFailedCheckedFuture(
+        Mockito.when(writeTx.submit()).thenReturn(
+                Futures.<Void, TransactionCommitFailedException>immediateFailedCheckedFuture(
                         new TransactionCommitFailedException("mock")));
         final Node data = new NodeBuilder().setId(nodeId).build();
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
index cdc392714ab7ae210d7bebf28fd7d9e95ea90fcb..599242e1d9ea18ae7f2091664ee317dfca41908f 100644 (file)
@@ -20,7 +20,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 /**
  * Flow building helper.
  */
-public class TestFlowHelper {
+public final class TestFlowHelper {
+
+    private TestFlowHelper() {
+    }
+
     /**
      * Creates flow and statistics builder.
      * @param index data seed
index 2a611abef1aac3844ac562b185c24d27a6ee2b32..6bee7c92ccb664ae50b5ee1db47179e4d9783da6 100644 (file)
@@ -109,26 +109,39 @@ public class SalBundleServiceImplTest {
         service.addBundleMessages(input);
         for (Message msg : innerMessages) {
             Mockito.verify(experimenterMessageService)
-                    .sendExperimenter(
-                            experimenterBuilder.setExperimenterMessageOfChoice(
-                                    addMessageBuilder
-                                            .setSalAddMessageData(
-                                                    dataBuilder.setNode(NODE_REF).setBundleInnerMessage(msg.getBundleInnerMessage()).build()
-                                            ).build()
-                            ).build()
-                    );
+                    .sendExperimenter(experimenterBuilder
+                                  .setExperimenterMessageOfChoice(addMessageBuilder
+                                              .setSalAddMessageData(
+                                                    dataBuilder.setNode(NODE_REF).setBundleInnerMessage(
+                                                                                        msg.getBundleInnerMessage())
+                                                                                .build())
+                                                                .build()).build());
         }
     }
 
     private static List<Message> createMessages() {
         List<Message> messages  = new ArrayList<>();
-        messages.add(new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleAddFlowCaseBuilder().build()).build());
-        messages.add(new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleUpdateFlowCaseBuilder().build()).build());
-        messages.add(new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleRemoveFlowCaseBuilder().build()).build());
-        messages.add(new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleAddGroupCaseBuilder().build()).build());
-        messages.add(new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleUpdateGroupCaseBuilder().build()).build());
-        messages.add(new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleRemoveGroupCaseBuilder().build()).build());
-        messages.add(new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleUpdatePortCaseBuilder().build()).build());
+        messages.add(
+                new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleAddFlowCaseBuilder().build())
+                        .build());
+        messages.add(
+                new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleUpdateFlowCaseBuilder().build())
+                        .build());
+        messages.add(
+                new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleRemoveFlowCaseBuilder().build())
+                        .build());
+        messages.add(
+                new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleAddGroupCaseBuilder().build())
+                        .build());
+        messages.add(
+                new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleUpdateGroupCaseBuilder().build())
+                        .build());
+        messages.add(
+                new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleRemoveGroupCaseBuilder().build())
+                        .build());
+        messages.add(
+                new MessageBuilder().setNode(NODE_REF).setBundleInnerMessage(new BundleUpdatePortCaseBuilder().build())
+                        .build());
         return messages;
     }
 
index 23a0621049191a059d38c6ccc967c13668d77146..cebe9bfb2c0cbccbeaeab6b7c13a0b29c69ce0d6 100644 (file)
@@ -54,12 +54,11 @@ public class StatisticsContextImplTest extends StatisticsContextImpMockInitiatio
     }
 
     private void initStatisticsContext() {
-        statisticsContext = new StatisticsContextImpl<>(
-                mockedDeviceContext, convertorManager,
-                MultipartWriterProviderFactory.createDefaultProvider(mockedDeviceContext),
-                MoreExecutors.newDirectExecutorService(),
-                true,
-                false, 3000, 50000);
+        statisticsContext = new StatisticsContextImpl<>(mockedDeviceContext, convertorManager,
+                                                        MultipartWriterProviderFactory
+                                                                .createDefaultProvider(mockedDeviceContext),
+                                                        MoreExecutors.newDirectExecutorService(), true, false, 3000,
+                                                        50000);
 
         statisticsContext.setStatisticsGatheringService(mockedStatisticsGatheringService);
         statisticsContext.setStatisticsGatheringOnTheFlyService(mockedStatisticsOnFlyGatheringService);
@@ -74,15 +73,20 @@ public class StatisticsContextImplTest extends StatisticsContextImpMockInitiatio
     }
 
     /**
-     * There is nothing to check in close method
+     * There is nothing to check in close method.
      */
     @Test
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void testClose() throws Exception {
-        final StatisticsContextImpl<MultipartReply> statisticsContext = new StatisticsContextImpl<>(
-                mockedDeviceContext, convertorManager,
-                MultipartWriterProviderFactory.createDefaultProvider(mockedDeviceContext),
-                MoreExecutors.newDirectExecutorService(),
-                true, false, 3000, 50000);
+        final StatisticsContextImpl<MultipartReply> statisticsContext =
+                new StatisticsContextImpl<>(mockedDeviceContext,
+                                            convertorManager,
+                                            MultipartWriterProviderFactory
+                                                    .createDefaultProvider(mockedDeviceContext),
+                                            MoreExecutors.newDirectExecutorService(),
+                                            true,
+                                            false,
+                                            3000,50000);
 
         final RequestContext<Object> requestContext = statisticsContext.createRequestContext();
         statisticsContext.close();
@@ -115,18 +119,14 @@ public class StatisticsContextImplTest extends StatisticsContextImpMockInitiatio
         when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_ID);
         initStatisticsContext();
 
-        when(mockedStatisticsGatheringService.getStatisticsOfType(Matchers.any(EventIdentifier.class),
-                    Matchers.any(MultipartType.class)))
-                .thenReturn(
-                        Futures.immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList())
-                            .build())
-                );
-        when(mockedStatisticsOnFlyGatheringService.getStatisticsOfType(Matchers.any(EventIdentifier.class),
-                    Matchers.any(MultipartType.class)))
-                .thenReturn(
-                        Futures.immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList())
-                            .build())
-                );
+        when(mockedStatisticsGatheringService
+                     .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)))
+                .thenReturn(Futures.immediateFuture(
+                        RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build()));
+        when(mockedStatisticsOnFlyGatheringService
+                     .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)))
+                .thenReturn(Futures.immediateFuture(
+                        RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build()));
 
         statisticsContext.registerMastershipWatcher(mockedMastershipWatcher);
         statisticsContext.setStatisticsGatheringService(mockedStatisticsGatheringService);
index df8390526957baf6fbd6be0352e57a426a5b432f..edf9b715cdba9e9245796075c12bcb467e60afd9 100644 (file)
@@ -176,7 +176,6 @@ public class StatisticsManagerImplTest {
     /**
      * switching to {@link StatisticsWorkMode#FULLYDISABLED}; no pollTimeout and no lifecycleRegistry.
      *
-     * @throws Exception
      */
     @Test
     public void testChangeStatisticsWorkMode1() throws Exception {
@@ -205,7 +204,6 @@ public class StatisticsManagerImplTest {
     /**
      * Switching to {@link StatisticsWorkMode#FULLYDISABLED}; with pollTimeout and lifecycleRegistry.
      *
-     * @throws Exception
      */
     @Test
     public void testChangeStatisticsWorkMode2() throws Exception {
@@ -225,10 +223,9 @@ public class StatisticsManagerImplTest {
     }
 
     /**
-     * switching to {@link StatisticsWorkMode#FULLYDISABLED} and back
-     * to {@link StatisticsWorkMode#COLLECTALL}; with lifecycleRegistry and pollTimeout
+     * Tests switching to {@link StatisticsWorkMode#FULLYDISABLED} and back
+     * to {@link StatisticsWorkMode#COLLECTALL}; with lifecycleRegistry and pollTimeout.
      *
-     * @throws Exception
      */
     @Test
     public void testChangeStatisticsWorkMode3() throws Exception {
index 5f544121af71a15c2d766d60f941d358b7e2d499..3f79b2140520d9984e31d8ca74f4494a96ba3ccc 100644 (file)
@@ -41,9 +41,7 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
 
     @Override
     public void setUp() throws Exception {
-        service = new MeterDirectStatisticsService(requestContextStack,
-                                                   deviceContext,
-                                                   convertorManager,
+        service = new MeterDirectStatisticsService(requestContextStack, deviceContext, convertorManager,
                                                    multipartWriterProvider);
     }
 
@@ -55,8 +53,7 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         when(input.getMeterId()).thenReturn(new MeterId(METER_NO));
 
         final MultipartRequestMeterCase body = (MultipartRequestMeterCase) ((MultipartRequestInput) service
-            .buildRequest(new Xid(42L), input))
-            .getMultipartRequestBody();
+                .buildRequest(new Xid(42L), input)).getMultipartRequestBody();
 
         final MultipartRequestMeter meter = body.getMultipartRequestMeter();
 
@@ -68,16 +65,10 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         final MultipartReply reply = mock(MultipartReply.class);
         final MultipartReplyMeterCase MeterCase = mock(MultipartReplyMeterCase.class);
         final MultipartReplyMeter meter = mock(MultipartReplyMeter.class);
-        final MeterStats meterStat = new MeterStatsBuilder()
-                .setMeterId(new org.opendaylight.yang.gen.v1.urn
-                        .opendaylight.openflow.common.types.rev130731.MeterId(METER_NO))
-                .setByteInCount(BigInteger.ONE)
-                .setPacketInCount(BigInteger.ONE)
-                .setDurationSec(1L)
-                .setDurationNsec(1L)
-                .setFlowCount(0L)
-                .setMeterBandStats(Collections.emptyList())
-                .build();
+        final MeterStats meterStat = new MeterStatsBuilder().setMeterId(
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId(METER_NO))
+                .setByteInCount(BigInteger.ONE).setPacketInCount(BigInteger.ONE).setDurationSec(1L).setDurationNsec(1L)
+                .setFlowCount(0L).setMeterBandStats(Collections.emptyList()).build();
 
         final List<MeterStats> meterStats = Collections.singletonList(meterStat);
         final List<MultipartReply> input = Collections.singletonList(reply);
@@ -89,22 +80,23 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         final GetMeterStatisticsOutput output = service.buildReply(input, true);
         assertTrue(output.getMeterStats().size() > 0);
 
-        final org.opendaylight.yang.gen.v1.urn
-            .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stats = output.getMeterStats().get(0);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats
+                stats = output.getMeterStats().get(0);
 
         assertEquals(stats.getMeterId().getValue(), METER_NO);
     }
 
     @Override
     public void testStoreStatistics() throws Exception {
-        final org.opendaylight.yang.gen.v1.urn
-                .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stat =
-                mock(org.opendaylight.yang.gen.v1.urn
-                        .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats.class);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stat
+                = mock(
+                org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats
+                        .class);
         when(stat.getMeterId()).thenReturn(new MeterId(METER_NO));
 
-        final List<org.opendaylight.yang.gen.v1.urn
-                .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats> stats = Collections.singletonList(stat);
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply
+                .MeterStats>
+                stats = Collections.singletonList(stat);
         final GetMeterStatisticsOutput output = mock(GetMeterStatisticsOutput.class);
         when(output.getMeterStats()).thenReturn(stats);
 
index 145449ee0694f4616d8494eb798caf239dd54cf0..7e0c9fd47671c4a933b84738c64349798376c75b 100644 (file)
@@ -102,7 +102,8 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         when(stat.getMeterId()).thenReturn(new MeterId(METER_NO));
 
         final List<org.opendaylight.yang.gen.v1.urn
-                .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats> stats = Collections.singletonList(stat);
+                .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>
+                stats = Collections.singletonList(stat);
         final GetMeterStatisticsOutput output = mock(GetMeterStatisticsOutput.class);
         when(output.getMeterStats()).thenReturn(stats);
 
index 4de3d4e9e1b9fa2d7f57566aeabc0b2a134c2edc..de68ce7998c94c1350728117fe33b0a8fd390754 100644 (file)
@@ -31,8 +31,7 @@ public class MessageFactoryTest {
     public void testCreateHelloInputWithElements() {
         short highestVersion = (short) 0x04;
         long xid = 42L;
-        Boolean[] expectedVersionBitmap = new Boolean[]{
-                false, true, false, false, true};
+        Boolean[] expectedVersionBitmap = new Boolean[]{false, true, false, false, true};
 
         HelloInput helloMsg = MessageFactory.createHelloInput(highestVersion, xid, OFConstants.VERSION_ORDER);
         Assert.assertEquals(highestVersion, helloMsg.getVersion().shortValue());
index 5f6eaa0eb47ac2d346b0e60a20b799cbbadb13e5..9f7edbcb93c0b0b90a3da511410d816d85446454 100644 (file)
@@ -21,13 +21,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.Se
  */
 public class PacketInUtilTest {
 
-
     /**
-     * Test method for PacketInUtil#getMdSalPacketInReason(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason);
+     * Test method for PacketInUtil#getMdSalPacketInReason(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+     * .common.types.rev130731.PacketInReason).
      */
     @Test
     public void testGetMdSalPacketInReason() {
-        Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketInReason> resultReason;
+        Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketInReason>
+                resultReason;
 
         resultReason = PacketInUtil.getMdSalPacketInReason(PacketInReason.OFPRACTION);
         assertTrue(resultReason.getName().equals(SendToController.class.getName()));
index 5eae324aa8beea98d050d968aaf8593fea32a7cc..c14803e5cc40d2114dc0ef7e3acf3d70c56ced75 100644 (file)
@@ -31,8 +31,11 @@ public class PortTranslatorUtilTest {
 
     private static final String MAC_ADDRESS = "00:01:02:03:04:05";
     private static final String NAME = "PortTranslatorTest";
-    private final Boolean[] pfBls = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
-    private final boolean[] pfV10Bls = {false, false, false, false, false, false, false, false, false, false, false, false};
+    private final Boolean[] pfBls
+                = {false, false, false, false, false, false, false, false, false, false, false, false, false, false,
+                   false, false};
+    private final boolean[] pfV10Bls
+            = {false, false, false, false, false, false, false, false, false, false, false, false};
     private final boolean[] portCfgBools = {false, false, false, false};
     private final boolean[] portCfgV10bools = {false, false, false, false, false, false, false};
     private final boolean[] portStateBools = {false, false, false, false};
@@ -40,29 +43,31 @@ public class PortTranslatorUtilTest {
     private static final Long MAX_SPEED = Long.decode("4294967295");
 
     /**
-     * Test  method for {@link PortTranslatorUtil#translatePortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures)}
+     * Test  method for
+     * {@link PortTranslatorUtil#translatePortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight
+     * .openflow.common.types.rev130731.PortFeatures)}.
      */
     @Test
     public void testTranslatePortFeatures() {
-
-
         for (int i = 0; i < pfBls.length; i++) {
             pfBls[i] = true;
             final PortFeatures apf = getPortFeatures();
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures npf = PortTranslatorUtil.translatePortFeatures(apf);
+            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures npf
+                    = PortTranslatorUtil.translatePortFeatures(apf);
             assertEqualsPortFeatures(apf, npf);
             pfBls[i] = false;
         }
-
     }
 
     private PortFeatures getPortFeatures() {
-        return new PortFeatures(pfBls[0], pfBls[1], pfBls[2], pfBls[3], pfBls[4], pfBls[5], pfBls[6], pfBls[7], pfBls[8],
-                pfBls[9], pfBls[10], pfBls[11], pfBls[12], pfBls[13], pfBls[14], pfBls[15]);
+        return new PortFeatures(pfBls[0], pfBls[1], pfBls[2], pfBls[3], pfBls[4], pfBls[5], pfBls[6], pfBls[7],
+                                pfBls[8], pfBls[9], pfBls[10], pfBls[11], pfBls[12], pfBls[13], pfBls[14], pfBls[15]);
     }
 
     /**
-     * Test  method for {@link PortTranslatorUtil#translatePortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10)}
+     * Test  method for
+     * {@link PortTranslatorUtil#translatePortFeatures(org.opendaylight.yang.gen.v1.urn
+     * .opendaylight.openflow.common.types.rev130731.PortFeaturesV10)}.
      */
     @Test
     public void testTranslatePortFeaturesV10() {
@@ -72,7 +77,8 @@ public class PortTranslatorUtilTest {
 
             pfV10Bls[i] = true;
             final PortFeaturesV10 apfV10 = getPortFeaturesV10();
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures npf = PortTranslatorUtil.translatePortFeatures(apfV10);
+            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures npf
+                    = PortTranslatorUtil.translatePortFeatures(apfV10);
             assertEqualsPortFeaturesV10(apfV10, npf);
             pfV10Bls[i] = false;
 
@@ -81,12 +87,14 @@ public class PortTranslatorUtilTest {
     }
 
     private PortFeaturesV10 getPortFeaturesV10() {
-        return new PortFeaturesV10(pfV10Bls[0], pfV10Bls[1], pfV10Bls[2], pfV10Bls[3], pfV10Bls[4], pfV10Bls[5], pfV10Bls[6],
-                pfV10Bls[7], pfV10Bls[8], pfV10Bls[9], pfV10Bls[10], pfV10Bls[11]);
+        return new PortFeaturesV10(pfV10Bls[0], pfV10Bls[1], pfV10Bls[2], pfV10Bls[3], pfV10Bls[4], pfV10Bls[5],
+                                   pfV10Bls[6], pfV10Bls[7], pfV10Bls[8], pfV10Bls[9], pfV10Bls[10], pfV10Bls[11]);
     }
 
     /**
-     * Test  method for {@link PortTranslatorUtil#translatePort(Short, java.math.BigInteger, Long, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping)} ()}
+     * Test  method for
+     * {@link PortTranslatorUtil#translatePort(Short, java.math.BigInteger,
+     * Long, org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping)} ()}.
      */
     @Test
     public void testTranslatePort() {
@@ -97,7 +105,8 @@ public class PortTranslatorUtilTest {
         Long portNumber = Long.MAX_VALUE;
         PortGrouping portGrouping = mockPortGrouping();
 
-        NodeConnectorUpdated nodeConnectorUpdated = PortTranslatorUtil.translatePort(version, dataPathId, portNumber, portGrouping);
+        NodeConnectorUpdated nodeConnectorUpdated = PortTranslatorUtil
+                .translatePort(version, dataPathId, portNumber, portGrouping);
         assertNotNull(nodeConnectorUpdated);
         version = OpenflowVersion.OF13.getVersion();
         nodeConnectorUpdated = PortTranslatorUtil.translatePort(version, dataPathId, portNumber, portGrouping);
@@ -141,14 +150,17 @@ public class PortTranslatorUtilTest {
     }
 
     private PortConfigV10 getPortConfigV10() {
-        return new PortConfigV10(portCfgV10bools[0], portCfgV10bools[1], portCfgV10bools[2], portCfgV10bools[3], portCfgV10bools[4], portCfgV10bools[5], portCfgV10bools[6]);
+        return new PortConfigV10(portCfgV10bools[0], portCfgV10bools[1], portCfgV10bools[2], portCfgV10bools[3],
+                                 portCfgV10bools[4], portCfgV10bools[5], portCfgV10bools[6]);
     }
 
     private PortConfig getPortConfig() {
         return new PortConfig(portCfgBools[0], portCfgBools[1], portCfgBools[2], portCfgBools[3]);
     }
 
-    private static void assertEqualsPortFeaturesV10(final PortFeaturesV10 apfV10, final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures npf) {
+    private static void assertEqualsPortFeaturesV10(final PortFeaturesV10 apfV10,
+                                                    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types
+                                                            .port.rev130925.PortFeatures npf) {
         assertEquals(apfV10.is_100mbFd(), npf.isHundredMbFd());
         assertEquals(apfV10.is_100mbHd(), npf.isHundredMbHd());
 
@@ -166,7 +178,9 @@ public class PortTranslatorUtilTest {
         assertEquals(apfV10.isPauseAsym(), npf.isPauseAsym());
     }
 
-    private static void assertEqualsPortFeatures(final PortFeatures apf, final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures npf) {
+    private static void assertEqualsPortFeatures(final PortFeatures apf,
+                                                 final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port
+                                                         .rev130925.PortFeatures npf) {
         assertEquals(apf.is_100gbFd(), npf.isHundredGbFd());
         assertEquals(apf.is_100mbFd(), npf.isHundredMbFd());
         assertEquals(apf.is_100mbHd(), npf.isHundredMbHd());