flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointStoreTest.java
/**
	 * Tests a store-load-dispose sequence.
	 */
Tests a store-load-dispose sequence.
Tests a store - load - dispose sequence .
@Test
	public void testStoreLoadDispose() throws Exception {
		String root = tmp.getRoot().getAbsolutePath();
		File rootFile = new File(root);
		File[] list = rootFile.listFiles();
		assertNotNull(list);
		assertEquals(0, list.length);
		String savepointDirectory = SavepointStore.createSavepointDirectory(root, new JobID());
		SavepointV2 stored = new SavepointV2(
			1929292,
			CheckpointTestUtils.createOperatorStates(4, 24),
			Collections.<MasterState>emptyList());
		String path = SavepointStore.storeSavepoint(savepointDirectory, stored);
		list = rootFile.listFiles();
		assertNotNull(list);
		assertEquals(1, list.length);
		Savepoint loaded = SavepointStore.loadSavepoint(path, Thread.currentThread().getContextClassLoader());
		assertEquals(stored.getCheckpointId(), loaded.getCheckpointId());
		assertEquals(stored.getOperatorStates(), loaded.getOperatorStates());
		assertEquals(stored.getMasterStates(), loaded.getMasterStates());
		loaded.dispose();
		SavepointStore.deleteSavepointDirectory(path);
		list = rootFile.listFiles();
		assertNotNull(list);
		assertEquals(0, list.length);
	}
@ Test public void testStoreLoadDispose ( ) throws Exception { String root = tmp . getRoot ( ) . getAbsolutePath ( ) ; File rootFile = new File ( root ) ; File [ ] list = rootFile . listFiles ( ) ; assertNotNull ( list ) ; assertEquals ( 0 , list . length ) ; String savepointDirectory = SavepointStore . createSavepointDirectory ( root , new JobID ( ) ) ; SavepointV2 stored = new SavepointV2 ( 1929292 , CheckpointTestUtils . createOperatorStates ( 4 , 24 ) , Collections . < MasterState > emptyList ( ) ) ; String path = SavepointStore . storeSavepoint ( savepointDirectory , stored ) ; list = rootFile . listFiles ( ) ; assertNotNull ( list ) ; assertEquals ( 1 , list . length ) ; Savepoint loaded = SavepointStore . loadSavepoint ( path , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; assertEquals ( stored . getCheckpointId ( ) , loaded . getCheckpointId ( ) ) ; assertEquals ( stored . getOperatorStates ( ) , loaded . getOperatorStates ( ) ) ; assertEquals ( stored . getMasterStates ( ) , loaded . getMasterStates ( ) ) ; loaded . dispose ( ) ; SavepointStore . deleteSavepointDirectory ( path ) ; list = rootFile . listFiles ( ) ; assertNotNull ( list ) ; assertEquals ( 0 , list . length ) ; }
Tests a store-load-dispose sequence.
Tests a store - load - dispose sequence .
// Store // Load // Dispose