예제 #1
0
  @Test
  public void creatingANavigationShouldLinkNavigationAndNode() {
    Id<Portal> classic = gateIn.siteId(Site.Type.PORTAL, "classic");
    Portal portal = gateIn.get(classic);
    assert portal.equals(gateIn.getPortal(classic));

    Page page = portal.getPageRegistry().get(classic.getIdforChild("page"));
    Id<Page> pageId = page.getId();
    assert page.equals(gateIn.get(pageId));

    Navigation nav = portal.getNavigation().get("page");
    assert page.equals(nav.getTargetPage());

    Page sub = portal.getPageRegistry().get("sub");
    assert sub.equals(gateIn.get(pageId.getIdforChild("sub")));

    Navigation navigation = portal.createNavigationTo(sub, portal.getNavigation());
    assert sub.equals(navigation.getTargetPage());
    assert sub.getInboundNavigations().contains(navigation.getId());
    assert portal.getNavigation().contains(navigation.getName());

    Navigation inboundNavigation = sub.createInboundNavigationIn(portal, portal.getNavigation());
    assert sub.equals(inboundNavigation.getTargetPage());
    assert sub.getInboundNavigations().contains(inboundNavigation.getId());
    assert portal.getNavigation().contains(inboundNavigation.getName());
  }
예제 #2
0
  @Test
  public void creatingASimplePage() {
    Portal portal = gateIn.getDefaultPortal();

    String name = "name", title = "title";
    Page page = portal.getPageRegistry().createAndAdd(name);
    assert name.equals(page.getId().toString());
    assert name.equals(page.getTitle())
        : "By default, a Page's title should be the same as its name";
    assert portal.equals(page.getSite());

    page.setTitle(title);
    assert title.equals(page.getTitle());
  }