use of org.talend.components.simplefileio.runtime.SimpleFileIOInputRuntime in project components by Talend.
the class GSRoundTripRuntimeTestIT method testCsv.
@Test
public void testCsv() {
List<IndexedRecord> expected = new ArrayList<>();
expected.add(ConvertToIndexedRecord.convertToAvro(new String[] { "1", "one" }));
expected.add(ConvertToIndexedRecord.convertToAvro(new String[] { "2", "two" }));
SimpleFileIOOutputProperties outputProps = createOutputProps();
outputProps.getDatasetProperties().path.setValue(gsPath);
SimpleFileIOOutputRuntime outputRuntime = new SimpleFileIOOutputRuntime();
outputRuntime.initialize(null, outputProps);
PCollection<IndexedRecord> input = writeP.apply(Create.of(expected));
input.apply(outputRuntime);
writeP.run(pipelineOptions).waitUntilFinish();
SimpleFileIOInputProperties inputProps = createInputProps();
inputProps.getDatasetProperties().path.setValue(gsPath + "*");
SimpleFileIOInputRuntime inputRuntime = new SimpleFileIOInputRuntime();
inputRuntime.initialize(null, inputProps);
PCollection<IndexedRecord> readRecords = readP.apply(inputRuntime);
PAssert.that(readRecords).containsInAnyOrder(expected);
readP.run(pipelineOptions).waitUntilFinish();
}
Aggregations