Search in sources :

Example 1 with MetricsMasterFactory

use of alluxio.master.metrics.MetricsMasterFactory in project alluxio by Alluxio.

the class ConcurrentBlockMasterTest method before.

/**
 * Sets up the dependencies before a test runs.
 */
@Before
public void before() throws Exception {
    mRegistry = new MasterRegistry();
    mMasterContext = MasterTestUtils.testMasterContext();
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, mMasterContext);
    mClock = new ManualClock();
    mExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestBlockMaster-%d", true));
    mClientExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestBlockMaster-%d", true));
    // No one is listening to this latch, so do any preparation for the test
    CountDownLatch voidLatch = new CountDownLatch(1);
    mBlockMaster = new SignalBlockMaster(mMetricsMaster, mMasterContext, mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService), voidLatch);
    mRegistry.add(BlockMaster.class, mBlockMaster);
    mRegistry.start(true);
}
Also used : ManualClock(alluxio.clock.ManualClock) MasterRegistry(alluxio.master.MasterRegistry) CountDownLatch(java.util.concurrent.CountDownLatch) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Before(org.junit.Before)

Example 2 with MetricsMasterFactory

use of alluxio.master.metrics.MetricsMasterFactory 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 3 with MetricsMasterFactory

use of alluxio.master.metrics.MetricsMasterFactory in project alluxio by Alluxio.

the class PermissionCheckTest method before.

@Before
public void before() throws Exception {
    ServerConfiguration.set(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS, mTestFolder.newFolder());
    GroupMappingServiceTestUtils.resetCache();
    mRegistry = new MasterRegistry();
    mRegistry.add(MetricsMaster.class, mMetricsMaster);
    CoreMasterContext masterContext = MasterTestUtils.testMasterContext(new NoopJournalSystem(), new TestUserState(TEST_USER_ADMIN.getUser(), ServerConfiguration.global()));
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
    new BlockMasterFactory().create(mRegistry, masterContext);
    mFileSystemMaster = new FileSystemMasterFactory().create(mRegistry, masterContext);
    mRegistry.start(true);
    createDirAndFileForTest();
}
Also used : BlockMasterFactory(alluxio.master.block.BlockMasterFactory) CoreMasterContext(alluxio.master.CoreMasterContext) TestUserState(alluxio.security.user.TestUserState) MasterRegistry(alluxio.master.MasterRegistry) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Before(org.junit.Before)

Example 4 with MetricsMasterFactory

use of alluxio.master.metrics.MetricsMasterFactory in project alluxio by Alluxio.

the class InodeTreeTest method before.

/**
 * Sets up all dependencies before a test runs.
 */
@Before
public void before() throws Exception {
    mRegistry = new MasterRegistry();
    CoreMasterContext context = MasterTestUtils.testMasterContext();
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, context);
    mRegistry.add(MetricsMaster.class, mMetricsMaster);
    BlockMaster blockMaster = new BlockMasterFactory().create(mRegistry, context);
    InodeDirectoryIdGenerator directoryIdGenerator = new InodeDirectoryIdGenerator(blockMaster);
    UfsManager ufsManager = mock(UfsManager.class);
    MountTable mountTable = new MountTable(ufsManager, mock(MountInfo.class));
    InodeLockManager lockManager = new InodeLockManager();
    mInodeStore = context.getInodeStoreFactory().apply(lockManager);
    mTree = new InodeTree(mInodeStore, blockMaster, directoryIdGenerator, mountTable, lockManager);
    mRegistry.start(true);
    mTree.initializeRoot(TEST_OWNER, TEST_GROUP, TEST_DIR_MODE, NoopJournalContext.INSTANCE);
}
Also used : BlockMaster(alluxio.master.block.BlockMaster) BlockMasterFactory(alluxio.master.block.BlockMasterFactory) UfsManager(alluxio.underfs.UfsManager) CoreMasterContext(alluxio.master.CoreMasterContext) MasterRegistry(alluxio.master.MasterRegistry) MountInfo(alluxio.master.file.meta.options.MountInfo) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Before(org.junit.Before)

Example 5 with MetricsMasterFactory

use of alluxio.master.metrics.MetricsMasterFactory in project alluxio by Alluxio.

the class BlockMasterTest method before.

/**
 * Sets up the dependencies before a test runs.
 */
@Before
public void before() throws Exception {
    mRegistry = new MasterRegistry();
    mMetrics = Lists.newArrayList();
    JournalSystem journalSystem = new NoopJournalSystem();
    CoreMasterContext masterContext = MasterTestUtils.testMasterContext();
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
    mClock = new ManualClock();
    mExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestBlockMaster-%d", true));
    mBlockMaster = new DefaultBlockMaster(mMetricsMaster, masterContext, mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService));
    mRegistry.add(BlockMaster.class, mBlockMaster);
    mRegistry.start(true);
}
Also used : ManualClock(alluxio.clock.ManualClock) CoreMasterContext(alluxio.master.CoreMasterContext) JournalSystem(alluxio.master.journal.JournalSystem) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) MasterRegistry(alluxio.master.MasterRegistry) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Before(org.junit.Before)

Aggregations

MetricsMasterFactory (alluxio.master.metrics.MetricsMasterFactory)18 MasterRegistry (alluxio.master.MasterRegistry)15 BlockMasterFactory (alluxio.master.block.BlockMasterFactory)12 CoreMasterContext (alluxio.master.CoreMasterContext)11 Before (org.junit.Before)9 JournalSystem (alluxio.master.journal.JournalSystem)6 ManualClock (alluxio.clock.ManualClock)4 MountInfo (alluxio.master.file.meta.options.MountInfo)4 NoopJournalSystem (alluxio.master.journal.noop.NoopJournalSystem)4 UfsManager (alluxio.underfs.UfsManager)4 DefaultBlockMaster (alluxio.master.block.DefaultBlockMaster)3 FileSystemMasterFactory (alluxio.master.file.FileSystemMasterFactory)3 InodeDirectoryIdGenerator (alluxio.master.file.meta.InodeDirectoryIdGenerator)3 InodeLockManager (alluxio.master.file.meta.InodeLockManager)3 InodeTree (alluxio.master.file.meta.InodeTree)3 MountTable (alluxio.master.file.meta.MountTable)3 BlockMaster (alluxio.master.block.BlockMaster)2 FileSystemMaster (alluxio.master.file.FileSystemMaster)2 MutableInodeFile (alluxio.master.file.meta.MutableInodeFile)2 TestUserState (alluxio.security.user.TestUserState)2