Search in sources :

Example 26 with StorageTier

use of alluxio.worker.block.meta.StorageTier in project alluxio by Alluxio.

the class BlockStoreMetaTest method getBlockList.

/**
 * Tests the {@link BlockStoreMeta#getBlockList()} method.
 */
@Test
public void getBlockList() {
    Map<String, List<Long>> tierAliasToBlockIds = new HashMap<>();
    for (StorageTier tier : mMetadataManager.getTiers()) {
        List<Long> blockIdsOnTier = new ArrayList<>();
        for (StorageDir dir : tier.getStorageDirs()) {
            blockIdsOnTier.addAll(dir.getBlockIds());
        }
        tierAliasToBlockIds.put(tier.getTierAlias(), blockIdsOnTier);
    }
    Map<String, List<Long>> actual = mBlockStoreMetaFull.getBlockList();
    Assert.assertEquals(TieredBlockStoreTestUtils.TIER_ALIAS.length, actual.keySet().size());
    Assert.assertEquals(tierAliasToBlockIds, actual);
}
Also used : HashMap(java.util.HashMap) StorageTier(alluxio.worker.block.meta.StorageTier) ArrayList(java.util.ArrayList) StorageDir(alluxio.worker.block.meta.StorageDir) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 27 with StorageTier

use of alluxio.worker.block.meta.StorageTier in project alluxio by Alluxio.

the class BlockStoreMetaTest method getCapacityBytesOnDirs.

/**
 * Tests the {@link BlockStoreMeta#getCapacityBytes()} method.
 */
@Test
public void getCapacityBytesOnDirs() {
    Map<Pair<String, String>, Long> dirsToCapacityBytes = new HashMap<>();
    for (StorageTier tier : mMetadataManager.getTiers()) {
        for (StorageDir dir : tier.getStorageDirs()) {
            dirsToCapacityBytes.put(new Pair<>(tier.getTierAlias(), dir.getDirPath()), dir.getCapacityBytes());
        }
    }
    Assert.assertEquals(dirsToCapacityBytes, mBlockStoreMeta.getCapacityBytesOnDirs());
    Assert.assertEquals(TieredBlockStoreTestUtils.getDefaultDirNum(), mBlockStoreMeta.getCapacityBytesOnDirs().values().size());
}
Also used : HashMap(java.util.HashMap) StorageTier(alluxio.worker.block.meta.StorageTier) StorageDir(alluxio.worker.block.meta.StorageDir) Pair(alluxio.collections.Pair) Test(org.junit.Test)

Aggregations

StorageTier (alluxio.worker.block.meta.StorageTier)27 Test (org.junit.Test)17 StorageDir (alluxio.worker.block.meta.StorageDir)16 HashMap (java.util.HashMap)5 BlockMeta (alluxio.worker.block.meta.BlockMeta)4 StorageTierView (alluxio.worker.block.meta.StorageTierView)4 BlockDoesNotExistException (alluxio.exception.BlockDoesNotExistException)3 DefaultBlockMeta (alluxio.worker.block.meta.DefaultBlockMeta)3 Pair (alluxio.collections.Pair)2 BlockStoreLocation (alluxio.worker.block.BlockStoreLocation)2 DefaultStorageTier (alluxio.worker.block.meta.DefaultStorageTier)2 StorageTierEvictorView (alluxio.worker.block.meta.StorageTierEvictorView)2 TempBlockMeta (alluxio.worker.block.meta.TempBlockMeta)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 ExpectedException (org.junit.rules.ExpectedException)2 StorageTierAssoc (alluxio.StorageTierAssoc)1 WorkerStorageTierAssoc (alluxio.WorkerStorageTierAssoc)1 PropertyKey (alluxio.conf.PropertyKey)1