Пример #1
0
  @Test(expected = Splits.SplitException.class)
  @Category(UnitTest.class)
  public void getSplitHigh() throws Splits.SplitException {
    Splits splits = new PartitionerSplit();
    splits.generateSplits(new TestGenerator());

    splits.getSplit(1000);
  }
Пример #2
0
  @Test
  @Category(UnitTest.class)
  public void getSplitLow() throws Splits.SplitException {
    Splits splits = new PartitionerSplit();
    splits.generateSplits(new TestGenerator());

    PartitionerSplit.PartitionerSplitInfo split =
        (PartitionerSplit.PartitionerSplitInfo) splits.getSplit(0);

    Assert.assertEquals("Splits entry not correct", 0, split.getPartition());
  }
Пример #3
0
  @Test
  @Category(UnitTest.class)
  public void getSplit() throws Splits.SplitException {
    Splits splits = new PartitionerSplit();
    splits.generateSplits(new TestGenerator());

    Random rand = new Random();
    for (int i = 0; i < 1000; i++) {
      long test = rand.nextInt(generated[generated.length - 1].intValue());
      long testPartition = findSplit(generated, test);

      PartitionerSplit.PartitionerSplitInfo split =
          (PartitionerSplit.PartitionerSplitInfo) splits.getSplit(test);

      Assert.assertEquals("Splits entry not correct", testPartition, split.getPartition());
    }
  }
Пример #4
0
 @Test(expected = Splits.SplitException.class)
 @Category(UnitTest.class)
 public void getSplitNotGenerated() throws Splits.SplitException {
   Splits splits = new PartitionerSplit();
   splits.getSplit(10);
 }