diff --git a/common/src/test/java/org/apache/uniffle/common/util/RetryUtilsTest.java b/common/src/test/java/org/apache/uniffle/common/util/RetryUtilsTest.java index d119d273b8..70c59f8746 100644 --- a/common/src/test/java/org/apache/uniffle/common/util/RetryUtilsTest.java +++ b/common/src/test/java/org/apache/uniffle/common/util/RetryUtilsTest.java @@ -17,11 +17,12 @@ package org.apache.uniffle.common.util; +import java.util.concurrent.atomic.AtomicInteger; + import com.google.common.collect.Sets; -import org.apache.uniffle.common.exception.RssException; import org.junit.jupiter.api.Test; -import java.util.concurrent.atomic.AtomicInteger; +import org.apache.uniffle.common.exception.RssException; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -39,6 +40,7 @@ public void testRetry() { callbackTime.incrementAndGet(); }, 10, maxTryTime, Sets.newHashSet(RssException.class)); } catch (Throwable throwable) { + // ignore } assertEquals(tryTimes.get(), maxTryTime); assertEquals(callbackTime.get(), maxTryTime - 1); @@ -50,6 +52,7 @@ public void testRetry() { throw new Exception(""); }, 10, maxTryTime); } catch (Throwable throwable) { + // ignore } assertEquals(tryTimes.get(), maxTryTime); @@ -61,6 +64,7 @@ public void testRetry() { }, 10, maxTryTime); assertEquals(ret, 1); } catch (Throwable throwable) { + // ignore } assertEquals(tryTimes.get(), 1); } diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/AccessCandidatesCheckerTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/AccessCandidatesCheckerTest.java index a27385a593..03c7c1a01f 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/AccessCandidatesCheckerTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/AccessCandidatesCheckerTest.java @@ -51,7 +51,7 @@ public void clear() { @Test public void test(@TempDir File tempDir) throws Exception { File cfgFile = File.createTempFile("tmp", ".conf", tempDir); - String cfgFileName = cfgFile.getAbsolutePath(); + final String cfgFileName = cfgFile.getAbsolutePath(); final String filePath = Objects.requireNonNull( getClass().getClassLoader().getResource("coordinator.conf")).getFile(); CoordinatorConf conf = new CoordinatorConf(filePath); diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/AccessManagerTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/AccessManagerTest.java index 145e6945b4..bc12ffe3a4 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/AccessManagerTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/AccessManagerTest.java @@ -104,7 +104,9 @@ public MockAccessCheckerAlwaysFalse(AccessManager accessManager) throws Exceptio super(accessManager); } - public void close() {} + public void close() { + + } public AccessCheckResult check(AccessInfo accessInfo) { return new AccessCheckResult(false, "MockAccessCheckerAlwaysFalse"); diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/ApplicationManagerTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/ApplicationManagerTest.java index aced225d4a..8cbccbc259 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/ApplicationManagerTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/ApplicationManagerTest.java @@ -22,8 +22,8 @@ import com.google.common.collect.Sets; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.apache.uniffle.common.RemoteStorageInfo; diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/BasicAssignmentStrategyTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/BasicAssignmentStrategyTest.java index a1f79cf7b8..69e0087408 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/BasicAssignmentStrategyTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/BasicAssignmentStrategyTest.java @@ -17,27 +17,28 @@ package org.apache.uniffle.coordinator; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import com.google.common.collect.Sets; -import java.util.Collection; -import java.util.stream.Collectors; -import org.apache.uniffle.common.PartitionRange; - import java.io.IOException; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; +import java.util.stream.Collectors; +import com.google.common.collect.Sets; import org.apache.hadoop.conf.Configuration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.apache.uniffle.common.PartitionRange; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class BasicAssignmentStrategyTest { Set tags = Sets.newHashSet("test"); @@ -112,11 +113,11 @@ public void testRandomAssign() { @Test public void testAssignWithDifferentNodeNum() { - ServerNode sn1 = new ServerNode("sn1", "", 0, 0, 0, + final ServerNode sn1 = new ServerNode("sn1", "", 0, 0, 0, 20, 0, tags, true); - ServerNode sn2 = new ServerNode("sn2", "", 0, 0, 0, + final ServerNode sn2 = new ServerNode("sn2", "", 0, 0, 0, 10, 0, tags, true); - ServerNode sn3 = new ServerNode("sn3", "", 0, 0, 0, + final ServerNode sn3 = new ServerNode("sn3", "", 0, 0, 0, 0, 0, tags, true); clusterManager.add(sn1); diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/ClientConfManagerTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/ClientConfManagerTest.java index 6a42f40ce5..c5bfc0f245 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/ClientConfManagerTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/ClientConfManagerTest.java @@ -31,10 +31,10 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.apache.uniffle.common.RemoteStorageInfo; import org.apache.uniffle.common.util.Constants; -import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -56,7 +56,7 @@ public void clear() { @Test public void test(@TempDir File tempDir) throws Exception { File cfgFile = File.createTempFile("tmp", ".conf", tempDir); - String cfgFileName = cfgFile.getAbsolutePath(); + final String cfgFileName = cfgFile.getAbsolutePath(); final String filePath = Objects.requireNonNull( getClass().getClassLoader().getResource("coordinator.conf")).getFile(); CoordinatorConf conf = new CoordinatorConf(filePath); @@ -139,9 +139,9 @@ public void test(@TempDir File tempDir) throws Exception { @Test public void dynamicRemoteStorageTest() throws Exception { int updateIntervalSec = 2; - String remotePath1 = "hdfs://host1/path1"; - String remotePath2 = "hdfs://host2/path2"; - String remotePath3 = "hdfs://host3/path3"; + final String remotePath1 = "hdfs://host1/path1"; + final String remotePath2 = "hdfs://host2/path2"; + final String remotePath3 = "hdfs://host3/path3"; File cfgFile = Files.createTempFile("dynamicRemoteStorageTest", ".conf").toFile(); cfgFile.deleteOnExit(); writeRemoteStorageConf(cfgFile, remotePath1); @@ -152,7 +152,7 @@ public void dynamicRemoteStorageTest() throws Exception { conf.set(CoordinatorConf.COORDINATOR_DYNAMIC_CLIENT_CONF_ENABLED, true); ApplicationManager applicationManager = new ApplicationManager(conf); - ClientConfManager clientConfManager = new ClientConfManager(conf, new Configuration(), applicationManager); + final ClientConfManager clientConfManager = new ClientConfManager(conf, new Configuration(), applicationManager); Thread.sleep(500); Set expectedAvailablePath = Sets.newHashSet(remotePath1); assertEquals(expectedAvailablePath, applicationManager.getAvailableRemoteStorageInfo().keySet()); diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorConfTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorConfTest.java index bb38e49e16..71c0c9b6be 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorConfTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorConfTest.java @@ -17,11 +17,12 @@ package org.apache.uniffle.coordinator; -import static org.junit.jupiter.api.Assertions.assertEquals; - import java.util.Objects; + import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class CoordinatorConfTest { @Test diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorMetricsTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorMetricsTest.java index 97cc3bdf4f..0e70092b5f 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorMetricsTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorMetricsTest.java @@ -107,7 +107,7 @@ public void testGrpcMetrics() throws Exception { assertEquals(6, actualObj.get("metrics").size()); } - static private void writeRemoteStorageConf(File cfgFile, String value) throws Exception { + private static void writeRemoteStorageConf(File cfgFile, String value) throws Exception { FileWriter fileWriter = new FileWriter(cfgFile); PrintWriter printWriter = new PrintWriter(fileWriter); printWriter.println(CoordinatorConf.COORDINATOR_REMOTE_STORAGE_PATH.key() + " " + value); diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorServerTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorServerTest.java index 581f3ffa00..33c9eb4728 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorServerTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorServerTest.java @@ -17,12 +17,13 @@ package org.apache.uniffle.coordinator; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; import org.apache.uniffle.common.util.ExitUtils; import org.apache.uniffle.common.util.ExitUtils.ExitException; -import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; public class CoordinatorServerTest { diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionBalanceAssignmentStrategyTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionBalanceAssignmentStrategyTest.java index 47cc26f9b1..67d54f6885 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionBalanceAssignmentStrategyTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionBalanceAssignmentStrategyTest.java @@ -23,12 +23,11 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.common.util.concurrent.Uninterruptibles; - -import java.util.stream.Collectors; import org.apache.hadoop.conf.Configuration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -128,7 +127,7 @@ public void testAssign() { valid(expect); list = Lists.newArrayList(); - for (int i = 0; i< 20; i++) { + for (int i = 0; i < 20; i++) { if (i % 2 == 0) { list.add(10L); } else { diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionRangeAssignmentTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionRangeAssignmentTest.java index 715cb040d7..4c23530ca8 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionRangeAssignmentTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionRangeAssignmentTest.java @@ -17,18 +17,20 @@ package org.apache.uniffle.coordinator; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.google.common.collect.Sets; -import org.apache.uniffle.common.PartitionRange; -import org.apache.uniffle.proto.RssProtos; import java.util.Collections; import java.util.List; import java.util.SortedMap; import java.util.TreeMap; + +import com.google.common.collect.Sets; import org.junit.jupiter.api.Test; +import org.apache.uniffle.common.PartitionRange; +import org.apache.uniffle.proto.RssProtos; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class PartitionRangeAssignmentTest { @Test diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionRangeTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionRangeTest.java index 5cdb4a0895..6a465b991f 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionRangeTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/PartitionRangeTest.java @@ -17,11 +17,12 @@ package org.apache.uniffle.coordinator; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; +import org.junit.jupiter.api.Test; import org.apache.uniffle.common.PartitionRange; -import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; public class PartitionRangeTest { diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/ServerNodeTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/ServerNodeTest.java index 713da9f4c0..c70d58f16a 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/ServerNodeTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/ServerNodeTest.java @@ -17,15 +17,16 @@ package org.apache.uniffle.coordinator; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import java.util.Collections; import java.util.List; import java.util.Set; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class ServerNodeTest { @Test diff --git a/coordinator/src/test/java/org/apache/uniffle/coordinator/SimpleClusterManagerTest.java b/coordinator/src/test/java/org/apache/uniffle/coordinator/SimpleClusterManagerTest.java index 06709e2889..5abb4e9d20 100644 --- a/coordinator/src/test/java/org/apache/uniffle/coordinator/SimpleClusterManagerTest.java +++ b/coordinator/src/test/java/org/apache/uniffle/coordinator/SimpleClusterManagerTest.java @@ -27,7 +27,6 @@ import java.util.Set; import com.google.common.collect.Sets; - import org.apache.hadoop.conf.Configuration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; @@ -117,7 +116,7 @@ public void heartbeatTimeoutTest() throws Exception { try { Thread.sleep(800); } catch (Exception e) { - + // ignore } }