@Test public void testPartitionAvailabilityCheck() { final IntermediateResultPartitionID irp1ID = new IntermediateResultPartitionID(); final IntermediateResultPartitionID irp2ID = new IntermediateResultPartitionID(); final IntermediateResultPartitionID irp3ID = new IntermediateResultPartitionID(); final IntermediateResultPartitionID irp4ID = new IntermediateResultPartitionID(); final Map<IntermediateResultPartitionID, Boolean> expectedAvailability = new HashMap<IntermediateResultPartitionID, Boolean>() {{ put(irp1ID, true); put(irp2ID, false); put(irp3ID, false); put(irp4ID, true); }}; final TestingPartitionTracker partitionTracker = new TestingPartitionTracker(); partitionTracker.setIsPartitionTrackedFunction(rpID -> expectedAvailability.get(rpID.getPartitionId())); final Function<IntermediateResultPartitionID, ResultPartitionID> partitionIDMapper = intermediateResultPartitionID -> new ResultPartitionID(intermediateResultPartitionID, new ExecutionAttemptID()); final ResultPartitionAvailabilityChecker resultPartitionAvailabilityChecker = new ExecutionGraphResultPartitionAvailabilityChecker(partitionIDMapper, partitionTracker); for (IntermediateResultPartitionID irpID : expectedAvailability.keySet()) { assertEquals(expectedAvailability.get(irpID), resultPartitionAvailabilityChecker.isAvailable(irpID)); } }
@Override public boolean isAvailable(final IntermediateResultPartitionID resultPartitionID) { return partitionTracker.isPartitionTracked(partitionIDMapper.apply(resultPartitionID)); }
ExecutionGraphResultPartitionAvailabilityChecker implements ResultPartitionAvailabilityChecker { @Override public boolean isAvailable(final IntermediateResultPartitionID resultPartitionID) { return partitionTracker.isPartitionTracked(partitionIDMapper.apply(resultPartitionID)); } }
ExecutionGraphResultPartitionAvailabilityChecker implements ResultPartitionAvailabilityChecker { @Override public boolean isAvailable(final IntermediateResultPartitionID resultPartitionID) { return partitionTracker.isPartitionTracked(partitionIDMapper.apply(resultPartitionID)); } ExecutionGraphResultPartitionAvailabilityChecker(
			final Function<IntermediateResultPartitionID, ResultPartitionID> partitionIDMapper,
			final PartitionTracker partitionTracker); }
ExecutionGraphResultPartitionAvailabilityChecker implements ResultPartitionAvailabilityChecker { @Override public boolean isAvailable(final IntermediateResultPartitionID resultPartitionID) { return partitionTracker.isPartitionTracked(partitionIDMapper.apply(resultPartitionID)); } ExecutionGraphResultPartitionAvailabilityChecker(
			final Function<IntermediateResultPartitionID, ResultPartitionID> partitionIDMapper,
			final PartitionTracker partitionTracker); @Override boolean isAvailable(final IntermediateResultPartitionID resultPartitionID); }
ExecutionGraphResultPartitionAvailabilityChecker implements ResultPartitionAvailabilityChecker { @Override public boolean isAvailable(final IntermediateResultPartitionID resultPartitionID) { return partitionTracker.isPartitionTracked(partitionIDMapper.apply(resultPartitionID)); } ExecutionGraphResultPartitionAvailabilityChecker(
			final Function<IntermediateResultPartitionID, ResultPartitionID> partitionIDMapper,
			final PartitionTracker partitionTracker); @Override boolean isAvailable(final IntermediateResultPartitionID resultPartitionID);  }