use of alluxio.master.lineage.meta.LineageStoreView in project alluxio by Alluxio.
the class CheckpointLatestPlannerTest method before.
/**
* Sets up all dependencies before a test runs.
*/
@Before
public void before() {
mLineageStore = new LineageStore(new LineageIdGenerator());
mJob = new CommandLineJob("test", new JobConf("output"));
mFileSystemMaster = Mockito.mock(FileSystemMaster.class);
mPlanner = new CheckpointLatestPlanner(new LineageStoreView(mLineageStore), new FileSystemMasterView(mFileSystemMaster));
}
use of alluxio.master.lineage.meta.LineageStoreView in project alluxio by Alluxio.
the class CheckpointLatestPlannerTest method schedule.
/**
* Tests the {@link CheckpointLatestPlanner#generatePlan(LineageStoreView, FileSystemMasterView)}
* method.
*/
@Test
public void schedule() throws Exception {
long fileId1 = 1L;
long fileId2 = 2L;
long l1 = mLineageStore.createLineage(new ArrayList<Long>(), Lists.newArrayList(fileId1), mJob);
// Sleep for 1ms to guarantee that the next lineage's creation time is later than the first's
CommonUtils.sleepMs(1);
long l2 = mLineageStore.createLineage(Lists.newArrayList(fileId1), Lists.newArrayList(fileId2), mJob);
Mockito.when(mFileSystemMaster.getPersistenceState(fileId1)).thenReturn(PersistenceState.NOT_PERSISTED);
Mockito.when(mFileSystemMaster.getPersistenceState(fileId2)).thenReturn(PersistenceState.NOT_PERSISTED);
FileInfo fileInfo1 = new FileInfo();
fileInfo1.setCompleted(true);
Mockito.when(mFileSystemMaster.getFileInfo(fileId1)).thenReturn(fileInfo1);
FileInfo fileInfo2 = new FileInfo();
fileInfo2.setCompleted(false);
Mockito.when(mFileSystemMaster.getFileInfo(fileId2)).thenReturn(fileInfo2);
CheckpointPlan plan = mPlanner.generatePlan(new LineageStoreView(mLineageStore), new FileSystemMasterView(mFileSystemMaster));
Assert.assertEquals((Long) l1, plan.getLineagesToCheckpoint().get(0));
// complete file 2 and it's ready for checkpoint
fileInfo2.setCompleted(true);
plan = mPlanner.generatePlan(new LineageStoreView(mLineageStore), new FileSystemMasterView(mFileSystemMaster));
Assert.assertEquals((Long) l2, plan.getLineagesToCheckpoint().get(0));
}
Aggregations