public static String getUsername(String recPath) {
    String user = "anonymous";
    Matcher matcher = USER_NAME.matcher(recPath);
    if (matcher.find()) {
      user = matcher.group(1);
    }
    return user;
  }
@Test
  public void testGetUserFromPath() throws Exception {
    assertEquals("bob", RegistryPathUtils
        .getUsername("/registry/users/bob/services/yarn-service/test1/"));
    assertEquals("bob-dev", RegistryPathUtils
        .getUsername("/registry/users/bob-dev/services/yarn-service/test1"));
    assertEquals("bob.dev", RegistryPathUtils
        .getUsername("/registry/users/bob.dev/services/yarn-service/test1"));
  }