use of alluxio.AlluxioURI 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.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method file.
/**
* Tests file creation.
*/
@Test
public void file() throws Exception {
CreateFileOptions option = CreateFileOptions.defaults().setBlockSizeBytes(64);
AlluxioURI filePath = new AlluxioURI("/xyz");
mFileSystem.createFile(filePath, option).close();
URIStatus status = mFileSystem.getStatus(filePath);
mLocalAlluxioCluster.stopFS();
fileTestUtil(status);
deleteFsMasterJournalLogs();
fileTestUtil(status);
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method fileDirectory.
/**
* Tests file and directory creation.
*/
@Test
public void fileDirectory() throws Exception {
for (int i = 0; i < 10; i++) {
mFileSystem.createDirectory(new AlluxioURI("/i" + i));
for (int j = 0; j < 10; j++) {
CreateFileOptions option = CreateFileOptions.defaults().setBlockSizeBytes((i + j + 1) * 64);
mFileSystem.createFile(new AlluxioURI("/i" + i + "/j" + j), option).close();
}
}
mLocalAlluxioCluster.stopFS();
fileDirectoryTestUtil();
deleteFsMasterJournalLogs();
fileDirectoryTestUtil();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class JournalIntegrationTest method directoryTestUtil.
private void directoryTestUtil(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 fileId = fsMaster.getFileId(new AlluxioURI("/xyz"));
Assert.assertTrue(fileId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(status, new URIStatus(fsMaster.getFileInfo(fileId)));
fsMaster.stop();
}
use of alluxio.AlluxioURI 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();
}
Aggregations