|
|
@ -17,6 +17,8 @@ |
|
|
|
package org.apache.dolphinscheduler.common.utils; |
|
|
|
package org.apache.dolphinscheduler.common.utils; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
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.Assert; |
|
|
|
import org.junit.Ignore; |
|
|
|
import org.junit.Ignore; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
@ -45,7 +47,8 @@ public class HadoopUtilsTest { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void getConfiguration(){ |
|
|
|
public void getConfiguration(){ |
|
|
|
logger.info(HadoopUtils.getInstance().getConfiguration().get(Constants.HDFS_ROOT_USER)); |
|
|
|
Configuration conf = HadoopUtils.getInstance().getConfiguration(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -78,6 +81,24 @@ public class HadoopUtilsTest { |
|
|
|
Assert.assertEquals("/dolphinscheduler/resources/11000", result); |
|
|
|
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 |
|
|
|
@Test |
|
|
|
public void isYarnEnabled() throws IOException { |
|
|
|
public void isYarnEnabled() throws IOException { |
|
|
|
boolean result = HadoopUtils.getInstance().isYarnEnabled(); |
|
|
|
boolean result = HadoopUtils.getInstance().isYarnEnabled(); |
|
|
@ -98,10 +119,8 @@ public class HadoopUtilsTest { |
|
|
|
logger.error(e.getMessage(),e); |
|
|
|
logger.error(e.getMessage(),e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@Test |
|
|
|
|
|
|
|
public void testCapacity(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testMove(){ |
|
|
|
public void testMove(){ |
|
|
|
HadoopUtils instance = HadoopUtils.getInstance(); |
|
|
|
HadoopUtils instance = HadoopUtils.getInstance(); |
|
|
@ -111,7 +130,6 @@ public class HadoopUtilsTest { |
|
|
|
logger.error(e.getMessage(), e); |
|
|
|
logger.error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|