org.apache.flink.client.cli.util.MockedCliFrontend Java Examples

The following examples show how to use org.apache.flink.client.cli.util.MockedCliFrontend. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testTriggerSavepointFailureIllegalJobID() throws Exception {
	replaceStdOutAndStdErr();

	try {
		CliFrontend frontend = new MockedCliFrontend(new RestClusterClient<>(getConfiguration(), StandaloneClusterId.getInstance()));

		String[] parameters = { "invalid job id" };
		try {
			frontend.savepoint(parameters);
			fail("Should have failed.");
		} catch (CliArgsException e) {
			assertThat(e.getMessage(), Matchers.containsString("Cannot parse JobID"));
		}
	}
	finally {
		restoreStdOutAndStdErr();
	}
}
 
Example #2
Source File: CliFrontendCancelTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCancel() throws Exception {
	// test cancel properly
	JobID jid = new JobID();

	OneShotLatch cancelLatch = new OneShotLatch();

	String[] parameters = { jid.toString() };

	TestingClusterClient<String> clusterClient = new TestingClusterClient<>();

	clusterClient.setCancelFunction(jobID -> {
		cancelLatch.trigger();
		return CompletableFuture.completedFuture(Acknowledge.get());
	});

	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);
	testFrontend.cancel(parameters);
	cancelLatch.await();
}
 
Example #3
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testDisposeSavepointSuccess() throws Exception {
	replaceStdOutAndStdErr();

	String savepointPath = "expectedSavepointPath";

	ClusterClient clusterClient = new DisposeSavepointClusterClient(
		(String path) -> CompletableFuture.completedFuture(Acknowledge.get()), getConfiguration());

	try {

		CliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { "-d", savepointPath };
		frontend.savepoint(parameters);

		String outMsg = buffer.toString();
		assertTrue(outMsg.contains(savepointPath));
		assertTrue(outMsg.contains("disposed"));
	}
	finally {
		clusterClient.close();
		restoreStdOutAndStdErr();
	}
}
 
Example #4
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testTriggerSavepointFailureIllegalJobID() throws Exception {
	replaceStdOutAndStdErr();

	try {
		CliFrontend frontend = new MockedCliFrontend(new RestClusterClient<>(getConfiguration(), StandaloneClusterId.getInstance()));

		String[] parameters = { "invalid job id" };
		try {
			frontend.savepoint(parameters);
			fail("Should have failed.");
		} catch (CliArgsException e) {
			assertThat(e.getMessage(), Matchers.containsString("Cannot parse JobID"));
		}
	}
	finally {
		restoreStdOutAndStdErr();
	}
}
 
Example #5
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testTriggerSavepointSuccess() throws Exception {
	replaceStdOutAndStdErr();

	JobID jobId = new JobID();

	String savepointPath = "expectedSavepointPath";

	final ClusterClient<String> clusterClient = createClusterClient(savepointPath);

	try {
		MockedCliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { jobId.toString() };
		frontend.savepoint(parameters);

		verify(clusterClient, times(1))
			.triggerSavepoint(eq(jobId), isNull(String.class));

		assertTrue(buffer.toString().contains(savepointPath));
	}
	finally {
		clusterClient.close();
		restoreStdOutAndStdErr();
	}
}
 
Example #6
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnknownJobId() throws Exception {
	// test unknown job Id
	JobID jid = new JobID();

	String[] parameters = { "-p", "test-target-dir", jid.toString() };
	String expectedMessage = "Test exception";
	FlinkException testException = new FlinkException(expectedMessage);
	TestingClusterClient<String> clusterClient = new TestingClusterClient<>();
	clusterClient.setStopWithSavepointFunction((jobID, advanceToEndOfEventTime, savepointDirectory) -> FutureUtils.completedExceptionally(testException));
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);

	try {
		testFrontend.stop(parameters);
		fail("Should have failed.");
	} catch (FlinkException e) {
		assertTrue(ExceptionUtils.findThrowableWithMessage(e, expectedMessage).isPresent());
	}
}
 
