Fix CS warnings in sal-cluster-admin and and enable enforcement 61/46861/3
authorTom Pantelis <tpanteli@brocade.com>
Thu, 13 Oct 2016 06:30:53 +0000 (02:30 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 24 Oct 2016 11:39:20 +0000 (11:39 +0000)
Fixed checkstyle warnings and enabled enforcement. Most of the
warnings/changes were for:
 - white space before if/for/while/catch
 - line too long
 - illegal catching of Exception (suppressed)
 - adding final for locals declared too far from first usage

Change-Id: I0b78c01398a1c62220980e0c8ad22db288208d59
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-cluster-admin/pom.xml
opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java
opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModule.java
opendaylight/md-sal/sal-cluster-admin/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java

index e92961f..14ccea2 100644 (file)
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 </project>
index 1d39fd4..a55eca1 100644 (file)
@@ -87,12 +87,12 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     @Override
     public Future<RpcResult<Void>> addShardReplica(final AddShardReplicaInput input) {
         final String shardName = input.getShardName();
-        if(Strings.isNullOrEmpty(shardName)) {
+        if (Strings.isNullOrEmpty(shardName)) {
             return newFailedRpcResultFuture("A valid shard name must be specified");
         }
 
         DataStoreType dataStoreType = input.getDataStoreType();
-        if(dataStoreType == null) {
+        if (dataStoreType == null) {
             return newFailedRpcResultFuture("A valid DataStoreType must be specified");
         }
 
@@ -120,17 +120,17 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     @Override
     public Future<RpcResult<Void>> removeShardReplica(RemoveShardReplicaInput input) {
         final String shardName = input.getShardName();
-        if(Strings.isNullOrEmpty(shardName)) {
+        if (Strings.isNullOrEmpty(shardName)) {
             return newFailedRpcResultFuture("A valid shard name must be specified");
         }
 
         DataStoreType dataStoreType = input.getDataStoreType();
-        if(dataStoreType == null) {
+        if (dataStoreType == null) {
             return newFailedRpcResultFuture("A valid DataStoreType must be specified");
         }
 
         final String memberName = input.getMemberName();
-        if(Strings.isNullOrEmpty(memberName)) {
+        if (Strings.isNullOrEmpty(memberName)) {
             return newFailedRpcResultFuture("A valid member name must be specified");
         }
 
@@ -177,7 +177,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         LOG.info("Removing replicas for all shards");
 
         final String memberName = input.getMemberName();
-        if(Strings.isNullOrEmpty(memberName)) {
+        if (Strings.isNullOrEmpty(memberName)) {
             return newFailedRpcResultFuture("A valid member name must be specified");
         }
 
@@ -196,17 +196,17 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     @Override
     public Future<RpcResult<Void>> changeMemberVotingStatesForShard(ChangeMemberVotingStatesForShardInput input) {
         final String shardName = input.getShardName();
-        if(Strings.isNullOrEmpty(shardName)) {
+        if (Strings.isNullOrEmpty(shardName)) {
             return newFailedRpcResultFuture("A valid shard name must be specified");
         }
 
         DataStoreType dataStoreType = input.getDataStoreType();
-        if(dataStoreType == null) {
+        if (dataStoreType == null) {
             return newFailedRpcResultFuture("A valid DataStoreType must be specified");
         }
 
         List<MemberVotingState> memberVotingStates = input.getMemberVotingState();
-        if(memberVotingStates == null || memberVotingStates.isEmpty()) {
+        if (memberVotingStates == null || memberVotingStates.isEmpty()) {
             return newFailedRpcResultFuture("No member voting state input was specified");
         }
 
@@ -239,7 +239,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     public Future<RpcResult<ChangeMemberVotingStatesForAllShardsOutput>> changeMemberVotingStatesForAllShards(
             final ChangeMemberVotingStatesForAllShardsInput input) {
         List<MemberVotingState> memberVotingStates = input.getMemberVotingState();
-        if(memberVotingStates == null || memberVotingStates.isEmpty()) {
+        if (memberVotingStates == null || memberVotingStates.isEmpty()) {
             return newFailedRpcResultFuture("No member voting state input was specified");
         }
 
@@ -277,7 +277,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     public Future<RpcResult<Void>> backupDatastore(final BackupDatastoreInput input) {
         LOG.debug("backupDatastore: {}", input);
 
-        if(Strings.isNullOrEmpty(input.getFilePath())) {
+        if (Strings.isNullOrEmpty(input.getFilePath())) {
             return newFailedRpcResultFuture("A valid file path must be specified");
         }
 
@@ -301,7 +301,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     private ChangeShardMembersVotingStatus toChangeShardMembersVotingStatus(final String shardName,
             List<MemberVotingState> memberVotingStatus) {
         Map<String, Boolean> serverVotingStatusMap = new HashMap<>();
-        for(MemberVotingState memberStatus: memberVotingStatus) {
+        for (MemberVotingState memberStatus: memberVotingStatus) {
             serverVotingStatusMap.put(memberStatus.getMemberName(), memberStatus.isVoting());
         }
 
@@ -316,11 +316,11 @@ public class ClusterAdminRpcService implements ClusterAdminService {
             final String failureLogMsgPrefix) {
         final SettableFuture<RpcResult<T>> returnFuture = SettableFuture.create();
         final List<ShardResult> shardResults = new ArrayList<>();
-        for(final Entry<ListenableFuture<Success>, ShardResultBuilder> entry: shardResultData) {
+        for (final Entry<ListenableFuture<Success>, ShardResultBuilder> entry : shardResultData) {
             Futures.addCallback(entry.getKey(), new FutureCallback<Success>() {
                 @Override
                 public void onSuccess(Success result) {
-                    synchronized(shardResults) {
+                    synchronized (shardResults) {
                         ShardResultBuilder shardResult = entry.getValue();
                         LOG.debug("onSuccess for shard {}, type {}", shardResult.getShardName(),
                                 shardResult.getDataStoreType());
@@ -330,20 +330,20 @@ public class ClusterAdminRpcService implements ClusterAdminService {
                 }
 
                 @Override
-                public void onFailure(Throwable t) {
-                    synchronized(shardResults) {
+                public void onFailure(Throwable failure) {
+                    synchronized (shardResults) {
                         ShardResultBuilder shardResult = entry.getValue();
                         LOG.warn("{} for shard {}, type {}", failureLogMsgPrefix, shardResult.getShardName(),
-                                shardResult.getDataStoreType(), t);
+                                shardResult.getDataStoreType(), failure);
                         shardResults.add(shardResult.setSucceeded(false).setErrorMessage(
-                                Throwables.getRootCause(t).getMessage()).build());
+                                Throwables.getRootCause(failure).getMessage()).build());
                         checkIfComplete();
                     }
                 }
 
                 void checkIfComplete() {
                     LOG.debug("checkIfComplete: expected {}, actual {}", shardResultData.size(), shardResults.size());
-                    if(shardResults.size() == shardResultData.size()) {
+                    if (shardResults.size() == shardResultData.size()) {
                         returnFuture.set(newSuccessfulResult(resultDataSupplier.apply(shardResults)));
                     }
                 }
@@ -355,13 +355,13 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     private <T> void sendMessageToManagerForConfiguredShards(DataStoreType dataStoreType,
             List<Entry<ListenableFuture<T>, ShardResultBuilder>> shardResultData,
             Function<String, Object> messageSupplier) {
-        ActorContext actorContext = dataStoreType == DataStoreType.Config ?
-                configDataStore.getActorContext() : operDataStore.getActorContext();
+        ActorContext actorContext = dataStoreType == DataStoreType.Config ? configDataStore.getActorContext()
+                : operDataStore.getActorContext();
         Set<String> allShardNames = actorContext.getConfiguration().getAllShardNames();
 
         LOG.debug("Sending message to all shards {} for data store {}", allShardNames, actorContext.getDataStoreName());
 
-        for(String shardName: allShardNames) {
+        for (String shardName: allShardNames) {
             ListenableFuture<T> future = this.<T>ask(actorContext.getShardManager(), messageSupplier.apply(shardName),
                     SHARD_MGR_TIMEOUT);
             shardResultData.add(new SimpleEntry<>(future,
@@ -379,19 +379,21 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     private <T> ListenableFuture<T> sendMessageToShardManager(DataStoreType dataStoreType, Object message) {
-        ActorRef shardManager = dataStoreType == DataStoreType.Config ?
-                configDataStore.getActorContext().getShardManager() : operDataStore.getActorContext().getShardManager();
+        ActorRef shardManager = dataStoreType == DataStoreType.Config
+                ? configDataStore.getActorContext().getShardManager()
+                        : operDataStore.getActorContext().getShardManager();
         return ask(shardManager, message, SHARD_MGR_TIMEOUT);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static void saveSnapshotsToFile(DatastoreSnapshotList snapshots, String fileName,
             SettableFuture<RpcResult<Void>> returnFuture) {
-        try(FileOutputStream fos = new FileOutputStream(fileName)) {
+        try (FileOutputStream fos = new FileOutputStream(fileName)) {
             SerializationUtils.serialize(snapshots, fos);
 
             returnFuture.set(newSuccessfulResult());
             LOG.info("Successfully backed up datastore to file {}", fileName);
-        } catch(Exception e) {
+        } catch (Exception e) {
             onDatastoreBackupFailure(fileName, returnFuture, e);
         }
     }
@@ -416,7 +418,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         askFuture.onComplete(new OnComplete<T>() {
             @Override
             public void onComplete(Throwable failure, T resp) {
-                if(failure != null) {
+                if (failure != null) {
                     returnFuture.setException(failure);
                 } else {
                     returnFuture.set(resp);
index 62c1a2e..07acc18 100644 (file)
@@ -18,6 +18,7 @@ import static org.junit.Assert.fail;
 import static org.opendaylight.controller.cluster.datastore.MemberNode.verifyNoShardPresent;
 import static org.opendaylight.controller.cluster.datastore.MemberNode.verifyRaftPeersPresent;
 import static org.opendaylight.controller.cluster.datastore.MemberNode.verifyRaftState;
+
 import akka.actor.ActorRef;
 import akka.actor.PoisonPill;
 import akka.actor.Status.Success;
@@ -59,7 +60,7 @@ import org.opendaylight.controller.cluster.raft.RaftState;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry;
 import org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload;
 import org.opendaylight.controller.cluster.raft.persisted.ServerInfo;
-import org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm;
+import org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm;
 import org.opendaylight.controller.cluster.raft.utils.InMemoryJournal;
 import org.opendaylight.controller.cluster.raft.utils.InMemorySnapshotStore;
 import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
@@ -110,20 +111,20 @@ public class ClusterAdminRpcServiceTest {
 
     @Test
     public void testBackupDatastore() throws Exception {
-        MemberNode node = MemberNode.builder(memberNodes).akkaConfig("Member1").
-                moduleShardsConfig("module-shards-member1.conf").
-                waitForShardLeader("cars", "people").testName("testBackupDatastore").build();
+        MemberNode node = MemberNode.builder(memberNodes).akkaConfig("Member1")
+                .moduleShardsConfig("module-shards-member1.conf").waitForShardLeader("cars", "people")
+                .testName("testBackupDatastore").build();
 
         String fileName = "target/testBackupDatastore";
         new File(fileName).delete();
 
         ClusterAdminRpcService service = new ClusterAdminRpcService(node.configDataStore(), node.operDataStore());
 
-        RpcResult<Void> rpcResult = service .backupDatastore(new BackupDatastoreInputBuilder().
-                setFilePath(fileName).build()).get(5, TimeUnit.SECONDS);
+        RpcResult<Void> rpcResult = service .backupDatastore(new BackupDatastoreInputBuilder()
+                .setFilePath(fileName).build()).get(5, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
-        try(FileInputStream fis = new FileInputStream(fileName)) {
+        try (FileInputStream fis = new FileInputStream(fileName)) {
             List<DatastoreSnapshot> snapshots = SerializationUtils.deserialize(fis);
             assertEquals("DatastoreSnapshot size", 2, snapshots.size());
 
@@ -137,24 +138,25 @@ public class ClusterAdminRpcServiceTest {
 
         // Test failure by killing a shard.
 
-        node.configDataStore().getActorContext().getShardManager().tell(node.datastoreContextBuilder().
-                shardInitializationTimeout(200, TimeUnit.MILLISECONDS).build(), ActorRef.noSender());
+        node.configDataStore().getActorContext().getShardManager().tell(node.datastoreContextBuilder()
+                .shardInitializationTimeout(200, TimeUnit.MILLISECONDS).build(), ActorRef.noSender());
 
         ActorRef carsShardActor = node.configDataStore().getActorContext().findLocalShard("cars").get();
         node.kit().watch(carsShardActor);
         carsShardActor.tell(PoisonPill.getInstance(), ActorRef.noSender());
         node.kit().expectTerminated(carsShardActor);
 
-        rpcResult = service.backupDatastore(new BackupDatastoreInputBuilder().setFilePath(fileName).build()).
-                get(5, TimeUnit.SECONDS);
+        rpcResult = service.backupDatastore(new BackupDatastoreInputBuilder().setFilePath(fileName).build())
+                .get(5, TimeUnit.SECONDS);
         assertEquals("isSuccessful", false, rpcResult.isSuccessful());
         assertEquals("getErrors", 1, rpcResult.getErrors().size());
     }
 
-    private static void verifyDatastoreSnapshot(String type, DatastoreSnapshot datastoreSnapshot, String... expShardNames) {
+    private static void verifyDatastoreSnapshot(String type, DatastoreSnapshot datastoreSnapshot,
+            String... expShardNames) {
         assertNotNull("Missing DatastoreSnapshot for type " + type, datastoreSnapshot);
         Set<String> shardNames = new HashSet<>();
-        for(DatastoreSnapshot.ShardSnapshot s: datastoreSnapshot.getShardSnapshots()) {
+        for (DatastoreSnapshot.ShardSnapshot s: datastoreSnapshot.getShardSnapshots()) {
             shardNames.add(s.getName());
         }
 
@@ -165,18 +167,18 @@ public class ClusterAdminRpcServiceTest {
     public void testAddShardReplica() throws Exception {
         String name = "testAddShardReplica";
         String moduleShardsConfig = "module-shards-cars-member-1.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).waitForShardLeader("cars").build();
+        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name )
+                .moduleShardsConfig(moduleShardsConfig).waitForShardLeader("cars").build();
 
-        MemberNode newReplicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        MemberNode newReplicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.waitForMembersUp("member-2");
 
         doAddShardReplica(newReplicaNode2, "cars", "member-1");
 
-        MemberNode newReplicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        MemberNode newReplicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.waitForMembersUp("member-3");
         newReplicaNode2.waitForMembersUp("member-3");
@@ -187,7 +189,7 @@ public class ClusterAdminRpcServiceTest {
         verifyRaftPeersPresent(newReplicaNode2.operDataStore(), "cars", "member-1", "member-3");
 
         // Write data to member-2's config datastore and read/verify via member-3
-        NormalizedNode<?, ?> configCarsNode = writeCarsNodeAndVerify(newReplicaNode2.configDataStore(),
+        final NormalizedNode<?, ?> configCarsNode = writeCarsNodeAndVerify(newReplicaNode2.configDataStore(),
                 newReplicaNode3.configDataStore());
 
         // Write data to member-3's oper datastore and read/verify via member-2
@@ -215,8 +217,8 @@ public class ClusterAdminRpcServiceTest {
         Cluster.get(leaderNode1.kit().getSystem()).down(Cluster.get(newReplicaNode3.kit().getSystem()).selfAddress());
         newReplicaNode3.cleanup();
 
-        newReplicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).createOperDatastore(false).build();
+        newReplicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).createOperDatastore(false).build();
 
         verifyRaftState(newReplicaNode3.configDataStore(), "cars", verifier);
         readCarsNodeAndVerify(newReplicaNode3.configDataStore(), configCarsNode);
@@ -225,22 +227,22 @@ public class ClusterAdminRpcServiceTest {
     @Test
     public void testAddShardReplicaFailures() throws Exception {
         String name = "testAddShardReplicaFailures";
-        MemberNode memberNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name).
-                moduleShardsConfig("module-shards-cars-member-1.conf").build();
+        MemberNode memberNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig("module-shards-cars-member-1.conf").build();
 
         ClusterAdminRpcService service = new ClusterAdminRpcService(memberNode.configDataStore(),
                 memberNode.operDataStore());
 
-        RpcResult<Void> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().
-                setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
+        RpcResult<Void> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder()
+                .setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
         verifyFailedRpcResult(rpcResult);
 
-        rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName("cars").
-                build()).get(10, TimeUnit.SECONDS);
+        rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName("cars")
+                .build()).get(10, TimeUnit.SECONDS);
         verifyFailedRpcResult(rpcResult);
 
-        rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName("people").
-                setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
+        rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName("people")
+                .setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
         verifyFailedRpcResult(rpcResult);
     }
 
@@ -262,8 +264,8 @@ public class ClusterAdminRpcServiceTest {
 
     private static void readCarsNodeAndVerify(DistributedDataStore readFromStore,
             NormalizedNode<?, ?> expCarsNode) throws Exception {
-        Optional<NormalizedNode<?, ?>> optional = readFromStore.newReadOnlyTransaction().
-                read(CarsModel.BASE_PATH).get(15, TimeUnit.SECONDS);
+        Optional<NormalizedNode<?, ?>> optional = readFromStore.newReadOnlyTransaction()
+                .read(CarsModel.BASE_PATH).get(15, TimeUnit.SECONDS);
         assertEquals("isPresent", true, optional.isPresent());
         assertEquals("Data node", expCarsNode, optional.get());
     }
@@ -275,8 +277,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service = new ClusterAdminRpcService(memberNode.configDataStore(),
                 memberNode.operDataStore());
 
-        RpcResult<Void> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName(shardName).
-                setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
+        RpcResult<Void> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName(shardName)
+                .setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
         verifyRaftPeersPresent(memberNode.configDataStore(), shardName, peerMemberNames);
@@ -284,16 +286,16 @@ public class ClusterAdminRpcServiceTest {
         Optional<ActorRef> optional = memberNode.operDataStore().getActorContext().findLocalShard(shardName);
         assertEquals("Oper shard present", false, optional.isPresent());
 
-        rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName(shardName).
-                setDataStoreType(DataStoreType.Operational).build()).get(10, TimeUnit.SECONDS);
+        rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName(shardName)
+                .setDataStoreType(DataStoreType.Operational).build()).get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
         verifyRaftPeersPresent(memberNode.operDataStore(), shardName, peerMemberNames);
     }
 
     private static <T> T verifySuccessfulRpcResult(RpcResult<T> rpcResult) {
-        if(!rpcResult.isSuccessful()) {
-            if(rpcResult.getErrors().size() > 0) {
+        if (!rpcResult.isSuccessful()) {
+            if (rpcResult.getErrors().size() > 0) {
                 RpcError error = Iterables.getFirst(rpcResult.getErrors(), null);
                 throw new AssertionError("Rpc failed with error: " + error, error.getCause());
             }
@@ -315,16 +317,16 @@ public class ClusterAdminRpcServiceTest {
     public void testRemoveShardReplica() throws Exception {
         String name = "testRemoveShardReplica";
         String moduleShardsConfig = "module-shards-member1-and-2-and-3.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).
-                datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        final MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
-        MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.configDataStore().waitTillReady();
         replicaNode3.configDataStore().waitTillReady();
@@ -337,9 +339,9 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service3 = new ClusterAdminRpcService(replicaNode3.configDataStore(),
                 replicaNode3.operDataStore());
 
-        RpcResult<Void> rpcResult = service3.removeShardReplica(new RemoveShardReplicaInputBuilder().
-                setShardName("cars").setMemberName("member-3").setDataStoreType(DataStoreType.Config).build()).
-                        get(10, TimeUnit.SECONDS);
+        RpcResult<Void> rpcResult = service3.removeShardReplica(new RemoveShardReplicaInputBuilder()
+                .setShardName("cars").setMemberName("member-3").setDataStoreType(DataStoreType.Config).build())
+                .get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
         verifyRaftPeersPresent(leaderNode1.configDataStore(), "cars", "member-2");
@@ -351,40 +353,39 @@ public class ClusterAdminRpcServiceTest {
         Cluster.get(leaderNode1.kit().getSystem()).down(Cluster.get(replicaNode2.kit().getSystem()).selfAddress());
         replicaNode2.cleanup();
 
-        replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        MemberNode newPeplicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        replicaNode2.configDataStore().waitTillReady();
-        verifyRaftPeersPresent(replicaNode2.configDataStore(), "cars", "member-1");
+        newPeplicaNode2.configDataStore().waitTillReady();
+        verifyRaftPeersPresent(newPeplicaNode2.configDataStore(), "cars", "member-1");
 
         // Invoke RPC service on member-1 to remove member-2
 
         ClusterAdminRpcService service1 = new ClusterAdminRpcService(leaderNode1.configDataStore(),
                 leaderNode1.operDataStore());
 
-        rpcResult = service1.removeShardReplica(new RemoveShardReplicaInputBuilder().
-                setShardName("cars").setMemberName("member-2").setDataStoreType(DataStoreType.Config).build()).
-                        get(10, TimeUnit.SECONDS);
+        rpcResult = service1.removeShardReplica(new RemoveShardReplicaInputBuilder().setShardName("cars")
+                .setMemberName("member-2").setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
         verifyRaftPeersPresent(leaderNode1.configDataStore(), "cars");
-        verifyNoShardPresent(replicaNode2.configDataStore(), "cars");
+        verifyNoShardPresent(newPeplicaNode2.configDataStore(), "cars");
     }
 
     @Test
     public void testRemoveShardLeaderReplica() throws Exception {
         String name = "testRemoveShardLeaderReplica";
         String moduleShardsConfig = "module-shards-member1-and-2-and-3.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).
-                datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        final MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
-        MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.configDataStore().waitTillReady();
         verifyRaftPeersPresent(leaderNode1.configDataStore(), "cars", "member-2", "member-3");
@@ -399,13 +400,14 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service1 = new ClusterAdminRpcService(leaderNode1.configDataStore(),
                 leaderNode1.operDataStore());
 
-        RpcResult<Void> rpcResult = service1.removeShardReplica(new RemoveShardReplicaInputBuilder().
-                setShardName("cars").setMemberName("member-1").setDataStoreType(DataStoreType.Config).build()).
-                        get(10, TimeUnit.SECONDS);
+        RpcResult<Void> rpcResult = service1.removeShardReplica(new RemoveShardReplicaInputBuilder()
+                .setShardName("cars").setMemberName("member-1").setDataStoreType(DataStoreType.Config).build())
+                .get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
         verifyRaftState(replicaNode2.configDataStore(), "cars", raftState ->
-                assertThat("Leader Id", raftState.getLeader(), anyOf(containsString("member-2"), containsString("member-3"))));
+                assertThat("Leader Id", raftState.getLeader(), anyOf(containsString("member-2"),
+                        containsString("member-3"))));
 
         verifyRaftPeersPresent(replicaNode2.configDataStore(), "cars", "member-3");
         verifyRaftPeersPresent(replicaNode3.configDataStore(), "cars", "member-2");
@@ -416,8 +418,8 @@ public class ClusterAdminRpcServiceTest {
     public void testAddReplicasForAllShards() throws Exception {
         String name = "testAddReplicasForAllShards";
         String moduleShardsConfig = "module-shards-member1.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).waitForShardLeader("cars", "people").build();
+        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name )
+                .moduleShardsConfig(moduleShardsConfig).waitForShardLeader("cars", "people").build();
 
         ModuleShardConfiguration petsModuleConfig = new ModuleShardConfiguration(URI.create("pets-ns"), "pets-module",
                 "pets", null, Arrays.asList(MEMBER_1));
@@ -426,8 +428,8 @@ public class ClusterAdminRpcServiceTest {
         leaderNode1.kit().expectMsgClass(Success.class);
         leaderNode1.kit().waitUntilLeader(leaderNode1.configDataStore().getActorContext(), "pets");
 
-        MemberNode newReplicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        MemberNode newReplicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.waitForMembersUp("member-2");
         newReplicaNode2.waitForMembersUp("member-1");
@@ -445,7 +447,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service = new ClusterAdminRpcService(newReplicaNode2.configDataStore(),
                 newReplicaNode2.operDataStore());
 
-        RpcResult<AddReplicasForAllShardsOutput> rpcResult = service.addReplicasForAllShards().get(10, TimeUnit.SECONDS);
+        RpcResult<AddReplicasForAllShardsOutput> rpcResult =
+                service.addReplicasForAllShards().get(10, TimeUnit.SECONDS);
         AddReplicasForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -465,15 +468,16 @@ public class ClusterAdminRpcServiceTest {
     public void testRemoveAllShardReplicas() throws Exception {
         String name = "testRemoveAllShardReplicas";
         String moduleShardsConfig = "module-shards-member1-and-2-and-3.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        final MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
-        MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.configDataStore().waitTillReady();
         verifyRaftPeersPresent(leaderNode1.configDataStore(), "cars", "member-2", "member-3");
@@ -525,15 +529,16 @@ public class ClusterAdminRpcServiceTest {
     public void testChangeMemberVotingStatesForShard() throws Exception {
         String name = "testChangeMemberVotingStatusForShard";
         String moduleShardsConfig = "module-shards-member1-and-2-and-3.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        final MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
-        MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.configDataStore().waitTillReady();
         replicaNode3.configDataStore().waitTillReady();
@@ -546,29 +551,32 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service3 = new ClusterAdminRpcService(replicaNode3.configDataStore(),
                 replicaNode3.operDataStore());
 
-        RpcResult<Void> rpcResult = service3.changeMemberVotingStatesForShard(
-                new ChangeMemberVotingStatesForShardInputBuilder().setShardName("cars").
-                    setDataStoreType(DataStoreType.Config).setMemberVotingState(ImmutableList.of(
-                        new MemberVotingStateBuilder().setMemberName("member-2").setVoting(false).build(),
-                        new MemberVotingStateBuilder().setMemberName("member-3").setVoting(false).build())).build()).
-                get(10, TimeUnit.SECONDS);
+        RpcResult<Void> rpcResult = service3
+                .changeMemberVotingStatesForShard(new ChangeMemberVotingStatesForShardInputBuilder()
+                        .setShardName("cars").setDataStoreType(DataStoreType.Config)
+                        .setMemberVotingState(ImmutableList.of(
+                                new MemberVotingStateBuilder().setMemberName("member-2").setVoting(false).build(),
+                                new MemberVotingStateBuilder().setMemberName("member-3").setVoting(false).build()))
+                        .build())
+                .get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
-        verifyVotingStates(leaderNode1.configDataStore(), "cars", new SimpleEntry<>("member-1", true), new SimpleEntry<>("member-2", false),
-                new SimpleEntry<>("member-3", false));
-        verifyVotingStates(replicaNode2.configDataStore(), "cars", new SimpleEntry<>("member-1", true), new SimpleEntry<>("member-2", false),
-                new SimpleEntry<>("member-3", false));
-        verifyVotingStates(replicaNode3.configDataStore(), "cars", new SimpleEntry<>("member-1", true), new SimpleEntry<>("member-2", false),
-                new SimpleEntry<>("member-3", false));
+        verifyVotingStates(leaderNode1.configDataStore(), "cars", new SimpleEntry<>("member-1", true),
+                new SimpleEntry<>("member-2", false), new SimpleEntry<>("member-3", false));
+        verifyVotingStates(replicaNode2.configDataStore(), "cars", new SimpleEntry<>("member-1", true),
+                new SimpleEntry<>("member-2", false), new SimpleEntry<>("member-3", false));
+        verifyVotingStates(replicaNode3.configDataStore(), "cars", new SimpleEntry<>("member-1", true),
+                new SimpleEntry<>("member-2", false), new SimpleEntry<>("member-3", false));
     }
 
     @Test
     public void testChangeMemberVotingStatesForSingleNodeShard() throws Exception {
         String name = "testChangeMemberVotingStatesForSingleNodeShard";
         String moduleShardsConfig = "module-shards-member1.conf";
-        MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        MemberNode leaderNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
         leaderNode.configDataStore().waitTillReady();
 
@@ -577,11 +585,13 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service = new ClusterAdminRpcService(leaderNode.configDataStore(),
                 leaderNode.operDataStore());
 
-        RpcResult<Void> rpcResult = service.changeMemberVotingStatesForShard(
-                new ChangeMemberVotingStatesForShardInputBuilder().setShardName("cars").
-                    setDataStoreType(DataStoreType.Config).setMemberVotingState(ImmutableList.of(
-                        new MemberVotingStateBuilder().setMemberName("member-1").setVoting(false).build())).build()).
-                get(10, TimeUnit.SECONDS);
+        RpcResult<Void> rpcResult = service
+                .changeMemberVotingStatesForShard(new ChangeMemberVotingStatesForShardInputBuilder()
+                        .setShardName("cars").setDataStoreType(DataStoreType.Config)
+                        .setMemberVotingState(ImmutableList
+                                .of(new MemberVotingStateBuilder().setMemberName("member-1").setVoting(false).build()))
+                        .build())
+                .get(10, TimeUnit.SECONDS);
         verifyFailedRpcResult(rpcResult);
 
         verifyVotingStates(leaderNode.configDataStore(), "cars", new SimpleEntry<>("member-1", true));
@@ -591,15 +601,16 @@ public class ClusterAdminRpcServiceTest {
     public void testChangeMemberVotingStatesForAllShards() throws Exception {
         String name = "testChangeMemberVotingStatesForAllShards";
         String moduleShardsConfig = "module-shards-member1-and-2-and-3.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        final MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
-        MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.configDataStore().waitTillReady();
         leaderNode1.operDataStore().waitTillReady();
@@ -617,8 +628,8 @@ public class ClusterAdminRpcServiceTest {
         RpcResult<ChangeMemberVotingStatesForAllShardsOutput> rpcResult = service3.changeMemberVotingStatesForAllShards(
                 new ChangeMemberVotingStatesForAllShardsInputBuilder().setMemberVotingState(ImmutableList.of(
                         new MemberVotingStateBuilder().setMemberName("member-2").setVoting(false).build(),
-                        new MemberVotingStateBuilder().setMemberName("member-3").setVoting(false).build())).build()).
-                get(10, TimeUnit.SECONDS);
+                        new MemberVotingStateBuilder().setMemberName("member-3").setVoting(false).build())).build())
+                .get(10, TimeUnit.SECONDS);
         ChangeMemberVotingStatesForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -628,8 +639,8 @@ public class ClusterAdminRpcServiceTest {
         verifyVotingStates(new DistributedDataStore[]{leaderNode1.configDataStore(), leaderNode1.operDataStore(),
                 replicaNode2.configDataStore(), replicaNode2.operDataStore(),
                 replicaNode3.configDataStore(), replicaNode3.operDataStore()},
-                new String[]{"cars", "people"}, new SimpleEntry<>("member-1", true), new SimpleEntry<>("member-2", false),
-                new SimpleEntry<>("member-3", false));
+                new String[]{"cars", "people"}, new SimpleEntry<>("member-1", true),
+                new SimpleEntry<>("member-2", false), new SimpleEntry<>("member-3", false));
     }
 
     @Test
@@ -645,15 +656,16 @@ public class ClusterAdminRpcServiceTest {
         setupPersistedServerConfigPayload(persistedServerConfig, "member-3", name, "cars", "people");
 
         String moduleShardsConfig = "module-shards-member1-and-2-and-3.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        final MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
-        MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.configDataStore().waitTillReady();
         leaderNode1.operDataStore().waitTillReady();
@@ -665,8 +677,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service3 = new ClusterAdminRpcService(replicaNode3.configDataStore(),
                 replicaNode3.operDataStore());
 
-        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service3.flipMemberVotingStatesForAllShards().
-                get(10, TimeUnit.SECONDS);
+        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service3.flipMemberVotingStatesForAllShards()
+                .get(10, TimeUnit.SECONDS);
         FlipMemberVotingStatesForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -733,15 +745,16 @@ public class ClusterAdminRpcServiceTest {
         setupPersistedServerConfigPayload(persistedServerConfig, "member-3", name, "cars", "people");
 
         String moduleShardsConfig = "module-shards-member1-and-2-and-3.conf";
-        MemberNode replicaNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        final MemberNode replicaNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
-        MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         // Initially there won't be a leader b/c all the up nodes are non-voting.
 
@@ -758,8 +771,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service1 = new ClusterAdminRpcService(replicaNode1.configDataStore(),
                 replicaNode1.operDataStore());
 
-        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service1.flipMemberVotingStatesForAllShards().
-                get(10, TimeUnit.SECONDS);
+        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service1.flipMemberVotingStatesForAllShards()
+                .get(10, TimeUnit.SECONDS);
         FlipMemberVotingStatesForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -804,15 +817,16 @@ public class ClusterAdminRpcServiceTest {
         setupPersistedServerConfigPayload(persistedServerConfig, "member-3", name, "cars", "people");
 
         String moduleShardsConfig = "module-shards-member1-and-2-and-3.conf";
-        MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name ).
-                moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(DatastoreContext.newBuilder().
-                        shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1)).build();
+        final MemberNode leaderNode1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).datastoreContextBuilder(
+                        DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(300).shardElectionTimeoutFactor(1))
+                .build();
 
-        MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
-        MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name).
-                moduleShardsConfig(moduleShardsConfig).build();
+        final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
+                .moduleShardsConfig(moduleShardsConfig).build();
 
         leaderNode1.configDataStore().waitTillReady();
         leaderNode1.operDataStore().waitTillReady();
@@ -824,8 +838,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service1 = new ClusterAdminRpcService(leaderNode1.configDataStore(),
                 leaderNode1.operDataStore());
 
-        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service1.flipMemberVotingStatesForAllShards().
-                get(10, TimeUnit.SECONDS);
+        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service1.flipMemberVotingStatesForAllShards()
+                .get(10, TimeUnit.SECONDS);
         FlipMemberVotingStatesForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -852,10 +866,10 @@ public class ClusterAdminRpcServiceTest {
     private void setupPersistedServerConfigPayload(ServerConfigurationPayload serverConfig,
             String member, String datastoreTypeSuffix, String... shards) {
         String[] datastoreTypes = {"config_", "oper_"};
-        for(String type: datastoreTypes) {
-            for(String shard: shards) {
+        for (String type : datastoreTypes) {
+            for (String shard : shards) {
                 List<ServerInfo> newServerInfo = new ArrayList<>(serverConfig.getServerConfig().size());
-                for(ServerInfo info: serverConfig.getServerConfig()) {
+                for (ServerInfo info : serverConfig.getServerConfig()) {
                     newServerInfo.add(new ServerInfo(ShardIdentifier.create(shard, MemberName.forName(info.getId()),
                             type + datastoreTypeSuffix).toString(), info.isVoting()));
                 }
@@ -872,8 +886,8 @@ public class ClusterAdminRpcServiceTest {
     @SafeVarargs
     private static void verifyVotingStates(DistributedDataStore[] datastores, String[] shards,
             SimpleEntry<String, Boolean>... expStates) throws Exception {
-        for(DistributedDataStore datastore: datastores) {
-            for(String shard: shards) {
+        for (DistributedDataStore datastore: datastores) {
+            for (String shard: shards) {
                 verifyVotingStates(datastore, shard, expStates);
             }
         }
@@ -884,7 +898,7 @@ public class ClusterAdminRpcServiceTest {
             SimpleEntry<String, Boolean>... expStates) throws Exception {
         String localMemberName = datastore.getActorContext().getCurrentMemberName().getName();
         Map<String, Boolean> expStateMap = new HashMap<>();
-        for(Entry<String, Boolean> e: expStates) {
+        for (Entry<String, Boolean> e: expStates) {
             expStateMap.put(ShardIdentifier.create(shardName, MemberName.forName(e.getKey()),
                     datastore.getActorContext().getDataStoreName()).toString(), e.getValue());
         }
@@ -893,7 +907,7 @@ public class ClusterAdminRpcServiceTest {
             String localPeerId = ShardIdentifier.create(shardName, MemberName.forName(localMemberName),
                     datastore.getActorContext().getDataStoreName()).toString();
             assertEquals("Voting state for " + localPeerId, expStateMap.get(localPeerId), raftState.isVoting());
-            for(Entry<String, Boolean> e: raftState.getPeerVotingStates().entrySet()) {
+            for (Entry<String, Boolean> e: raftState.getPeerVotingStates().entrySet()) {
                 assertEquals("Voting state for " + e.getKey(), expStateMap.get(e.getKey()), e.getValue());
             }
         });
@@ -901,23 +915,23 @@ public class ClusterAdminRpcServiceTest {
 
     private static void verifyShardResults(List<ShardResult> shardResults, ShardResult... expShardResults) {
         Map<String, ShardResult> expResultsMap = new HashMap<>();
-        for(ShardResult r: expShardResults) {
+        for (ShardResult r: expShardResults) {
             expResultsMap.put(r.getShardName() + "-" + r.getDataStoreType(), r);
         }
 
-        for(ShardResult result: shardResults) {
+        for (ShardResult result: shardResults) {
             ShardResult exp = expResultsMap.remove(result.getShardName() + "-" + result.getDataStoreType());
             assertNotNull(String.format("Unexpected result for shard %s, type %s", result.getShardName(),
                     result.getDataStoreType()), exp);
             assertEquals("isSucceeded", exp.isSucceeded(), result.isSucceeded());
-            if(exp.isSucceeded()) {
+            if (exp.isSucceeded()) {
                 assertNull("Expected null error message", result.getErrorMessage());
             } else {
                 assertNotNull("Expected error message", result.getErrorMessage());
             }
         }
 
-        if(!expResultsMap.isEmpty()) {
+        if (!expResultsMap.isEmpty()) {
             fail("Missing shard results for " + expResultsMap.keySet());
         }
     }