Search in sources :

Example 1 with Publication

use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.

the class PublicationServiceTest method testFindPublicationById.

@Ignore
@Test
public void testFindPublicationById() {
    Publication publication = this.publicationService.findPublicationById(100L);
    assertEquals(100L, publication.getPublicationId());
    assertEquals("an interesting paper", publication.getTitle());
}
Also used : Publication(org.nextprot.api.core.domain.Publication) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with Publication

use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.

the class PublicationServiceTest method verifyFindPublicationById.

@Test
public void verifyFindPublicationById() {
    Publication publication = mock(Publication.class);
    when(publication.getPublicationId()).thenReturn(1L);
    when(publicationDao.findPublicationById(100L)).thenReturn(publication);
    publicationService.findPublicationById(100L);
    verify(publicationDao).findPublicationById(100L);
    verify(authorService).findAuthorsByPublicationId(1L);
    verify(dbXrefService).findDbXRefByPublicationId(1L);
}
Also used : Publication(org.nextprot.api.core.domain.Publication) Test(org.junit.Test)

Example 3 with Publication

use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.

the class ConsistencyResourceTest method shouldFindAllPublications.

@Test
public void shouldFindAllPublications() {
    boolean missingPublications = false;
    List<String> pubmedIds = statementDao.findAllDistinctValuesforFieldWhereFieldEqualsValues(StatementField.REFERENCE_ACCESSION, new StatementSimpleWhereClauseQueryDSL(StatementField.REFERENCE_DATABASE, "PubMed"));
    System.out.println("Found " + pubmedIds.size() + " distinct pubmeds");
    for (String p : pubmedIds) {
        if (p != null) {
            String pubmedId = p.replace("(PubMed,", "").replace(")", "");
            Publication pub = publicationService.findPublicationByDatabaseAndAccession("PubMed", pubmedId);
            // TODO: remove the following line after next release data jan 2018
            if (!"23248292".equals(pubmedId)) {
                if (pub == null) {
                    System.err.println("Can t find publication for " + pubmedId);
                    missingPublications = true;
                }
            } else {
                System.err.println("FOUND EMPTY PUBLICATION " + pubmedId + ", FIX THIS IN NEXT RELEASE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Probably related to: https://issues.isb-sib.ch/browse/NEXTPROT-1369");
            }
        }
    }
    ;
    if (missingPublications)
        Assert.fail();
}
Also used : Publication(org.nextprot.api.core.domain.Publication) StatementSimpleWhereClauseQueryDSL(org.nextprot.api.core.dao.impl.StatementSimpleWhereClauseQueryDSL) Test(org.junit.Test)

Example 4 with Publication

use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.

the class PublicationServiceIntegrationTest method testPublicationXrefs.

@Test
@Ignore
public void testPublicationXrefs() {
    Publication publication = publicationService.findPublicationById(690405);
    // check that publication bug NEXTPROT-989 is fixed (pmid 12631268), should have 2 xrefs
    List<PublicationDbXref> xrefs = publication.getDbXrefs();
    // System.err.println(TerminologyUtils.convertXrefsToSolrString(new ArrayList<DbXref>(xrefs)));
    Assert.assertTrue(xrefs.size() > 1);
}
Also used : Publication(org.nextprot.api.core.domain.Publication) PublicationDbXref(org.nextprot.api.core.domain.PublicationDbXref) Ignore(org.junit.Ignore) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 5 with Publication

use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.

the class PublicationServiceIntegrationTest method testPublicationPubmed23248292.

// TODO: do not ignore the following test after next release data jan 2018
@Ignore
@Test
public void testPublicationPubmed23248292() {
    Publication publication = publicationService.findPublicationByDatabaseAndAccession("PubMed", "23248292");
    Assert.assertEquals("Proteasome inhibition rescues clinically significant unstable variants of the mismatch repair protein Msh2.", publication.getTitle());
}
Also used : Publication(org.nextprot.api.core.domain.Publication) Ignore(org.junit.Ignore) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Aggregations

Publication (org.nextprot.api.core.domain.Publication)33 Test (org.junit.Test)17 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)13 EntryPublication (org.nextprot.api.core.domain.publication.EntryPublication)6 Ignore (org.junit.Ignore)4 StatementSimpleWhereClauseQueryDSL (org.nextprot.api.core.dao.impl.StatementSimpleWhereClauseQueryDSL)4 ImmutableList (com.google.common.collect.ImmutableList)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Cacheable (org.springframework.cache.annotation.Cacheable)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 PublicationAuthor (org.nextprot.api.core.domain.PublicationAuthor)2 PublicationDbXref (org.nextprot.api.core.domain.PublicationDbXref)2 GlobalPublicationStatistics (org.nextprot.api.core.domain.publication.GlobalPublicationStatistics)2 Service (org.springframework.stereotype.Service)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Sets (com.google.common.collect.Sets)1 Argument (graphql.language.Argument)1 Field (graphql.language.Field)1