Example #7
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStopWithMaxWMAndExplicitSavepointDir() throws Exception {
	JobID jid = new JobID();

	String[] parameters = { "-d", "-p", "test-target-dir", jid.toString() };
	OneShotLatch stopWithSavepointLatch = new OneShotLatch();
	TestingClusterClient<String> clusterClient = new TestingClusterClient<>();
	clusterClient.setStopWithSavepointFunction((jobID, advanceToEndOfEventTime, savepointDirectory) -> {
		assertThat(jobID, is(jid));
		assertThat(advanceToEndOfEventTime, is(true));
		assertThat(savepointDirectory, is("test-target-dir"));
		stopWithSavepointLatch.trigger();
		return CompletableFuture.completedFuture(savepointDirectory);
	});
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);
	testFrontend.stop(parameters);

	stopWithSavepointLatch.await();
}
 
Example #8
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStopWithMaxWMAndDefaultSavepointDir() throws Exception {
	JobID jid = new JobID();

	String[] parameters = { "-p", "-d", jid.toString() };
	OneShotLatch stopWithSavepointLatch = new OneShotLatch();
	TestingClusterClient<String> clusterClient = new TestingClusterClient<>();
	clusterClient.setStopWithSavepointFunction((jobID, advanceToEndOfEventTime, savepointDirectory) -> {
		assertThat(jobID, is(jid));
		assertThat(advanceToEndOfEventTime, is(true));
		assertNull(savepointDirectory);
		stopWithSavepointLatch.trigger();
		return CompletableFuture.completedFuture(savepointDirectory);
	});
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);
	testFrontend.stop(parameters);

	stopWithSavepointLatch.await();
}
 
Example #9
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStopOnlyWithMaxWM() throws Exception {
	JobID jid = new JobID();

	String[] parameters = { "-d", jid.toString() };
	OneShotLatch stopWithSavepointLatch = new OneShotLatch();
	TestingClusterClient<String> clusterClient = new TestingClusterClient<>();
	clusterClient.setStopWithSavepointFunction((jobID, advanceToEndOfEventTime, savepointDirectory) -> {
		assertThat(jobID, is(jid));
		assertThat(advanceToEndOfEventTime, is(true));
		assertNull(savepointDirectory);
		stopWithSavepointLatch.trigger();
		return CompletableFuture.completedFuture(savepointDirectory);
	});
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);
	testFrontend.stop(parameters);

	stopWithSavepointLatch.await();
}
 
Example #10
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStopWithExplicitSavepointDir() throws Exception {
	JobID jid = new JobID();

	String[] parameters = { "-p", "test-target-dir", jid.toString() };
	OneShotLatch stopWithSavepointLatch = new OneShotLatch();
	TestingClusterClient<String> clusterClient = new TestingClusterClient<>();
	clusterClient.setStopWithSavepointFunction((jobID, advanceToEndOfEventTime, savepointDirectory) -> {
		assertThat(jobID, is(jid));
		assertThat(advanceToEndOfEventTime, is(false));
		assertThat(savepointDirectory, is("test-target-dir"));
		stopWithSavepointLatch.trigger();
		return CompletableFuture.completedFuture(savepointDirectory);
	});
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);
	testFrontend.stop(parameters);
	stopWithSavepointLatch.await();
}
 
Example #11
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStopWithDefaultSavepointDir() throws Exception {
	JobID jid = new JobID();

	String[] parameters = {jid.toString() };
	OneShotLatch stopWithSavepointLatch = new OneShotLatch();
	TestingClusterClient<String> clusterClient = new TestingClusterClient<>();
	clusterClient.setStopWithSavepointFunction((jobID, advanceToEndOfEventTime, savepointDirectory) -> {
		assertThat(jobID, is(jid));
		assertThat(advanceToEndOfEventTime, is(false));
		assertNull(savepointDirectory);
		stopWithSavepointLatch.trigger();
		return CompletableFuture.completedFuture(savepointDirectory);
	});
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);
	testFrontend.stop(parameters);

	stopWithSavepointLatch.await();
}
 
