Search in sources :

Example 1 with SiteMapGenerator

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());
    }
}
Also used : SiteMapGenerator(org.broadleafcommerce.common.sitemap.service.SiteMapGenerator) ModuleConfiguration(org.broadleafcommerce.common.config.domain.ModuleConfiguration) SiteMapConfigurationImpl(org.broadleafcommerce.common.sitemap.domain.SiteMapConfigurationImpl) ModuleConfigurationService(org.broadleafcommerce.common.config.service.ModuleConfigurationService) SiteMapConfiguration(org.broadleafcommerce.common.sitemap.domain.SiteMapConfiguration) ArrayList(java.util.ArrayList) SiteMapGenerationResponse(org.broadleafcommerce.common.sitemap.service.SiteMapGenerationResponse) SiteMapGeneratorConfiguration(org.broadleafcommerce.common.sitemap.domain.SiteMapGeneratorConfiguration)

Aggregations

ArrayList (java.util.ArrayList)1 ModuleConfiguration (org.broadleafcommerce.common.config.domain.ModuleConfiguration)1 ModuleConfigurationService (org.broadleafcommerce.common.config.service.ModuleConfigurationService)1 SiteMapConfiguration (org.broadleafcommerce.common.sitemap.domain.SiteMapConfiguration)1 SiteMapConfigurationImpl (org.broadleafcommerce.common.sitemap.domain.SiteMapConfigurationImpl)1 SiteMapGeneratorConfiguration (org.broadleafcommerce.common.sitemap.domain.SiteMapGeneratorConfiguration)1 SiteMapGenerationResponse (org.broadleafcommerce.common.sitemap.service.SiteMapGenerationResponse)1 SiteMapGenerator (org.broadleafcommerce.common.sitemap.service.SiteMapGenerator)1