Browse Source

Update HadoopUtilsTest.java

pull/2/head
dailidong 5 years ago committed by GitHub
parent
commit
51bf150b94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/HadoopUtilsTest.java

22
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/HadoopUtilsTest.java

@ -72,7 +72,7 @@ public class HadoopUtilsTest {
try { try {
result = hadoopUtils.mkdir("/dolphinscheduler/hdfs"); result = hadoopUtils.mkdir("/dolphinscheduler/hdfs");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); logger.error(e.getMessage(), e);
} }
Assert.assertEquals(true, result); Assert.assertEquals(true, result);
} }
@ -83,7 +83,7 @@ public class HadoopUtilsTest {
try { try {
result = hadoopUtils.delete("/dolphinscheduler/hdfs",true); result = hadoopUtils.delete("/dolphinscheduler/hdfs",true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); logger.error(e.getMessage(), e);
} }
Assert.assertEquals(true, result); Assert.assertEquals(true, result);
} }
@ -94,7 +94,7 @@ public class HadoopUtilsTest {
try { try {
result = hadoopUtils.exists("/dolphinscheduler/hdfs"); result = hadoopUtils.exists("/dolphinscheduler/hdfs");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); logger.error(e.getMessage(), e);
} }
Assert.assertEquals(true, result); Assert.assertEquals(true, result);
} }
@ -108,7 +108,7 @@ public class HadoopUtilsTest {
@Test @Test
public void getHdfsResDir() { public void getHdfsResDir() {
String result = hadoopUtils.getHdfsResDir("11000"); String result = hadoopUtils.getHdfsResDir("11000");
Assert.assertEquals("/dolphinscheduler/resources/11000", result); Assert.assertEquals("/dolphinscheduler/11000/resources", result);
} }
@Test @Test
@ -126,7 +126,7 @@ public class HadoopUtilsTest {
@Test @Test
public void getHdfsFileName() { public void getHdfsFileName() {
String result = hadoopUtils.getHdfsFileName(ResourceType.FILE,"11000","aa.txt"); String result = hadoopUtils.getHdfsFileName(ResourceType.FILE,"11000","aa.txt");
Assert.assertEquals("/dolphinscheduler/resources/11000/aa.txt", result); Assert.assertEquals("/dolphinscheduler/11000/resources/aa.txt", result);
} }
@Test @Test
@ -139,8 +139,8 @@ public class HadoopUtilsTest {
public void test() { public void test() {
try { try {
hadoopUtils.copyLocalToHdfs("/root/teamviewer_13.1.8286.x86_64.rpm", "/journey", true, true); hadoopUtils.copyLocalToHdfs("/root/teamviewer_13.1.8286.x86_64.rpm", "/journey", true, true);
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.error(e.getMessage(), e);
} }
} }
@ -181,8 +181,8 @@ public class HadoopUtilsTest {
List<String> stringList = null; List<String> stringList = null;
try { try {
stringList = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/WCSparkPython.py", 0, 1000); stringList = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/WCSparkPython.py", 0, 1000);
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.error(e.getMessage(), e);
} }
logger.info(String.join(",",stringList)); logger.info(String.join(",",stringList));
} }
@ -192,8 +192,8 @@ public class HadoopUtilsTest {
byte[] content = new byte[0]; byte[] content = new byte[0];
try { try {
content = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/WCSparkPython.py"); content = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/WCSparkPython.py");
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); logger.error(e.getMessage(), e);
} }
logger.info(Arrays.toString(content)); logger.info(Arrays.toString(content));
} }

Loading…
Cancel
Save