Search in sources :

Example 6 with UfsManager

use of alluxio.underfs.UfsManager in project alluxio by Alluxio.

the class ReplicationCheckerTest method before.

@Before
public void before() throws Exception {
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_TYPE, "UFS");
    MasterRegistry registry = new MasterRegistry();
    JournalSystem journalSystem = JournalTestUtils.createJournalSystem(mTestFolder);
    mContext = MasterTestUtils.testMasterContext(journalSystem);
    new MetricsMasterFactory().create(registry, mContext);
    mBlockMaster = new BlockMasterFactory().create(registry, mContext);
    InodeDirectoryIdGenerator directoryIdGenerator = new InodeDirectoryIdGenerator(mBlockMaster);
    UfsManager manager = mock(UfsManager.class);
    MountTable mountTable = new MountTable(manager, mock(MountInfo.class));
    InodeLockManager lockManager = new InodeLockManager();
    mInodeStore = mContext.getInodeStoreFactory().apply(lockManager);
    mInodeTree = new InodeTree(mInodeStore, mBlockMaster, directoryIdGenerator, mountTable, lockManager);
    journalSystem.start();
    journalSystem.gainPrimacy();
    mBlockMaster.start(true);
    ServerConfiguration.set(PropertyKey.TEST_MODE, true);
    ServerConfiguration.set(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED, true);
    ServerConfiguration.set(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_SUPERGROUP, "test-supergroup");
    mInodeTree.initializeRoot(TEST_OWNER, TEST_GROUP, TEST_MODE, NoopJournalContext.INSTANCE);
    mMockReplicationHandler = new MockHandler();
    mReplicationChecker = new ReplicationChecker(mInodeTree, mBlockMaster, mContext.getSafeModeManager(), mMockReplicationHandler);
}
Also used : InodeDirectoryIdGenerator(alluxio.master.file.meta.InodeDirectoryIdGenerator) BlockMasterFactory(alluxio.master.block.BlockMasterFactory) UfsManager(alluxio.underfs.UfsManager) InodeLockManager(alluxio.master.file.meta.InodeLockManager) JournalSystem(alluxio.master.journal.JournalSystem) MasterRegistry(alluxio.master.MasterRegistry) MountTable(alluxio.master.file.meta.MountTable) MountInfo(alluxio.master.file.meta.options.MountInfo) InodeTree(alluxio.master.file.meta.InodeTree) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Before(org.junit.Before)

Example 7 with UfsManager

use of alluxio.underfs.UfsManager in project alluxio by Alluxio.

the class UfsFileWriteHandlerTest method before.

@Before
public void before() throws Exception {
    mFile = mTestFolder.newFile();
    mOutputStream = new FileOutputStream(mFile);
    UnderFileSystem mockUfs = Mockito.mock(UnderFileSystem.class);
    UfsManager ufsManager = Mockito.mock(UfsManager.class);
    UfsClient ufsClient = new UfsClient(() -> mockUfs, AlluxioURI.EMPTY_URI);
    Mockito.when(ufsManager.get(TEST_MOUNT_ID)).thenReturn(ufsClient);
    Mockito.when(mockUfs.createNonexistingFile(Mockito.anyString(), Mockito.any(CreateOptions.class))).thenReturn(mOutputStream).thenReturn(new FileOutputStream(mFile, true));
    mResponseObserver = Mockito.mock(StreamObserver.class);
    mWriteHandler = new UfsFileWriteHandler(ufsManager, mResponseObserver, mUserInfo);
    setupResponseTrigger();
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) UfsManager(alluxio.underfs.UfsManager) FileOutputStream(java.io.FileOutputStream) UfsClient(alluxio.underfs.UfsManager.UfsClient) UnderFileSystem(alluxio.underfs.UnderFileSystem) Before(org.junit.Before)

Example 8 with UfsManager

use of alluxio.underfs.UfsManager in project alluxio by Alluxio.

the class BlockWorkerDataReaderTest method before.

