You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by al...@apache.org on 2018/03/05 15:14:54 UTC

[2/2] flink git commit: Fix checkstyle in ZooKeeperCompletedCheckpointStoreTest

Fix checkstyle in ZooKeeperCompletedCheckpointStoreTest


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/1602b63c
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/1602b63c
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/1602b63c

Branch: refs/heads/release-1.5
Commit: 1602b63ce34f7b1f9650aed4a8097e8c552b36d9
Parents: f8681a9
Author: Aljoscha Krettek <al...@gmail.com>
Authored: Mon Mar 5 15:45:36 2018 +0100
Committer: Aljoscha Krettek <al...@gmail.com>
Committed: Mon Mar 5 16:13:54 2018 +0100

----------------------------------------------------------------------
 .../ZooKeeperCompletedCheckpointStoreTest.java  | 29 ++++++++++----------
 1 file changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/1602b63c/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStoreTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStoreTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStoreTest.java
index 08c73ba..0384733 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStoreTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStoreTest.java
@@ -33,10 +33,8 @@ import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.CuratorEventType;
 import org.apache.curator.framework.api.ErrorListenerPathable;
 import org.apache.curator.utils.EnsurePath;
-
 import org.junit.Test;
 import org.junit.runner.RunWith;
-
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
@@ -67,6 +65,9 @@ import static org.powermock.api.mockito.PowerMockito.doAnswer;
 import static org.powermock.api.mockito.PowerMockito.doThrow;
 import static org.powermock.api.mockito.PowerMockito.whenNew;
 
+/**
+ * Tests for {@link ZooKeeperCompletedCheckpointStore}.
+ */
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(ZooKeeperCompletedCheckpointStore.class)
 public class ZooKeeperCompletedCheckpointStoreTest extends TestLogger {
@@ -209,7 +210,7 @@ public class ZooKeeperCompletedCheckpointStoreTest extends TestLogger {
 		// are subsumed should they be discarded.
 		verify(failingRetrievableStateHandle, never()).discardState();
 	}
-	
+
 	/**
 	 * Tests that the checkpoint does not exist in the store when we fail to add
 	 * it into the store (i.e., there exists an exception thrown by the method).
@@ -218,29 +219,29 @@ public class ZooKeeperCompletedCheckpointStoreTest extends TestLogger {
 	public void testAddCheckpointWithFailedRemove() throws Exception {
 		final CuratorFramework client = mock(CuratorFramework.class, Mockito.RETURNS_DEEP_STUBS);
 		final RetrievableStateStorageHelper<CompletedCheckpoint> storageHelperMock = mock(RetrievableStateStorageHelper.class);
-		
-		ZooKeeperStateHandleStore<CompletedCheckpoint> zookeeperStateHandleStoreMock = 
+
+		ZooKeeperStateHandleStore<CompletedCheckpoint> zookeeperStateHandleStoreMock =
 			spy(new ZooKeeperStateHandleStore<>(client, storageHelperMock, Executors.directExecutor()));
 		whenNew(ZooKeeperStateHandleStore.class).withAnyArguments().thenReturn(zookeeperStateHandleStoreMock);
-		
+
 		doAnswer(new Answer<RetrievableStateHandle<CompletedCheckpoint>>() {
 			@Override
 			public RetrievableStateHandle<CompletedCheckpoint> answer(InvocationOnMock invocationOnMock) throws Throwable {
-				CompletedCheckpoint checkpoint = (CompletedCheckpoint)invocationOnMock.getArguments()[1];
-				
+				CompletedCheckpoint checkpoint = (CompletedCheckpoint) invocationOnMock.getArguments()[1];
+
 				RetrievableStateHandle<CompletedCheckpoint> retrievableStateHandle = mock(RetrievableStateHandle.class);
 				when(retrievableStateHandle.retrieveState()).thenReturn(checkpoint);
-				
+
 				return retrievableStateHandle;
 			}
 		}).when(zookeeperStateHandleStoreMock).addAndLock(anyString(), any(CompletedCheckpoint.class));
-		
+
 		doThrow(new Exception()).when(zookeeperStateHandleStoreMock).releaseAndTryRemove(anyString(), any(ZooKeeperStateHandleStore.RemoveCallback.class));
-		
+
 		final int numCheckpointsToRetain = 1;
 		final String checkpointsPath = "foobar";
 		final RetrievableStateStorageHelper<CompletedCheckpoint> stateSotrage = mock(RetrievableStateStorageHelper.class);
-		
+
 		ZooKeeperCompletedCheckpointStore zooKeeperCompletedCheckpointStore = new ZooKeeperCompletedCheckpointStore(
 			numCheckpointsToRetain,
 			client,
@@ -252,10 +253,10 @@ public class ZooKeeperCompletedCheckpointStoreTest extends TestLogger {
 			CompletedCheckpoint checkpointToAdd = mock(CompletedCheckpoint.class);
 			doReturn(i).when(checkpointToAdd).getCheckpointID();
 			doReturn(Collections.emptyMap()).when(checkpointToAdd).getOperatorStates();
-			
+
 			try {
 				zooKeeperCompletedCheckpointStore.addCheckpoint(checkpointToAdd);
-				
+
 				// The checkpoint should be in the store if we successfully add it into the store.
 				List<CompletedCheckpoint> addedCheckpoints = zooKeeperCompletedCheckpointStore.getAllCheckpoints();
 				assertTrue(addedCheckpoints.contains(checkpointToAdd));