|
@@ -39,6 +39,34 @@ import org.junit.Test;
|
|
*/
|
|
*/
|
|
public class TestJobResourceUploader {
|
|
public class TestJobResourceUploader {
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void testStringToPath() throws IOException {
|
|
|
|
+ Configuration conf = new Configuration();
|
|
|
|
+ JobResourceUploader uploader =
|
|
|
|
+ new JobResourceUploader(FileSystem.getLocal(conf), false);
|
|
|
|
+
|
|
|
|
+ Assert.assertEquals("Failed: absolute, no scheme, with fragment",
|
|
|
|
+ "/testWithFragment.txt",
|
|
|
|
+ uploader.stringToPath("/testWithFragment.txt#fragment.txt").toString());
|
|
|
|
+
|
|
|
|
+ Assert.assertEquals("Failed: absolute, with scheme, with fragment",
|
|
|
|
+ "file:/testWithFragment.txt",
|
|
|
|
+ uploader.stringToPath("file:///testWithFragment.txt#fragment.txt")
|
|
|
|
+ .toString());
|
|
|
|
+
|
|
|
|
+ Assert.assertEquals("Failed: relative, no scheme, with fragment",
|
|
|
|
+ "testWithFragment.txt",
|
|
|
|
+ uploader.stringToPath("testWithFragment.txt#fragment.txt").toString());
|
|
|
|
+
|
|
|
|
+ Assert.assertEquals("Failed: relative, no scheme, no fragment",
|
|
|
|
+ "testWithFragment.txt",
|
|
|
|
+ uploader.stringToPath("testWithFragment.txt").toString());
|
|
|
|
+
|
|
|
|
+ Assert.assertEquals("Failed: absolute, with scheme, no fragment",
|
|
|
|
+ "file:/testWithFragment.txt",
|
|
|
|
+ uploader.stringToPath("file:///testWithFragment.txt").toString());
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void testAllDefaults() throws IOException {
|
|
public void testAllDefaults() throws IOException {
|
|
ResourceLimitsConf.Builder b = new ResourceLimitsConf.Builder();
|
|
ResourceLimitsConf.Builder b = new ResourceLimitsConf.Builder();
|
|
@@ -210,17 +238,17 @@ public class TestJobResourceUploader {
|
|
rlConf.maxSingleResourceMB);
|
|
rlConf.maxSingleResourceMB);
|
|
|
|
|
|
conf.set("tmpfiles",
|
|
conf.set("tmpfiles",
|
|
- buildPathString("file://tmpFiles", rlConf.numOfTmpFiles));
|
|
|
|
|
|
+ buildPathString("file:///tmpFiles", rlConf.numOfTmpFiles));
|
|
conf.set("tmpjars",
|
|
conf.set("tmpjars",
|
|
- buildPathString("file://tmpjars", rlConf.numOfTmpLibJars));
|
|
|
|
|
|
+ buildPathString("file:///tmpjars", rlConf.numOfTmpLibJars));
|
|
conf.set("tmparchives",
|
|
conf.set("tmparchives",
|
|
- buildPathString("file://tmpArchives", rlConf.numOfTmpArchives));
|
|
|
|
|
|
+ buildPathString("file:///tmpArchives", rlConf.numOfTmpArchives));
|
|
conf.set(MRJobConfig.CACHE_ARCHIVES,
|
|
conf.set(MRJobConfig.CACHE_ARCHIVES,
|
|
- buildPathString("file://cacheArchives", rlConf.numOfDCArchives));
|
|
|
|
|
|
+ buildPathString("file:///cacheArchives", rlConf.numOfDCArchives));
|
|
conf.set(MRJobConfig.CACHE_FILES,
|
|
conf.set(MRJobConfig.CACHE_FILES,
|
|
- buildPathString("file://cacheFiles", rlConf.numOfDCFiles));
|
|
|
|
|
|
+ buildPathString("file:///cacheFiles", rlConf.numOfDCFiles));
|
|
if (rlConf.jobJar) {
|
|
if (rlConf.jobJar) {
|
|
- conf.setJar("file://jobjar.jar");
|
|
|
|
|
|
+ conf.setJar("file:///jobjar.jar");
|
|
}
|
|
}
|
|
return conf;
|
|
return conf;
|
|
}
|
|
}
|