Search in sources :

Example 1 with PageDao

use of org.broadleafcommerce.cms.page.dao.PageDao in project BroadleafCommerce by BroadleafCommerce.

the class PageSiteMapGeneratorTest method testPageSiteMapGenerator.

@Test
public void testPageSiteMapGenerator() throws SiteMapException, IOException {
    Page p1 = new PageImpl();
    p1.setFullUrl("/about_us");
    Page p2 = new PageImpl();
    p2.setFullUrl("faq");
    Page p3 = new PageImpl();
    p3.setFullUrl("/new-to-hot-sauce");
    List<Page> pages = new ArrayList<Page>();
    pages.add(p1);
    pages.add(p2);
    pages.add(p3);
    PageDao pageDao = EasyMock.createMock(PageDao.class);
    EasyMock.expect(pageDao.readOnlineAndIncludedPages(5, 0, "fullUrl")).andReturn(pages);
    EasyMock.replay(pageDao);
    PageSiteMapGenerator psmg = new PageSiteMapGenerator();
    psmg.setPageDao(pageDao);
    psmg.setRowLimit(5);
    SiteMapGeneratorConfiguration smgc = new SiteMapGeneratorConfigurationImpl();
    smgc.setDisabled(false);
    smgc.setSiteMapGeneratorType(SiteMapGeneratorType.PAGE);
    smgc.setSiteMapChangeFreq(SiteMapChangeFreqType.HOURLY);
    smgc.setSiteMapPriority(SiteMapPriorityType.POINT5);
    testGenerator(smgc, psmg);
    File file1 = fileService.getResource("/sitemap_index.xml");
    File file2 = fileService.getResource("/sitemap1.xml");
    File file3 = fileService.getResource("/sitemap2.xml");
    compareFiles(file1, "src/test/resources/org/broadleafcommerce/sitemap/page/sitemap_index.xml");
    compareFiles(file2, "src/test/resources/org/broadleafcommerce/sitemap/page/sitemap1.xml");
    compareFiles(file3, "src/test/resources/org/broadleafcommerce/sitemap/page/sitemap2.xml");
}
Also used : PageImpl(org.broadleafcommerce.cms.page.domain.PageImpl) PageDao(org.broadleafcommerce.cms.page.dao.PageDao) ArrayList(java.util.ArrayList) Page(org.broadleafcommerce.cms.page.domain.Page) SiteMapGeneratorConfigurationImpl(org.broadleafcommerce.common.sitemap.domain.SiteMapGeneratorConfigurationImpl) SiteMapGeneratorConfiguration(org.broadleafcommerce.common.sitemap.domain.SiteMapGeneratorConfiguration) File(java.io.File) Test(org.junit.Test) SiteMapGeneratorTest(org.broadleafcommerce.common.sitemap.service.SiteMapGeneratorTest)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 PageDao (org.broadleafcommerce.cms.page.dao.PageDao)1 Page (org.broadleafcommerce.cms.page.domain.Page)1 PageImpl (org.broadleafcommerce.cms.page.domain.PageImpl)1 SiteMapGeneratorConfiguration (org.broadleafcommerce.common.sitemap.domain.SiteMapGeneratorConfiguration)1 SiteMapGeneratorConfigurationImpl (org.broadleafcommerce.common.sitemap.domain.SiteMapGeneratorConfigurationImpl)1 SiteMapGeneratorTest (org.broadleafcommerce.common.sitemap.service.SiteMapGeneratorTest)1 Test (org.junit.Test)1