Search in sources :

Example 1 with ControllableScheduler

use of alluxio.util.executor.ControllableScheduler in project alluxio by Alluxio.

the class AccessTimeUpdaterTest method before.

@Before
public final void before() throws Exception {
    mFileSystemMaster = Mockito.mock(FileSystemMaster.class);
    when(mFileSystemMaster.getName()).thenReturn(Constants.FILE_SYSTEM_MASTER_NAME);
    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.SECURITY_AUTHORIZATION_PERMISSION_ENABLED, true);
    ServerConfiguration.set(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_SUPERGROUP, "test-supergroup");
    mInodeTree.initializeRoot(TEST_OWNER, TEST_GROUP, TEST_MODE, NoopJournalContext.INSTANCE);
    mScheduler = new ControllableScheduler();
}
Also used : InodeDirectoryIdGenerator(alluxio.master.file.meta.InodeDirectoryIdGenerator) BlockMasterFactory(alluxio.master.block.BlockMasterFactory) UfsManager(alluxio.underfs.UfsManager) InodeLockManager(alluxio.master.file.meta.InodeLockManager) ControllableScheduler(alluxio.util.executor.ControllableScheduler) 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 2 with ControllableScheduler

use of alluxio.util.executor.ControllableScheduler in project alluxio by Alluxio.

the class DailyMetadataBackupTest method before.

@Before
public void before() throws Exception {
    mRandom = new Random();
    mBackupDir = "/tmp/test/alluxio_backups";
    mMetaMaster = Mockito.mock(MetaMaster.class);
    when(mMetaMaster.backup(any(), any())).thenReturn(BackupStatus.fromProto(BackupPStatus.newBuilder().setBackupId(UUID.randomUUID().toString()).setBackupState(BackupState.Completed).setBackupUri(PathUtils.concatPath(mBackupDir, generateBackupFileName())).setBackupHost("localhost").build()));
    mUfs = Mockito.mock(UnderFileSystem.class);
    when(mUfs.getUnderFSType()).thenReturn("local");
    when(mUfs.deleteFile(any())).thenReturn(true);
    mUfsClient = Mockito.mock(UfsManager.UfsClient.class);
    when(mUfsClient.acquireUfsResource()).thenReturn(new CloseableResource<UnderFileSystem>(mUfs) {

        @Override
        public void closeResource() {
        // Noop
        }
    });
    mUfsManager = Mockito.mock(UfsManager.class);
    when(mUfsManager.getRoot()).thenReturn(mUfsClient);
    mScheduler = new ControllableScheduler();
}
Also used : Random(java.util.Random) UfsManager(alluxio.underfs.UfsManager) ControllableScheduler(alluxio.util.executor.ControllableScheduler) UnderFileSystem(alluxio.underfs.UnderFileSystem) Before(org.junit.Before)

Aggregations

UfsManager (alluxio.underfs.UfsManager)2 ControllableScheduler (alluxio.util.executor.ControllableScheduler)2 Before (org.junit.Before)2 MasterRegistry (alluxio.master.MasterRegistry)1 BlockMasterFactory (alluxio.master.block.BlockMasterFactory)1 InodeDirectoryIdGenerator (alluxio.master.file.meta.InodeDirectoryIdGenerator)1 InodeLockManager (alluxio.master.file.meta.InodeLockManager)1 InodeTree (alluxio.master.file.meta.InodeTree)1 MountTable (alluxio.master.file.meta.MountTable)1 MountInfo (alluxio.master.file.meta.options.MountInfo)1 JournalSystem (alluxio.master.journal.JournalSystem)1 MetricsMasterFactory (alluxio.master.metrics.MetricsMasterFactory)1 UnderFileSystem (alluxio.underfs.UnderFileSystem)1 Random (java.util.Random)1