use of org.broadleafcommerce.common.sitemap.service.CustomUrlSiteMapGenerator in project BroadleafCommerce by BroadleafCommerce.
the class CustomUrlSiteMapGeneratorTest method testCustomUrlSiteMapGenerator.
@Test
public void testCustomUrlSiteMapGenerator() throws SiteMapException, IOException {
CustomUrlSiteMapGeneratorConfiguration smgc = getConfiguration();
testGenerator(smgc, new CustomUrlSiteMapGenerator());
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/custom/sitemap_index.xml");
compareFiles(file2, "src/test/resources/org/broadleafcommerce/sitemap/custom/sitemap1.xml");
compareFiles(file3, "src/test/resources/org/broadleafcommerce/sitemap/custom/sitemap2.xml");
}
use of org.broadleafcommerce.common.sitemap.service.CustomUrlSiteMapGenerator in project BroadleafCommerce by BroadleafCommerce.
the class CustomUrlSiteMapGeneratorTest method testSiteMapsWithSiteContext.
@Test
public void testSiteMapsWithSiteContext() throws SiteMapException, IOException {
BroadleafRequestContext brc = new BroadleafRequestContext();
BroadleafRequestContext.setBroadleafRequestContext(brc);
Site site = new SiteImpl();
site.setId(256L);
brc.setSite(site);
CustomUrlSiteMapGeneratorConfiguration smgc = getConfiguration();
testGenerator(smgc, new CustomUrlSiteMapGenerator());
File file1 = fileService.getResource("/sitemap_index.xml");
File file2 = fileService.getResource("/sitemap1.xml");
File file3 = fileService.getResource("/sitemap2.xml");
assertThat(file1.getAbsolutePath(), containsString("site-256"));
assertThat(file2.getAbsolutePath(), containsString("site-256"));
assertThat(file3.getAbsolutePath(), containsString("site-256"));
compareFiles(file1, "src/test/resources/org/broadleafcommerce/sitemap/custom/sitemap_index.xml");
compareFiles(file2, "src/test/resources/org/broadleafcommerce/sitemap/custom/sitemap1.xml");
compareFiles(file3, "src/test/resources/org/broadleafcommerce/sitemap/custom/sitemap2.xml");
// Remove the request context from thread local so it doesn't get in the way of subsequent tests
BroadleafRequestContext.setBroadleafRequestContext(null);
}
Aggregations