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);
}
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();
}
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);
}
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);
}
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()));
}
Aggregations