[
https://issues.apache.org/jira/browse/FLINK-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14718310#comment-14718310
]
ASF GitHub Bot commented on FLINK-2111:
---------------------------------------
Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/750#discussion_r38186682
--- Diff:
flink-clients/src/test/java/org/apache/flink/client/CliFrontendPackageProgramTest.java
---
@@ -46,186 +43,120 @@
public class CliFrontendPackageProgramTest {
-
+
@BeforeClass
public static void init() {
pipeSystemOutToNull();
}
- @Test
- public void testNonExistingJarFile() {
- try {
- CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
+ @Test(expected = FileNotFoundException.class)
+ public void testNonExistingJarFile() throws Exception {
+ CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
- ProgramOptions options = mock(ProgramOptions.class);
-
when(options.getJarFilePath()).thenReturn("/some/none/existing/path");
+ ProgramOptions options = mock(ProgramOptions.class);
+
when(options.getJarFilePath()).thenReturn("/some/none/existing/path");
- try {
- frontend.buildProgram(options);
- fail("should throw an exception");
- }
- catch (FileNotFoundException e) {
- // that's what we want
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ frontend.buildProgram(options);
}
-
- @Test
- public void testFileNotJarFile() {
- try {
- CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
- ProgramOptions options = mock(ProgramOptions.class);
-
when(options.getJarFilePath()).thenReturn(getNonJarFilePath());
+ @Test(expected = ProgramInvocationException.class)
+ public void testFileNotJarFile() throws Exception {
+ CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
- try {
- frontend.buildProgram(options);
- fail("should throw an exception");
- }
- catch (ProgramInvocationException e) {
- // that's what we want
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ ProgramOptions options = mock(ProgramOptions.class);
+ when(options.getJarFilePath()).thenReturn(getNonJarFilePath());
+
+ frontend.buildProgram(options);
}
-
+
@Test
- public void testVariantWithExplicitJarAndArgumentsOption() {
- try {
- String[] arguments = {"-j", getTestJarPath(), "-a",
"--debug", "true", "arg1", "arg2"};
- String[] reducedArguments = new String[] {"--debug",
"true", "arg1", "arg2"};
+ public void testVariantWithExplicitJarAndArgumentsOption() throws
Exception {
+ String[] arguments = {"-j", getTestJarPath(), "-a", "--debug",
"true", "arg1", "arg2"};
+ String[] reducedArguments = new String[] {"--debug", "true",
"arg1", "arg2"};
- RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
- assertEquals(getTestJarPath(),
options.getJarFilePath());
- assertArrayEquals(reducedArguments,
options.getProgramArgs());
+ RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
+ assertEquals(getTestJarPath(), options.getJarFilePath());
+ assertArrayEquals(reducedArguments, options.getProgramArgs());
- CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
- PackagedProgram prog = frontend.buildProgram(options);
+ CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
+ PackagedProgram prog = frontend.buildProgram(options);
- Assert.assertArrayEquals(reducedArguments,
prog.getArguments());
- Assert.assertEquals(TEST_JAR_MAIN_CLASS,
prog.getMainClassName());
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ Assert.assertArrayEquals(reducedArguments, prog.getArguments());
+ Assert.assertEquals(TEST_JAR_MAIN_CLASS,
prog.getMainClassName());
}
-
+
@Test
- public void testVariantWithExplicitJarAndNoArgumentsOption() {
- try {
- String[] arguments = {"-j", getTestJarPath(),
"--debug", "true", "arg1", "arg2"};
- String[] reducedArguments = new String[] {"--debug",
"true", "arg1", "arg2"};
+ public void testVariantWithExplicitJarAndNoArgumentsOption() throws
Exception {
+ String[] arguments = {"-j", getTestJarPath(), "--debug",
"true", "arg1", "arg2"};
+ String[] reducedArguments = new String[] {"--debug", "true",
"arg1", "arg2"};
- RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
- assertEquals(getTestJarPath(),
options.getJarFilePath());
- assertArrayEquals(reducedArguments,
options.getProgramArgs());
+ RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
+ assertEquals(getTestJarPath(), options.getJarFilePath());
+ assertArrayEquals(reducedArguments, options.getProgramArgs());
- CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
+ CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
- PackagedProgram prog = frontend.buildProgram(options);
+ PackagedProgram prog = frontend.buildProgram(options);
- Assert.assertArrayEquals(reducedArguments,
prog.getArguments());
- Assert.assertEquals(TEST_JAR_MAIN_CLASS,
prog.getMainClassName());
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ Assert.assertArrayEquals(reducedArguments, prog.getArguments());
+ Assert.assertEquals(TEST_JAR_MAIN_CLASS,
prog.getMainClassName());
}
-
+
@Test
- public void testValidVariantWithNoJarAndNoArgumentsOption() {
- try {
- String[] arguments = {getTestJarPath(), "--debug",
"true", "arg1", "arg2"};
- String[] reducedArguments = {"--debug", "true", "arg1",
"arg2"};
+ public void testValidVariantWithNoJarAndNoArgumentsOption() throws
Exception {
+ String[] arguments = {getTestJarPath(), "--debug", "true",
"arg1", "arg2"};
+ String[] reducedArguments = {"--debug", "true", "arg1", "arg2"};
- RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
- assertEquals(getTestJarPath(),
options.getJarFilePath());
- assertArrayEquals(reducedArguments,
options.getProgramArgs());
+ RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
+ assertEquals(getTestJarPath(), options.getJarFilePath());
+ assertArrayEquals(reducedArguments, options.getProgramArgs());
- CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
+ CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
- PackagedProgram prog = frontend.buildProgram(options);
+ PackagedProgram prog = frontend.buildProgram(options);
- Assert.assertArrayEquals(reducedArguments,
prog.getArguments());
- Assert.assertEquals(TEST_JAR_MAIN_CLASS,
prog.getMainClassName());
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ Assert.assertArrayEquals(reducedArguments, prog.getArguments());
+ Assert.assertEquals(TEST_JAR_MAIN_CLASS,
prog.getMainClassName());
}
-
+
@Test
- public void testNoJarNoArgumentsAtAll() {
- try {
- CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
- assertTrue(frontend.run(new String[0]) != 0);
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ public void testNoJarNoArgumentsAtAll() throws Exception {
+ CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
+ assertTrue(frontend.run(new String[0]) != 0);
}
-
- @Test
- public void testNonExistingFileWithArguments() {
- try {
- String[] arguments = {"/some/none/existing/path",
"--debug", "true", "arg1", "arg2"};
- String[] reducedArguments = {"--debug", "true", "arg1",
"arg2"};
- RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
- assertEquals(arguments[0], options.getJarFilePath());
- assertArrayEquals(reducedArguments,
options.getProgramArgs());
+ @Test(expected = FileNotFoundException.class)
+ public void testNonExistingFileWithArguments() throws Exception {
+ String[] arguments = {"/some/none/existing/path", "--debug",
"true", "arg1", "arg2"};
+ String[] reducedArguments = {"--debug", "true", "arg1", "arg2"};
- CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
+ RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
+ assertEquals(arguments[0], options.getJarFilePath());
+ assertArrayEquals(reducedArguments, options.getProgramArgs());
- try {
- frontend.buildProgram(options);
- fail("Should fail with an exception");
- }
- catch (FileNotFoundException e) {
- // that's what we want
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
+
+ frontend.buildProgram(options);
}
-
+
@Test
- public void testNonExistingFileWithoutArguments() {
- try {
- String[] arguments = {"/some/none/existing/path"};
+ public void testNonExistingFileWithoutArguments() throws Exception {
+ String[] arguments = {"/some/none/existing/path"};
- RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
- assertEquals(arguments[0], options.getJarFilePath());
- assertArrayEquals(new String[0],
options.getProgramArgs());
+ RunOptions options =
CliFrontendParser.parseRunCommand(arguments);
+ assertEquals(arguments[0], options.getJarFilePath());
+ assertArrayEquals(new String[0], options.getProgramArgs());
- CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
+ CliFrontend frontend = new
CliFrontend(CliFrontendTestUtils.getConfigDir());
- try {
- frontend.buildProgram(options);
- }
- catch (FileNotFoundException e) {
- // that's what we want
- }
+ try {
+ frontend.buildProgram(options);
}
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
+ catch (FileNotFoundException e) {
+ // that's what we want
--- End diff --
We could also use the `@Test(expected = ... )` annotation.
> Add "stop" signal to cleanly shutdown streaming jobs
> ----------------------------------------------------
>
> Key: FLINK-2111
> URL: https://issues.apache.org/jira/browse/FLINK-2111
> Project: Flink
> Issue Type: Improvement
> Components: Distributed Runtime, JobManager, Local Runtime,
> Streaming, TaskManager, Webfrontend
> Reporter: Matthias J. Sax
> Assignee: Matthias J. Sax
> Priority: Minor
>
> Currently, streaming jobs can only be stopped using "cancel" command, what is
> a "hard" stop with no clean shutdown.
> The new introduced "stop" signal, will only affect streaming source tasks
> such that the sources can stop emitting data and shutdown cleanly, resulting
> in a clean shutdown of the whole streaming job.
> This feature is a pre-requirment for
> https://issues.apache.org/jira/browse/FLINK-1929
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)