NfsExports { public AccessPrivilege getAccessPrivilege(InetAddress addr) { return getAccessPrivilege(addr.getHostAddress(), addr.getCanonicalHostName()); } NfsExports(int cacheSize, long expirationPeriodNano, String matchHosts); static synchronized NfsExports getInstance(Configuration conf); String[] getHostGroupList(); AccessPrivilege getAccessPrivilege(InetAddress addr); static final Log LOG; }
@Test public void testRegexGrouping() { NfsExports matcher = new NfsExports(CacheSize, ExpirationPeriod, "192.168.0.(12|34)"); Assert.assertEquals(AccessPrivilege.READ_ONLY, matcher.getAccessPrivilege(address1, hostname1)); Assert.assertEquals(AccessPrivilege.READ_ONLY, matcher.getAccessPrivilege(address1, hostname2)); matcher = new NfsExports(CacheSize, ExpirationPeriod, "\\w*.a.b.com"); Assert.assertEquals(AccessPrivilege.READ_ONLY, matcher.getAccessPrivilege("1.2.3.4", "web.a.b.com")); Assert.assertEquals(AccessPrivilege.READ_ONLY, matcher.getAccessPrivilege("1.2.3.4", "email.a.b.org")); }