use of alluxio.master.block.BlockMasterFactory in project alluxio by Alluxio.
the class JournalContextTest method before.
@Before
public void before() throws Exception {
ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_TYPE, mJournalType);
mRegistry = new MasterRegistry();
mJournalSystem = JournalTestUtils.createJournalSystem(mTemporaryFolder);
mJournalSystem.format();
mMasterContext = MasterTestUtils.testMasterContext(mJournalSystem);
new MetricsMasterFactory().create(mRegistry, mMasterContext);
mBlockMaster = new BlockMasterFactory().create(mRegistry, mMasterContext);
// start
mJournalSystem.start();
mJournalSystem.gainPrimacy();
mRegistry.start(true);
}
use of alluxio.master.block.BlockMasterFactory in project alluxio by Alluxio.
the class PersistenceTest method startServices.
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);
}
use of alluxio.master.block.BlockMasterFactory in project alluxio by Alluxio.
the class JournalSinkTest method startMasters.
private void startMasters(MasterRegistry registry, JournalSystem journalSystem, JournalSink sink, boolean leader) throws Exception {
CoreMasterContext masterContext = MasterTestUtils.testMasterContext(journalSystem);
new MetricsMasterFactory().create(registry, masterContext);
new BlockMasterFactory().create(registry, masterContext);
new FileSystemMasterFactory().create(registry, masterContext);
if (sink != null) {
// add journal sink
journalSystem.addJournalSink(registry.get(FileSystemMaster.class), sink);
}
journalSystem.start();
if (leader) {
journalSystem.gainPrimacy();
}
registry.start(leader);
}
use of alluxio.master.block.BlockMasterFactory in project alluxio by Alluxio.
the class AlluxioMasterRestServiceHandlerTest method before.
@Before
public void before() throws Exception {
mMasterProcess = mock(AlluxioMasterProcess.class);
ServletContext context = mock(ServletContext.class);
mRegistry = new MasterRegistry();
CoreMasterContext masterContext = MasterTestUtils.testMasterContext();
mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
mRegistry.add(MetricsMaster.class, mMetricsMaster);
registerMockUfs();
mBlockMaster = new BlockMasterFactory().create(mRegistry, masterContext);
mFileSystemMaster = new FileSystemMasterFactory().create(mRegistry, masterContext);
mRegistry.start(true);
when(mMasterProcess.getMaster(BlockMaster.class)).thenReturn(mBlockMaster);
when(mMasterProcess.getMaster(FileSystemMaster.class)).thenReturn(mFileSystemMaster);
when(context.getAttribute(MasterWebServer.ALLUXIO_MASTER_SERVLET_RESOURCE_KEY)).thenReturn(mMasterProcess);
mHandler = new AlluxioMasterRestServiceHandler(context);
// Register two workers
long worker1 = mBlockMaster.getWorkerId(NET_ADDRESS_1);
long worker2 = mBlockMaster.getWorkerId(NET_ADDRESS_2);
List<String> tiers = Arrays.asList(Constants.MEDIUM_MEM, Constants.MEDIUM_SSD);
mBlockMaster.workerRegister(worker1, tiers, WORKER1_TOTAL_BYTES_ON_TIERS, WORKER1_USED_BYTES_ON_TIERS, NO_BLOCKS_ON_LOCATIONS, NO_LOST_STORAGE, RegisterWorkerPOptions.getDefaultInstance());
mBlockMaster.workerRegister(worker2, tiers, WORKER2_TOTAL_BYTES_ON_TIERS, WORKER2_USED_BYTES_ON_TIERS, NO_BLOCKS_ON_LOCATIONS, NO_LOST_STORAGE, RegisterWorkerPOptions.getDefaultInstance());
String filesPinnedProperty = MetricKey.MASTER_FILES_PINNED.getName();
MetricsSystem.METRIC_REGISTRY.remove(filesPinnedProperty);
}
use of alluxio.master.block.BlockMasterFactory in project alluxio by Alluxio.
the class FileSystemMasterTest method startServices.
private void startServices() throws Exception {
mRegistry = new MasterRegistry();
mJournalSystem = JournalTestUtils.createJournalSystem(mJournalFolder);
CoreMasterContext masterContext = MasterTestUtils.testMasterContext(mJournalSystem, new TestUserState(TEST_USER, ServerConfiguration.global()));
mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
mRegistry.add(MetricsMaster.class, mMetricsMaster);
mMetrics = Lists.newArrayList();
mBlockMaster = new BlockMasterFactory().create(mRegistry, masterContext);
mExecutorService = Executors.newFixedThreadPool(4, ThreadFactoryUtils.build("DefaultFileSystemMasterTest-%d", true));
mFileSystemMaster = new DefaultFileSystemMaster(mBlockMaster, masterContext, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService));
mInodeStore = mFileSystemMaster.getInodeStore();
mInodeTree = mFileSystemMaster.getInodeTree();
mRegistry.add(FileSystemMaster.class, mFileSystemMaster);
mJournalSystem.start();
mJournalSystem.gainPrimacy();
mRegistry.start(true);
// set up workers
mWorkerId1 = mBlockMaster.getWorkerId(new WorkerNetAddress().setHost("localhost").setRpcPort(80).setDataPort(81).setWebPort(82));
mBlockMaster.workerRegister(mWorkerId1, Arrays.asList(Constants.MEDIUM_MEM, Constants.MEDIUM_SSD), ImmutableMap.of(Constants.MEDIUM_MEM, (long) Constants.MB, Constants.MEDIUM_SSD, (long) Constants.MB), ImmutableMap.of(Constants.MEDIUM_MEM, (long) Constants.KB, Constants.MEDIUM_SSD, (long) Constants.KB), ImmutableMap.of(), new HashMap<String, StorageList>(), RegisterWorkerPOptions.getDefaultInstance());
mWorkerId2 = mBlockMaster.getWorkerId(new WorkerNetAddress().setHost("remote").setRpcPort(80).setDataPort(81).setWebPort(82));
mBlockMaster.workerRegister(mWorkerId2, Arrays.asList(Constants.MEDIUM_MEM, Constants.MEDIUM_SSD), ImmutableMap.of(Constants.MEDIUM_MEM, (long) Constants.MB, Constants.MEDIUM_SSD, (long) Constants.MB), ImmutableMap.of(Constants.MEDIUM_MEM, (long) Constants.KB, Constants.MEDIUM_SSD, (long) Constants.KB), ImmutableMap.of(), new HashMap<String, StorageList>(), RegisterWorkerPOptions.getDefaultInstance());
}
Aggregations