static String substitute(String expr) { return expr == null ? null : INSTANCE.substitute(null, expr, 1); }
static String substitute(Configuration conf, String expr) { return expr == null ? null : INSTANCE.substitute(conf, expr, 1); }
this.valClass = String.class; this.valType = VarType.STRING; this.defaultStrVal = SystemVariables.substitute((String)defaultVal); this.defaultIntVal = -1; this.defaultLongVal = -1;
@Test public void test_RelativeJavaIoTmpDir_CoercedTo_AbsolutePath() { FileSystem localFileSystem = new LocalFileSystem(); String systemJavaIoTmpDir = makeVarName(SYSTEM, "java.io.tmpdir"); System.setProperty("java.io.tmpdir", "./relativePath"); Path relativePath = new Path(localFileSystem.getWorkingDirectory(), "./relativePath"); assertEquals(relativePath.toString(), SystemVariables.substitute(systemJavaIoTmpDir)); System.setProperty("java.io.tmpdir", "this/is/a/relative/path"); Path thisIsARelativePath= new Path(localFileSystem.getWorkingDirectory(), "this/is/a/relative/path"); assertEquals(thisIsARelativePath.toString(), SystemVariables.substitute(systemJavaIoTmpDir)); }
@Test public void test_RelativePathWithNoCoercion_NotChanged() { FileSystem localFileSystem = new LocalFileSystem(); String systemJavaIoTmpDir = makeVarName(SYSTEM, "java.io._NOT_tmpdir"); System.setProperty("java.io._NOT_tmpdir", "this/is/an/relative/path"); Path relativePath = new Path("this/is/an/relative/path"); assertEquals(relativePath.toString(), SystemVariables.substitute(systemJavaIoTmpDir)); }
@Test public void test_AbsoluteJavaIoTmpDir_NotChanged() { FileSystem localFileSystem = new LocalFileSystem(); String systemJavaIoTmpDir = makeVarName(SYSTEM, "java.io.tmpdir"); System.setProperty("java.io.tmpdir", "file:/this/is/an/absolute/path"); Path absolutePath = new Path("file:/this/is/an/absolute/path"); assertEquals(absolutePath.toString(), SystemVariables.substitute(systemJavaIoTmpDir)); }
@Test public void test_EmptyJavaIoTmpDir_NotChanged() { FileSystem localFileSystem = new LocalFileSystem(); String systemJavaIoTmpDir = makeVarName(SYSTEM, "java.io.tmpdir"); System.setProperty("java.io.tmpdir", ""); assertEquals("", SystemVariables.substitute(systemJavaIoTmpDir)); } }
static String substitute(String expr) { return expr == null ? null : INSTANCE.substitute(null, expr, 1); }
static String substitute(Configuration conf, String expr) { return expr == null ? null : INSTANCE.substitute(conf, expr, 1); }
static String substitute(String expr) { return expr == null ? null : new SystemVariables().substitute(null, expr, 1); }
static String substitute(Configuration conf, String expr) { return expr == null ? null : new SystemVariables().substitute(conf, expr, 1); }
this.valClass = String.class; this.valType = VarType.STRING; this.defaultStrVal = SystemVariables.substitute((String)defaultVal); this.defaultIntVal = -1; this.defaultLongVal = -1;
this.valClass = String.class; this.valType = VarType.STRING; this.defaultStrVal = SystemVariables.substitute((String)defaultVal); this.defaultIntVal = -1; this.defaultLongVal = -1;