Search in sources :

Example 1 with OrcidSolrDocument

use of org.orcid.utils.solr.entities.OrcidSolrDocument in project ORCID-Source by ORCID.

the class OrcidIndexManagerImplTest method solrDocFilteredByAffilliationVisibility.

private OrcidSolrDocument solrDocFilteredByAffilliationVisibility() {
    OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
    OrcidProfile orcidProfile = orcidProfileLimitedVisiblityAffiliations();
    OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfile);
    orcidSolrDocument.setPublicProfileMessage(orcidMessage.toString());
    return orcidSolrDocument;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage)

Example 2 with OrcidSolrDocument

use of org.orcid.utils.solr.entities.OrcidSolrDocument in project ORCID-Source by ORCID.

the class OrcidIndexManagerImplTest method solrDocWithFundingTitles.

private OrcidSolrDocument solrDocWithFundingTitles() {
    OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
    orcidSolrDocument.setFundingTitles(Arrays.asList(new String[] { "grant 1", "grant 2" }));
    OrcidProfile orcidProfile = getOrcidWithGrants();
    OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfile);
    orcidSolrDocument.setPublicProfileMessage(orcidMessage.toString());
    return orcidSolrDocument;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage)

Example 3 with OrcidSolrDocument

use of org.orcid.utils.solr.entities.OrcidSolrDocument in project ORCID-Source by ORCID.

the class OrcidIndexManagerImplTest method visibilityConstraintsAppliedToSolr.

@Test
@Rollback
@Ignore
public void visibilityConstraintsAppliedToSolr() throws Exception {
    OrcidProfile hiddenNamesOrcid = orcidProfileLimitedVisiblityCreditNameAndOtherNames();
    orcidIndexManager.persistProfileInformationForIndexing(hiddenNamesOrcid);
    // check that limited fields are hidden from solr indexing
    OrcidSolrDocument namesHiddenSolrDoc = solrDocFilteredByNameVisibility();
    verify(solrDao).persist(eq(namesHiddenSolrDoc));
    // reset orcid test data and check affilations
    OrcidProfile limitedOrcid = orcidProfileLimitedVisiblityAffiliations();
    orcidIndexManager.persistProfileInformationForIndexing(limitedOrcid);
    OrcidSolrDocument hiddenPastAffiliations = solrDocFilteredByAffilliationVisibility();
    verify(solrDao).persist(eq(hiddenPastAffiliations));
    OrcidProfile orcidAllWorksPrivate = orcidProfileAllLimitedVisibilityWorks();
    orcidIndexManager.persistProfileInformationForIndexing(orcidAllWorksPrivate);
    OrcidSolrDocument hiddenWorks = solrDocFilteredByAffilliationVisibility();
    verify(solrDao).persist(eq(hiddenWorks));
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) Ignore(org.junit.Ignore) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 4 with OrcidSolrDocument

use of org.orcid.utils.solr.entities.OrcidSolrDocument in project ORCID-Source by ORCID.

the class OrcidIndexManagerImplTest method solrDocFilteredByNameVisibility.

private OrcidSolrDocument solrDocFilteredByNameVisibility() {
    OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
    orcidSolrDocument.setCreditName(null);
    orcidSolrDocument.setOtherNames(null);
    orcidSolrDocument.setGivenNames(null);
    orcidSolrDocument.setFamilyName(null);
    orcidSolrDocument.setGivenAndFamilyNames(null);
    OrcidProfile orcidProfile = orcidProfileLimitedVisiblityCreditNameAndOtherNames();
    OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfile);
    orcidSolrDocument.setPublicProfileMessage(orcidMessage.toString());
    return orcidSolrDocument;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage)

Example 5 with OrcidSolrDocument

use of org.orcid.utils.solr.entities.OrcidSolrDocument in project ORCID-Source by ORCID.

the class OrcidIndexManagerImplTest method onlyDoiPersistedFromOrcidWorks.

@Test
@Rollback
public void onlyDoiPersistedFromOrcidWorks() {
    OrcidProfile orcidProfileWithDOI = getStandardOrcidWithDoiInformation();
    OrcidSolrDocument doiListings = solrDocumentLimitedtoVisibleDoi();
    // check that the limited profiles or non doi identifiers aren't
    // included
    orcidIndexManager.persistProfileInformationForIndexing(orcidProfileWithDOI);
    verify(solrDao).persist(eq(doiListings));
    // now check null values aren't persisted when either the type or value
    // are missing
    OrcidWork orcidWork1 = orcidProfileWithDOI.retrieveOrcidWorks().getOrcidWork().get(0);
    orcidWork1.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).setWorkExternalIdentifierType(null);
    OrcidWork orcidWork2 = orcidProfileWithDOI.retrieveOrcidWorks().getOrcidWork().get(1);
    orcidWork2.getWorkExternalIdentifiers().getWorkExternalIdentifier().get(0).setWorkExternalIdentifierId(null);
    // so this should leave only the second doi
    doiListings.setDigitalObjectIds(Arrays.asList(new String[] { "work2-doi2" }));
    OrcidMessage orcidMessage = createFilteredOrcidMessage(orcidProfileWithDOI);
    doiListings.setPublicProfileMessage(orcidMessage.toString());
    orcidIndexManager.persistProfileInformationForIndexing(orcidProfileWithDOI);
    verify(solrDao).persist(eq(doiListings));
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Aggregations

OrcidSolrDocument (org.orcid.utils.solr.entities.OrcidSolrDocument)31 Test (org.junit.Test)16 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)12 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)11 OrcidSolrResult (org.orcid.utils.solr.entities.OrcidSolrResult)9 ArrayList (java.util.ArrayList)4 BaseTest (org.orcid.core.BaseTest)4 Funding (org.orcid.jaxb.model.record_v2.Funding)4 Rollback (org.springframework.test.annotation.Rollback)4 HashMap (java.util.HashMap)3 List (java.util.List)3 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)3 Record (org.orcid.jaxb.model.record_v2.Record)3 OrcidRecordToSolrDocument (org.orcid.listener.solr.OrcidRecordToSolrDocument)3 OrcidSolrResults (org.orcid.utils.solr.entities.OrcidSolrResults)3 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)2 Email (org.orcid.jaxb.model.message.Email)2 ExternalIdReference (org.orcid.jaxb.model.message.ExternalIdReference)2 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)2 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)2