Package org.apache.hadoop.nfs

Examples of org.apache.hadoop.nfs.NfsExports


        matcher.getAccessPrivilege(address1, hostname1));
  }

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


        matcher.getAccessPrivilege(address1, hostname1));
  }

  @Test
  public void testCidrShortRW() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod,
        "192.168.0.0/22 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 testCidrShortRO() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod,
        "192.168.0.0/22");
    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 testCidrLongRW() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod,
        "192.168.0.0/255.255.252.0 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 testCidrLongRO() {
    NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod,
        "192.168.0.0/255.255.252.0");
    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 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
    AccessPrivilege ap;
    long startNanos = System.nanoTime();
    do {
      ap = matcher.getAccessPrivilege(address2, address2);
      if (ap == AccessPrivilege.NONE) {
        break;
      }
      Thread.sleep(500);
    } while ((System.nanoTime() - startNanos) / NanosPerMillis < 5000);
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.