Bug 8153: Enforce check-style rules for netconf - netconf-topology-singleton 87/55987/5
authormatus.kubica <matus.kubica@pantheon.tech>
Tue, 25 Apr 2017 12:38:20 +0000 (14:38 +0200)
committermatus.kubica <matus.kubica@pantheon.tech>
Fri, 5 May 2017 10:26:10 +0000 (12:26 +0200)
    Organize Imports for Checkstyle compliance.
    Checkstyle compliance: line length.
    Checkstyle compliance: various types of small changes.
    Checkstyle compliant Exception handling.
    Checkstyle final clean up & enforcement.
    Add the fail on violation flag into the pom.xml .

Change-Id: I690d1d6c21f042874977f1030f216b08c4c21c45
Signed-off-by: matus.kubica <matus.kubica@pantheon.tech>
32 files changed:
netconf/netconf-topology-singleton/pom.xml
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/api/NetconfTopologySingletonService.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/api/RemoteDeviceConnector.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/MasterSalFacade.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfNodeManager.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyContext.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMDataBroker.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/SlaveSalFacade.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/NetconfNodeActor.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/ReadAdapter.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/WriteAdapter.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyReadAdapter.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyReadTransaction.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyReadWriteTransaction.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyWriteAdapter.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyWriteTransaction.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/utils/NetconfTopologyUtils.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/RefreshSetupMasterActorData.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/SchemaPathMessage.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/rpc/InvokeRpcMessage.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/rpc/InvokeRpcMessageReply.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/transactions/EmptyResultResponse.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/transactions/SubmitFailedReply.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfNodeActorTest.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImplTest.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/actors/ReadTransactionActorTest.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/tx/ReadWriteTransactionTest.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/tx/WriteOnlyTransactionTest.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/utils/NetconfTopologyUtilTest.java

index 5508c24835f04327eb2dbffbe762af24dd06cdf0..c4c540092c35d43b65486a40649373519bcc14d4 100644 (file)
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
index 37095becdf57363ba0b06084849d1ebb5183e88e..fe0f89759c68e0a416dac26a4884cd4ccbd36949 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.netconf.topology.singleton.api;
 
 /**
- * Provides API for advertising services for blue print service
+ * Provides API for advertising services for blue print service.
  */
 public interface NetconfTopologySingletonService {
 }
index bb74b754b30a92ca236ba2401230947c1b0dffb0..4e9cc8924e4bfdcc384764449a6f4446808c84b8 100644 (file)
@@ -11,18 +11,18 @@ package org.opendaylight.netconf.topology.singleton.api;
 import akka.actor.ActorRef;
 
 /**
- * Provides API for connection odl (master) with device
+ * Provides API for connection odl (master) with device.
  */
 public interface RemoteDeviceConnector {
 
     /**
-     * Create device communicator and open device connection
+     * Create device communicator and open device connection.
      * @param masterActorRef master actor reference
      */
     void startRemoteDeviceConnection(ActorRef masterActorRef);
 
     /**
-     * Stop device communicator
+     * Stop device communicator.
      */
     void stopRemoteDeviceConnection();
 }
