Pārlūkot izejas kodu

HDDS-137. Cleanup Hdds-ozone CheckStyle Issues.
Contributed by Anu Engineer.

Anu Engineer 7 gadi atpakaļ
vecāks
revīzija
19560bb704

+ 2 - 1
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/ContainerData.java

@@ -285,7 +285,8 @@ public class ContainerData {
    *
    * @return String Name.
    */
-    // TODO: check the ContainerCache class to see if we are using the ContainerID instead.
+    // TODO: check the ContainerCache class to see if
+  // we are using the ContainerID instead.
    /*
    public String getName() {
     return getContainerID();

+ 5 - 3
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerManagerImpl.java

@@ -314,7 +314,8 @@ public class ContainerManagerImpl implements ContainerManager {
     writeLock();
     try {
       if (containerMap.containsKey(containerData.getContainerID())) {
-        LOG.debug("container already exists. {}", containerData.getContainerID());
+        LOG.debug("container already exists. {}",
+            containerData.getContainerID());
         throw new StorageContainerException("container already exists.",
             CONTAINER_EXISTS);
       }
@@ -595,7 +596,8 @@ public class ContainerManagerImpl implements ContainerManager {
   @Override
   public void updateContainer(long containerID, ContainerData data,
       boolean forceUpdate) throws StorageContainerException {
-    Preconditions.checkState(containerID >= 0, "Container ID cannot be negative.");
+    Preconditions.checkState(containerID >= 0,
+        "Container ID cannot be negative.");
     Preconditions.checkNotNull(data, "Container data cannot be null");
     FileOutputStream containerStream = null;
     DigestOutputStream dos = null;
@@ -711,7 +713,7 @@ public class ContainerManagerImpl implements ContainerManager {
   }
 
   /**
-   * Returns LifeCycle State of the container
+   * Returns LifeCycle State of the container.
    * @param containerID - Id of the container
    * @return LifeCycle State of the container
    * @throws StorageContainerException

+ 8 - 4
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/KeyManagerImpl.java

@@ -72,8 +72,10 @@ public class KeyManagerImpl implements KeyManager {
    */
   @Override
   public void putKey(KeyData data) throws IOException {
-    Preconditions.checkNotNull(data, "KeyData cannot be null for put operation.");
-    Preconditions.checkState(data.getContainerID() >= 0, "Container ID cannot be negative");
+    Preconditions.checkNotNull(data,
+        "KeyData cannot be null for put operation.");
+    Preconditions.checkState(data.getContainerID() >= 0,
+        "Container ID cannot be negative");
     containerManager.readLock();
     try {
       // We are not locking the key manager since LevelDb serializes all actions
@@ -169,8 +171,10 @@ public class KeyManagerImpl implements KeyManager {
   public List<KeyData> listKey(
       long containerID, long startLocalID, int count)
       throws IOException {
-    Preconditions.checkState(containerID >= 0, "Container ID cannot be negative");
-    Preconditions.checkState(startLocalID >= 0, "startLocal ID cannot be negative");
+    Preconditions.checkState(containerID >= 0,
+        "Container ID cannot be negative");
+    Preconditions.checkState(startLocalID >= 0,
+        "startLocal ID cannot be negative");
     Preconditions.checkArgument(count > 0,
         "Count must be a positive number.");
     ContainerData cData = containerManager.readContainer(containerID);

+ 2 - 1
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java

@@ -265,7 +265,8 @@ public class ContainerStateMachine extends BaseStateMachine {
         Message message = runCommand(requestProto);
         if (cmdType == ContainerProtos.Type.CreateContainer) {
           long containerID =
-              requestProto.getCreateContainer().getContainerData().getContainerID();
+              requestProto.getCreateContainer()
+                  .getContainerData().getContainerID();
           createContainerFutureMap.remove(containerID).complete(message);
         }
         return CompletableFuture.completedFuture(message);

+ 4 - 2
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/ContainerCache.java

@@ -125,7 +125,8 @@ public final class ContainerCache extends LRUMap {
    */
   public MetadataStore getDB(long containerID, String containerDBPath)
       throws IOException {
-    Preconditions.checkState(containerID >= 0, "Container ID cannot be negative.");
+    Preconditions.checkState(containerID >= 0,
+        "Container ID cannot be negative.");
     lock.lock();
     try {
       MetadataStore db = (MetadataStore) this.get(containerID);
@@ -153,7 +154,8 @@ public final class ContainerCache extends LRUMap {
    * @param containerID - ID of the container.
    */
   public void removeDB(long containerID) {
-    Preconditions.checkState(containerID >= 0, "Container ID cannot be negative.");
+    Preconditions.checkState(containerID >= 0,
+        "Container ID cannot be negative.");
     lock.lock();
     try {
       MetadataStore db = (MetadataStore)this.get(containerID);

+ 22 - 0
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/package-info.java

@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+/**
+ * SCM Testing and Mocking Utils.
+ */
+package org.apache.hadoop.ozone.container.common;