Search in sources :

Example 26 with OrcidSearchResult

use of org.orcid.jaxb.model.message.OrcidSearchResult in project ORCID-Source by ORCID.

the class OrcidSearchManagerImplTest method orcidMultipleOrcidsIndexed.

/**
 */
@Test
public void orcidMultipleOrcidsIndexed() {
    when(mockSolrDao.findByDocumentCriteria("rndQuery", null, null)).thenReturn(multipleResultsForQuery());
    when(mockOrcidProfileCacheManager.retrievePublicBio("5678")).thenReturn(getOrcidProfile5678MandatoryOnly());
    when(mockOrcidProfileCacheManager.retrievePublicBio("6789")).thenReturn(getOrcidProfile6789MandatoryOnly());
    OrcidMessage retrievedOrcidMessage = orcidSearchManager.findOrcidsByQuery("rndQuery");
    assertNotNull(retrievedOrcidMessage);
    assertTrue(retrievedOrcidMessage.getOrcidSearchResults().getOrcidSearchResult().size() == 2);
    OrcidSearchResult result = retrievedOrcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0);
    OrcidProfile retrievedProfile = result.getOrcidProfile();
    assertEquals("5678", retrievedProfile.getOrcidIdentifier().getPath());
    OrcidBio orcidBio = retrievedProfile.getOrcidBio();
    assertEquals("Logan", orcidBio.getPersonalDetails().getFamilyName().getContent());
    assertEquals("Donald Edward", orcidBio.getPersonalDetails().getGivenNames().getContent());
    assertNull(orcidBio.getContactDetails());
    OrcidSearchResult result2 = retrievedOrcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(1);
    OrcidProfile retrievedProfile2 = result2.getOrcidProfile();
    assertEquals("6789", retrievedProfile2.getOrcidIdentifier().getPath());
    OrcidBio orcidBio2 = retrievedProfile2.getOrcidBio();
    assertEquals("Thomson", orcidBio2.getPersonalDetails().getFamilyName().getContent());
    assertEquals("Homer J", orcidBio2.getPersonalDetails().getGivenNames().getContent());
    assertNotNull(orcidBio2.getContactDetails());
    assertEquals("don@semantico.com", orcidBio2.getContactDetails().retrievePrimaryEmail().getValue());
}
Also used : OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)26 OrcidSearchResult (org.orcid.jaxb.model.message.OrcidSearchResult)26 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)19 Test (org.junit.Test)15 BaseTest (org.orcid.core.BaseTest)14 OrcidSearchResults (org.orcid.jaxb.model.message.OrcidSearchResults)8 OrcidSolrResult (org.orcid.utils.solr.entities.OrcidSolrResult)8 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)7 Rollback (org.springframework.test.annotation.Rollback)6 ArrayList (java.util.ArrayList)5 DeactivatedException (org.orcid.core.exception.DeactivatedException)4 OrcidDeprecatedException (org.orcid.core.exception.OrcidDeprecatedException)4 LockedException (org.orcid.core.security.aop.LockedException)4 Funding (org.orcid.jaxb.model.message.Funding)4 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)4 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)4 OrcidSolrResults (org.orcid.utils.solr.entities.OrcidSolrResults)4 BufferedReader (java.io.BufferedReader)2 IOException (java.io.IOException)2 Reader (java.io.Reader)2