use of org.apache.flink.client.cli.util.MockedCliFrontend in project flink by apache.
the class CliFrontendStopWithSavepointTest method testStopWithDefaultSavepointDir.
@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, 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.cli.util.MockedCliFrontend in project flink by apache.
the class CliFrontendStopWithSavepointTest method testStopWithMaxWMAndDefaultSavepointDir.
@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, formatType) -> {
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();
}
use of org.apache.flink.client.cli.util.MockedCliFrontend in project flink by apache.
the class CliFrontendCancelTest method testCancel.
@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();
}
Aggregations