use of org.hamcrest.core.IsInstanceOf in project beam by apache.
the class ShuffleReaderFactoryTest method runTestCreateShuffleReader.
<T extends NativeReader> T runTestCreateShuffleReader(byte[] shuffleReaderConfig, @Nullable String start, @Nullable String end, CloudObject encoding, BatchModeExecutionContext context, Class<T> shuffleReaderClass, String shuffleSourceAlias) throws Exception {
CloudObject spec = CloudObject.forClassName(shuffleSourceAlias);
addString(spec, "shuffle_reader_config", encodeBase64String(shuffleReaderConfig));
if (start != null) {
addString(spec, "start_shuffle_position", start);
}
if (end != null) {
addString(spec, "end_shuffle_position", end);
}
Source cloudSource = new Source();
cloudSource.setSpec(spec);
cloudSource.setCodec(encoding);
NativeReader<?> reader = ReaderRegistry.defaultRegistry().create(cloudSource, PipelineOptionsFactory.create(), context, null);
assertThat(reader, new IsInstanceOf(shuffleReaderClass));
return (T) reader;
}
Aggregations