Example #12
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStopWithOnlyJobId() throws Exception {
	// test stop properly
	JobID jid = new JobID();
	String jidString = jid.toString();

	String[] parameters = { jidString };
	OneShotLatch stopWithSavepointLatch = new OneShotLatch();
	TestingClusterClient<String> clusterClient = new TestingClusterClient<>();
	clusterClient.setStopWithSavepointFunction((jobID, advanceToEndOfEventTime, savepointDirectory) -> {
		assertThat(jobID, is(jid));
		assertThat(advanceToEndOfEventTime, is(false));
		assertNull(savepointDirectory);
		stopWithSavepointLatch.trigger();
		return CompletableFuture.completedFuture(savepointDirectory);
	});
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);

	testFrontend.stop(parameters);

	stopWithSavepointLatch.await();
}
 
Example #13
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testDisposeSavepointSuccess() throws Exception {
	replaceStdOutAndStdErr();

	String savepointPath = "expectedSavepointPath";

	ClusterClient clusterClient = new DisposeSavepointClusterClient(
		(String path) -> CompletableFuture.completedFuture(Acknowledge.get()), getConfiguration());

	try {

		CliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { "-d", savepointPath };
		frontend.savepoint(parameters);

		String outMsg = buffer.toString();
		assertTrue(outMsg.contains(savepointPath));
		assertTrue(outMsg.contains("disposed"));
	}
	finally {
		clusterClient.shutdown();
		restoreStdOutAndStdErr();
	}
}
 
Example #14
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testTriggerSavepointSuccess() throws Exception {
	replaceStdOutAndStdErr();

	JobID jobId = new JobID();

	String savepointPath = "expectedSavepointPath";

	final ClusterClient<String> clusterClient = createClusterClient(savepointPath);

	try {
		MockedCliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { jobId.toString() };
		frontend.savepoint(parameters);

		verify(clusterClient, times(1))
			.triggerSavepoint(eq(jobId), isNull(String.class));

		assertTrue(buffer.toString().contains(savepointPath));
	}
	finally {
		clusterClient.shutdown();
		restoreStdOutAndStdErr();
	}
}
 
Example #15
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnknownJobId() throws Exception {
	// test unknown job Id
	JobID jid = new JobID();

	String[] parameters = { "-p", "test-target-dir", jid.toString() };
	String expectedMessage = "Test exception";
	FlinkException testException = new FlinkException(expectedMessage);
	final ClusterClient<String> clusterClient = createClusterClient(testException);
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);

	try {
		testFrontend.stop(parameters);
		fail("Should have failed.");
	} catch (FlinkException e) {
		assertTrue(ExceptionUtils.findThrowableWithMessage(e, expectedMessage).isPresent());
	}
}
 
Example #16
Source File: CliFrontendStopTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnknownJobId() throws Exception {
	// test unknown job Id
	JobID jid = new JobID();

	String[] parameters = { jid.toString() };
	String expectedMessage = "Test exception";
	FlinkException testException = new FlinkException(expectedMessage);
	final ClusterClient<String> clusterClient = createClusterClient(testException);
	MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);

	try {
		testFrontend.stop(parameters);
		fail("Should have failed.");
	} catch (FlinkException e) {
		assertTrue(ExceptionUtils.findThrowableWithMessage(e, expectedMessage).isPresent());
	}
}
 
Example #17
Source File: CliFrontendSavepointTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testTriggerSavepointSuccess() throws Exception {
	replaceStdOutAndStdErr();

	JobID jobId = new JobID();

	String savepointPath = "expectedSavepointPath";

	final ClusterClient<String> clusterClient = createClusterClient(savepointPath);

	try {
		MockedCliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { jobId.toString() };
		frontend.savepoint(parameters);

		verify(clusterClient, times(1))
			.triggerSavepoint(eq(jobId), isNull(String.class));

		assertTrue(buffer.toString().contains(savepointPath));
	}
	finally {
		clusterClient.shutdown();
		restoreStdOutAndStdErr();
	}
}
 
Example #18
Source File: CliFrontendSavepointTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testTriggerSavepointFailureIllegalJobID() throws Exception {
	replaceStdOutAndStdErr();

	try {
		CliFrontend frontend = new MockedCliFrontend(new RestClusterClient<>(getConfiguration(), StandaloneClusterId.getInstance()));

		String[] parameters = { "invalid job id" };
		try {
			frontend.savepoint(parameters);
			fail("Should have failed.");
		} catch (CliArgsException e) {
			assertThat(e.getMessage(), Matchers.containsString("Cannot parse JobID"));
		}
	}
	finally {
		restoreStdOutAndStdErr();
	}
}
 
