Package org.apache.hadoop.nfs

Examples of org.apache.hadoop.nfs.NfsExports


        matcher.getAccessPrivilege(address2, hostname1));
  }

  @Test
  public void testRegexIPRW() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod,
        "192.168.0.[0-9]+ rw");
    Assert.assertEquals(AccessPrivilege.READ_WRITE,
        matcher.getAccessPrivilege(address1, hostname1));
    Assert.assertEquals(AccessPrivilege.NONE,
        matcher.getAccessPrivilege(address2, hostname1));
  }
View Full Code Here


        matcher.getAccessPrivilege(address2, hostname1));
  }

  @Test
  public void testRegexIPRO() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod,
        "192.168.0.[0-9]+");
    Assert.assertEquals(AccessPrivilege.READ_ONLY,
        matcher.getAccessPrivilege(address1, hostname1));
    Assert.assertEquals(AccessPrivilege.NONE,
        matcher.getAccessPrivilege(address2, hostname1));
  }
View Full Code Here

        matcher.getAccessPrivilege(address2, hostname1));
  }

  @Test
  public void testRegexHostRW() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod,
        "[a-z]+.b.com rw");
    Assert.assertEquals(AccessPrivilege.READ_WRITE,
        matcher.getAccessPrivilege(address1, hostname1));
    // address1 will hit the cache
    Assert.assertEquals(AccessPrivilege.READ_WRITE,
        matcher.getAccessPrivilege(address1, hostname2));
  }
View Full Code Here

        matcher.getAccessPrivilege(address1, hostname2));
  }

  @Test
  public void testRegexHostRO() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod,
        "[a-z]+.b.com");
    Assert.assertEquals(AccessPrivilege.READ_ONLY,
        matcher.getAccessPrivilege(address1, hostname1));
    // address1 will hit the cache
    Assert.assertEquals(AccessPrivilege.READ_ONLY,
        matcher.getAccessPrivilege(address1, hostname2));
  }
View Full Code Here

  }
 
  @Test
  public void testMultiMatchers() throws Exception {
    long shortExpirationPeriod = 1 * 1000 * 1000 * 1000; // 1s
    NfsExports matcher = new NfsExports(CacheSize, shortExpirationPeriod,
        "192.168.0.[0-9]+;[a-z]+.b.com rw");
    Assert.assertEquals(AccessPrivilege.READ_ONLY,
        matcher.getAccessPrivilege(address1, hostname2));
    Assert.assertEquals(AccessPrivilege.READ_ONLY,
        matcher.getAccessPrivilege(address1, address1));
    Assert.assertEquals(AccessPrivilege.READ_ONLY,
        matcher.getAccessPrivilege(address1, hostname1));
    Assert.assertEquals(AccessPrivilege.READ_WRITE,
        matcher.getAccessPrivilege(address2, hostname1));
    // address2 will hit the cache
    Assert.assertEquals(AccessPrivilege.READ_WRITE,
        matcher.getAccessPrivilege(address2, hostname2));
   
    Thread.sleep(1000);
    // no cache for address2 now
    Assert.assertEquals(AccessPrivilege.NONE,
        matcher.getAccessPrivilege(address2, address2));
  }
View Full Code Here

  private static final int CacheSize = Nfs3Constant.EXPORTS_CACHE_SIZE_DEFAULT;
  private static final long NanosPerMillis = 1000000;

  @Test
  public void testWildcardRW() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod, "* rw");
    Assert.assertEquals(AccessPrivilege.READ_WRITE,
        matcher.getAccessPrivilege(address1, hostname1));
  }
View Full Code Here

        matcher.getAccessPrivilege(address1, hostname1));
  }

  @Test
  public void testWildcardRO() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod, "* ro");
    Assert.assertEquals(AccessPrivilege.READ_ONLY,
        matcher.getAccessPrivilege(address1, hostname1));
  }
View Full Code Here

        matcher.getAccessPrivilege(address1, hostname1));
  }

  @Test
  public void testExactAddressRW() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod, address1
        + " rw");
    Assert.assertEquals(AccessPrivilege.READ_WRITE,
        matcher.getAccessPrivilege(address1, hostname1));
    Assert.assertFalse(AccessPrivilege.READ_WRITE == matcher
        .getAccessPrivilege(address2, hostname1));
  }
View Full Code Here

        .getAccessPrivilege(address2, hostname1));
  }

  @Test
  public void testExactAddressRO() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod, address1);
    Assert.assertEquals(AccessPrivilege.READ_ONLY,
        matcher.getAccessPrivilege(address1, hostname1));
    Assert.assertEquals(AccessPrivilege.NONE,
        matcher.getAccessPrivilege(address2, hostname1));
  }
View Full Code Here

        matcher.getAccessPrivilege(address2, hostname1));
  }

  @Test
  public void testExactHostRW() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod, hostname1
        + " rw");
    Assert.assertEquals(AccessPrivilege.READ_WRITE,
        matcher.getAccessPrivilege(address1, hostname1));
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.nfs.NfsExports

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.