Search in sources :

Example 1 with FuseShell

use of alluxio.cli.FuseShell in project alluxio by Alluxio.

the class FuseShellTest method before.

@Before
public void before() throws Exception {
    mConf.set(PropertyKey.USER_METADATA_CACHE_ENABLED, true);
    ClientContext clientContext = ClientContext.create(mConf);
    FileSystemContext fileContext = PowerMockito.mock(FileSystemContext.class);
    mFileSystemMasterClient = new GetStatusFileSystemMasterClient();
    when(fileContext.acquireMasterClientResource()).thenReturn(new CloseableResource<FileSystemMasterClient>(mFileSystemMasterClient) {

        @Override
        public void closeResource() {
        // Noop.
        }
    });
    when(fileContext.getClientContext()).thenReturn(clientContext);
    when(fileContext.getClusterConf()).thenReturn(mConf);
    when(fileContext.getPathConf(any())).thenReturn(mConf);
    when(fileContext.getUriValidationEnabled()).thenReturn(true);
    mFileSystem = new MetadataCachingBaseFileSystem(fileContext);
    mFuseShell = new FuseShell(mFileSystem, mConf);
    mFileStatusMap = new HashMap<>();
    mFileStatusMap.put(FILE, FILE_STATUS);
    mFileStatusMap.put(DIR, DIR_STATUS);
    // Here metadata cache will have two contents.
    mFileSystem.getStatus(FILE);
    mFileSystem.getStatus(DIR);
    // Remove from map, so the result will get from cache.
    mFileStatusMap.remove(FILE);
    mFileStatusMap.remove(DIR);
}
Also used : FileSystemMasterClient(alluxio.client.file.FileSystemMasterClient) MetadataCachingBaseFileSystem(alluxio.client.file.MetadataCachingBaseFileSystem) ClientContext(alluxio.ClientContext) FuseShell(alluxio.cli.FuseShell) FileSystemContext(alluxio.client.file.FileSystemContext) Before(org.junit.Before)

Aggregations

ClientContext (alluxio.ClientContext)1 FuseShell (alluxio.cli.FuseShell)1 FileSystemContext (alluxio.client.file.FileSystemContext)1 FileSystemMasterClient (alluxio.client.file.FileSystemMasterClient)1 MetadataCachingBaseFileSystem (alluxio.client.file.MetadataCachingBaseFileSystem)1 Before (org.junit.Before)1