@Test
public void testMiniClusterStore()
throws EventDeliveryException, IOException {
// setup a minicluster
MiniDFSCluster cluster = new MiniDFSCluster
.Builder(new Configuration())
.build();
FileSystem dfs = cluster.getFileSystem();
Configuration conf = dfs.getConf();
URI hdfsUri = URI.create(
"dataset:" + conf.get("fs.defaultFS") + "/tmp/repo" + DATASET_NAME);
try {
// create a repository and dataset in HDFS
Datasets.create(hdfsUri, DESCRIPTOR);
// update the config to use the HDFS repository
config.put(DatasetSinkConstants.CONFIG_KITE_DATASET_URI, hdfsUri.toString());
DatasetSink sink = sink(in, config);
// run the sink
sink.start();
sink.process();
sink.stop();
Assert.assertEquals(
Sets.newHashSet(expected),
read(Datasets.load(hdfsUri)));
Assert.assertEquals("Should have committed", 0, remaining(in));
} finally {
if (Datasets.exists(hdfsUri)) {
Datasets.delete(hdfsUri);
}
cluster.shutdown();
}
}