@Override public URI getUri() { return originalFs.getUri(); }
@Override public URI getUri() { return unsafeFileSystem.getUri(); }
/** * Creates a <code>LocalFileStatus</code> object from a given {@link File} object. * * @param f * the {@link File} object this <code>LocalFileStatus</code> refers to * @param fs * the file system the corresponding file has been read from */ public LocalFileStatus(final File f, final FileSystem fs) { this.file = f; this.path = new Path(fs.getUri().getScheme() + ":" + f.toURI().getPath()); }
/** * Returns a qualified path object. * * @param fs * the FileSystem that should be used to obtain the current working directory * @return the qualified path object */ public Path makeQualified(FileSystem fs) { Path path = this; if (!isAbsolute()) { path = new Path(fs.getWorkingDirectory(), this); } final URI pathUri = path.toUri(); final URI fsUri = fs.getUri(); String scheme = pathUri.getScheme(); String authority = pathUri.getAuthority(); if (scheme != null && (authority != null || fsUri.getAuthority() == null)) { return path; } if (scheme == null) { scheme = fsUri.getScheme(); } if (authority == null) { authority = fsUri.getAuthority(); if (authority == null) { authority = ""; } } return new Path(scheme + ":" + "//" + authority + pathUri.getPath()); }
@Test public void testCreateHadoopFsWithoutConfig() throws Exception { final URI uri = URI.create("hdfs://localhost:12345/"); HadoopFsFactory factory = new HadoopFsFactory(); FileSystem fs = factory.create(uri); assertEquals(uri.getScheme(), fs.getUri().getScheme()); assertEquals(uri.getAuthority(), fs.getUri().getAuthority()); assertEquals(uri.getPort(), fs.getUri().getPort()); }
@Test public void testDefaultsToLocal() throws Exception { URI justPath = new URI(tempFolder.newFile().toURI().getPath()); assertNull(justPath.getScheme()); FileSystem fs = FileSystem.get(justPath); assertEquals("file", fs.getUri().getScheme()); }
@Test public void testExplicitlySetToLocal() throws Exception { final Configuration conf = new Configuration(); conf.setString(CoreOptions.DEFAULT_FILESYSTEM_SCHEME, LocalFileSystem.getLocalFsURI().toString()); FileSystem.initialize(conf); URI justPath = new URI(tempFolder.newFile().toURI().getPath()); assertNull(justPath.getScheme()); FileSystem fs = FileSystem.get(justPath); assertEquals("file", fs.getUri().getScheme()); }
@Test public void testExplicitlyPathTakesPrecedence() throws Exception { final Configuration conf = new Configuration(); conf.setString(CoreOptions.DEFAULT_FILESYSTEM_SCHEME, "otherFS://localhost:1234/"); FileSystem.initialize(conf); URI pathAndScheme = tempFolder.newFile().toURI(); assertNotNull(pathAndScheme.getScheme()); FileSystem fs = FileSystem.get(pathAndScheme); assertEquals("file", fs.getUri().getScheme()); } }
verify(fs).getUri();
@Override public URI getUri() { return unsafeFileSystem.getUri(); }
@Override public URI getUri() { return unsafeFileSystem.getUri(); }
@Override public URI getUri() { return originalFs.getUri(); }
@Override public URI getUri() { return originalFs.getUri(); }
/** * Creates a <code>LocalFileStatus</code> object from a given {@link File} object. * * @param f * the {@link File} object this <code>LocalFileStatus</code> refers to * @param fs * the file system the corresponding file has been read from */ public LocalFileStatus(final File f, final FileSystem fs) { this.file = f; this.path = new Path(fs.getUri().getScheme() + ":" + f.toURI().getPath()); }
/** * Creates a <code>LocalFileStatus</code> object from a given {@link File} object. * * @param f * the {@link File} object this <code>LocalFileStatus</code> refers to * @param fs * the file system the corresponding file has been read from */ public LocalFileStatus(final File f, final FileSystem fs) { this.file = f; this.path = new Path(fs.getUri().getScheme() + ":" + f.toURI().getPath()); }
/** * Returns a qualified path object. * * @param fs * the FileSystem that should be used to obtain the current working directory * @return the qualified path object */ public Path makeQualified(FileSystem fs) { Path path = this; if (!isAbsolute()) { path = new Path(fs.getWorkingDirectory(), this); } final URI pathUri = path.toUri(); final URI fsUri = fs.getUri(); String scheme = pathUri.getScheme(); String authority = pathUri.getAuthority(); if (scheme != null && (authority != null || fsUri.getAuthority() == null)) { return path; } if (scheme == null) { scheme = fsUri.getScheme(); } if (authority == null) { authority = fsUri.getAuthority(); if (authority == null) { authority = ""; } } return new Path(scheme + ":" + "//" + authority + pathUri.getPath()); }
/** * Returns a qualified path object. * * @param fs * the FileSystem that should be used to obtain the current working directory * @return the qualified path object */ public Path makeQualified(FileSystem fs) { Path path = this; if (!isAbsolute()) { path = new Path(fs.getWorkingDirectory(), this); } final URI pathUri = path.toUri(); final URI fsUri = fs.getUri(); String scheme = pathUri.getScheme(); String authority = pathUri.getAuthority(); if (scheme != null && (authority != null || fsUri.getAuthority() == null)) { return path; } if (scheme == null) { scheme = fsUri.getScheme(); } if (authority == null) { authority = fsUri.getAuthority(); if (authority == null) { authority = ""; } } return new Path(scheme + ":" + "//" + authority + pathUri.getPath()); }
"file/directory '" + checkpointPointer + "' on file system '" + fs.getUri().getScheme() + "'.");