private void setUnreadableBySuperuserXattrib(Path p) throws IOException {
   if (fs.getScheme().toLowerCase().contains("hdfs")
       && intermediateEncryptionEnabled
       && !fs.getXAttrs(p).containsKey(UNREADABLE_BY_SUPERUSER_XATTRIB)) {
     fs.setXAttr(p, UNREADABLE_BY_SUPERUSER_XATTRIB, null, EnumSet.of(XAttrSetFlag.CREATE));
   }
 }
  /**
   * Verify a ViewFileSystem wrapped over multiple federated NameNodes will dispatch the XAttr
   * operations to the correct NameNode.
   */
  @Test
  public void testXAttrOnMountEntry() throws Exception {
    // Set XAttrs on the first namespace and verify they are correct
    fsView.setXAttr(mountOnNn1, name1, value1);
    fsView.setXAttr(mountOnNn1, name2, value2);
    assertEquals(2, fsView.getXAttrs(mountOnNn1).size());
    assertArrayEquals(value1, fsView.getXAttr(mountOnNn1, name1));
    assertArrayEquals(value2, fsView.getXAttr(mountOnNn1, name2));
    // Double-check by getting the XAttrs using FileSystem
    // instead of ViewFileSystem
    assertArrayEquals(value1, fHdfs.getXAttr(targetTestRoot, name1));
    assertArrayEquals(value2, fHdfs.getXAttr(targetTestRoot, name2));

    // Paranoid check: verify the other namespace does not
    // have XAttrs set on the same path.
    assertEquals(0, fsView.getXAttrs(mountOnNn2).size());
    assertEquals(0, fHdfs2.getXAttrs(targetTestRoot2).size());

    // Remove the XAttr entries on the first namespace
    fsView.removeXAttr(mountOnNn1, name1);
    fsView.removeXAttr(mountOnNn1, name2);
    assertEquals(0, fsView.getXAttrs(mountOnNn1).size());
    assertEquals(0, fHdfs.getXAttrs(targetTestRoot).size());

    // Now set XAttrs on the second namespace
    fsView.setXAttr(mountOnNn2, name1, value1);
    fsView.setXAttr(mountOnNn2, name2, value2);
    assertEquals(2, fsView.getXAttrs(mountOnNn2).size());
    assertArrayEquals(value1, fsView.getXAttr(mountOnNn2, name1));
    assertArrayEquals(value2, fsView.getXAttr(mountOnNn2, name2));
    assertArrayEquals(value1, fHdfs2.getXAttr(targetTestRoot2, name1));
    assertArrayEquals(value2, fHdfs2.getXAttr(targetTestRoot2, name2));

    fsView.removeXAttr(mountOnNn2, name1);
    fsView.removeXAttr(mountOnNn2, name2);
    assertEquals(0, fsView.getXAttrs(mountOnNn2).size());
    assertEquals(0, fHdfs2.getXAttrs(targetTestRoot2).size());
  }