use of org.apache.gobblin.source.extractor.extract.google.GoogleDriveSource in project incubator-gobblin by apache.
the class GoogleDriveSourceTest method testGetExtractor.
public void testGetExtractor() throws IOException {
@SuppressWarnings("rawtypes") GoogleDriveSource source = new GoogleDriveSource<>();
GoogleDriveFsHelper fsHelper = mock(GoogleDriveFsHelper.class);
source.fsHelper = fsHelper;
Extractor extractor = source.getExtractor(new WorkUnitState());
Assert.assertTrue(extractor instanceof GoogleDriveExtractor);
}
use of org.apache.gobblin.source.extractor.extract.google.GoogleDriveSource in project incubator-gobblin by apache.
the class GoogleDriveSourceTest method testGetcurrentFsSnapshot.
@SuppressWarnings("unchecked")
public void testGetcurrentFsSnapshot() throws FileBasedHelperException {
@SuppressWarnings("rawtypes") GoogleDriveSource source = new GoogleDriveSource<>();
GoogleDriveFsHelper fsHelper = mock(GoogleDriveFsHelper.class);
source.fsHelper = fsHelper;
List<String> fileIds = ImmutableList.of("test1", "test2", "test3");
when(fsHelper.ls(anyString())).thenReturn(fileIds);
long timestamp = System.currentTimeMillis();
when(fsHelper.getFileMTime(anyString())).thenReturn(timestamp);
List<String> expected = Lists.newArrayList();
for (String fileId : fileIds) {
expected.add(fileId + source.splitPattern + timestamp);
}
Assert.assertEquals(expected, source.getcurrentFsSnapshot(new State()));
}
Aggregations