Search in sources :

Example 1 with TestNonRichInputFormat

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

the class RemoteEnvironmentITCase method testInvalidAkkaConfiguration.

/**
	 * Ensure that that Akka configuration parameters can be set.
	 */
@Test(expected = IllegalArgumentException.class)
public void testInvalidAkkaConfiguration() throws Throwable {
    Configuration config = new Configuration();
    config.setString(ConfigConstants.AKKA_STARTUP_TIMEOUT, INVALID_STARTUP_TIMEOUT);
    final ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment(cluster.hostname(), cluster.getLeaderRPCPort(), config);
    env.getConfig().disableSysoutLogging();
    DataSet<String> result = env.createInput(new TestNonRichInputFormat());
    result.output(new LocalCollectionOutputFormat<String>(new ArrayList<String>()));
    try {
        env.execute();
        Assert.fail("Program should not run successfully, cause of invalid akka settings.");
    } catch (IOException ex) {
        throw ex.getCause();
    }
}
Also used : ExecutionEnvironment(org.apache.flink.api.java.ExecutionEnvironment) Configuration(org.apache.flink.configuration.Configuration) ArrayList(java.util.ArrayList) IOException(java.io.IOException) TestNonRichInputFormat(org.apache.flink.api.common.operators.util.TestNonRichInputFormat) Test(org.junit.Test)

Example 2 with TestNonRichInputFormat

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

the class GenericDataSourceBaseTest method testDataSourcePlain.

@Test
public void testDataSourcePlain() {
    try {
        TestNonRichInputFormat in = new TestNonRichInputFormat();
        GenericDataSourceBase<String, TestNonRichInputFormat> source = new GenericDataSourceBase<String, TestNonRichInputFormat>(in, new OperatorInformation<String>(BasicTypeInfo.STRING_TYPE_INFO), "testSource");
        ExecutionConfig executionConfig = new ExecutionConfig();
        executionConfig.disableObjectReuse();
        List<String> resultMutableSafe = source.executeOnCollections(null, executionConfig);
        in.reset();
        executionConfig.enableObjectReuse();
        List<String> resultRegular = source.executeOnCollections(null, executionConfig);
        assertEquals(asList(TestIOData.NAMES), resultMutableSafe);
        assertEquals(asList(TestIOData.NAMES), resultRegular);
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : ExecutionConfig(org.apache.flink.api.common.ExecutionConfig) TestNonRichInputFormat(org.apache.flink.api.common.operators.util.TestNonRichInputFormat) Test(org.junit.Test)

Example 3 with TestNonRichInputFormat

use of org.apache.flink.api.common.operators.util.TestNonRichInputFormat 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

TestNonRichInputFormat (org.apache.flink.api.common.operators.util.TestNonRichInputFormat)3 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)1 TestNonRichOutputFormat (org.apache.flink.api.common.operators.util.TestNonRichOutputFormat)1 Configuration (org.apache.flink.configuration.Configuration)1