use of alluxio.wire.TieredIdentity.LocalityTier in project alluxio by Alluxio.
the class TieredIdentityTest method matchByIpResolution.
@Test
public void matchByIpResolution() throws Exception {
assumeTrue(InetAddress.getByName("localhost").getHostAddress().equals("127.0.0.1"));
LocalityTier lt1 = new LocalityTier("node", "localhost");
LocalityTier lt2 = new LocalityTier("node", "127.0.0.1");
assertTrue(TieredIdentityUtils.matches(lt1, lt2, true));
assertFalse(TieredIdentityUtils.matches(lt1, lt2, false));
}
use of alluxio.wire.TieredIdentity.LocalityTier in project alluxio by Alluxio.
the class TieredIdentityTest method matchByStringEquality.
@Test
public void matchByStringEquality() {
LocalityTier lt1 = new LocalityTier("node", "NonResolvableHostname-A");
LocalityTier lt2 = new LocalityTier("node", "NonResolvableHostname-A");
LocalityTier lt3 = new LocalityTier("node", "NonResolvableHostname-B");
LocalityTier lt4 = new LocalityTier("rack", "NonResolvableHostname-A");
LocalityTier lt5 = new LocalityTier("rack", "NonResolvableHostname-B");
LocalityTier lt6 = new LocalityTier("rack", "NonResolvableHostname-B");
LocalityTier lt7 = new LocalityTier("rack", "");
LocalityTier lt8 = new LocalityTier("node", "NonResolvableHostname-A");
LocalityTier lt9 = new LocalityTier("node", "");
assertTrue(TieredIdentityUtils.matches(lt1, lt1, true));
assertTrue(TieredIdentityUtils.matches(lt1, lt2, true));
assertFalse(TieredIdentityUtils.matches(lt2, lt3, true));
assertTrue(TieredIdentityUtils.matches(lt5, lt6, true));
assertFalse(TieredIdentityUtils.matches(lt4, lt5, true));
assertFalse(TieredIdentityUtils.matches(lt6, lt7, true));
assertFalse(TieredIdentityUtils.matches(lt8, lt9, true));
}
Aggregations