Java 类org.apache.hadoop.hdfs.util.Diff 实例源码

项目:hadoop    文件:DirectoryWithSnapshotFeature.java   
@Override
QuotaCounts combinePosteriorAndCollectBlocks(
    final BlockStoragePolicySuite bsps,
    final INodeDirectory currentDir, final DirectoryDiff posterior,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  final QuotaCounts counts = new QuotaCounts.Builder().build();
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.computeQuotaUsage(bsps, counts, false);
        inode.destroyAndCollectBlocks(bsps, collectedBlocks, removedINodes);
      }
    }
  });
  return counts;
}
项目:hadoop    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:big-c    文件:DirectoryWithSnapshotFeature.java   
@Override
QuotaCounts combinePosteriorAndCollectBlocks(
    final BlockStoragePolicySuite bsps,
    final INodeDirectory currentDir, final DirectoryDiff posterior,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  final QuotaCounts counts = new QuotaCounts.Builder().build();
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.computeQuotaUsage(bsps, counts, false);
        inode.destroyAndCollectBlocks(bsps, collectedBlocks, removedINodes);
      }
    }
  });
  return counts;
}
项目:big-c    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:big-c    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DirectoryWithSnapshotFeature.java   
@Override
Quota.Counts combinePosteriorAndCollectBlocks(
    final INodeDirectory currentDir, final DirectoryDiff posterior,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  final Quota.Counts counts = Quota.Counts.newInstance();
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.computeQuotaUsage(counts, false);
        inode.destroyAndCollectBlocks(collectedBlocks, removedINodes);
      }
    }
  });
  return counts;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-plus    文件:INodeDirectoryWithSnapshot.java   
@Override
Quota.Counts combinePosteriorAndCollectBlocks(
    final INodeDirectory currentDir, final DirectoryDiff posterior,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  final Quota.Counts counts = Quota.Counts.newInstance();
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.computeQuotaUsage(counts, false);
        inode.destroyAndCollectBlocks(collectedBlocks, removedINodes);
      }
    }
  });
  return counts;
}
项目:hadoop-plus    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-plus    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:FlexMap    文件:DirectoryWithSnapshotFeature.java   
@Override
Quota.Counts combinePosteriorAndCollectBlocks(
    final INodeDirectory currentDir, final DirectoryDiff posterior,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  final Quota.Counts counts = Quota.Counts.newInstance();
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.computeQuotaUsage(counts, false);
        inode.destroyAndCollectBlocks(collectedBlocks, removedINodes);
      }
    }
  });
  return counts;
}
项目:FlexMap    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:FlexMap    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-TCP    文件:INodeDirectoryWithSnapshot.java   
@Override
Quota.Counts combinePosteriorAndCollectBlocks(
    final INodeDirectory currentDir, final DirectoryDiff posterior,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  final Quota.Counts counts = Quota.Counts.newInstance();
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.computeQuotaUsage(counts, false);
        inode.destroyAndCollectBlocks(collectedBlocks, removedINodes);
      }
    }
  });
  return counts;
}
项目:hadoop-TCP    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-TCP    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hardfs    文件:INodeDirectoryWithSnapshot.java   
@Override
Quota.Counts combinePosteriorAndCollectBlocks(
    final INodeDirectory currentDir, final DirectoryDiff posterior,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  final Quota.Counts counts = Quota.Counts.newInstance();
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.computeQuotaUsage(counts, false);
        inode.destroyAndCollectBlocks(collectedBlocks, removedINodes);
      }
    }
  });
  return counts;
}
项目:hardfs    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hardfs    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-on-lustre2    文件:DirectoryWithSnapshotFeature.java   
@Override
Quota.Counts combinePosteriorAndCollectBlocks(
    final INodeDirectory currentDir, final DirectoryDiff posterior,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  final Quota.Counts counts = Quota.Counts.newInstance();
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.computeQuotaUsage(counts, false);
        inode.destroyAndCollectBlocks(collectedBlocks, removedINodes);
      }
    }
  });
  return counts;
}
项目:hadoop-on-lustre2    文件:TestDiff.java   
static void create(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i < 0);
  current.add(-i - 1, inode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final int undoInfo = diff.create(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoCreate(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.create(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-on-lustre2    文件:TestDiff.java   
static void delete(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  current.remove(i);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.delete(inode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoDelete(inode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.delete(inode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false,
    oldinode.getFeatures());
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:DirectoryWithSnapshotFeature.java   
@Override
void combinePosteriorAndCollectBlocks(
    final INode.ReclaimContext reclaimContext,
    final INodeDirectory currentDir,
    final DirectoryDiff posterior) {
  diff.combinePosterior(posterior.diff, new Diff.Processor<INode>() {
    /** Collect blocks for deleted files. */
    @Override
    public void process(INode inode) {
      if (inode != null) {
        inode.destroyAndCollectBlocks(reclaimContext);
      }
    }
  });
}
项目:aliyun-oss-hadoop-fs    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false,
    oldinode.getFeatures());
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:big-c    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false,
    oldinode.getFeatures());
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false,
    oldinode.getFeatures());
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-plus    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false);
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:FlexMap    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false,
    oldinode.getFeatures());
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-TCP    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false);
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:hardfs    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false);
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop-on-lustre2    文件:TestDiff.java   
static void modify(INode inode, final List<INode> current,
    Diff<byte[], INode> diff) {
  final int i = Diff.search(current, inode.getKey());
  Assert.assertTrue(i >= 0);
  final INodeDirectory oldinode = (INodeDirectory)current.get(i);
  final INodeDirectory newinode = new INodeDirectory(oldinode, false,
    oldinode.getFeatures());
  newinode.setModificationTime(oldinode.getModificationTime() + 1);

  current.set(i, newinode);
  if (diff != null) {
    //test undo with 1/UNDO_TEST_P probability
    final boolean testUndo = RANDOM.nextInt(UNDO_TEST_P) == 0;
    String before = null;
    if (testUndo) {
      before = diff.toString();
    }

    final UndoInfo<INode> undoInfo = diff.modify(oldinode, newinode);

    if (testUndo) {
      final String after = diff.toString();
      //undo
      diff.undoModify(oldinode, newinode, undoInfo);
      assertDiff(before, diff);
      //re-do
      diff.modify(oldinode, newinode);
      assertDiff(after, diff);
    }
  }
}
项目:hadoop    文件:TestDiff.java   
static void assertDiff(String s, Diff<byte[], INode> diff) {
  Assert.assertEquals(s, diff.toString());
}
项目:aliyun-oss-hadoop-fs    文件:TestDiff.java   
static void assertDiff(String s, Diff<byte[], INode> diff) {
  Assert.assertEquals(s, diff.toString());
}
项目:big-c    文件:TestDiff.java   
static void assertDiff(String s, Diff<byte[], INode> diff) {
  Assert.assertEquals(s, diff.toString());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDiff.java   
static void assertDiff(String s, Diff<byte[], INode> diff) {
  Assert.assertEquals(s, diff.toString());
}