@Test
  @Ignore // very incomplete
  public void testPathAnalysis() throws SolrServerException, IOException {
    SolrServer solr = getSolr();
    // Not really unit testing the schema here because the path logic in the handler is too relevant
    // - could be switched to
    IndexingItemProgress p = mock(IndexingItemProgress.class);
    CmsRepository repo = new CmsRepository("http://ex.ampl:444/s/rep1");
    when(p.getRepository()).thenReturn(repo);
    when(p.getRevision()).thenReturn(new RepoRevision(35L, new Date()));
    CmsChangesetItem item = mock(CmsChangesetItem.class);
    when(item.getPath())
        .thenReturn(new CmsItemPath("/dir/doc main.xml"))
        .thenReturn(new CmsItemPath("/dir sect/doc appendix.xml"));
    ;
    IndexingDocIncrementalSolrj doc = new IndexingDocIncrementalSolrj();
    when(p.getFields()).thenReturn(doc);
    when(p.getItem()).thenReturn(item);
    HandlerPathinfo handlerPathinfo = new HandlerPathinfo();
    handlerPathinfo.handle(p);
    solr.add(doc.getSolrDoc());

    fail(
        "need to test effects of analyzed path* fields and confirm the need for name and extension");
  }
  // Documents the effect of the caveat in http://wiki.apache.org/solr/Atomic_Updates
  @Test
  public void testHeadFlagUpdateEffect() throws Exception {
    SolrServer solr = getSolr();

    IndexingDocIncrementalSolrj doc = new IndexingDocIncrementalSolrj();
    doc.addField("id", "f#01");
    doc.addField("head", true);
    doc.addField("pathstat", "A");
    doc.addField("path", "dir/file.txt");
    doc.addField("pathext", "txt");
    doc.addField("text", "quite secret content, though searchable");
    solr.add(doc.getSolrDoc());
    solr.commit();
    assertEquals(
        "Should be searchable on path",
        1,
        solr.query(new SolrQuery("path:dir*")).getResults().getNumFound());
    assertEquals(
        "Should be searchable on pathext",
        1,
        solr.query(new SolrQuery("pathext:txt")).getResults().getNumFound());
    assertEquals(
        "Should be searchable on text",
        1,
        solr.query(new SolrQuery("text:secret")).getResults().getNumFound());

    IndexingDocIncrementalSolrj docd = new IndexingDocIncrementalSolrj();
    docd.addField("id", "f#02");
    docd.addField("head", true);
    docd.addField("pathstat", "D");
    docd.addField("path", "dir/file.txt");
    docd.addField("pathext", "txt");
    doc.setUpdateMode(true);
    doc.setField("head", false);
    solr.add(docd.getSolrDoc());
    solr.add(doc.getSolrDoc());
    solr.commit();
    assertEquals(
        "Both head and historical should be searchable on path",
        2,
        solr.query(new SolrQuery("path:dir*")).getResults().getNumFound());
    assertEquals(
        "Both head and historical should be searchable on pathext",
        2,
        solr.query(new SolrQuery("pathext:txt")).getResults().getNumFound());
    assertEquals(
        "Text search for historical has been scoped out, if made stored it might affect access control requirements",
        // assertEquals("Historical should still be searchable on text after head flag update",
        0,
        solr.query(new SolrQuery("text:secret")).getResults().getNumFound());
  }