use of alluxio.wire.BlockMasterInfo in project alluxio by Alluxio.
the class SummaryCommandTest method prepareDependencies.
@Before
public void prepareDependencies() throws IOException {
// Generate random values for MasterInfo and BlockMasterInfo
// Prepare mock meta master client
mMetaMasterClient = mock(MetaMasterClient.class);
MasterInfo masterInfo = MasterInfo.newBuilder().setLeaderMasterAddress("testAddress").setWebPort(1231).setRpcPort(8462).setStartTimeMs(1131242343122L).setUpTimeMs(12412412312L).setVersion("testVersion").setSafeMode(false).addAllZookeeperAddresses(Arrays.asList("[zookeeper_hostname1]:2181", "[zookeeper_hostname2]:2181", "[zookeeper_hostname3]:2181")).build();
when(mMetaMasterClient.getMasterInfo(any())).thenReturn(masterInfo);
// Prepare mock block master client
mBlockMasterClient = mock(BlockMasterClient.class);
Map<String, Long> capacityBytesOnTiers = new HashMap<>();
Map<String, Long> usedBytesOnTiers = new HashMap<>();
capacityBytesOnTiers.put(Constants.MEDIUM_MEM, 1341353L);
capacityBytesOnTiers.put("RAM", 23112L);
capacityBytesOnTiers.put("DOM", 236501L);
usedBytesOnTiers.put(Constants.MEDIUM_MEM, 62434L);
usedBytesOnTiers.put("RAM", 6243L);
usedBytesOnTiers.put("DOM", 74235L);
BlockMasterInfo blockMasterInfo = new BlockMasterInfo().setLiveWorkerNum(12).setLostWorkerNum(4).setCapacityBytes(1341353L).setCapacityBytesOnTiers(capacityBytesOnTiers).setUsedBytes(62434L).setUsedBytesOnTiers(usedBytesOnTiers).setFreeBytes(1278919L);
when(mBlockMasterClient.getBlockMasterInfo(any())).thenReturn(blockMasterInfo);
// Prepare print stream
mOutputStream = new ByteArrayOutputStream();
mPrintStream = new PrintStream(mOutputStream, true, "utf-8");
}
Aggregations