use of org.apache.gobblin.data.management.copy.CopyableDataset in project incubator-gobblin by apache.
the class DeletingCopyDataPublisherTest method testDeleteOnSource.
@Test
public void testDeleteOnSource() throws Exception {
State state = getTestState("testDeleteOnSource");
Path testMethodTempPath = new Path(testClassTempPath, "testDeleteOnSource");
DeletingCopyDataPublisher copyDataPublisher = closer.register(new DeletingCopyDataPublisher(state));
File outputDir = new File(testMethodTempPath.toString(), "task-output/jobid/1f042f494d1fe2198e0e71a17faa233f33b5099b");
outputDir.mkdirs();
outputDir.deleteOnExit();
WorkUnitState wus = new WorkUnitState();
CopyableDataset copyableDataset = new TestCopyableDataset(new Path("origin"));
CopyableDatasetMetadata metadata = new CopyableDatasetMetadata(copyableDataset);
CopyEntity cf = CopyableFileUtils.createTestCopyableFile(new Path(testMethodTempPath, "test.txt").toString());
CopySource.serializeCopyableDataset(wus, metadata);
CopySource.serializeCopyEntity(wus, cf);
Assert.assertTrue(fs.exists(new Path(testMethodTempPath, "test.txt")));
wus.setWorkingState(WorkingState.SUCCESSFUL);
copyDataPublisher.publishData(ImmutableList.of(wus));
Assert.assertFalse(fs.exists(new Path(testMethodTempPath, "test.txt")));
}
Aggregations