use of org.broadleafcommerce.common.sitemap.service.SiteMapGenerator in project BroadleafCommerce by BroadleafCommerce.
the class SiteMapGeneratorTest method testGenerator.
protected void testGenerator(List<SiteMapGeneratorConfiguration> smgcList, SiteMapGenerator smg, int maxEntriesPerFile) throws SiteMapException, IOException {
if (CollectionUtils.isNotEmpty(smgcList)) {
SiteMapConfiguration smc = new SiteMapConfigurationImpl();
smc.setMaximumUrlEntriesPerFile(maxEntriesPerFile);
smc.setSiteMapGeneratorConfigurations(smgcList);
smc.setIndexedSiteMapFileName("sitemap_index.xml");
for (SiteMapGeneratorConfiguration smgc : smgcList) {
smgc.setSiteMapConfiguration(smc);
}
List<ModuleConfiguration> mcList = new ArrayList<>();
mcList.add(smc);
ModuleConfigurationService mcs = EasyMock.createMock(ModuleConfigurationService.class);
EasyMock.expect(mcs.findActiveConfigurationsByType(ModuleConfigurationType.SITE_MAP)).andReturn(mcList);
EasyMock.replay(mcs);
List<SiteMapGenerator> smgList = new ArrayList<>();
smgList.add(smg);
siteMapService.setGzipSiteMapFiles(false);
siteMapService.setModuleConfigurationService(mcs);
siteMapService.setSiteMapGenerators(smgList);
SiteMapGenerationResponse smgr = siteMapService.generateSiteMap();
Assert.assertFalse(smgr.isHasError());
}
}
Aggregations