@Test(expected = CliArgsException.class) public void testUnrecognizedOption() throws Exception { // test unrecognized option String[] parameters = { "-v", "-l" }; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.stop(parameters); }
@Test public void testStop() throws Exception { // test stop properly JobID jid = new JobID(); String jidString = jid.toString(); String[] parameters = { jidString }; final ClusterClient<String> clusterClient = createClusterClient(null); MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient); testFrontend.stop(parameters); Mockito.verify(clusterClient, times(1)).stop(any(JobID.class)); }
@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()); } }
@Test(expected = CliArgsException.class) public void testMissingJobId() throws Exception { // test missing job id String[] parameters = {}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.stop(parameters); }