@Override public void run() { unbounded.toBefore("timestamp", sep12End).moveToTrash(); } });
@Override public void run() { unbounded.from("timestamp", oct12BadStart).to("timestamp", oct12End).moveToTrash(); } });
@Override public void run() { unbounded.fromAfter("timestamp", nov11Start).toBefore("timestamp", nov12Start).moveToTrash(); } });
@Override public void run() { unbounded.from("timestamp", nov11Start).to("timestamp", nov12Start).moveToTrash(); } });
@Override public void run() { unbounded.from("timestamp", octInstant).to("timestamp", octInstant).moveToTrash(); } });
@Override public void run() { unbounded.from("timestamp", oct12Start).to("timestamp", oct12BadEnd).moveToTrash(); } });
@Test @SuppressWarnings("unchecked") public void testUnboundedMoveToTrash() throws Exception { // NOTE: this is an un-restricted write so all should succeed DatasetWriter<StandardEvent> writer = null; try { writer = unbounded.newWriter(); writer.write(sepEvent); writer.write(octEvent); writer.write(novEvent); } finally { Closeables.close(writer, false); } final Path root = new Path("target/data/ns/test"); final Path y2013 = new Path("target/data/ns/test/year=2013"); final Path sep = new Path("target/data/ns/test/year=2013/month=09"); final Path sep12 = new Path("target/data/ns/test/year=2013/month=09/day=12"); final Path oct = new Path("target/data/ns/test/year=2013/month=10"); final Path oct12 = new Path("target/data/ns/test/year=2013/month=10/day=12"); final Path nov = new Path("target/data/ns/test/year=2013/month=11"); final Path nov11 = new Path("target/data/ns/test/year=2013/month=11/day=11"); assertDirectoriesExist(fs, root, y2013, sep, sep12, oct, oct12, nov, nov11); Assert.assertTrue("Delete should return true to indicate data was deleted.", unbounded.moveToTrash()); assertDirectoriesDoNotExist(fs, y2013, sep12, sep, oct12, oct, nov11, nov); assertDirectoriesExist(fs, root); }
unbounded.from("timestamp", decStart).moveToTrash()); Assert.assertFalse("Delete should return false to indicate no changes", unbounded.from("timestamp", julStart).toBefore("timestamp", sepStart).moveToTrash()); unbounded.to("timestamp", sep12End).moveToTrash()); assertDirectoriesDoNotExist(fs, sep12, sep); assertDirectoriesInTrash(fs, trashPolicy, sep12, sep); assertDirectoriesExist(fs, root, y2013, oct, oct12, nov, nov11); Assert.assertFalse("Delete should return false to indicate no changes", unbounded.to("timestamp", sep12End).moveToTrash()); assertDirectoriesDoNotExist(fs, sep12, sep); assertDirectoriesExist(fs, root, y2013, oct, oct12, nov, nov11); unbounded.from("timestamp", nov11Start).toBefore("timestamp", nov12Start).moveToTrash()); assertDirectoriesDoNotExist(fs, sep12, sep, nov11, nov); assertDirectoriesExist(fs, root, y2013, oct, oct12); Assert.assertFalse("Delete should return false to indicate no changes", unbounded.from("timestamp", nov11Start).toBefore("timestamp", nov12Start).moveToTrash()); assertDirectoriesDoNotExist(fs, sep12, sep, nov11, nov); assertDirectoriesInTrash(fs, trashPolicy, sep12, sep, nov11, nov); unbounded.from("timestamp", oct12Start).to("timestamp", oct12End).moveToTrash()); assertDirectoriesDoNotExist(fs, y2013, sep12, sep, oct12, oct, nov11, nov); assertDirectoriesInTrash(fs, trashPolicy, y2013, sep12, sep, oct12, oct, nov11, nov); assertDirectoriesExist(fs, root); Assert.assertFalse("Delete should return false to indicate no changes", unbounded.from("timestamp", oct12Start).to("timestamp", oct12End).moveToTrash()); assertDirectoriesDoNotExist(fs, y2013, sep12, sep, oct12, oct, nov11, nov); assertDirectoriesInTrash(fs, trashPolicy, y2013, sep12, sep, oct12, oct, nov11, nov);