use of io.cdap.cdap.api.dataset.lib.partitioned.ConsumablePartition in project cdap by caskdata.
the class ConsumablePartitionTest method testAlreadyTakenTransition.
@Test(expected = IllegalStateException.class)
public void testAlreadyTakenTransition() {
// cannot take a partition that's already taken
ConsumablePartition partition = new DefaultConsumablePartition(generateUniqueKey());
partition.take();
partition.take();
}
use of io.cdap.cdap.api.dataset.lib.partitioned.ConsumablePartition in project cdap by caskdata.
the class ConsumablePartitionTest method testRetryWithoutTakenTransition.
@Test(expected = IllegalStateException.class)
public void testRetryWithoutTakenTransition() {
// cannot take retry a partition without it being taken first
ConsumablePartition partition = new DefaultConsumablePartition(generateUniqueKey());
partition.retry();
}
use of io.cdap.cdap.api.dataset.lib.partitioned.ConsumablePartition in project cdap by caskdata.
the class ConsumablePartitionTest method testSimpleTransitions.
@Test
public void testSimpleTransitions() {
// tests simple success case
ConsumablePartition partition = new DefaultConsumablePartition(generateUniqueKey());
Assert.assertEquals(0, partition.getNumFailures());
partition.take();
partition.retry();
Assert.assertEquals(1, partition.getNumFailures());
partition.take();
// test that untake doesn't increment failure count
partition.untake();
Assert.assertEquals(1, partition.getNumFailures());
partition.take();
partition.complete();
}
use of io.cdap.cdap.api.dataset.lib.partitioned.ConsumablePartition in project cdap by caskdata.
the class ConsumablePartitionTest method testAlreadyCompletedTransition.
@Test(expected = IllegalStateException.class)
public void testAlreadyCompletedTransition() {
// cannot complete a partition that has already been completed
ConsumablePartition partition = new DefaultConsumablePartition(generateUniqueKey());
partition.take();
partition.complete();
partition.complete();
}
Aggregations