protected static FsShell newShellInstance() { return new FsShell(); }
/** * Copy the permissions, group, and ACLs from a source {@link HadoopFileStatus} to a target {@link Path}. This method * will only log a warning if permissions cannot be set, no exception will be thrown. * * @param conf the {@link Configuration} used when setting permissions and ACLs * @param sourceStatus the source {@link HadoopFileStatus} to copy permissions and ACLs from * @param targetGroup the group of the target {@link Path}, if this is set and it is equal to the source group, an * extra set group operation is avoided * @param fs the {@link FileSystem} that contains the target {@link Path} * @param target the {@link Path} to copy permissions, group, and ACLs to * @param recursion recursively set permissions and ACLs on the target {@link Path} */ public static void setFullFileStatus(Configuration conf, HdfsUtils.HadoopFileStatus sourceStatus, String targetGroup, FileSystem fs, Path target, boolean recursion) { setFullFileStatus(conf, sourceStatus, targetGroup, fs, target, recursion, recursion ? new FsShell() : null); }
/** * Copy the permissions, group, and ACLs from a source {@link HadoopFileStatus} to a target {@link Path}. This method * will only log a warning if permissions cannot be set, no exception will be thrown. * * @param conf the {@link Configuration} used when setting permissions and ACLs * @param sourceStatus the source {@link HadoopFileStatus} to copy permissions and ACLs from * @param targetGroup the group of the target {@link Path}, if this is set and it is equal to the source group, an * extra set group operation is avoided * @param fs the {@link FileSystem} that contains the target {@link Path} * @param target the {@link Path} to copy permissions, group, and ACLs to * @param recursion recursively set permissions and ACLs on the target {@link Path} */ public static void setFullFileStatus(Configuration conf, HdfsUtils.HadoopFileStatus sourceStatus, String targetGroup, FileSystem fs, Path target, boolean recursion) { setFullFileStatus(conf, sourceStatus, targetGroup, fs, target, recursion, recursion ? new FsShell() : null); }
public DfsProcessor(Configuration conf, boolean addSchema) { dfs = new FsShell(conf); dfsSchema = new Schema(); dfsSchema.addToFieldSchemas(new FieldSchema(DFS_RESULT_HEADER, "string", "")); }
public DfsProcessor(Configuration conf, boolean addSchema) { dfs = new FsShell(conf); dfsSchema = new Schema(); dfsSchema.addToFieldSchemas(new FieldSchema(DFS_RESULT_HEADER, "string", "")); }
FsShell shell = new FsShell(conf);
FsShell shell = new FsShell(conf);
srcFs.initialize(sourceDir.toUri(), conf); FsShell fss = new FsShell(conf); int ret = 0; try {
srcFs.initialize(sourceDir.toUri(), conf); FsShell fss = new FsShell(conf); int ret = 0; try {
public DfsProcessor(Configuration conf, boolean addSchema) { dfs = new FsShell(conf); dfsSchema = new Schema(); dfsSchema.addToFieldSchemas(new FieldSchema(DFS_RESULT_HEADER, "string", "")); }
public static void FsShellRun(String cmd, int retcode, String contain, Configuration conf) throws Exception { FsShell shell = new FsShell(new Configuration(conf)); toolRun(shell, cmd, retcode, contain); }
@Override public CommandExecutor getExecutor(String tag) throws IllegalArgumentException { if (getType() instanceof CLICommandFS) return new FSCmdExecutor(tag, new FsShell()); throw new IllegalArgumentException("Unknown type of test command: " + getType()); }
@Override public CommandExecutor getExecutor(String tag) throws IllegalArgumentException { if (getType() instanceof CLICommandFS) return new FSCmdExecutor(tag, new FsShell()); throw new IllegalArgumentException("Unknown type of test command: " + getType()); }
@BeforeClass public static void setup() throws Exception { conf = new Configuration(); shell = new FsShell(conf); lfs = FileSystem.getLocal(conf); testRootDir = lfs.makeQualified(new Path( System.getProperty("test.build.data","test/build/data"), "testShellCopy")); lfs.mkdirs(testRootDir); srcPath = new Path(testRootDir, "srcFile"); dstPath = new Path(testRootDir, "dstFile"); }
@BeforeClass public static void setup() throws Exception { conf = new Configuration(); shell = new FsShell(conf); lfs = FileSystem.getLocal(conf); testRootDir = lfs.makeQualified(new Path( System.getProperty("test.build.data","test/build/data"), "testShellCopy")); lfs.mkdirs(testRootDir); srcPath = new Path(testRootDir, "srcFile"); dstPath = new Path(testRootDir, "dstFile"); }
@BeforeClass public static void setup() throws IOException { conf.setClass("fs.file.impl", LocalFileSystemExtn.class, LocalFileSystem.class); fileSys = FileSystem.get(conf); fsShell = new FsShell(conf); }
@BeforeClass public static void setup() throws IOException { conf.setClass("fs.file.impl", LocalFileSystemExtn.class, LocalFileSystem.class); fileSys = FileSystem.get(conf); fsShell = new FsShell(conf); }
@Test public void testLsNoRpcForGetAclStatus() throws Exception { Configuration conf = new Configuration(); conf.set(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY, "stubfs:///"); conf.setClass("fs.stubfs.impl", StubFileSystem.class, FileSystem.class); conf.setBoolean("stubfs.noRpcForGetAclStatus", true); assertEquals("ls must succeed even if getAclStatus RPC does not exist.", 0, ToolRunner.run(conf, new FsShell(), new String[] { "-ls", "/" })); }
@Test public void testLsAclsUnsupported() throws Exception { Configuration conf = new Configuration(); conf.set(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY, "stubfs:///"); conf.setClass("fs.stubfs.impl", StubFileSystem.class, FileSystem.class); assertEquals("ls must succeed even if FileSystem does not implement ACLs.", 0, ToolRunner.run(conf, new FsShell(), new String[] { "-ls", "/" })); }
private void syncAndVerify() throws Exception { final FsShell shell = new FsShell(conf); lsrSource("Before sync source: ", shell, source); lsr("Before sync target: ", shell, target); Assert.assertTrue(sync()); lsrSource("After sync source: ", shell, source); lsr("After sync target: ", shell, target); verifyCopy(dfs.getFileStatus(source), dfs.getFileStatus(target), false); }