use of org.apache.flink.streaming.util.MockStreamingRuntimeContext in project flink by apache.
the class PrintSinkFunctionTest method testPrintSinkWithIdentifierAndPrefix.
@Test
public void testPrintSinkWithIdentifierAndPrefix() throws Exception {
PrintSinkFunction<String> printSink = new PrintSinkFunction<>("mySink", false);
printSink.setRuntimeContext(new MockStreamingRuntimeContext(false, 2, 1));
printSink.open(new Configuration());
printSink.invoke("hello world!", SinkContextUtil.forTimestamp(0));
assertEquals("Print to System.out", printSink.toString());
assertEquals("mySink:2> hello world!" + line, arrayOutputStream.toString());
printSink.close();
}
use of org.apache.flink.streaming.util.MockStreamingRuntimeContext in project flink by apache.
the class PrintSinkFunctionTest method testPrintSinkWithIdentifierButNoPrefix.
@Test
public void testPrintSinkWithIdentifierButNoPrefix() throws Exception {
PrintSinkFunction<String> printSink = new PrintSinkFunction<>("mySink", false);
printSink.setRuntimeContext(new MockStreamingRuntimeContext(false, 1, 0));
printSink.open(new Configuration());
printSink.invoke("hello world!", SinkContextUtil.forTimestamp(0));
assertEquals("Print to System.out", printSink.toString());
assertEquals("mySink> hello world!" + line, arrayOutputStream.toString());
printSink.close();
}
Aggregations