Search in sources :

Example 51 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster 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());
    }
}
Also used : FileInfo(alluxio.wire.FileInfo) FileSystemMaster(alluxio.master.file.FileSystemMaster) FsMasterResource(alluxio.testutils.master.FsMasterResource) AlluxioURI(alluxio.AlluxioURI)

Example 52 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster 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())));
    }
}
Also used : FileSystemMaster(alluxio.master.file.FileSystemMaster) FsMasterResource(alluxio.testutils.master.FsMasterResource) URIStatus(alluxio.client.file.URIStatus) AlluxioURI(alluxio.AlluxioURI)

Example 53 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster 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());
    }
}
Also used : FileSystemMaster(alluxio.master.file.FileSystemMaster) FsMasterResource(alluxio.testutils.master.FsMasterResource) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 54 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster 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);
        }
    }
}
Also used : FileSystemMaster(alluxio.master.file.FileSystemMaster) FsMasterResource(alluxio.testutils.master.FsMasterResource) AlluxioURI(alluxio.AlluxioURI)

Example 55 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster 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);
            }
        }
    }
}
Also used : FileSystemMaster(alluxio.master.file.FileSystemMaster) FsMasterResource(alluxio.testutils.master.FsMasterResource) AlluxioURI(alluxio.AlluxioURI)

Aggregations

FileSystemMaster (alluxio.master.file.FileSystemMaster)61 AlluxioURI (alluxio.AlluxioURI)43 Test (org.junit.Test)27 FsMasterResource (alluxio.testutils.master.FsMasterResource)22 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)16 FileInfo (alluxio.wire.FileInfo)13 URIStatus (alluxio.client.file.URIStatus)10 OperationId (alluxio.wire.OperationId)5 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)4 UnderFileSystemSpy (alluxio.UnderFileSystemSpy)3 BlockMaster (alluxio.master.block.BlockMaster)3 MountPointInfo (alluxio.wire.MountPointInfo)3 FileSystem (alluxio.client.file.FileSystem)2 AccessControlException (alluxio.exception.AccessControlException)2 DefaultFileSystemMaster (alluxio.master.file.DefaultFileSystemMaster)2 PersistJob (alluxio.master.file.PersistJob)2 DeleteContext (alluxio.master.file.contexts.DeleteContext)2 JournalFactory (alluxio.master.journal.JournalFactory)2 Mode (alluxio.security.authorization.Mode)2 ExponentialTimer (alluxio.time.ExponentialTimer)2