private static void assertExternalTableLocations(File exteralWarehouseDir, File externalNonWhDir)
    throws IOException {
    Set<String> actualDirs = Files.find(Paths.get(exteralWarehouseDir.toURI()), Integer.MAX_VALUE, (p, a)->true)
      .map(p->p.toString().replaceAll(exteralWarehouseDir.getAbsolutePath(), ""))
      .filter(s->!s.isEmpty()).collect(toSet());
    Set<String> expectedDirs = new HashSet<>();
    expectedDirs.add("/extwhwh");
    expectedDirs.add("/extwhwh/p=p2");
    expectedDirs.add("/extwhwh/p=p1");
    expectedDirs.add("/extwhmixed");
    expectedDirs.add("/extwhmixed/p=p2");
    expectedDirs.add("/manwhwh");
    expectedDirs.add("/manwhwh/p=p2");
    expectedDirs.add("/manwhwh/p=p1");
    expectedDirs.add("/custdb.db");
    expectedDirs.add("/custdb.db/custmanwhwh");
    expectedDirs.add("/custdb.db/custmanwhwh/p=p2");
    expectedDirs.add("/custdb.db/custmanwhwh/p=p1");
    expectedDirs.add("/custdb.db/custextwhwh");
    expectedDirs.add("/custdb.db/custextwhwh/p=p2");
    expectedDirs.add("/custdb.db/custextwhwh/p=p1");
    expectedDirs.add("/manwhout");
    expectedDirs.add("/manwhnone");
    expectedDirs.add("/manwhmixed");
    expectedDirs.add("/manwhmixed/p=p2");
    expectedDirs.add("/extwhnone");
    expectedDirs.add("/extwhout");
    assertEquals("Unexpected external warehouse directory structure in " + exteralWarehouseDir, expectedDirs,
      actualDirs);

    actualDirs = Files.find(Paths.get(externalNonWhDir.toURI()), Integer.MAX_VALUE, (p, a)->true)
      .map(p->p.toString().replaceAll(externalNonWhDir.getAbsolutePath(), ""))
      .filter(s->!s.isEmpty()).collect(toSet());
    expectedDirs.clear();
    expectedDirs.add("/manoutout");
    expectedDirs.add("/extoutout/p=p2");
    expectedDirs.add("/extoutout/p=p1");
    expectedDirs.add("/extwhoutp2");
    expectedDirs.add("/extwhoutp1");
    expectedDirs.add("/manwhmixedp1");
    expectedDirs.add("/manwhoutp1");
    expectedDirs.add("/manoutout/p=p1");
    expectedDirs.add("/manoutout/p=p2");
    expectedDirs.add("/manwhoutp2");
    expectedDirs.add("/extoutnone");
    expectedDirs.add("/manoutnone");
    expectedDirs.add("/extoutout");
    expectedDirs.add("/extwhmixedp1");
    assertEquals("Unexpected external (non-warehouse) directory structure in " + externalNonWhDir, expectedDirs,
      actualDirs);
  }
Should encounter a DB with an unset owner, and should try to chown the new dir path to 'hive' user.
This will always fail in this test, as we're never running it as root.
@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/util/TestHiveStrictManagedMigration.java