use of org.talend.sdk.component.runtime.beam.impl.BeamMapperImpl in project component-runtime by Talend.
the class BeamIOWrappingTest method mapper.
@Test
public void mapper() {
final Object source = newComponent("beamio_input", ComponentManager.ComponentType.MAPPER);
assertThat(source, instanceOf(BeamSource.class));
final Mapper mapper = new BeamMapperImpl((PTransform<PBegin, ?>) source, getPlugin(), "test", "beamio_input");
mapper.start();
assertEquals(2, mapper.assess());
final Input input = mapper.create();
assertNotNull(input);
input.start();
assertEquals(new Sample("a"), input.next());
assertEquals(new Sample("b"), input.next());
assertNull(input.next());
input.stop();
mapper.stop();
}
use of org.talend.sdk.component.runtime.beam.impl.BeamMapperImpl in project component-runtime by Talend.
the class BeamIOWrappingTest method inputChain.
@Test
public void inputChain() {
MySink.DATA.clear();
final Object source = newComponent("beamio_input_chain", ComponentManager.ComponentType.MAPPER);
final Mapper mapper = new BeamMapperImpl((PTransform<PBegin, ?>) source, getPlugin(), "test", "beamio_input_chain");
mapper.start();
assertEquals(4, mapper.assess());
final Input input = mapper.create();
assertNotNull(input);
input.start();
assertNotNull(input.next());
assertNotNull(input.next());
assertNull(input.next());
try {
input.stop();
} catch (final IllegalArgumentException iae) {
// for now we ignore this error which is issuing an output in an after bundle
assertEquals("chunk outputs are not yet supported", iae.getMessage());
}
mapper.stop();
assertEquals(asList("setup", "start-bundle", "1a", "2b", "teardown"), MySink.DATA);
}
Aggregations