URI journalLocation = JournalUtils.getJournalLocation(); mJournalSystem = new JournalSystem.Builder().setLocation(journalLocation).build(); mRegistry = new MasterRegistry(); mSafeModeManager = new DefaultSafeModeManager(); mBackupManager = new BackupManager(mRegistry);
private void startServices() throws Exception { mRegistry = new MasterRegistry(); JournalSystem journalSystem = JournalTestUtils.createJournalSystem(mJournalFolder.getAbsolutePath()); CoreMasterContext context = MasterTestUtils.testMasterContext(journalSystem); new MetricsMasterFactory().create(mRegistry, context); new BlockMasterFactory().create(mRegistry, context); mFileSystemMaster = new FileSystemMasterFactory().create(mRegistry, context); journalSystem.start(); journalSystem.gainPrimacy(); mRegistry.start(true); mMockJobMasterClient = Mockito.mock(JobMasterClient.class); PowerMockito.mockStatic(JobMasterClient.Factory.class); Mockito.when(JobMasterClient.Factory.create(any(JobMasterClientContext.class))) .thenReturn(mMockJobMasterClient); }
@Before public void before() throws Exception { mRegistry = new MasterRegistry(); mClock = new ManualClock(); mExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestMetricsMaster-%d", true)); mMetricsMaster = new DefaultMetricsMaster(MasterTestUtils.testMasterContext(), mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService)); mRegistry.add(MetricsMaster.class, mMetricsMaster); mRegistry.start(true); }
mRegistry = new MasterRegistry(); mSafeModeManager = new DefaultSafeModeManager(); mBackupManager = new BackupManager(mRegistry);
mMasterProcess = mock(AlluxioMasterProcess.class); ServletContext context = mock(ServletContext.class); mRegistry = new MasterRegistry(); CoreMasterContext masterContext = MasterTestUtils.testMasterContext(); mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
/** * Sets up the dependencies before a test runs. */ @Before public void before() throws Exception { mRegistry = new MasterRegistry(); mSafeModeManager = new TestSafeModeManager(); mStartTimeMs = System.currentTimeMillis(); mPort = ServerConfiguration.getInt(PropertyKey.MASTER_RPC_PORT); 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); }
private void startServices() throws Exception { mRegistry = new MasterRegistry(); mJournalSystem = JournalTestUtils.createJournalSystem(mJournalFolder); CoreMasterContext masterContext = MasterTestUtils.testMasterContext(mJournalSystem);
/** * 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(new InodeStoreArgs(lockManager, ServerConfiguration.global())); mTree = new InodeTree(mInodeStore, blockMaster, directoryIdGenerator, mountTable, lockManager); mRegistry.start(true); mTree.initializeRoot(TEST_OWNER, TEST_GROUP, TEST_DIR_MODE, NoopJournalContext.INSTANCE); }
@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(); mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext); new BlockMasterFactory().create(mRegistry, masterContext); mFileSystemMaster = new FileSystemMasterFactory().create(mRegistry, masterContext); mRegistry.start(true); createDirAndFileForTest(); }
@Before public void before() throws Exception { MasterRegistry registry = new MasterRegistry(); JournalSystem journalSystem = JournalTestUtils.createJournalSystem(mTestFolder); CoreMasterContext context = MasterTestUtils.testMasterContext(journalSystem); new MetricsMasterFactory().create(registry, context); mBlockMaster = new BlockMasterFactory().create(registry, context); InodeDirectoryIdGenerator directoryIdGenerator = new InodeDirectoryIdGenerator(mBlockMaster); UfsManager manager = mock(UfsManager.class); MountTable mountTable = new MountTable(manager, mock(MountInfo.class)); InodeLockManager lockManager = new InodeLockManager(); mInodeStore = context.getInodeStoreFactory() .apply(new InodeStoreArgs(lockManager, ServerConfiguration.global())); 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); mMockReplicationHandler = new MockHandler(); mReplicationChecker = new ReplicationChecker(mInodeTree, mBlockMaster, context.getSafeModeManager(), mMockReplicationHandler); }
sRegistry = new MasterRegistry(); CoreMasterContext masterContext = MasterTestUtils.testMasterContext(); sMetricsMaster = new MetricsMasterFactory().create(sRegistry, masterContext);
/** * Creates a {@link AlluxioSecondaryMaster}. */ AlluxioSecondaryMaster() { try { URI journalLocation = JournalUtils.getJournalLocation(); mJournalSystem = new JournalSystem.Builder().setLocation(journalLocation).build(); mRegistry = new MasterRegistry(); mSafeModeManager = new DefaultSafeModeManager(); mBackupManager = new BackupManager(mRegistry); mStartTimeMs = System.currentTimeMillis(); mPort = Configuration.getInt(PropertyKey.MASTER_RPC_PORT); // Create masters. MasterUtils.createMasters(mRegistry, new MasterContext(mJournalSystem, mSafeModeManager, mBackupManager, mStartTimeMs, mPort)); // Check that journals of each service have been formatted. if (!mJournalSystem.isFormatted()) { throw new RuntimeException( String.format("Journal %s has not been formatted!", journalLocation)); } mLatch = new CountDownLatch(1); } catch (IOException e) { throw new RuntimeException(e); } }
mRegistry = new MasterRegistry(); mSafeModeManager = new DefaultSafeModeManager(); mBackupManager = new BackupManager(mRegistry);