Example #19
Source File: CliFrontendSavepointTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testDisposeSavepointSuccess() throws Exception {
	replaceStdOutAndStdErr();

	String savepointPath = "expectedSavepointPath";

	ClusterClient clusterClient = new DisposeSavepointClusterClient(
		(String path) -> CompletableFuture.completedFuture(Acknowledge.get()), getConfiguration());

	try {

		CliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { "-d", savepointPath };
		frontend.savepoint(parameters);

		String outMsg = buffer.toString();
		assertTrue(outMsg.contains(savepointPath));
		assertTrue(outMsg.contains("disposed"));
	}
	finally {
		clusterClient.shutdown();
		restoreStdOutAndStdErr();
	}
}
 
Example #20
Source File: CliFrontendSavepointTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testDisposeSavepointFailure() throws Exception {
	replaceStdOutAndStdErr();

	String savepointPath = "expectedSavepointPath";

	Exception testException = new Exception("expectedTestException");

	DisposeSavepointClusterClient clusterClient = new DisposeSavepointClusterClient((String path) -> FutureUtils.completedExceptionally(testException), getConfiguration());

	try {
		CliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { "-d", savepointPath };

		try {
			frontend.savepoint(parameters);

			fail("Savepoint should have failed.");
		} catch (Exception e) {
			assertTrue(ExceptionUtils.findThrowableWithMessage(e, testException.getMessage()).isPresent());
		}
	}
	finally {
		clusterClient.shutdown();
		restoreStdOutAndStdErr();
	}
}
 
Example #21
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testDisposeSavepointFailure() throws Exception {
	replaceStdOutAndStdErr();

	String savepointPath = "expectedSavepointPath";

	Exception testException = new Exception("expectedTestException");

	DisposeSavepointClusterClient clusterClient = new DisposeSavepointClusterClient((String path) -> FutureUtils.completedExceptionally(testException), getConfiguration());

	try {
		CliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { "-d", savepointPath };

		try {
			frontend.savepoint(parameters);

			fail("Savepoint should have failed.");
		} catch (Exception e) {
			assertTrue(ExceptionUtils.findThrowableWithMessage(e, testException.getMessage()).isPresent());
		}
	}
	finally {
		clusterClient.close();
		restoreStdOutAndStdErr();
	}
}
 
Example #22
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Tests disposal with a JAR file.
 */
@Test
public void testDisposeWithJar() throws Exception {
	replaceStdOutAndStdErr();

	final CompletableFuture<String> disposeSavepointFuture = new CompletableFuture<>();

	final DisposeSavepointClusterClient clusterClient = new DisposeSavepointClusterClient(
		(String savepointPath) -> {
			disposeSavepointFuture.complete(savepointPath);
			return CompletableFuture.completedFuture(Acknowledge.get());
		}, getConfiguration());

	try {
		CliFrontend frontend = new MockedCliFrontend(clusterClient);

		// Fake JAR file
		File f = tmp.newFile();
		ZipOutputStream out = new ZipOutputStream(new FileOutputStream(f));
		out.close();

		final String disposePath = "any-path";
		String[] parameters = { "-d", disposePath, "-j", f.getAbsolutePath() };

		frontend.savepoint(parameters);

		final String actualSavepointPath = disposeSavepointFuture.get();

		assertEquals(disposePath, actualSavepointPath);
	} finally {
		clusterClient.close();
		restoreStdOutAndStdErr();
	}
}
 
Example #23
Source File: CliFrontendListTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testList() throws Exception {
	// test list properly
	{
		String[] parameters = {"-r", "-s", "-a"};
		ClusterClient<String> clusterClient = createClusterClient();
		MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);
		testFrontend.list(parameters);
		Mockito.verify(clusterClient, times(1))
			.listJobs();
	}
}
 
Example #24
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that a CLI call with a custom savepoint directory target is
 * forwarded correctly to the cluster client.
 */
