Search in sources :

Example 11 with LocalityTier

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));
}
Also used : LocalityTier(alluxio.wire.TieredIdentity.LocalityTier) Test(org.junit.Test)

Example 12 with LocalityTier

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));
}
Also used : LocalityTier(alluxio.wire.TieredIdentity.LocalityTier) Test(org.junit.Test)

Aggregations

LocalityTier (alluxio.wire.TieredIdentity.LocalityTier)12 TieredIdentity (alluxio.wire.TieredIdentity)8 Test (org.junit.Test)7 ConfigurationRule (alluxio.ConfigurationRule)4 Closeable (java.io.Closeable)4 ArrayList (java.util.ArrayList)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 BlockWorkerInfo (alluxio.client.block.BlockWorkerInfo)2 WorkerNetAddress (alluxio.wire.WorkerNetAddress)2 AlluxioURI (alluxio.AlluxioURI)1 Constants (alluxio.Constants)1 URIStatus (alluxio.client.file.URIStatus)1 Pair (alluxio.collections.Pair)1 FailedPreconditionException (alluxio.exception.status.FailedPreconditionException)1 RunTaskContext (alluxio.job.RunTaskContext)1 SelectExecutorsContext (alluxio.job.SelectExecutorsContext)1 AbstractVoidPlanDefinition (alluxio.job.plan.AbstractVoidPlanDefinition)1 LoadTask (alluxio.job.plan.load.LoadDefinition.LoadTask)1 JobUtils (alluxio.job.util.JobUtils)1 SerializableVoid (alluxio.job.util.SerializableVoid)1