private TestFsShellPermission.TestDeleteHelper GenDeleteEmptyDirHelper(string cmdOpts , string targetPerm, string asUser, bool expectedToDelete) { TestFsShellPermission.FileEntry[] files = new TestFsShellPermission.FileEntry[] { new TestFsShellPermission.FileEntry(this, "userA", true, "userA", "users", "755" ), new TestFsShellPermission.FileEntry(this, "userA/userB", true, "userB", "users" , targetPerm) }; TestFsShellPermission.FileEntry deleteEntry = files[1]; return(new TestFsShellPermission.TestDeleteHelper(this, files, deleteEntry, cmdOpts , asUser, expectedToDelete)); }
// Expect target to be deleted /// <exception cref="System.Exception"/> public virtual TestFsShellPermission.TestDeleteHelper GenDeleteSingleFileNotAsOwner () { TestFsShellPermission.FileEntry[] files = new TestFsShellPermission.FileEntry[] { new TestFsShellPermission.FileEntry(this, "userA", true, "userA", "users", "755" ), new TestFsShellPermission.FileEntry(this, "userA/userB", false, "userB", "users" , "700") }; TestFsShellPermission.FileEntry deleteEntry = files[1]; return(new TestFsShellPermission.TestDeleteHelper(this, files, deleteEntry, "-rm -r" , "userA", true)); }
public TestDeleteHelper(TestFsShellPermission _enclosing, TestFsShellPermission.FileEntry [] fileEntries, TestFsShellPermission.FileEntry deleteEntry, string cmdAndOptions , string doAsUser, bool expectedToDelete) { this._enclosing = _enclosing; /* * Each instance of TestDeleteHelper captures one testing scenario. * * To create all files listed in fileEntries, and then delete as user * doAsuser the deleteEntry with command+options specified in cmdAndOptions. * * When expectedToDelete is true, the deleteEntry is expected to be deleted; * otherwise, it's not expected to be deleted. At the end of test, * the existence of deleteEntry is checked against expectedToDelete * to ensure the command is finished with expected result */ this.fileEntries = fileEntries; this.deleteEntry = deleteEntry; this.cmdAndOptions = cmdAndOptions; this.expectedToDelete = expectedToDelete; this.doAsGroup = doAsUser.Equals("hdfs") ? "supergroup" : "users"; this.userUgi = TestFsShellPermission.CreateUGI(doAsUser, this.doAsGroup); }