From a563c82c6d8d5247f8cc6cc9184f37118c7a4371 Mon Sep 17 00:00:00 2001 From: dailidong Date: Fri, 17 Apr 2020 23:28:19 +0800 Subject: [PATCH] Update HadoopUtilsTest.java --- .../common/utils/HadoopUtilsTest.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/HadoopUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/HadoopUtilsTest.java index 2b973895b9..ba323c4032 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/HadoopUtilsTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/HadoopUtilsTest.java @@ -17,6 +17,8 @@ package org.apache.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.Constants; +import org.apache.dolphinscheduler.common.enums.ResourceType; +import org.apache.hadoop.conf.Configuration; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -45,7 +47,8 @@ public class HadoopUtilsTest { @Test public void getConfiguration(){ - logger.info(HadoopUtils.getInstance().getConfiguration().get(Constants.HDFS_ROOT_USER)); + Configuration conf = HadoopUtils.getInstance().getConfiguration(); + } @Test @@ -78,6 +81,24 @@ public class HadoopUtilsTest { Assert.assertEquals("/dolphinscheduler/resources/11000", result); } + @Test + public void getHdfsUserDir() throws IOException { + String result = HadoopUtils.getInstance().getHdfsUserDir("11000",1000); + Assert.assertEquals("/dolphinscheduler/11000/home/1000", result); + } + + @Test + public void getHdfsUdfDir() throws IOException { + String result = HadoopUtils.getInstance().getHdfsUdfDir("11000"); + Assert.assertEquals("/dolphinscheduler/11000/udfs", result); + } + + @Test + public void getHdfsFileName() throws IOException { + String result = HadoopUtils.getInstance().getHdfsFileName(ResourceType.FILE,"11000","aa.txt"); + Assert.assertEquals("/dolphinscheduler/resources/11000/aa.txt", result); + } + @Test public void isYarnEnabled() throws IOException { boolean result = HadoopUtils.getInstance().isYarnEnabled(); @@ -98,10 +119,8 @@ public class HadoopUtilsTest { logger.error(e.getMessage(),e); } } - @Test - public void testCapacity(){ - } + @Test public void testMove(){ HadoopUtils instance = HadoopUtils.getInstance(); @@ -111,7 +130,6 @@ public class HadoopUtilsTest { logger.error(e.getMessage(), e); } - } @Test