use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class AbstractFileSystemTest method getStatus.
@Test
public void getStatus() throws Exception {
FileInfo fileInfo = new FileInfo().setLastModificationTimeMs(111L).setFolder(false).setOwner("user1").setGroup("group1").setMode(00755);
Path path = new Path("/dir");
alluxio.client.file.FileSystem alluxioFs = Mockito.mock(alluxio.client.file.FileSystem.class);
Mockito.when(alluxioFs.getStatus(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)))).thenReturn(new URIStatus(fileInfo));
FileSystem alluxioHadoopFs = new FileSystem(alluxioFs);
FileStatus fileStatus = alluxioHadoopFs.getFileStatus(path);
assertFileInfoEqualsFileStatus(fileInfo, fileStatus);
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class JournalIntegrationTest method loadMetadataTestUtil.
private void loadMetadataTestUtil(URIStatus status) throws AccessControlException, IOException, InvalidPathException, FileDoesNotExistException {
FileSystemMaster fsMaster = createFsMasterFromJournal();
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(1, fsMaster.listStatus(mRootUri, ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Never)).size());
Assert.assertTrue(fsMaster.getFileId(new AlluxioURI("/xyz")) != IdUtils.INVALID_FILE_ID);
FileInfo fsMasterInfo = fsMaster.getFileInfo(fsMaster.getFileId(new AlluxioURI("/xyz")));
Assert.assertEquals(status, new URIStatus(fsMasterInfo));
fsMaster.stop();
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class JournalIntegrationTest method addBlockTestUtil.
private void addBlockTestUtil(URIStatus status) throws AccessControlException, IOException, InvalidPathException, FileDoesNotExistException {
FileSystemMaster fsMaster = createFsMasterFromJournal();
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(1, fsMaster.listStatus(mRootUri, ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Never)).size());
long xyzId = fsMaster.getFileId(new AlluxioURI("/xyz"));
Assert.assertTrue(xyzId != IdUtils.INVALID_FILE_ID);
FileInfo fsMasterInfo = fsMaster.getFileInfo(xyzId);
Assert.assertEquals(0, fsMaster.getFileInfo(xyzId).getInMemoryPercentage());
Assert.assertEquals(status.getBlockIds(), fsMasterInfo.getBlockIds());
Assert.assertEquals(status.getBlockSizeBytes(), fsMasterInfo.getBlockSizeBytes());
Assert.assertEquals(status.getLength(), fsMasterInfo.getLength());
fsMaster.stop();
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class BaseFileSystemTest method listStatus.
/**
* Tests for the {@link BaseFileSystem#listStatus(AlluxioURI, ListStatusOptions)} method.
*/
@Test
public void listStatus() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
List<URIStatus> infos = new ArrayList<>();
infos.add(new URIStatus(new FileInfo()));
ListStatusOptions listStatusOptions = ListStatusOptions.defaults();
Mockito.when(mFileSystemMasterClient.listStatus(file, listStatusOptions)).thenReturn(infos);
Assert.assertSame(infos, mFileSystem.listStatus(file, listStatusOptions));
Mockito.verify(mFileSystemMasterClient).listStatus(file, listStatusOptions);
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class BaseFileSystemTest method getStatus.
/**
* Tests for the {@link BaseFileSystem#getStatus(AlluxioURI, GetStatusOptions)} method.
*/
@Test
public void getStatus() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
URIStatus status = new URIStatus(new FileInfo());
Mockito.when(mFileSystemMasterClient.getStatus(file)).thenReturn(status);
GetStatusOptions getStatusOptions = GetStatusOptions.defaults();
Assert.assertSame(status, mFileSystem.getStatus(file, getStatusOptions));
Mockito.verify(mFileSystemMasterClient).getStatus(file);
}
Aggregations