flink-clients/src/test/java/org/apache/flink/client/CliFrontendListCancelTest.java
/**
	 * Tests cancelling with the savepoint option.
	 */
Tests cancelling with the savepoint option.
Tests cancelling with the savepoint option .
@Test
	public void testCancelWithSavepoint() throws Exception {
		{
			JobID jid = new JobID();
			String[] parameters = { "-s", jid.toString() };
			CancelTestCliFrontend testFrontend = new CancelTestCliFrontend(false);
			assertEquals(0, testFrontend.cancel(parameters));
			Mockito.verify(testFrontend.client, times(1))
				.cancelWithSavepoint(any(JobID.class), isNull(String.class));
		}
		{
			JobID jid = new JobID();
			String[] parameters = { "-s", "targetDirectory", jid.toString() };
			CancelTestCliFrontend testFrontend = new CancelTestCliFrontend(false);
			assertEquals(0, testFrontend.cancel(parameters));
			Mockito.verify(testFrontend.client, times(1))
				.cancelWithSavepoint(any(JobID.class), notNull(String.class));
		}
		{
			, but no job ID
			String[] parameters = { "-s", "targetDirectory" };
			CliFrontend testFrontend = new CliFrontend(CliFrontendTestUtils.getConfigDir());
			assertNotEquals(0, testFrontend.cancel(parameters));
		}
		{
			 and no job ID
			String[] parameters = { "-s" };
			CliFrontend testFrontend = new CliFrontend(CliFrontendTestUtils.getConfigDir());
			assertNotEquals(0, testFrontend.cancel(parameters));
		}
	}
@ Test public void testCancelWithSavepoint ( ) throws Exception { { JobID jid = new JobID ( ) ; String [ ] parameters = { "-s" , jid . toString ( ) } ; CancelTestCliFrontend testFrontend = new CancelTestCliFrontend ( false ) ; assertEquals ( 0 , testFrontend . cancel ( parameters ) ) ; Mockito . verify ( testFrontend . client , times ( 1 ) ) . cancelWithSavepoint ( any ( JobID . class ) , isNull ( String . class ) ) ; } { JobID jid = new JobID ( ) ; String [ ] parameters = { "-s" , "targetDirectory" , jid . toString ( ) } ; CancelTestCliFrontend testFrontend = new CancelTestCliFrontend ( false ) ; assertEquals ( 0 , testFrontend . cancel ( parameters ) ) ; Mockito . verify ( testFrontend . client , times ( 1 ) ) . cancelWithSavepoint ( any ( JobID . class ) , notNull ( String . class ) ) ; } { String [ ] parameters = { "-s" , "targetDirectory" } ; CliFrontend testFrontend = new CliFrontend ( CliFrontendTestUtils . getConfigDir ( ) ) ; assertNotEquals ( 0 , testFrontend . cancel ( parameters ) ) ; } { String [ ] parameters = { "-s" } ; CliFrontend testFrontend = new CliFrontend ( CliFrontendTestUtils . getConfigDir ( ) ) ; assertNotEquals ( 0 , testFrontend . cancel ( parameters ) ) ; } }
Tests cancelling with the savepoint option.
Tests cancelling with the savepoint option .
// Cancel with savepoint (no target directory) // Cancel with savepoint (with target directory) // Cancel with savepoint (with target directory), but no job ID // Cancel with savepoint (no target directory) and no job ID