@Test
@TestDir
@TestJetty
@TestHdfs
public void testCustomizedUserAndGroupNames() throws Exception {

  // Start server with default configuration
  Server server = createHttpFSServer(false, false);
  final Configuration conf = HttpFSServerWebApp.get()
      .get(FileSystemAccess.class).getFileSystemConfiguration();
  // Change pattern config
  conf.set(HdfsClientConfigKeys.DFS_WEBHDFS_USER_PATTERN_KEY,
      "^[A-Za-z0-9_][A-Za-z0-9._-]*[$]?$");
  conf.set(HdfsClientConfigKeys.DFS_WEBHDFS_ACL_PERMISSION_PATTERN_KEY,
      "^(default:)?(user|group|mask|other):" +
          "[[0-9A-Za-z_][@A-Za-z0-9._-]]*:([rwx-]{3})?(,(default:)?" +
          "(user|group|mask|other):[[0-9A-Za-z_][@A-Za-z0-9._-]]*:" +
          "([rwx-]{3})?)*$");
  // Save configuration to site file
  writeConf(conf, "hdfs-site.xml");
  // Restart the HttpFS server to apply new config
  server.stop();
  server.start();
  final String aclUser = "user:123:rw-";
  final String aclGroup = "group:foo@bar:r--";
  final String aclSpec = "aclspec=user::rwx," + aclUser + ",group::rwx," +
      aclGroup + ",other::---";
  final String dir = "/aclFileTestCustom";
  final String path = dir + "/test";
  // Create test dir
  FileSystem fs = FileSystem.get(conf);
  fs.mkdirs(new Path(dir));
  createWithHttp(path, null);
  // Set ACL
  putCmd(path, "SETACL", aclSpec);
  // Verify ACL
  String statusJson = getStatus(path, "GETACLSTATUS");
  List<String> aclEntries = getAclEntries(statusJson);
  Assert.assertTrue(aclEntries.contains(aclUser));
  Assert.assertTrue(aclEntries.contains(aclGroup));
}