use of org.nextprot.api.web.seo.domain.SitemapUrl in project nextprot-api by calipho-sib.
the class SitemapTest method testSitemapUrlSetCreation.
@Test
public void testSitemapUrlSetCreation() {
String base = "https://search.nextprot.org";
SitemapUrlSet urlSet = new SitemapUrlSet();
urlSet.add(new SitemapUrl(base + "/about"));
urlSet.add(new SitemapUrl(base + "/copyright"));
urlSet.add(new SitemapUrl(base + "/news"));
urlSet.add(new SitemapUrl(base + "/help"));
urlSet.add(new SitemapUrl(base + "/copyright"));
urlSet.add(new SitemapUrl(base + "/help/simple-search"));
// for (SitemapUrl siturl : urlSet.getUrls()) System.out.println(siturl.getLoc());
Assert.assertEquals(5, urlSet.getUrls().size());
}
use of org.nextprot.api.web.seo.domain.SitemapUrl in project nextprot-api by calipho-sib.
the class SitemapTest method testSitemapUrlCreation.
@Test
public void testSitemapUrlCreation() {
String url = "http://aaa.bbb.com/toto";
SitemapUrl siturl = new SitemapUrl(url);
String expectedDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
// System.out.println("expectedDate: " + expectedDate);
Assert.assertEquals(url, siturl.getLoc());
Assert.assertEquals(expectedDate, siturl.getLastmod());
Assert.assertEquals("weekly", siturl.getChangefreq());
Assert.assertEquals("0.5", siturl.getPriority());
}
use of org.nextprot.api.web.seo.domain.SitemapUrl in project nextprot-api by calipho-sib.
the class SitemapTest method test1.
@Test
public void test1() {
try {
String base = "https://search.nextprot.org";
SitemapUrlSet urlSet = new SitemapUrlSet();
urlSet.add(new SitemapUrl(base + "/about"));
urlSet.add(new SitemapUrl(base + "/copyright"));
urlSet.add(new SitemapUrl(base + "/news"));
JAXBContext jaxbContext = JAXBContext.newInstance(SitemapUrlSet.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// jaxbMarshaller.marshal(urlSet, System.out);
} catch (JAXBException e) {
e.printStackTrace();
}
}
use of org.nextprot.api.web.seo.domain.SitemapUrl in project nextprot-api by calipho-sib.
the class SitemapServiceImpl method getSitemapUrlSet.
@Override
public SitemapUrlSet getSitemapUrlSet() {
// TODO set this elsewhere !
String base = "https://www.nextprot.org";
SitemapUrlSet urlSet = new SitemapUrlSet();
// news urls
for (NextProtNews n : githubService.getNews()) {
urlSet.add(new SitemapUrl(base + "/news/" + n.getUrl()));
}
// other application urls (help, about, home, portals, ...)
for (SeoTagsAndUrl tag : seoTagService.getGitHubSeoTags()) {
// blocked by robots.txt, thus removed from sitemap
if ("/user/proteins/lists".equals(tag.getUrl()))
continue;
// blocked by robots.txt, thus removed from sitemap
if ("/user/queries".equals(tag.getUrl()))
continue;
urlSet.add(new SitemapUrl(base + tag.getUrl()));
}
// entry function urls
Set<String> acs = masterIdentifierService.findUniqueNames();
for (String ac : acs) {
urlSet.add(new SitemapUrl(base + "/entry/" + ac));
}
return urlSet;
}
Aggregations