Search in sources :

Example 6 with BlockMasterInfo

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");
}
Also used : BlockMasterInfo(alluxio.wire.BlockMasterInfo) BlockMasterInfo(alluxio.wire.BlockMasterInfo) MasterInfo(alluxio.grpc.MasterInfo) PrintStream(java.io.PrintStream) MetaMasterClient(alluxio.client.meta.MetaMasterClient) HashMap(java.util.HashMap) BlockMasterClient(alluxio.client.block.BlockMasterClient) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Before(org.junit.Before)

Aggregations

BlockMasterInfo (alluxio.wire.BlockMasterInfo)6 BlockMasterClient (alluxio.client.block.BlockMasterClient)5 HashSet (java.util.HashSet)3 ClientContext (alluxio.ClientContext)2 MasterClientContext (alluxio.master.MasterClientContext)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 MetaMasterClient (alluxio.client.meta.MetaMasterClient)1 MasterInfo (alluxio.grpc.MasterInfo)1 Statvfs (alluxio.jnifuse.struct.Statvfs)1 BlockMasterInfoField (alluxio.wire.BlockMasterInfo.BlockMasterInfoField)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 ByteBuffer (java.nio.ByteBuffer)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Pointer (jnr.ffi.Pointer)1 Runtime (jnr.ffi.Runtime)1