index 3b04d0fa957f6ec6f09de077241137f733c2464e..2e683734da5820e520d304c16a96ca9df3ffc19a 100644 (file)
@@ -156,6 +156,7 @@ class MasterSalFacade implements AutoCloseable, RemoteDeviceHandler<NetconfSessi
         salProvider.getMountInstance().onTopologyDeviceDisconnected();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void closeGracefully(final AutoCloseable resource) {
         if (resource != null) {
             try {
index a33953291f60c333369efbbe1adb47bcc0f25bbe..bb623a92da180ae746c0ec56cb6968fb7cb9d926 100644 (file)
@@ -14,7 +14,6 @@ import akka.util.Timeout;
 import java.util.Collection;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
@@ -81,9 +80,11 @@ class NetconfNodeManager
                     break;
                 case WRITE:
                     if (rootNode.getDataBefore() != null) {
-                        LOG.debug("{}: Operational for node {} rewrited. Trying to register slave mount point", id, nodeId);
+                        LOG.debug("{}: Operational for node {} rewrited. Trying to register slave mount point",
+                                id, nodeId);
                     } else {
-                        LOG.debug("{}: Operational for node {} created. Trying to register slave mount point", id, nodeId);
+                        LOG.debug("{}: Operational for node {} created. Trying to register slave mount point",
+                                id, nodeId);
                     }
                     handleSlaveMountPoint(rootNode);
                     break;
index 31a7f64d6cc021e8d99a5c5fdb9883bc91f17f54..62508a2c3b1d9ec9ccb0155ca147290217252662 100644 (file)
@@ -80,7 +80,8 @@ class NetconfTopologyContext implements ClusterSingletonService {
         }
 
         if (!finalClose) {
-            final String masterAddress = Cluster.get(netconfTopologyDeviceSetup.getActorSystem()).selfAddress().toString();
+            final String masterAddress =
+                    Cluster.get(netconfTopologyDeviceSetup.getActorSystem()).selfAddress().toString();
             masterActorRef = netconfTopologyDeviceSetup.getActorSystem().actorOf(NetconfNodeActor.props(
                     netconfTopologyDeviceSetup, remoteDeviceId, DEFAULT_SCHEMA_REPOSITORY, DEFAULT_SCHEMA_REPOSITORY,
                     actorResponseWaitTime, mountService),
@@ -129,7 +130,7 @@ class NetconfTopologyContext implements ClusterSingletonService {
     }
 
     /**
-     * If configuration data was changed
+     * Refresh, if configuration data was changed.
      * @param setup new setup
      */
     void refresh(@Nonnull final NetconfTopologySetup setup) {
index 1a9816c3f7707a2d9f4905887b2931728862d3c6..254a1fb08c9da456c270906a0b33bfba91fdc9f7 100644 (file)
@@ -161,6 +161,7 @@ public class NetconfTopologyManager
         contexts.put(instanceIdentifier, newNetconfTopologyContext);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void stopNetconfDeviceContext(final InstanceIdentifier<Node> instanceIdentifier) {
         if (contexts.containsKey(instanceIdentifier)) {
             try {
@@ -174,6 +175,7 @@ public class NetconfTopologyManager
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public void close() {
         if (dataChangeListenerRegistration != null) {
@@ -220,7 +222,8 @@ public class NetconfTopologyManager
                         NetconfTopologyUtils.createTopologyListPath(topologyId).child(Node.class)), this);
     }
 
-    private void initTopology(final WriteTransaction wtx, final LogicalDatastoreType datastoreType, final String topologyId) {
+    private void initTopology(final WriteTransaction wtx, final LogicalDatastoreType datastoreType,
+                              final String topologyId) {
         final NetworkTopology networkTopology = new NetworkTopologyBuilder().build();
         final InstanceIdentifier<NetworkTopology> networkTopologyId =
                 InstanceIdentifier.builder(NetworkTopology.class).build();
index d5c9c25a17366aa6887c67762245d89acf4101b8..893782feb729d2e1827b1cb8297042c74ae4433a 100644 (file)
@@ -48,6 +48,8 @@ public class ProxyDOMDataBroker implements DOMDataBroker {
     private final ActorSystem actorSystem;
 
     /**
+     * Constructor for {@code ProxyDOMDataBroker}.
+     *
      * @param actorSystem system
      * @param id          id
      * @param masterNode  {@link org.opendaylight.netconf.topology.singleton.impl.actors.NetconfNodeActor} ref
@@ -61,6 +63,7 @@ public class ProxyDOMDataBroker implements DOMDataBroker {
         this.askTimeout = askTimeout;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
         final Future<Object> txActorFuture = Patterns.ask(masterNode, new NewReadTransactionRequest(), askTimeout);
@@ -77,6 +80,7 @@ public class ProxyDOMDataBroker implements DOMDataBroker {
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public DOMDataReadWriteTransaction newReadWriteTransaction() {
         final Future<Object> txActorFuture = Patterns.ask(masterNode, new NewReadWriteTransactionRequest(), askTimeout);
@@ -93,6 +97,7 @@ public class ProxyDOMDataBroker implements DOMDataBroker {
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public DOMDataWriteTransaction newWriteOnlyTransaction() {
         final Future<Object> txActorFuture = Patterns.ask(masterNode, new NewWriteTransactionRequest(), askTimeout);
index 4fcd296329c22feefcc75b6068fdbfa2644a4c34..33fa7b96e7443f83e4e0bb1fe133c5b4699a8657 100644 (file)
@@ -76,13 +76,13 @@ public class ProxyDOMRpcService implements DOMRpcService {
         final CheckedFuture<DOMRpcResult, DOMRpcException> checkedFuture = Futures.makeChecked(settableFuture,
                 new Function<Exception, DOMRpcException>() {
 
-            @Nullable
-            @Override
-            public DOMRpcException apply(@Nullable final Exception exception) {
-                return new ClusteringRpcException(id + ": Exception during remote rpc invocation.",
-                        exception);
-            }
-        });
+                @Nullable
+                @Override
+                public DOMRpcException apply(@Nullable final Exception exception) {
+                    return new ClusteringRpcException(id + ": Exception during remote rpc invocation.",
+                            exception);
+                }
+            });
 
         scalaFuture.onComplete(new OnComplete<Object>() {
             @Override
@@ -103,7 +103,7 @@ public class ProxyDOMRpcService implements DOMRpcService {
                 final NormalizedNodeMessage normalizedNodeMessageResult =
                         ((InvokeRpcMessageReply) success).getNormalizedNodeMessage();
                 final DOMRpcResult result;
-                if (normalizedNodeMessageResult == null ){
+                if (normalizedNodeMessageResult == null{
                     result = new DefaultDOMRpcResult(errors);
                 } else {
                     if (errors == null) {
index 02f9fe8aba3131a4a6ef86599a2f3511f9ba5a70..bc9b4e9933e0553deeafa0743cc6acd7b46e7b59 100644 (file)
@@ -120,6 +120,7 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
         });
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public void stopRemoteDeviceConnection() {
         Preconditions.checkNotNull(deviceCommunicatorDTO, remoteDeviceId + ": Device communicator was not created.");
@@ -225,9 +226,9 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
 
         //non-module capabilities should not exist in yang module capabilities
         final NetconfSessionPreferences netconfSessionPreferences = NetconfSessionPreferences.fromStrings(capabilities);
-        Preconditions.checkState(netconfSessionPreferences.getNonModuleCaps().isEmpty(), "List yang-module-capabilities/capability " +
-                "should contain only module based capabilities. Non-module capabilities used: " +
-                netconfSessionPreferences.getNonModuleCaps());
+        Preconditions.checkState(netconfSessionPreferences.getNonModuleCaps().isEmpty(),
+                "List yang-module-capabilities/capability should contain only module based capabilities. "
+                        + "Non-module capabilities used: " + netconfSessionPreferences.getNonModuleCaps());
 
         if (node.getNonModuleCapabilities() != null) {
             capabilities.addAll(node.getNonModuleCapabilities().getCapability());
@@ -271,10 +272,13 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
 
         final AuthenticationHandler authHandler;
         final Credentials credentials = node.getCredentials();
-        if (credentials instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword) {
+        if (credentials instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf
+                .node.credentials.credentials.LoginPassword) {
             authHandler = new LoginPassword(
-                    ((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword) credentials).getUsername(),
-                    ((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword) credentials).getPassword());
+                    ((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf
+                            .node.credentials.credentials.LoginPassword) credentials).getUsername(),
+                    ((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf
+                            .node.credentials.credentials.LoginPassword) credentials).getPassword());
         } else {
             throw new IllegalStateException(remoteDeviceId + ": Only login/password authentication is supported");
         }
index ed4a27530c807de19270e24d861716765f516c49..0abbdaa0ba58aa3d609b4a2d035c2e67d7c4b674 100644 (file)
@@ -56,6 +56,7 @@ public class SlaveSalFacade {
         salProvider.getMountInstance().onTopologyDeviceDisconnected();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         unregisterSlaveMountPoint();
         try {
index dd5e9129279e9de4fc28e9344969b8e06b3be707..4b47c9de1703be801fc10941bd7ccb929a1e708a 100644 (file)
@@ -112,6 +112,7 @@ public class NetconfNodeActor extends UntypedActor {
         this.mountPointService = mountPointService;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public void onReceive(final Object message) throws Exception {
         if (message instanceof CreateInitialMasterActorData) { // master
index 0ef08f0d2e66dc9b195fff16e7f7553bdbb1c3ae..d36062459d35670fe61ed5bd56890b62103a4dae 100644 (file)
@@ -28,10 +28,11 @@ class ReadAdapter {
 
     private final DOMDataReadTransaction tx;
 
-    public ReadAdapter(final DOMDataReadTransaction tx) {
+    ReadAdapter(final DOMDataReadTransaction tx) {
         this.tx = tx;
     }
 
+    @SuppressWarnings("checkstyle:IllegalThrows")
     public void handle(final Object message, final ActorRef sender, final ActorRef self) throws Throwable {
         if (message instanceof ReadRequest) {
 
index 7e762bf264f34364c905543abf7c7ff1206f3ae0..4cf51eead297a3fbaff603a23ab22df699227a68 100644 (file)
@@ -27,7 +27,7 @@ import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitR
 class WriteAdapter {
     private final DOMDataWriteTransaction tx;
 
-    public WriteAdapter(final DOMDataWriteTransaction tx) {
+    WriteAdapter(final DOMDataWriteTransaction tx) {
         this.tx = tx;
     }
 
index b500e0d5c38cb8df529c640ae06cf785fc005a48..0f23c11f2e27610e34214da4b2393d1e7badc5fb 100644 (file)
@@ -39,7 +39,7 @@ class ProxyReadAdapter {
     private final ActorSystem actorSystem;
     private final Timeout askTimeout;
 
-    public ProxyReadAdapter(final ActorRef masterTxActor, final RemoteDeviceId id, final ActorSystem actorSystem,
+    ProxyReadAdapter(final ActorRef masterTxActor, final RemoteDeviceId id, final ActorSystem actorSystem,
                             final Timeout askTimeout) {
         this.masterTxActor = masterTxActor;
         this.id = id;
index 9ef11bc63d0b2f4361180e8dd719b889f174c2f1..b73c9466e153aac0a64fa610c369cb20c154621a 100644 (file)
@@ -29,10 +29,12 @@ public class ProxyReadTransaction implements DOMDataReadOnlyTransaction {
     private final ProxyReadAdapter delegate;
 
     /**
+     * Constructor for {@code ProxyReadTransaction}.
+     *
      * @param masterTxActor {@link org.opendaylight.netconf.topology.singleton.impl.actors.ReadTransactionActor} ref
      * @param id            device id
      * @param actorSystem   system
-     * @param askTimeout
+     * @param askTimeout    timeout
      */
     public ProxyReadTransaction(final ActorRef masterTxActor, final RemoteDeviceId id, final ActorSystem actorSystem,
                                 final Timeout askTimeout) {
index 2791389c0ea7c5aa4b3378d62188a16f2dc8be09..2b2759ba0f6e8fbd95a431e2c77d74e2d2ae6726 100644 (file)
@@ -34,10 +34,13 @@ public class ProxyReadWriteTransaction implements DOMDataReadWriteTransaction {
     private final ProxyWriteAdapter delegateWrite;
 
     /**
-     * @param masterTxActor {@link org.opendaylight.netconf.topology.singleton.impl.actors.ReadWriteTransactionActor} ref
+     * Constructor for {@code ProxyReadWriteTransaction}.
+     *
+     * @param masterTxActor
+     * {@link org.opendaylight.netconf.topology.singleton.impl.actors.ReadWriteTransactionActor} ref
      * @param id            device id
      * @param actorSystem   system
-     * @param askTimeout
+     * @param askTimeout    timeout
      */
     public ProxyReadWriteTransaction(final ActorRef masterTxActor, final RemoteDeviceId id,
                                      final ActorSystem actorSystem, final Timeout askTimeout) {
index e9be9e7747f6612522481ebcc683d5111bdcfd72..223e443cd52161228be1a7755cc168bd6bcfd77a 100644 (file)
@@ -60,6 +60,7 @@ public class ProxyWriteAdapter {
         this.askTimeout = askTimeout;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public boolean cancel() {
         if (!opened.compareAndSet(true, false)) {
             return false;
index eb64eaf8860fee2c7747dc45310491f8dfebe748..f8504c029c28e960ad42d01b7257fbadd6464b18 100644 (file)
@@ -31,16 +31,19 @@ public class ProxyWriteTransaction implements DOMDataWriteTransaction {
     private final ProxyWriteAdapter proxyWriteAdapter;
 
     /**
+     * Constructor for {@code ProxyWriteTransaction}.
+     *
      * @param masterTxActor {@link org.opendaylight.netconf.topology.singleton.impl.actors.WriteTransactionActor} ref
      * @param id            device id
      * @param actorSystem   system
-     * @param askTimeout
+     * @param askTimeout    timeout
      */
     public ProxyWriteTransaction(final ActorRef masterTxActor, final RemoteDeviceId id, final ActorSystem actorSystem,
                                  final Timeout askTimeout) {
         proxyWriteAdapter = new ProxyWriteAdapter(masterTxActor, id, actorSystem, askTimeout);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public boolean cancel() {
         return proxyWriteAdapter.cancel();
index 39ac4dd718fd377019a6944de020d7ff882f5c93..1324e8ad44d7c3025c9fcb8403797397dff06bcf 100644 (file)
@@ -13,8 +13,8 @@ import java.io.File;
 import java.math.BigDecimal;
 import java.net.InetSocketAddress;
 import java.util.HashMap;
-import org.opendaylight.controller.config.util.xml.DocumentedException;
 import java.util.Map;
+import org.opendaylight.controller.config.util.xml.DocumentedException;
 import org.opendaylight.netconf.sal.connect.netconf.NetconfDevice;
 import org.opendaylight.netconf.sal.connect.netconf.NetconfStateSchemasResolverImpl;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
@@ -86,15 +86,15 @@ public class NetconfTopologyUtils {
      * of the schema cache directory, and the value is a corresponding <code>SchemaResourcesDTO</code>.  The
      * <code>SchemaResourcesDTO</code> is essentially a container that allows for the extraction of the
      * <code>SchemaRegistry</code> and <code>SchemaContextFactory</code> which should be used for a particular
-     * Netconf mount.  Access to <code>schemaResourcesDTOs</code> should be surrounded by appropriate
+     * Netconf mount.  Access to <code>SCHEMA_RESOURCES_DTO_MAP</code> should be surrounded by appropriate
      * synchronization locks.
      */
-    private static final Map<String, NetconfDevice.SchemaResourcesDTO> schemaResourcesDTOs = new HashMap<>();
+    private static final Map<String, NetconfDevice.SchemaResourcesDTO> SCHEMA_RESOURCES_DTO_MAP = new HashMap<>();
 
     // Initializes default constant instances for the case when the default schema repository
     // directory cache/schema is used.
     static {
-        schemaResourcesDTOs.put(DEFAULT_CACHE_DIRECTORY,
+        SCHEMA_RESOURCES_DTO_MAP.put(DEFAULT_CACHE_DIRECTORY,
                 new NetconfDevice.SchemaResourcesDTO(DEFAULT_SCHEMA_REPOSITORY, DEFAULT_SCHEMA_REPOSITORY,
                         DEFAULT_SCHEMA_CONTEXT_FACTORY, new NetconfStateSchemasResolverImpl()));
         DEFAULT_SCHEMA_REPOSITORY.registerSchemaSourceListener(DEFAULT_CACHE);
@@ -117,17 +117,17 @@ public class NetconfTopologyUtils {
             if (!moduleSchemaCacheDirectory.equals(DEFAULT_CACHE_DIRECTORY)) {
                 // Multiple modules may be created at once;  synchronize to avoid issues with data consistency among
                 // threads.
-                synchronized (schemaResourcesDTOs) {
+                synchronized (SCHEMA_RESOURCES_DTO_MAP) {
                     // Look for the cached DTO to reuse SchemaRegistry and SchemaContextFactory variables if
                     // they already exist
-                    schemaResourcesDTO = schemaResourcesDTOs.get(moduleSchemaCacheDirectory);
+                    schemaResourcesDTO = SCHEMA_RESOURCES_DTO_MAP.get(moduleSchemaCacheDirectory);
                     if (schemaResourcesDTO == null) {
                         schemaResourcesDTO = createSchemaResourcesDTO(moduleSchemaCacheDirectory);
                         schemaResourcesDTO.getSchemaRegistry().registerSchemaSourceListener(
                                 TextToASTTransformer.create((SchemaRepository) schemaResourcesDTO.getSchemaRegistry(),
                                         schemaResourcesDTO.getSchemaRegistry())
                         );
-                        schemaResourcesDTOs.put(moduleSchemaCacheDirectory, schemaResourcesDTO);
+                        SCHEMA_RESOURCES_DTO_MAP.put(moduleSchemaCacheDirectory, schemaResourcesDTO);
                     }
                 }
                 LOG.info("{} : netconf connector will use schema cache directory {} instead of {}",
@@ -136,8 +136,8 @@ public class NetconfTopologyUtils {
         }
 
         if (schemaResourcesDTO == null) {
-            synchronized (schemaResourcesDTOs) {
-                schemaResourcesDTO = schemaResourcesDTOs.get(DEFAULT_CACHE_DIRECTORY);
+            synchronized (SCHEMA_RESOURCES_DTO_MAP) {
+                schemaResourcesDTO = SCHEMA_RESOURCES_DTO_MAP.get(DEFAULT_CACHE_DIRECTORY);
             }
             LOG.info("{} : using the default directory {}",
                     deviceId, QUALIFIED_DEFAULT_CACHE_DIRECTORY);
index fbc43f7cf90672437dd322b7394a3cbce49deeb3..2f6e2e250696fb3d44af54c55db094ef28d2c5fb 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySetup;
 
 /**
- * Master sends this message to the own actor to refresh setup data
+ * Master sends this message to the own actor to refresh setup data.
  */
 public class RefreshSetupMasterActorData implements Serializable {
     private static final long serialVersionUID = 1L;
index 036f4e2a02b351d736db393524dcb64088187cea..319b375340262e221b9dc4e0027fbbc88777ec79 100644 (file)
@@ -39,7 +39,7 @@ public class SchemaPathMessage implements Serializable {
 
         private SchemaPathMessage schemaPathMessage;
 
-        public Proxy() {
+        Proxy() {
             //due to Externalizable
         }
 
@@ -51,8 +51,8 @@ public class SchemaPathMessage implements Serializable {
         public void writeExternal(final ObjectOutput out) throws IOException {
             out.writeInt(Iterables.size(schemaPathMessage.getSchemaPath().getPathTowardsRoot()));
 
-            for (final QName qName : schemaPathMessage.getSchemaPath().getPathTowardsRoot()) {
-                out.writeObject(qName);
+            for (final QName qualifiedName : schemaPathMessage.getSchemaPath().getPathTowardsRoot()) {
+                out.writeObject(qualifiedName);
             }
 
             out.writeBoolean(schemaPathMessage.getSchemaPath().isAbsolute());
index f52131e17b05c717c3264fbd7c4c7b4af0d98bb3..9a0e5c35e5fe57a32e3765e99f821aadc9e975a0 100644 (file)
@@ -28,6 +28,7 @@ public class InvokeRpcMessage implements Serializable {
         this.schemaPathMessage = schemaPathMessage;
         this.normalizedNodeMessage = normalizedNodeMessage;
     }
+
     private SchemaPathMessage getSchemaPathMessage() {
         return schemaPathMessage;
     }
@@ -49,7 +50,7 @@ public class InvokeRpcMessage implements Serializable {
 
         private InvokeRpcMessage invokeRpcMessage;
 
-        public Proxy() {
+        Proxy() {
             //due to Externalizable
         }
 
index 5c60ba03fb7056d2074c788ac69250d7ba6710cb..ba658ba92f83b41db87812160987743a37a4564c 100644 (file)
@@ -47,7 +47,7 @@ public class InvokeRpcMessageReply implements Serializable {
 
         private InvokeRpcMessageReply invokeRpcMessageReply;
 
-        public Proxy() {
+        Proxy() {
             //due to Externalizable
         }
 
index 9d752b8059ce6cb3d6770e3bd09a8001a0a382e1..718d85c62447119de7a76074b4a886f34fefb088 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.netconf.topology.singleton.messages.transactions;
 import java.io.Serializable;
 
 /**
- * Message is sended when RPC result does not exist or is empty
+ * Message is sended when RPC result does not exist or is empty.
  */
 public class EmptyResultResponse implements Serializable {
     private static final long serialVersionUID = 1L;
index fe077e2fb5d2bfde5b5a11c66c1214681c5b69ae..18e1f47393c01493398e9304114e6e4e08ac4d5c 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.netconf.topology.singleton.messages.transactions;
 import java.io.Serializable;
 
 /**
- * Message sent from master back to the slave when submit is not performed, tx is closed
+ * Message sent from master back to the slave when submit is not performed, tx is closed.
  */
 public class SubmitFailedReply implements Serializable {
     private static final long serialVersionUID = 1L;
index 88441a1b067f33b0047e0a06fca165b987b30192..4e50b34943c0adb019b3a1c6ca1231fed336ada5 100644 (file)
@@ -110,8 +110,7 @@ public class NetconfNodeActorTest {
 
     @Before
     public void setup() {
-        initMocks
-                (this);
+        initMocks(this);
         remoteDeviceId = new RemoteDeviceId("netconf-topology",
                 new InetSocketAddress(InetAddresses.forString("127.0.0.1"), 9999));
         final NetconfTopologySetup setup = mock(NetconfTopologySetup.class);
@@ -242,7 +241,8 @@ public class NetconfNodeActorTest {
 
         final YangTextSchemaSource yangTextSchemaSource = new YangTextSchemaSource(sourceIdentifier) {
             @Override
-            protected MoreObjects.ToStringHelper addToStringAttributes(final MoreObjects.ToStringHelper toStringHelper) {
+            protected MoreObjects.ToStringHelper addToStringAttributes(
+                    final MoreObjects.ToStringHelper toStringHelper) {
                 return null;
             }
 
@@ -304,7 +304,8 @@ public class NetconfNodeActorTest {
 
         // test if slave get right identifiers from master
 
-        final ProxyDOMRpcService slaveDomRPCService = new ProxyDOMRpcService(system, masterRef, remoteDeviceId, TIMEOUT);
+        final ProxyDOMRpcService slaveDomRPCService =
+                new ProxyDOMRpcService(system, masterRef, remoteDeviceId, TIMEOUT);
 
         final SchemaPath schemaPath = SchemaPath.create(true, QName.create("TestQname"));
         final NormalizedNode<?, ?> outputNode = ImmutableContainerNodeBuilder.create()
@@ -324,8 +325,8 @@ public class NetconfNodeActorTest {
 
         // InvokeRpcMessageReply message
 
-        doReturn(Futures.immediateCheckedFuture(new DefaultDOMRpcResult(outputNode))).
-                when(domRpcService).invokeRpc(any(), any());
+        doReturn(Futures.immediateCheckedFuture(new DefaultDOMRpcResult(outputNode)))
+                .when(domRpcService).invokeRpc(any(), any());
 
         final CheckedFuture<DOMRpcResult, DOMRpcException> resultFutureNn =
                 slaveDomRPCService.invokeRpc(schemaPath, outputNode);
index 3d1f5ec2b936ac344e864853bfc34c81971dbfd3..9745e87c2db5e9e4ed746b0d26f724a6d781844b 100644 (file)
@@ -150,7 +150,7 @@ public class RemoteDeviceConnectorImplTest {
         builder.setNode(node);
 
 
-        final NetconfDeviceCommunicator communicator = mock (NetconfDeviceCommunicator.class);
+        final NetconfDeviceCommunicator communicator = mock(NetconfDeviceCommunicator.class);
         final RemoteDeviceHandler salFacade = mock(RemoteDeviceHandler.class);
 
         final TestingRemoteDeviceConnectorImpl remoteDeviceConnection =
index 3f52fd72b9a04770c19f3c5a84c8a75657f1359f..30d279aef4ee5fb96126a6f04e45439253159838 100644 (file)
@@ -36,8 +36,8 @@ import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 
 public class ReadTransactionActorTest {
 
-    private static final YangInstanceIdentifier path = YangInstanceIdentifier.EMPTY;
-    private static final LogicalDatastoreType store = LogicalDatastoreType.CONFIGURATION;
+    private static final YangInstanceIdentifier PATH = YangInstanceIdentifier.EMPTY;
+    private static final LogicalDatastoreType STORE = LogicalDatastoreType.CONFIGURATION;
 
     @Mock
     private DOMDataReadOnlyTransaction deviceReadTx;
@@ -63,43 +63,43 @@ public class ReadTransactionActorTest {
         final ContainerNode node = Builders.containerBuilder()
                 .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create("cont")))
                 .build();
-        when(deviceReadTx.read(store, path)).thenReturn(Futures.immediateCheckedFuture(Optional.of(node)));
-        actorRef.tell(new ReadRequest(store, path), probe.ref());
-        verify(deviceReadTx).read(store, path);
+        when(deviceReadTx.read(STORE, PATH)).thenReturn(Futures.immediateCheckedFuture(Optional.of(node)));
+        actorRef.tell(new ReadRequest(STORE, PATH), probe.ref());
+        verify(deviceReadTx).read(STORE, PATH);
         probe.expectMsgClass(NormalizedNodeMessage.class);
     }
 
     @Test
     public void testReadEmpty() throws Exception {
-        when(deviceReadTx.read(store, path)).thenReturn(Futures.immediateCheckedFuture(Optional.absent()));
-        actorRef.tell(new ReadRequest(store, path), probe.ref());
-        verify(deviceReadTx).read(store, path);
+        when(deviceReadTx.read(STORE, PATH)).thenReturn(Futures.immediateCheckedFuture(Optional.absent()));
+        actorRef.tell(new ReadRequest(STORE, PATH), probe.ref());
+        verify(deviceReadTx).read(STORE, PATH);
         probe.expectMsgClass(EmptyReadResponse.class);
     }
 
     @Test
     public void testReadFailure() throws Exception {
         final ReadFailedException cause = new ReadFailedException("fail");
-        when(deviceReadTx.read(store, path)).thenReturn(Futures.immediateFailedCheckedFuture(cause));
-        actorRef.tell(new ReadRequest(store, path), probe.ref());
-        verify(deviceReadTx).read(store, path);
+        when(deviceReadTx.read(STORE, PATH)).thenReturn(Futures.immediateFailedCheckedFuture(cause));
+        actorRef.tell(new ReadRequest(STORE, PATH), probe.ref());
+        verify(deviceReadTx).read(STORE, PATH);
         probe.expectMsg(cause);
     }
 
     @Test
     public void testExists() throws Exception {
-        when(deviceReadTx.exists(store, path)).thenReturn(Futures.immediateCheckedFuture(true));
-        actorRef.tell(new ExistsRequest(store, path), probe.ref());
-        verify(deviceReadTx).exists(store, path);
+        when(deviceReadTx.exists(STORE, PATH)).thenReturn(Futures.immediateCheckedFuture(true));
+        actorRef.tell(new ExistsRequest(STORE, PATH), probe.ref());
+        verify(deviceReadTx).exists(STORE, PATH);
         probe.expectMsg(true);
     }
 
     @Test
     public void testExistsFailure() throws Exception {
         final ReadFailedException cause = new ReadFailedException("fail");
-        when(deviceReadTx.exists(store, path)).thenReturn(Futures.immediateFailedCheckedFuture(cause));
-        actorRef.tell(new ExistsRequest(store, path), probe.ref());
-        verify(deviceReadTx).exists(store, path);
+        when(deviceReadTx.exists(STORE, PATH)).thenReturn(Futures.immediateFailedCheckedFuture(cause));
+        actorRef.tell(new ExistsRequest(STORE, PATH), probe.ref());
+        verify(deviceReadTx).exists(STORE, PATH);
         probe.expectMsg(cause);
     }
 }
\ No newline at end of file
index c50cef45a5ee3e4f6cfa114170f94f3119731fba..ccf2d59660ed1470c4121f9efd20af71ae2aacf7 100644 (file)
@@ -179,7 +179,8 @@ public class ReadWriteTransactionTest {
 
     @Test
     public void testSubmitWithOperation() throws Exception {
-        final CheckedFuture<Void, TransactionCommitFailedException> resultSubmitTx = Futures.immediateCheckedFuture(null);
+        final CheckedFuture<Void, TransactionCommitFailedException> resultSubmitTx =
+                Futures.immediateCheckedFuture(null);
         doReturn(resultSubmitTx).when(readWriteTx).submit();
         // With Tx
         final DOMDataWriteTransaction wTx = slaveDataBroker.newReadWriteTransaction();
index 3457b309e27c02113b6a42e0ec5f83f682622432..6267e73dbcf9d1261deed659dd18976bb5ff613a 100644 (file)
@@ -180,7 +180,8 @@ public class WriteOnlyTransactionTest {
 
     @Test
     public void testSubmitWithOperation() throws Exception {
-        final CheckedFuture<Void, TransactionCommitFailedException> resultSubmitTx = Futures.immediateCheckedFuture(null);
+        final CheckedFuture<Void, TransactionCommitFailedException> resultSubmitTx =
+                Futures.immediateCheckedFuture(null);
         doReturn(resultSubmitTx).when(writeTx).submit();
         // With Tx
         final DOMDataWriteTransaction wTx = slaveDataBroker.newWriteOnlyTransaction();
index 9f8d153a879d1f83459e0d88c0f9a67c60cefc4b..d84ca38dc53e5ee7ff7a6be2d6a5f4e38882598e 100644 (file)
@@ -52,8 +52,8 @@ public class NetconfTopologyUtilTest {
         assertEquals("nodeId", listPath.firstKeyOf(Node.class).getNodeId().getValue());
         assertEquals("topologyId", listPath.firstKeyOf(Topology.class).getTopologyId().getValue());
 
-        assertEquals("topologyId",  NetconfTopologyUtils.createTopologyNodePath("topologyId").
-                firstKeyOf(Topology.class).getTopologyId().getValue());
+        assertEquals("topologyId",  NetconfTopologyUtils.createTopologyNodePath("topologyId")
+                .firstKeyOf(Topology.class).getTopologyId().getValue());
     }
 
 }