use of ubic.gemma.core.loader.entrez.pubmed.PubMedXMLParser in project Gemma by PavlidisLab.
the class BibRefControllerTest method setup.
/*
* Add a bibliographic reference to the database for testing purposes.
*/
@Before
public void setup() throws Exception {
assert brs != null;
PubMedXMLParser pmp = new PubMedXMLParser();
try {
Collection<BibliographicReference> brl = pmp.parse(this.getClass().getResourceAsStream("/data/pubmed-test.xml"));
br = brl.iterator().next();
/* set the bib ref's pubmed accession number to the database entry. */
br.setPubAccession(this.getTestPersistentDatabaseEntry());
/* bibref is now set. Call service to persist to database. */
br = brs.findOrCreate(br);
assert br.getId() != null;
} catch (RuntimeException e) {
if (e.getCause() instanceof java.net.ConnectException) {
log.warn("Test skipped due to connection exception");
return;
} else if (e.getCause() instanceof java.net.UnknownHostException) {
log.warn("Test skipped due to unknown host exception");
return;
} else {
throw (e);
}
}
ready = true;
}
Aggregations