use of alluxio.testutils.master.FsMasterResource in project alluxio by Alluxio.
the class UfsJournalIntegrationTest method addBlockTestUtil.
private void addBlockTestUtil(URIStatus status) throws Exception {
try (FsMasterResource masterResource = createFsMasterFromJournal()) {
FileSystemMaster fsMaster = masterResource.getRegistry().get(FileSystemMaster.class);
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(1, fsMaster.listStatus(mRootUri, ListStatusContext.mergeFrom(ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.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());
}
}
use of alluxio.testutils.master.FsMasterResource in project alluxio by Alluxio.
the class UfsJournalIntegrationTest method fileTestUtil.
private void fileTestUtil(URIStatus status) throws Exception {
try (FsMasterResource masterResource = createFsMasterFromJournal()) {
FileSystemMaster fsMaster = masterResource.getRegistry().get(FileSystemMaster.class);
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(1, fsMaster.listStatus(mRootUri, ListStatusContext.mergeFrom(ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER))).size());
long fileId = fsMaster.getFileId(new AlluxioURI("/xyz"));
Assert.assertTrue(fileId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(status, new URIStatus(fsMaster.getFileInfo(fileId).setMountId(status.getMountId())));
}
}
use of alluxio.testutils.master.FsMasterResource in project alluxio by Alluxio.
the class UfsJournalIntegrationTest method emptyFileSystem.
@Test
public void emptyFileSystem() throws Exception {
Assert.assertEquals(0, mFileSystem.listStatus(mRootUri).size());
mLocalAlluxioCluster.stopFS();
try (FsMasterResource masterResource = createFsMasterFromJournal()) {
FileSystemMaster fsMaster = masterResource.getRegistry().get(FileSystemMaster.class);
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(0, fsMaster.listStatus(mRootUri, ListStatusContext.mergeFrom(ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER))).size());
}
}
use of alluxio.testutils.master.FsMasterResource in project alluxio by Alluxio.
the class UfsJournalIntegrationTest method manyFileTestUtil.
private void manyFileTestUtil() throws Exception {
try (FsMasterResource masterResource = createFsMasterFromJournal()) {
FileSystemMaster fsMaster = masterResource.getRegistry().get(FileSystemMaster.class);
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(10, fsMaster.listStatus(mRootUri, ListStatusContext.mergeFrom(ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER))).size());
for (int k = 0; k < 10; k++) {
Assert.assertTrue(fsMaster.getFileId(new AlluxioURI("/a" + k)) != IdUtils.INVALID_FILE_ID);
}
}
}
use of alluxio.testutils.master.FsMasterResource in project alluxio by Alluxio.
the class UfsJournalIntegrationTest method renameTestUtil.
private void renameTestUtil() throws Exception {
try (FsMasterResource masterResource = createFsMasterFromJournal()) {
FileSystemMaster fsMaster = masterResource.getRegistry().get(FileSystemMaster.class);
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(10, fsMaster.listStatus(mRootUri, ListStatusContext.mergeFrom(ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.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);
}
}
}
}
Aggregations