use of org.apache.flink.api.scala.FlinkILoop in project flink by apache.
the class FlinkILoopTest method testConfigurationForwardingStreamEnvironment.
@Test
public void testConfigurationForwardingStreamEnvironment() {
Configuration configuration = new Configuration();
configuration.setString("foobar", "foobar");
FlinkILoop flinkILoop = new FlinkILoop("localhost", 6123, configuration, Option.<String[]>empty());
StreamExecutionEnvironment streamEnv = flinkILoop.scalaSenv().getJavaEnv();
assertTrue(streamEnv instanceof RemoteStreamEnvironment);
RemoteStreamEnvironment remoteStreamEnv = (RemoteStreamEnvironment) streamEnv;
Configuration forwardedConfiguration = remoteStreamEnv.getClientConfiguration();
assertEquals(configuration, forwardedConfiguration);
}
use of org.apache.flink.api.scala.FlinkILoop in project flink by apache.
the class FlinkILoopTest method testConfigurationForwarding.
@Test
public void testConfigurationForwarding() throws Exception {
Configuration configuration = new Configuration();
configuration.setString("foobar", "foobar");
FlinkILoop flinkILoop = new FlinkILoop("localhost", 6123, configuration, Option.<String[]>empty());
final TestPlanExecutor testPlanExecutor = new TestPlanExecutor();
PowerMockito.mockStatic(PlanExecutor.class);
BDDMockito.given(PlanExecutor.createRemoteExecutor(Matchers.anyString(), Matchers.anyInt(), Matchers.any(Configuration.class), Matchers.any(java.util.List.class), Matchers.any(java.util.List.class))).willAnswer(new Answer<PlanExecutor>() {
@Override
public PlanExecutor answer(InvocationOnMock invocation) throws Throwable {
testPlanExecutor.setHost((String) invocation.getArguments()[0]);
testPlanExecutor.setPort((Integer) invocation.getArguments()[1]);
testPlanExecutor.setConfiguration((Configuration) invocation.getArguments()[2]);
testPlanExecutor.setJars((List<String>) invocation.getArguments()[3]);
testPlanExecutor.setGlobalClasspaths((List<String>) invocation.getArguments()[4]);
return testPlanExecutor;
}
});
Settings settings = new Settings();
((MutableSettings.BooleanSetting) settings.usejavacp()).value_$eq(true);
flinkILoop.settings_$eq(settings);
flinkILoop.createInterpreter();
ExecutionEnvironment env = flinkILoop.scalaBenv().getJavaEnv();
env.fromElements(1).output(new DiscardingOutputFormat<Integer>());
env.execute("Test job");
Configuration forwardedConfiguration = testPlanExecutor.getConfiguration();
assertEquals(configuration, forwardedConfiguration);
}
Aggregations