@Override public FileSystemKind getKind() { return originalFs.getKind(); }
@Override public FileSystemKind getKind() { return unsafeFileSystem.getKind(); }
@Test public void testS3nKind() throws IOException { try { Class.forName("org.apache.hadoop.fs.s3native.NativeS3FileSystem"); } catch (ClassNotFoundException ignored) { // not in the classpath, cannot run this test log.info("Skipping test 'testS3nKind()' because the Native S3 file system is not in the class path"); return; } final FileSystem s3n = new Path("s3n://myId:mySecret@bucket/some/bucket/some/object").getFileSystem(); assertEquals(FileSystemKind.OBJECT_STORE, s3n.getKind()); }
@Test public void testS3Kind() throws IOException { try { Class.forName("org.apache.hadoop.fs.s3.S3FileSystem"); } catch (ClassNotFoundException ignored) { // not in the classpath, cannot run this test log.info("Skipping test 'testS3Kind()' because the S3 file system is not in the class path"); return; } final FileSystem s3 = new Path("s3://myId:mySecret@bucket/some/bucket/some/object").getFileSystem(); assertEquals(FileSystemKind.OBJECT_STORE, s3.getKind()); }
@Test public void testS3aKind() throws IOException { try { Class.forName("org.apache.hadoop.fs.s3a.S3AFileSystem"); } catch (ClassNotFoundException ignored) { // not in the classpath, cannot run this test log.info("Skipping test 'testS3aKind()' because the S3AFileSystem is not in the class path"); return; } final FileSystem s3a = new Path("s3a://myId:mySecret@bucket/some/bucket/some/object").getFileSystem(); assertEquals(FileSystemKind.OBJECT_STORE, s3a.getKind()); }
@Test public void testKind() { final FileSystem fs = FileSystem.getLocalFileSystem(); assertEquals(FileSystemKind.FILE_SYSTEM, fs.getKind()); }
@Test public void testFileSystemKind() { assertEquals(getFileSystemKind(), fs.getKind()); }
@Test public void testHdfsKind() throws IOException { final FileSystem fs = new Path("hdfs://localhost:55445/my/file").getFileSystem(); assertEquals(FileSystemKind.FILE_SYSTEM, fs.getKind()); }
@Override public FileSystemKind getKind() { return unsafeFileSystem.getKind(); }
@Override public FileSystemKind getKind() { return unsafeFileSystem.getKind(); }
@Override public FileSystemKind getKind() { return originalFs.getKind(); }
@Override public FileSystemKind getKind() { return originalFs.getKind(); }
/** * Discard the state by deleting the file that stores the state. If the parent directory * of the state is empty after deleting the state file, it is also deleted. * * @throws Exception Thrown, if the file deletion (not the directory deletion) fails. */ @Override public void discardState() throws Exception { FileSystem fs = getFileSystem(); fs.delete(filePath, false); if (fs.getKind() == FileSystemKind.FILE_SYSTEM) { try { FileUtils.deletePathIfEmpty(fs, filePath.getParent()); } catch (Exception ignored) {} } }