use of org.apache.flink.client.program.TestingClusterClient in project flink by apache.
the class CliFrontendStopWithSavepointTest method testStopWithExplicitSavepointType.
@Test
public void testStopWithExplicitSavepointType() throws Exception {
JobID jid = new JobID();
String[] parameters = { "-p", "test-target-dir", jid.toString(), "-type", SavepointFormatType.NATIVE.toString() };
OneShotLatch stopWithSavepointLatch = new OneShotLatch();
TestingClusterClient<String> clusterClient = new TestingClusterClient<>();
clusterClient.setStopWithSavepointFunction((jobID, advanceToEndOfEventTime, savepointDirectory, formatType) -> {
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();
}
use of org.apache.flink.client.program.TestingClusterClient in project flink by apache.
the class CliFrontendStopWithSavepointTest method testStopWithExplicitSavepointDir.
@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, formatType) -> {
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();
}
use of org.apache.flink.client.program.TestingClusterClient in project flink by apache.
the class CliFrontendStopWithSavepointTest method testStopWithMaxWMAndExplicitSavepointDir.
@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, formatType) -> {
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();
}
use of org.apache.flink.client.program.TestingClusterClient in project flink by apache.
the class CliFrontendStopWithSavepointTest method testStopWithOnlyJobId.
@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, formatType) -> {
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();
}
use of org.apache.flink.client.program.TestingClusterClient in project flink by apache.
the class CliFrontendStopWithSavepointTest method testWrongSavepointDirOrder.
@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);
}
Aggregations