flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/PendingCheckpointTest.java
/**
	 * Tests that the completion future is succeeded on finalize and failed on
	 * abort and failures during finalize.
	 */
Tests that the completion future is succeeded on finalize and failed on
abort and failures during finalize.
Tests that the completion future is succeeded on finalize and failed on abort and failures during finalize .
@Test
	public void testCompletionFuture() throws Exception {
		CheckpointProperties props = new CheckpointProperties(false, true, false, false, false, false, false, false);
		PendingCheckpoint pending = createPendingCheckpoint(props, "ignored");
		CompletableFuture<CompletedCheckpoint> future = pending.getCompletionFuture();
		assertFalse(future.isDone());
		pending.abortDeclined();
		assertTrue(future.isDone());
		pending = createPendingCheckpoint(props, "ignored");
		future = pending.getCompletionFuture();
		assertFalse(future.isDone());
		pending.abortExpired();
		assertTrue(future.isDone());
		pending = createPendingCheckpoint(props, "ignored");
		future = pending.getCompletionFuture();
		assertFalse(future.isDone());
		pending.abortSubsumed();
		assertTrue(future.isDone());
		String target = tmpFolder.newFolder().getAbsolutePath();
		pending = createPendingCheckpoint(props, target);
		future = pending.getCompletionFuture();
		assertFalse(future.isDone());
		pending.acknowledgeTask(ATTEMPT_ID, null, new CheckpointMetrics());
		assertTrue(pending.isFullyAcknowledged());
		pending.finalizeCheckpointExternalized();
		assertTrue(future.isDone());
		pending = createPendingCheckpoint(props, "ignored");
		future = pending.getCompletionFuture();
		assertFalse(future.isDone());
		try {
			pending.finalizeCheckpointNonExternalized();
			fail("Did not throw expected Exception");
		} catch (IllegalStateException ignored) {
		}
		try {
			pending.finalizeCheckpointExternalized();
			fail("Did not throw expected Exception");
		} catch (IllegalStateException ignored) {
		}
	}
@ Test public void testCompletionFuture ( ) throws Exception { CheckpointProperties props = new CheckpointProperties ( false , true , false , false , false , false , false , false ) ; PendingCheckpoint pending = createPendingCheckpoint ( props , "ignored" ) ; CompletableFuture < CompletedCheckpoint > future = pending . getCompletionFuture ( ) ; assertFalse ( future . isDone ( ) ) ; pending . abortDeclined ( ) ; assertTrue ( future . isDone ( ) ) ; pending = createPendingCheckpoint ( props , "ignored" ) ; future = pending . getCompletionFuture ( ) ; assertFalse ( future . isDone ( ) ) ; pending . abortExpired ( ) ; assertTrue ( future . isDone ( ) ) ; pending = createPendingCheckpoint ( props , "ignored" ) ; future = pending . getCompletionFuture ( ) ; assertFalse ( future . isDone ( ) ) ; pending . abortSubsumed ( ) ; assertTrue ( future . isDone ( ) ) ; String target = tmpFolder . newFolder ( ) . getAbsolutePath ( ) ; pending = createPendingCheckpoint ( props , target ) ; future = pending . getCompletionFuture ( ) ; assertFalse ( future . isDone ( ) ) ; pending . acknowledgeTask ( ATTEMPT_ID , null , new CheckpointMetrics ( ) ) ; assertTrue ( pending . isFullyAcknowledged ( ) ) ; pending . finalizeCheckpointExternalized ( ) ; assertTrue ( future . isDone ( ) ) ; pending = createPendingCheckpoint ( props , "ignored" ) ; future = pending . getCompletionFuture ( ) ; assertFalse ( future . isDone ( ) ) ; try { pending . finalizeCheckpointNonExternalized ( ) ; fail ( "Did not throw expected Exception" ) ; } catch ( IllegalStateException ignored ) { } try { pending . finalizeCheckpointExternalized ( ) ; fail ( "Did not throw expected Exception" ) ; } catch ( IllegalStateException ignored ) { } }
Tests that the completion future is succeeded on finalize and failed on
 abort and failures during finalize.
Tests that the completion future is succeeded on finalize and failed on abort and failures during finalize .
// Abort declined // Abort expired // Abort subsumed // Finalize (all ACK'd) // Finalize (missing ACKs) // Expected // Expected