protected void disableWrite(FedBalanceContext fbcontext) throws IOException {
    // Save and cancel permission.
    FileStatus status = srcFs.getFileStatus(src);
    fPerm = status.getPermission();
    acl = srcFs.getAclStatus(src);
    srcFs.setPermission(src, FsPermission.createImmutable((short) 0));
    updateStage(Stage.FINAL_DISTCP);
  }
@Test
  public void testDisableWrite() throws Exception {
    String testRoot = nnUri + "/user/foo/testdir." + getMethodName();
    DistributedFileSystem fs =
        (DistributedFileSystem) FileSystem.get(URI.create(nnUri), conf);
    createFiles(fs, testRoot, srcfiles);
    Path src = new Path(testRoot, SRCDAT);
    Path dst = new Path(testRoot, DSTDAT);

    FedBalanceContext context = buildContext(src, dst, MOUNT);
    DistCpProcedure dcProcedure =
        new DistCpProcedure("distcp-procedure", null, 1000, context);
    assertNotEquals(0, fs.getFileStatus(src).getPermission().toShort());
    executeProcedure(dcProcedure, Stage.FINAL_DISTCP,
        () -> dcProcedure.disableWrite(context));
    assertEquals(0, fs.getFileStatus(src).getPermission().toShort());
    cleanup(fs, new Path(testRoot));
  }