@Before
public void before() throws Exception {
    BlockMasterClient blockMasterClient = mock(BlockMasterClient.class);
    BlockMasterClientPool blockMasterClientPool = spy(new BlockMasterClientPool());
    when(blockMasterClientPool.createNewResource()).thenReturn(blockMasterClient);
    TieredBlockStore blockStore = new TieredBlockStore();
    FileSystemMasterClient fileSystemMasterClient = mock(FileSystemMasterClient.class);
    Sessions sessions = mock(Sessions.class);
    // Connect to the real UFS for UFS read testing
    UfsManager ufsManager = mock(UfsManager.class);
    mRootUfs = ServerConfiguration.getString(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS);
    UfsManager.UfsClient ufsClient = new UfsManager.UfsClient(() -> UnderFileSystem.Factory.create(mRootUfs, UnderFileSystemConfiguration.defaults(ServerConfiguration.global())), new AlluxioURI(mRootUfs));
    when(ufsManager.get(anyLong())).thenReturn(ufsClient);
    mBlockWorker = new DefaultBlockWorker(blockMasterClientPool, fileSystemMasterClient, sessions, blockStore, ufsManager);
    URIStatus dummyStatus = new URIStatus(new FileInfo().setBlockIds(Collections.singletonList(BLOCK_ID)));
    InStreamOptions options = new InStreamOptions(dummyStatus, FileSystemOptions.openFileDefaults(mConf), mConf);
    mDataReaderFactory = new BlockWorkerDataReader.Factory(mBlockWorker, BLOCK_ID, CHUNK_SIZE, options);
}
Also used : BlockMasterClientPool(alluxio.worker.block.BlockMasterClientPool) UfsManager(alluxio.underfs.UfsManager) Sessions(alluxio.Sessions) URIStatus(alluxio.client.file.URIStatus) TieredBlockStore(alluxio.worker.block.TieredBlockStore) InStreamOptions(alluxio.client.file.options.InStreamOptions) BlockWorkerDataReader(alluxio.client.block.stream.BlockWorkerDataReader) FileSystemMasterClient(alluxio.worker.file.FileSystemMasterClient) FileInfo(alluxio.wire.FileInfo) BlockMasterClient(alluxio.worker.block.BlockMasterClient) DefaultBlockWorker(alluxio.worker.block.DefaultBlockWorker) AlluxioURI(alluxio.AlluxioURI) Before(org.junit.Before)

Example 9 with UfsManager

use of alluxio.underfs.UfsManager in project alluxio by Alluxio.

the class BlockWorkerRegisterStreamIntegrationTest method initBlockWorker.

public void initBlockWorker() throws Exception {
    // Prepare a block worker
    mBlockMasterClientPool = spy(new BlockMasterClientPool());
    when(mBlockMasterClientPool.createNewResource()).thenReturn(mBlockMasterClient);
    when(mBlockMasterClientPool.acquire()).thenReturn(mBlockMasterClient);
    TieredBlockStore mBlockStore = spy(new TieredBlockStore());
    FileSystemMasterClient mFileSystemMasterClient = mock(FileSystemMasterClient.class);
    Sessions mSessions = mock(Sessions.class);
    UfsManager mUfsManager = mock(UfsManager.class);
    mBlockWorker = new DefaultBlockWorker(mBlockMasterClientPool, mFileSystemMasterClient, mSessions, mBlockStore, mUfsManager);
}
Also used : BlockMasterClientPool(alluxio.worker.block.BlockMasterClientPool) FileSystemMasterClient(alluxio.worker.file.FileSystemMasterClient) UfsManager(alluxio.underfs.UfsManager) Sessions(alluxio.Sessions) DefaultBlockWorker(alluxio.worker.block.DefaultBlockWorker) TieredBlockStore(alluxio.worker.block.TieredBlockStore)

Example 10 with UfsManager

use of alluxio.underfs.UfsManager in project alluxio by Alluxio.

the class MountTableTest method before.

@Before
public void before() throws Exception {
    UfsManager ufsManager = mock(UfsManager.class);
    UfsClient ufsClient = new UfsManager.UfsClient(() -> mTestUfs, AlluxioURI.EMPTY_URI);
    when(ufsManager.get(anyLong())).thenReturn(ufsClient);
    mMountTable = new MountTable(ufsManager, new MountInfo(new AlluxioURI(MountTable.ROOT), new AlluxioURI(ROOT_UFS), IdUtils.ROOT_MOUNT_ID, MountContext.defaults().getOptions().build()));
}
Also used : UfsManager(alluxio.underfs.UfsManager) UfsClient(alluxio.underfs.UfsManager.UfsClient) MountInfo(alluxio.master.file.meta.options.MountInfo) AlluxioURI(alluxio.AlluxioURI) Before(org.junit.Before)

Aggregations

UfsManager (alluxio.underfs.UfsManager)13 Before (org.junit.Before)9 MountInfo (alluxio.master.file.meta.options.MountInfo)6 AlluxioURI (alluxio.AlluxioURI)5 MountTable (alluxio.master.file.meta.MountTable)5 MasterRegistry (alluxio.master.MasterRegistry)4 BlockMasterFactory (alluxio.master.block.BlockMasterFactory)4 InodeDirectoryIdGenerator (alluxio.master.file.meta.InodeDirectoryIdGenerator)4 InodeLockManager (alluxio.master.file.meta.InodeLockManager)4 InodeTree (alluxio.master.file.meta.InodeTree)4 MetricsMasterFactory (alluxio.master.metrics.MetricsMasterFactory)4 UnderFileSystem (alluxio.underfs.UnderFileSystem)4 Sessions (alluxio.Sessions)3 CoreMasterContext (alluxio.master.CoreMasterContext)3 BlockMaster (alluxio.master.block.BlockMaster)3 FileInfo (alluxio.wire.FileInfo)3 TieredBlockStore (alluxio.worker.block.TieredBlockStore)3 FileSystemMasterClient (alluxio.worker.file.FileSystemMasterClient)3 FileSystemContext (alluxio.client.file.FileSystemContext)2 URIStatus (alluxio.client.file.URIStatus)2