org.apache.flink.client.cli.CliFrontendTestUtils Java Examples

The following examples show how to use org.apache.flink.client.cli.CliFrontendTestUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PackagedProgramTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetPreviewPlan() {
	try {
		PackagedProgram prog = new PackagedProgram(new File(CliFrontendTestUtils.getTestJarPath()));

		final PrintStream out = System.out;
		final PrintStream err = System.err;
		try {
			System.setOut(new PrintStream(new NullOutputStream()));
			System.setErr(new PrintStream(new NullOutputStream()));

			Assert.assertNotNull(prog.getPreviewPlan());
		}
		finally {
			System.setOut(out);
			System.setErr(err);
		}
	}
	catch (Exception e) {
		System.err.println(e.getMessage());
		e.printStackTrace();
		Assert.fail("Test is erroneous: " + e.getMessage());
	}
}
 
Example #2
Source File: PackagedProgramTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetPreviewPlan() {
	try {
		PackagedProgram prog = new PackagedProgram(new File(CliFrontendTestUtils.getTestJarPath()));

		final PrintStream out = System.out;
		final PrintStream err = System.err;
		try {
			System.setOut(new PrintStream(new NullOutputStream()));
			System.setErr(new PrintStream(new NullOutputStream()));

			Assert.assertNotNull(prog.getPreviewPlan());
		}
		finally {
			System.setOut(out);
			System.setErr(err);
		}
	}
	catch (Exception e) {
		System.err.println(e.getMessage());
		e.printStackTrace();
		Assert.fail("Test is erroneous: " + e.getMessage());
	}
}
 
Example #3
Source File: ApplicationDispatcherBootstrapTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private PackagedProgram getProgram(int noOfJobs) throws FlinkException {
	try {
		return PackagedProgram.newBuilder()
				.setUserClassPaths(Collections.singletonList(new File(CliFrontendTestUtils.getTestJarPath()).toURI().toURL()))
				.setEntryPointClassName(MULTI_EXECUTE_JOB_CLASS_NAME)
				.setArguments(String.valueOf(noOfJobs))
				.build();
	} catch (ProgramInvocationException | FileNotFoundException | MalformedURLException e) {
		throw new FlinkException("Could not load the provided entrypoint class.", e);
	}
}
 
Example #4
Source File: CliFrontendRunWithYarnTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void init() {
	CliFrontendTestUtils.pipeSystemOutToNull();
}
 
Example #5
Source File: CliFrontendRunWithYarnTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void shutdown() {
	CliFrontendTestUtils.restoreSystemOut();
}
 
Example #6
Source File: CliFrontendRunWithYarnTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void init() {
	CliFrontendTestUtils.pipeSystemOutToNull();
}
 
Example #7
Source File: CliFrontendRunWithYarnTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void shutdown() {
	CliFrontendTestUtils.restoreSystemOut();
}
 
Example #8
Source File: PackagedProgramTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testNotThrowExceptionWhenJarFileIsNull() throws Exception {
	PackagedProgram.newBuilder()
		.setUserClassPaths(Collections.singletonList(new File(CliFrontendTestUtils.getTestJarPath()).toURI().toURL()))
		.setEntryPointClassName(TEST_JAR_MAIN_CLASS);
}
 
Example #9
Source File: CliFrontendRunWithYarnTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void init() {
	CliFrontendTestUtils.pipeSystemOutToNull();
}
 
Example #10
Source File: CliFrontendRunWithYarnTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void shutdown() {
	CliFrontendTestUtils.restoreSystemOut();
}