Search in sources :

Example 21 with FsMasterResource

use of alluxio.testutils.master.FsMasterResource in project alluxio by Alluxio.

the class UfsJournalIntegrationTest method directoryTestUtil.

private void directoryTestUtil(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 22 with FsMasterResource

use of alluxio.testutils.master.FsMasterResource in project alluxio by Alluxio.

the class UfsJournalIntegrationTest method deleteTestUtil.

private void deleteTestUtil() 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(5, fsMaster.listStatus(mRootUri, ListStatusContext.mergeFrom(ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.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);
            }
        }
    }
}
Also used : FileSystemMaster(alluxio.master.file.FileSystemMaster) FsMasterResource(alluxio.testutils.master.FsMasterResource) AlluxioURI(alluxio.AlluxioURI)

Aggregations

FileSystemMaster (alluxio.master.file.FileSystemMaster)22 FsMasterResource (alluxio.testutils.master.FsMasterResource)22 AlluxioURI (alluxio.AlluxioURI)20 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)11 Test (org.junit.Test)11 FileInfo (alluxio.wire.FileInfo)8 URIStatus (alluxio.client.file.URIStatus)5 Mode (alluxio.security.authorization.Mode)2 UfsMode (alluxio.underfs.UfsMode)2 MountPointInfo (alluxio.wire.MountPointInfo)2 FileSystem (alluxio.client.file.FileSystem)1 AccessControlException (alluxio.exception.AccessControlException)1 MountPOptions (alluxio.grpc.MountPOptions)1 UfsDirectoryStatus (alluxio.underfs.UfsDirectoryStatus)1 UnderFileSystem (alluxio.underfs.UnderFileSystem)1 UnderFileSystemFactory (alluxio.underfs.UnderFileSystemFactory)1 File (java.io.File)1 IOException (java.io.IOException)1 Ignore (org.junit.Ignore)1 ExpectedException (org.junit.rules.ExpectedException)1