use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class JournalIntegrationTest method fileTestUtil.
private void fileTestUtil(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.master.file.FileSystemMaster in project alluxio by Alluxio.
the class JournalIntegrationTest method deleteTestUtil.
private void deleteTestUtil() throws Exception {
FileSystemMaster fsMaster = createFsMasterFromJournal();
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(5, fsMaster.listStatus(mRootUri, ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Never)).size());
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
Assert.assertTrue(fsMaster.getFileId(new AlluxioURI("/i" + i + "/j" + j)) != IdUtils.INVALID_FILE_ID);
}
}
fsMaster.stop();
}
use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class JournalIntegrationTest method renameTestUtil.
private void renameTestUtil() throws Exception {
FileSystemMaster fsMaster = createFsMasterFromJournal();
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(10, fsMaster.listStatus(mRootUri, ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Never)).size());
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
Assert.assertTrue(fsMaster.getFileId(new AlluxioURI("/ii" + i + "/jj" + j)) != IdUtils.INVALID_FILE_ID);
}
}
fsMaster.stop();
}
use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class JournalIntegrationTest method failWhileDeletingCompletedLogs.
@Test
public void failWhileDeletingCompletedLogs() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
mFileSystem.createFile(file).close();
AlluxioURI journal = new AlluxioURI(Configuration.get(PropertyKey.MASTER_JOURNAL_FOLDER));
try (UnderFileSystemSpy ufsSpy = new UnderFileSystemSpy(journal)) {
doThrow(new RuntimeException("Failed to delete completed log")).when(ufsSpy.get()).deleteFile(Mockito.contains("FileSystemMaster/completed"));
try {
// Restart the master again, but with deleting the checkpoint file failing.
mLocalAlluxioCluster.stopFS();
createFsMasterFromJournal();
Assert.fail("Should have failed during delete");
} catch (RuntimeException e) {
Assert.assertEquals("Failed to delete completed log", e.getMessage());
}
}
// We shouldn't lose track of the fact that the file is loaded into memory.
FileSystemMaster fsMaster = createFsMasterFromJournal();
Assert.assertTrue(fsMaster.getInMemoryFiles().contains(file));
}
use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class JournalIntegrationTest method aclTestUtil.
private void aclTestUtil(URIStatus status, String user) throws Exception {
FileSystemMaster fsMaster = createFsMasterFromJournal();
AuthenticatedClientUser.set(user);
FileInfo info = fsMaster.getFileInfo(new AlluxioURI("/file"));
Assert.assertEquals(status, new URIStatus(info));
fsMaster.stop();
}
Aggregations