@@ -0,0 +1,3163 @@
+/*%0A * Licensed to the University of California, Berkeley under one or more contributor license%0A * agreements. See the NOTICE file distributed with this work for additional information regarding%0A * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance with the License. You may obtain a%0A * copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the License%0A * is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express%0A * or implied. See the License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage tachyon.worker.block.meta;%0A%0Aimport java.io.File;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.ExpectedException;%0Aimport org.junit.rules.TemporaryFolder;%0A%0Aimport com.google.common.collect.Sets;%0A%0Aimport tachyon.worker.block.BlockMetadataManager;%0Aimport tachyon.worker.block.BlockMetadataManagerView;%0Aimport tachyon.worker.block.evictor.EvictorTestUtils;%0A%0Apublic class StorageTierViewTest %7B%0A  private static final int TEST_TIER_LEVEL = 0;%0A%0A  private StorageTier mTestTier;%0A  private StorageTierView mTestTierView;%0A  private BlockMetadataManagerView mMetaManagerView;%0A%0A  @Rule%0A  public TemporaryFolder mTestFolder = new TemporaryFolder();%0A%0A  @Rule%0A  public ExpectedException mThrown = ExpectedException.none();%0A%0A  @Before%0A  public void before() throws Exception %7B%0A    File tempFolder = mTestFolder.newFolder();%0A    BlockMetadataManager metaManager = EvictorTestUtils.defaultMetadataManager(tempFolder%0A        .getAbsolutePath());%0A    mMetaManagerView = new BlockMetadataManagerView(metaManager, Sets.%3CInteger%3EnewHashSet(),%0A        Sets.%3CLong%3EnewHashSet());%0A    mTestTier = metaManager.getTiers().get(TEST_TIER_LEVEL);%0A    mTestTierView = new StorageTierView(mTestTier, mMetaManagerView);%0A  %7D%0A%0A  @Test%0A  public void getDirViewsTest() throws Exception %7B%0A    Assert.assertEquals(EvictorTestUtils.TIER_PATH%5BTEST_TIER_LEVEL%5D.length,%0A        mTestTierView.getDirViews().size());%0A  %7D%0A%0A  @Test%0A  public void getDirViewTest() throws Exception %7B%0A    // Default MEM tier has two dirs%0A    for (int dirIndex = 0; dirIndex %3C EvictorTestUtils.TIER_PATH%5BTEST_TIER_LEVEL%5D.length;%0A         dirIndex ++) %7B%0A      Assert.assertEquals(dirIndex, mTestTierView.getDirView(dirIndex).getDirViewIndex());%0A    %7D%0A  %7D%0A%0A  @Test%0A  public void getDirViewBadIndexTest() throws Exception %7B%0A    mThrown.expect(IndexOutOfBoundsException.class);%0A    int badDirIndex = EvictorTestUtils.TIER_PATH%5BTEST_TIER_LEVEL%5D.length;%0A    Assert.assertEquals(badDirIndex, mTestTierView.getDirView(badDirIndex).getDirViewIndex());%0A  %7D%0A%0A  @Test%0A  public void getTierViewAliasTest() throws Exception %7B%0A    Assert.assertEquals(mTestTier.getTierAlias(), mTestTierView.getTierViewAlias());%0A  %7D%0A%0A  @Test%0A  public void getTierViewLevelTest() throws Exception %7B%0A    Assert.assertEquals(mTestTier.getTierLevel(), mTestTierView.getTierViewLevel());%0A  %7D%0A%7D%0A

Add unit test of StorageTierView.