Search in sources :

Example 1 with TestNonRichOutputFormat

use of org.apache.flink.api.common.operators.util.TestNonRichOutputFormat in project flink by apache.

the class GenericDataSinkBaseTest method testDataSourcePlain.

@Test
public void testDataSourcePlain() {
    try {
        TestNonRichOutputFormat out = new TestNonRichOutputFormat();
        GenericDataSinkBase<String> sink = new GenericDataSinkBase<String>(out, new UnaryOperatorInformation<String, Nothing>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.getInfoFor(Nothing.class)), "test_sink");
        sink.setInput(source);
        ExecutionConfig executionConfig = new ExecutionConfig();
        executionConfig.disableObjectReuse();
        in.reset();
        sink.executeOnCollections(asList(TestIOData.NAMES), null, executionConfig);
        assertEquals(out.output, asList(TestIOData.NAMES));
        executionConfig.enableObjectReuse();
        out.clear();
        in.reset();
        sink.executeOnCollections(asList(TestIOData.NAMES), null, executionConfig);
        assertEquals(out.output, asList(TestIOData.NAMES));
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : TestNonRichOutputFormat(org.apache.flink.api.common.operators.util.TestNonRichOutputFormat) ExecutionConfig(org.apache.flink.api.common.ExecutionConfig) Nothing(org.apache.flink.types.Nothing) Test(org.junit.Test)

Example 2 with TestNonRichOutputFormat

use of org.apache.flink.api.common.operators.util.TestNonRichOutputFormat in project flink by apache.

the class InputOutputITCase method testProgram.

@Override
protected void testProgram() throws Exception {
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    TestNonRichOutputFormat output = new TestNonRichOutputFormat();
    env.createInput(new TestNonRichInputFormat()).output(output);
    try {
        env.execute();
    } catch (Exception e) {
        // we didn't break anything by making everything rich.
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : ExecutionEnvironment(org.apache.flink.api.java.ExecutionEnvironment) TestNonRichOutputFormat(org.apache.flink.api.common.operators.util.TestNonRichOutputFormat) TestNonRichInputFormat(org.apache.flink.api.common.operators.util.TestNonRichInputFormat)

Aggregations

TestNonRichOutputFormat (org.apache.flink.api.common.operators.util.TestNonRichOutputFormat)2 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)1 TestNonRichInputFormat (org.apache.flink.api.common.operators.util.TestNonRichInputFormat)1 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)1 Nothing (org.apache.flink.types.Nothing)1 Test (org.junit.Test)1