public ProxyLocalFileSystem() { localFs = new LocalFileSystem(); }
public InstrumentedLocalFileSystem() { super(SCHEME, new LocalFileSystem()); }
public FaultyFileSystem() { super(new LocalFileSystem()); System.err.println("Creating faulty!"); }
private static String getFSIdentifier(URI uri) { if (new LocalFileSystem().getScheme().equals(uri.getScheme())) { return "localhost"; } else { return ClustersNames.getInstance().getClusterName(uri.toString()); } }
@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)); }
@BeforeClass public static void beforeClass() throws Exception { UTIL.startMiniCluster(); FQ_OUTPUT_DIR = new Path(OUTPUT_DIR).makeQualified(new LocalFileSystem()); FileUtil.fullyDelete(new File(OUTPUT_DIR)); }
@Test public void testRelativePathToAbsolutePath() throws IOException { LocalFileSystem localFileSystem = new LocalFileSystem(); Path actualPath = FileUtils.makeAbsolute(localFileSystem, new Path("relative/path")); Path expectedPath = new Path(localFileSystem.getWorkingDirectory(), "relative/path"); assertEquals(expectedPath.toString(), actualPath.toString()); Path absolutePath = new Path("/absolute/path"); Path unchangedPath = FileUtils.makeAbsolute(localFileSystem, new Path("/absolute/path")); assertEquals(unchangedPath.toString(), absolutePath.toString()); }
@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_EmptyJavaIoTmpDir_NotChanged() { FileSystem localFileSystem = new LocalFileSystem(); String systemJavaIoTmpDir = makeVarName(SYSTEM, "java.io.tmpdir"); System.setProperty("java.io.tmpdir", ""); assertEquals("", SystemVariables.substitute(systemJavaIoTmpDir)); } }
@BeforeClass public static void setUpOneTime() throws Exception { fs = new LocalFileSystem(); fs.initialize(fs.getWorkingDirectory().toUri(), new Configuration()); HiveConf hiveConf = new HiveConf(); hiveConf.setInt(HCatConstants.HCAT_HIVE_CLIENT_EXPIRY_TIME, 0); // Hack to initialize cache with 0 expiry time causing it to return a new hive client every time // Otherwise the cache doesn't play well with the second test method with the client gets closed() in the // tearDown() of the previous test HCatUtil.getHiveMetastoreClient(hiveConf); MapCreate.writeCount = 0; MapRead.readCount = 0; }
final TableName sourceTable = TableName.valueOf(name.getMethodName()); String outputPath = OUTPUT_DIR + sourceTable; LocalFileSystem localFileSystem = new LocalFileSystem(); Path outputDir = new Path(outputPath).makeQualified(localFileSystem.getUri(),
private static String getFSIdentifier(URI uri) { if (new LocalFileSystem().getScheme().equals(uri.getScheme())) { return "localhost"; } else { return ClustersNames.getInstance().getClusterName(uri.toString()); } }
@BeforeClass public static void beforeClass() throws Exception { UTIL.startMiniCluster(); FQ_OUTPUT_DIR = new Path(OUTPUT_DIR).makeQualified(new LocalFileSystem()); FileUtil.fullyDelete(new File(OUTPUT_DIR)); }
@Test public void testLocalEmbedInit() throws Exception { FileSystem mockFs = createMockFs(false); // no conf = need init checkInit(new LocalFileSystem(mockFs), true); }
@Test public void testLocalEmbedInit() throws Exception { FileSystem mockFs = createMockFs(false); // no conf = need init checkInit(new LocalFileSystem(mockFs), true); }
@Test public void testInitLocalFsSetsConfs() throws Exception { LocalFileSystem lfs = new LocalFileSystem(); checkFsConf(lfs, null, 2); lfs.initialize(lfs.getUri(), conf); checkFsConf(lfs, conf, 2); }
@Test public void testInitLocalFsSetsConfs() throws Exception { LocalFileSystem lfs = new LocalFileSystem(); checkFsConf(lfs, null, 2); lfs.initialize(lfs.getUri(), conf); checkFsConf(lfs, conf, 2); }
@Test public void testInitFilterFsSetsEmbedConf() throws Exception { LocalFileSystem lfs = new LocalFileSystem(); checkFsConf(lfs, null, 2); FilterFileSystem ffs = new FilterFileSystem(lfs); assertEquals(lfs, ffs.getRawFileSystem()); checkFsConf(ffs, null, 3); ffs.initialize(URI.create("filter:/"), conf); checkFsConf(ffs, conf, 3); }
@Test public void testInitFilterFsSetsEmbedConf() throws Exception { LocalFileSystem lfs = new LocalFileSystem(); checkFsConf(lfs, null, 2); FilterFileSystem ffs = new FilterFileSystem(lfs); assertEquals(lfs, ffs.getRawFileSystem()); checkFsConf(ffs, null, 3); ffs.initialize(URI.create("filter:/"), conf); checkFsConf(ffs, conf, 3); }