Search in sources :

Example 1 with SiteItemService

use of org.craftercms.engine.service.SiteItemService in project engine by craftercms.

the class NavTreeBuilderImplTest method getSiteItemService.

private SiteItemService getSiteItemService() {
    SiteItemService siteItemService = mock(SiteItemService.class);
    SiteItem item1 = createSiteItem(URL1);
    SiteItem item3 = createSiteItem(URL3);
    SiteItem item2 = createSiteItem(URL2, item3);
    SiteItem rootItem = createSiteItem(ROOT_URL, item1, item2);
    when(siteItemService.getSiteTree(ROOT_URL, -1, (ItemFilter) null, null)).thenReturn(rootItem);
    return siteItemService;
}
Also used : SiteItemService(org.craftercms.engine.service.SiteItemService) SiteItem(org.craftercms.engine.model.SiteItem)

Example 2 with SiteItemService

use of org.craftercms.engine.service.SiteItemService in project engine by craftercms.

the class NavBreadcrumbBuilderImplTest method getSiteItemService.

protected SiteItemService getSiteItemService() {
    SiteItem enUsItem = mock(SiteItem.class);
    when(enUsItem.getStoreUrl()).thenReturn("/site/website/en_US");
    when(enUsItem.get("navLabel")).thenReturn("Home");
    when(enUsItem.getItem()).thenReturn(mock(Item.class));
    when(enUsItem.getDom()).thenReturn(mock(Document.class));
    SiteItem aboutUsItem = mock(SiteItem.class);
    when(aboutUsItem.getStoreUrl()).thenReturn("/site/website/en/about-us");
    when(aboutUsItem.get("navLabel")).thenReturn("About Us");
    when(aboutUsItem.getItem()).thenReturn(mock(Item.class));
    when(aboutUsItem.getDom()).thenReturn(mock(Document.class));
    SiteItem leadershipTeamItem = mock(SiteItem.class);
    when(leadershipTeamItem.getStoreUrl()).thenReturn("/site/website/en/about-us/leadership-team");
    when(leadershipTeamItem.get("navLabel")).thenReturn("Leadership Team");
    when(leadershipTeamItem.getItem()).thenReturn(mock(Item.class));
    when(leadershipTeamItem.getDom()).thenReturn(mock(Document.class));
    SiteItem productsItem = mock(SiteItem.class);
    when(productsItem.getStoreUrl()).thenReturn("/site/website/en_US/products");
    SiteItem flagshipProductItem = mock(SiteItem.class);
    when(flagshipProductItem.getStoreUrl()).thenReturn("/site/website/en_US/products/flagship");
    when(flagshipProductItem.get("navLabel")).thenReturn("Flagship");
    when(flagshipProductItem.getItem()).thenReturn(mock(Item.class));
    when(flagshipProductItem.getDom()).thenReturn(mock(Document.class));
    SiteItemService siteItemService = mock(SiteItemService.class);
    when(siteItemService.getSiteItem("/site/website/en_US", null)).thenReturn(enUsItem);
    when(siteItemService.getSiteItem("/site/website/en_US/about-us", null)).thenReturn(aboutUsItem);
    when(siteItemService.getSiteItem("/site/website/en_US/about-us/leadership-team", null)).thenReturn(leadershipTeamItem);
    when(siteItemService.getSiteItem("/site/website/en_US/products", null)).thenReturn(productsItem);
    when(siteItemService.getSiteItem("/site/website/en_US/products/flagship", null)).thenReturn(flagshipProductItem);
    return siteItemService;
}
Also used : Item(org.craftercms.core.service.Item) SiteItem(org.craftercms.engine.model.SiteItem) NavItem(org.craftercms.engine.navigation.NavItem) SiteItemService(org.craftercms.engine.service.SiteItemService) Document(org.dom4j.Document) SiteItem(org.craftercms.engine.model.SiteItem)

Aggregations

SiteItem (org.craftercms.engine.model.SiteItem)2 SiteItemService (org.craftercms.engine.service.SiteItemService)2 Item (org.craftercms.core.service.Item)1 NavItem (org.craftercms.engine.navigation.NavItem)1 Document (org.dom4j.Document)1