Browse Source

Update HadoopUtilsTest.java

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

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

@ -16,18 +16,16 @@
*/ */
package org.apache.dolphinscheduler.common.utils; package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.dolphinscheduler.common.enums.ResourceType;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.IOException; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -53,7 +51,7 @@ public class HadoopUtilsTest {
boolean result = false; boolean result = false;
try { try {
result = hadoopUtils.rename("/dolphinscheduler/hdfs1","/dolphinscheduler/hdfs2"); result = hadoopUtils.rename("/dolphinscheduler/hdfs1","/dolphinscheduler/hdfs2");
} catch (IOException e) { } catch (Exception e) {
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
} }
Assert.assertEquals(true, result); Assert.assertEquals(true, result);
@ -71,7 +69,7 @@ public class HadoopUtilsTest {
boolean result = false; boolean result = false;
try { try {
result = hadoopUtils.mkdir("/dolphinscheduler/hdfs"); result = hadoopUtils.mkdir("/dolphinscheduler/hdfs");
} catch (IOException e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
Assert.assertEquals(true, result); Assert.assertEquals(true, result);
@ -82,7 +80,7 @@ public class HadoopUtilsTest {
boolean result = false; boolean result = false;
try { try {
result = hadoopUtils.delete("/dolphinscheduler/hdfs",true); result = hadoopUtils.delete("/dolphinscheduler/hdfs",true);
} catch (IOException e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
Assert.assertEquals(true, result); Assert.assertEquals(true, result);
@ -93,7 +91,7 @@ public class HadoopUtilsTest {
boolean result = false; boolean result = false;
try { try {
result = hadoopUtils.exists("/dolphinscheduler/hdfs"); result = hadoopUtils.exists("/dolphinscheduler/hdfs");
} catch (IOException e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
Assert.assertEquals(true, result); Assert.assertEquals(true, result);
@ -167,7 +165,11 @@ public class HadoopUtilsTest {
@Test @Test
public void getApplicationStatus() { public void getApplicationStatus() {
try {
logger.info(hadoopUtils.getApplicationStatus("application_1542010131334_0029").toString()); logger.info(hadoopUtils.getApplicationStatus("application_1542010131334_0029").toString());
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} }
@Test @Test
@ -178,13 +180,13 @@ public class HadoopUtilsTest {
@Test @Test
public void catFileWithLimitTest() { public void catFileWithLimitTest() {
List<String> stringList = null; List<String> stringList = new ArrayList<>();
try { try {
stringList = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/WCSparkPython.py", 0, 1000); stringList = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/WCSparkPython.py", 0, 1000);
logger.info(String.join(",",stringList));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
logger.info(String.join(",",stringList));
} }
@Test @Test

Loading…
Cancel
Save