p.setTemplate(template.getIdentifier());
repository.put(p);
}
// Make sure everything is the way we set it up
SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPath(root);
assertEquals(1, repository.find(q).getDocumentCount());
q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPathPrefix(root);
assertEquals(pages, repository.find(q).getDocumentCount());
// Move the resources
repository.move(rootURI, newRoot, true);
// Make sure everything is gone from /root
q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPath(root);
assertEquals(0, repository.find(q).getDocumentCount());
q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPathPrefix(root);
assertEquals(0, repository.find(q).getDocumentCount());
// Make sure everything can be found in the new place
q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPath(newRoot);
assertEquals(1, repository.find(q).getDocumentCount());
q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPathPrefix(newRoot);
assertEquals(pages, repository.find(q).getDocumentCount());
}