Search in sources :

Example 1 with FileFlusher

use of io.divolte.server.filesinks.FileFlusher in project divolte-collector by divolte.

the class FileFlusherLocalHdfsTest method setupFlusher.

private void setupFlusher(final String rollEvery, final int recordCount) throws IOException {
    final Config config = ConfigFactory.parseMap(ImmutableMap.of("divolte.sinks.hdfs.file_strategy.roll_every", rollEvery, "divolte.sinks.hdfs.file_strategy.working_dir", tempInflightDir.toString(), "divolte.sinks.hdfs.file_strategy.publish_dir", tempPublishDir.toString())).withFallback(ConfigFactory.parseResources("hdfs-flusher-test.conf")).withFallback(ConfigFactory.parseResources("reference-test.conf"));
    final ValidatedConfiguration vc = new ValidatedConfiguration(() -> config);
    records = LongStream.range(0, recordCount).mapToObj((time) -> new GenericRecordBuilder(schema).set("ts", time).set("remoteHost", ARBITRARY_IP).build()).collect(Collectors.toList());
    flusher = new FileFlusher(vc.configuration().getSinkConfiguration("hdfs", FileSinkConfiguration.class).fileStrategy, HdfsFileManager.newFactory(vc, "hdfs", schema).create());
}
Also used : Config(com.typesafe.config.Config) FileFlusher(io.divolte.server.filesinks.FileFlusher) GenericRecordBuilder(org.apache.avro.generic.GenericRecordBuilder) ValidatedConfiguration(io.divolte.server.config.ValidatedConfiguration) FileSinkConfiguration(io.divolte.server.config.FileSinkConfiguration)

Aggregations

Config (com.typesafe.config.Config)1 FileSinkConfiguration (io.divolte.server.config.FileSinkConfiguration)1 ValidatedConfiguration (io.divolte.server.config.ValidatedConfiguration)1 FileFlusher (io.divolte.server.filesinks.FileFlusher)1 GenericRecordBuilder (org.apache.avro.generic.GenericRecordBuilder)1