From 8195f2d5de4139f3b7dabdc787082a151f5854ff Mon Sep 17 00:00:00 2001 From: Jian Zhang Date: Sat, 4 Jan 2025 12:38:26 +0800 Subject: [PATCH] fix check & javadoc --- .../server/federation/router/TestRouterRpc.java | 4 ---- .../router/async/TestRouterAsyncRpc.java | 7 ++----- .../TestRouterAsyncRpcMultiDestination.java | 17 ++--------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpc.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpc.java index a7effcce2f9fe..39b132ce31539 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpc.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpc.java @@ -354,10 +354,6 @@ protected void setRouter(RouterContext r) router.getFileSystem().getUri(), NamenodeProtocol.class).getProxy(); } - protected static void setCluster(MiniRouterDFSCluster cluster) { - TestRouterRpc.cluster = cluster; - } - protected FileSystem getRouterFileSystem() { return this.routerFS; } diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpc.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpc.java index 8ae7b4de0118a..09fe7c9db9378 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpc.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpc.java @@ -50,18 +50,15 @@ public static void globalSetUp() throws Exception { // We decrease the DN cache times to make the test faster routerConf.setTimeDuration( RBFConfigKeys.DN_REPORT_CACHE_EXPIRE, 1, TimeUnit.SECONDS); + // use async router. routerConf.setBoolean(DFS_ROUTER_RPC_ENABLE_ASYNC, true); setUp(routerConf); - setCluster(cluster); - } - - public static void tearDown() { - cluster.shutdown(); } @Before public void testSetup() throws Exception { super.testSetup(); + cluster = super.getCluster(); // Random router for this test rndRouter = cluster.getRandomRouter(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpcMultiDestination.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpcMultiDestination.java index 39b16f55364f3..0ded95aa06b66 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpcMultiDestination.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRpcMultiDestination.java @@ -23,7 +23,6 @@ import org.apache.hadoop.hdfs.server.federation.router.RBFConfigKeys; import org.apache.hadoop.hdfs.server.federation.router.TestRouterRpcMultiDestination; import org.apache.hadoop.security.UserGroupInformation; -import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -37,8 +36,6 @@ * Testing the asynchronous RPC functionality of the router with multiple mounts. */ public class TestRouterAsyncRpcMultiDestination extends TestRouterRpcMultiDestination { - private static MiniRouterDFSCluster cluster; - private MiniRouterDFSCluster.RouterContext rndRouter; @BeforeClass public static void globalSetUp() throws Exception { @@ -50,25 +47,15 @@ public static void globalSetUp() throws Exception { // We decrease the DN cache times to make the test faster routerConf.setTimeDuration( RBFConfigKeys.DN_REPORT_CACHE_EXPIRE, 1, TimeUnit.SECONDS); + // use async router. routerConf.setBoolean(DFS_ROUTER_RPC_ENABLE_ASYNC, true); setUp(routerConf); - setCluster(cluster); - } - - public static void tearDown() { - cluster.shutdown(); - } - - @Before - public void testSetup() throws Exception { - super.testSetup(); - // Random router for this test - rndRouter = cluster.getRandomRouter(); } @Test @Override public void testgetGroupsForUser() throws Exception { + MiniRouterDFSCluster.RouterContext rndRouter = super.getRouterContext(); String[] group = new String[] {"bar", "group2"}; UserGroupInformation.createUserForTesting("user", new String[] {"bar", "group2"});