public void directoryURL() throws Exception {
new FacesRequest() {
protected void invokeApplication() throws Exception {
EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
WikiDirectory d = (WikiDirectory)
em.createQuery("select d from WikiDirectory d where d.id = :id")
.setParameter("id", 3l)
.getSingleResult();
assert d.getPermURL(".lace").equals("3.lace");
assert d.getWikiURL().equals("CCC");
d = (WikiDirectory)
em.createQuery("select d from WikiDirectory d where d.id = :id")
.setParameter("id", 4l)
.getSingleResult();
assert d.getPermURL(".lace").equals("4.lace");
assert d.getWikiURL().equals("CCC/DDD");
d = (WikiDirectory)
em.createQuery("select d from WikiDirectory d where d.id = :id")
.setParameter("id", 1l)
.getSingleResult();
assert d.getPermURL(".lace").equals("1.lace");
assert d.getWikiURL().equals("");
}
}.run();
}