@Test
public void testTriggerSavepointCustomTarget() throws Exception {
	replaceStdOutAndStdErr();

	JobID jobId = new JobID();

	String savepointDirectory = "customTargetDirectory";

	final ClusterClient<String> clusterClient = createClusterClient(savepointDirectory);

	try {
		MockedCliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { jobId.toString(), savepointDirectory };
		frontend.savepoint(parameters);

		verify(clusterClient, times(1))
			.triggerSavepoint(eq(jobId), eq(savepointDirectory));

		assertTrue(buffer.toString().contains(savepointDirectory));
	}
	finally {
		clusterClient.close();

		restoreStdOutAndStdErr();
	}
}
 
Example #25
Source File: CliFrontendModifyTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private Tuple2<JobID, Integer> callModify(String[] args) throws Exception {
	final CompletableFuture<Tuple2<JobID, Integer>> rescaleJobFuture = new CompletableFuture<>();
	final TestingClusterClient clusterClient = new TestingClusterClient(rescaleJobFuture, getConfiguration());
	final MockedCliFrontend cliFrontend = new MockedCliFrontend(clusterClient);

	cliFrontend.modify(args);

	assertThat(rescaleJobFuture.isDone(), Matchers.is(true));

	return rescaleJobFuture.get();
}
 
Example #26
Source File: CliFrontendSavepointTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testTriggerSavepointFailure() throws Exception {
	replaceStdOutAndStdErr();

	JobID jobId = new JobID();

	String expectedTestException = "expectedTestException";
	Exception testException = new Exception(expectedTestException);

	final ClusterClient<String> clusterClient = createFailingClusterClient(testException);

	try {
		MockedCliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { jobId.toString() };

		try {
			frontend.savepoint(parameters);

			fail("Savepoint should have failed.");
		} catch (FlinkException e) {
			assertTrue(ExceptionUtils.findThrowableWithMessage(e, expectedTestException).isPresent());
		}
	}
	finally {
		clusterClient.close();
		restoreStdOutAndStdErr();
	}
}
 
Example #27
Source File: CliFrontendListTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testList() throws Exception {
	// test list properly
	{
		String[] parameters = {"-r", "-s", "-a"};
		ClusterClient<String> clusterClient = createClusterClient();
		MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient);
		testFrontend.list(parameters);
		Mockito.verify(clusterClient, times(1))
			.listJobs();
	}
}
 
Example #28
Source File: CliFrontendSavepointTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testTriggerSavepointFailure() throws Exception {
	replaceStdOutAndStdErr();

	JobID jobId = new JobID();

	String expectedTestException = "expectedTestException";
	Exception testException = new Exception(expectedTestException);

	final ClusterClient<String> clusterClient = createFailingClusterClient(testException);

	try {
		MockedCliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { jobId.toString() };

		try {
			frontend.savepoint(parameters);

			fail("Savepoint should have failed.");
		} catch (FlinkException e) {
			assertTrue(ExceptionUtils.findThrowableWithMessage(e, expectedTestException).isPresent());
		}
	}
	finally {
		clusterClient.shutdown();
		restoreStdOutAndStdErr();
	}
}
 
Example #29
Source File: CliFrontendStopWithSavepointTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test(expected = CliArgsException.class)
public void testWrongSavepointDirOrder() throws Exception {
	JobID jid = new JobID();
	String[] parameters = { "-s", "-d", "test-target-dir", jid.toString() };
	MockedCliFrontend testFrontend = new MockedCliFrontend(new TestingClusterClient());
	testFrontend.stop(parameters);
}
 
Example #30
Source File: CliFrontendSavepointTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that a CLI call with a custom savepoint directory target is
 * forwarded correctly to the cluster client.
 */
@Test
public void testTriggerSavepointCustomTarget() throws Exception {
	replaceStdOutAndStdErr();

	JobID jobId = new JobID();

	String savepointDirectory = "customTargetDirectory";

	final ClusterClient<String> clusterClient = createClusterClient(savepointDirectory);

	try {
		MockedCliFrontend frontend = new MockedCliFrontend(clusterClient);

		String[] parameters = { jobId.toString(), savepointDirectory };
		frontend.savepoint(parameters);

		verify(clusterClient, times(1))
			.triggerSavepoint(eq(jobId), eq(savepointDirectory));

		assertTrue(buffer.toString().contains(savepointDirectory));
	}
	finally {
		clusterClient.shutdown();

		restoreStdOutAndStdErr();
	}
}