use of org.apache.beam.sdk.io.FileSystemRegistrar in project beam by apache.
the class HadoopFileSystemRegistrarTest method testServiceLoader.
@Test
public void testServiceLoader() {
HadoopFileSystemOptions options = PipelineOptionsFactory.as(HadoopFileSystemOptions.class);
options.setHdfsConfiguration(ImmutableList.of(configuration));
for (FileSystemRegistrar registrar : Lists.newArrayList(ServiceLoader.load(FileSystemRegistrar.class).iterator())) {
if (registrar instanceof HadoopFileSystemRegistrar) {
Iterable<FileSystem<?>> fileSystems = registrar.fromOptions(options);
assertEquals(hdfsClusterBaseUri.getScheme(), ((HadoopFileSystem) Iterables.getOnlyElement(fileSystems)).getScheme());
return;
}
}
fail("Expected to find " + HadoopFileSystemRegistrar.class);
}
use of org.apache.beam.sdk.io.FileSystemRegistrar in project beam by apache.
the class GcsFileSystemRegistrarTest method testServiceLoader.
@Test
public void testServiceLoader() {
for (FileSystemRegistrar registrar : Lists.newArrayList(ServiceLoader.load(FileSystemRegistrar.class).iterator())) {
if (registrar instanceof GcsFileSystemRegistrar) {
Iterable<FileSystem<?>> fileSystems = registrar.fromOptions(PipelineOptionsFactory.create());
assertThat(fileSystems, contains(instanceOf(GcsFileSystem.class)));
return;
}
}
fail("Expected to find " + GcsFileSystemRegistrar.class);
}
Aggregations