throws EventDeliveryException, IOException {
// setup a minicluster
MiniDFSCluster cluster = new MiniDFSCluster
.Builder(new Configuration())
.build();
DatasetRepository hdfsRepo = null;
try {
FileSystem dfs = cluster.getFileSystem();
Configuration conf = dfs.getConf();
String repoURI = "repo:" + conf.get("fs.defaultFS") + "/tmp/repo";
// create a repository and dataset in HDFS
hdfsRepo = DatasetRepositories.open(repoURI);
hdfsRepo.create(DATASET_NAME, DESCRIPTOR);
// update the config to use the HDFS repository
config.put(DatasetSinkConstants.CONFIG_KITE_REPO_URI, repoURI);
DatasetSink sink = sink(in, config);
// run the sink
sink.start();
sink.process();
sink.stop();
Assert.assertEquals(
Sets.newHashSet(expected),
read(hdfsRepo.<GenericData.Record>load(DATASET_NAME)));
Assert.assertEquals("Should have committed", 0, remaining(in));
} finally {
if (hdfsRepo != null && hdfsRepo.exists(DATASET_NAME)) {
hdfsRepo.delete(DATASET_NAME);
}
cluster.shutdown();
}
}