Search in sources :

Example 11 with OrcidSolrDocument

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

the class OrcidRecordToSolrDocumentTest method testNonSchemaExternalID.

@Test
public void testNonSchemaExternalID() throws JAXBException {
    //as above, but with PDB identifier
    Record record = getRecord("/v20recordWithPDB.xml");
    OrcidRecordToSolrDocument v20 = new OrcidRecordToSolrDocument(false);
    OrcidSolrDocument v20Doc = v20.convert(record, new ArrayList<Funding>());
    Assert.assertEquals("cite-self", v20Doc.getSelfIds().get("cit-self").get(0));
    Assert.assertEquals("pdb-value-self", v20Doc.getSelfIds().get("pdb-self").get(0));
    Assert.assertEquals("cit-part-of", v20Doc.getPartOfIds().get("cit-part-of").get(0));
    Assert.assertEquals("pdb-value-part-of", v20Doc.getPartOfIds().get("pdb-part-of").get(0));
    Assert.assertTrue(v20Doc.getDigitalObjectIds().containsAll(v20Doc.getSelfIds().get("doi-self")));
    Assert.assertTrue(v20Doc.getSelfIds().get("doi-self").containsAll(v20Doc.getDigitalObjectIds()));
    Assert.assertTrue(v20Doc.getOtherIdentifierType().contains("pdb-value-self"));
    Assert.assertTrue(v20Doc.getOtherIdentifierType().contains("pdb-value-part-of"));
}
Also used : OrcidRecordToSolrDocument(org.orcid.listener.solr.OrcidRecordToSolrDocument) Funding(org.orcid.jaxb.model.record_v2.Funding) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) Record(org.orcid.jaxb.model.record_v2.Record) Test(org.junit.Test)

Example 12 with OrcidSolrDocument

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

the class OrcidIndexManagerImplTest method checkSubtitlesPersisted.

@Test
@Rollback
public void checkSubtitlesPersisted() throws Exception {
    OrcidProfile subtitledWorksProfile = getOrcidWithSubtitledWork();
    OrcidSolrDocument standardWorkListing = solrDocWithAdditionalSubtitles();
    orcidIndexManager.persistProfileInformationForIndexing(subtitledWorksProfile);
    verify(solrDao).persist(eq(standardWorkListing));
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 13 with OrcidSolrDocument

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

the class OrcidIndexManagerImplTest method fullyPopulatedSolrDocumentForPersistence.

private OrcidSolrDocument fullyPopulatedSolrDocumentForPersistence() {
    OrcidSolrDocument orcidSolrDocument = new OrcidSolrDocument();
    orcidSolrDocument.setOrcid("1234");
    orcidSolrDocument.setCreditName("credit name");
    orcidSolrDocument.setArxiv(new ArrayList<String>());
    orcidSolrDocument.setAsin(new ArrayList<String>());
    orcidSolrDocument.setAsintld(new ArrayList<String>());
    orcidSolrDocument.setBibcode(new ArrayList<String>());
    orcidSolrDocument.setDigitalObjectIds(new ArrayList<String>());
    orcidSolrDocument.setEid(new ArrayList<String>());
    orcidSolrDocument.setIsbn(new ArrayList<String>());
    orcidSolrDocument.setIssn(new ArrayList<String>());
    orcidSolrDocument.setJfm(new ArrayList<String>());
    orcidSolrDocument.setJstor(new ArrayList<String>());
    orcidSolrDocument.setLccn(new ArrayList<String>());
    orcidSolrDocument.setMr(new ArrayList<String>());
    orcidSolrDocument.setOclc(new ArrayList<String>());
    orcidSolrDocument.setOl(new ArrayList<String>());
    orcidSolrDocument.setOsti(new ArrayList<String>());
    orcidSolrDocument.setOtherIdentifierType(new ArrayList<String>());
    orcidSolrDocument.setPmc(new ArrayList<String>());
    orcidSolrDocument.setRfc(new ArrayList<String>());
    orcidSolrDocument.setSsrn(new ArrayList<String>());
    orcidSolrDocument.setZbl(new ArrayList<String>());
    orcidSolrDocument.setFamilyName("familyName");
    orcidSolrDocument.setGivenNames("givenNames");
    orcidSolrDocument.addEmailAddress("email");
    // orcidSolrDocument.setAffiliatePrimaryInstitutionNames(Arrays.asList(new
    // String[] { "Primary Inst1" }));
    // orcidSolrDocument.setAffiliateInstitutionNames(Arrays.asList(new
    // String[] { "Current Inst2" }));
    orcidSolrDocument.setOtherNames(Arrays.asList(new String[] { "Other 1", "Other 2" }));
    orcidSolrDocument.setPmid(Arrays.asList(new String[] { "work1-pmid" }));
    orcidSolrDocument.setExternalIdSources(Arrays.asList(new String[] { "45678", "54321" }));
    orcidSolrDocument.setExternalIdReferences(Arrays.asList(new String[] { "defghi", "abc123" }));
    orcidSolrDocument.setExternalIdSourcesAndReferences(Arrays.asList(new String[] { "45678=defghi", "54321=abc123" }));
    // orcidSolrDocument.setPastInstitutionNames(Arrays.asList(new String[]
    // { "Past Inst 1", "Past Inst 2" }));
    orcidSolrDocument.setWorkTitles(Arrays.asList(new String[] { "Work title 1", "Work title 2" }));
    orcidSolrDocument.setKeywords(Arrays.asList(new String[] { "Pavement Studies", "Advanced Tea Making" }));
    OrcidProfile orcidProfile = getStandardOrcid();
    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 14 with OrcidSolrDocument

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

the class OrcidIndexManagerImplTest method solrDocumentLimitedtoVisibleDoi.

private OrcidSolrDocument solrDocumentLimitedtoVisibleDoi() {
    OrcidSolrDocument orcidSolrDocument = fullyPopulatedSolrDocumentForPersistence();
    orcidSolrDocument.setDigitalObjectIds((Arrays.asList(new String[] { "work1-doi1", "work2-doi1", "work2-doi2" })));
    OrcidProfile orcidProfile = getStandardOrcidWithDoiInformation();
    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 15 with OrcidSolrDocument

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

the class OrcidIndexManagerImplTest method checkGrantsPersisted.

@Test
@Rollback
public void checkGrantsPersisted() throws Exception {
    OrcidProfile grantsProfileListing = getOrcidWithGrants();
    OrcidSolrDocument grantsListing = solrDocWithFundingTitles();
    orcidIndexManager.persistProfileInformationForIndexing(grantsProfileListing);
    verify(solrDao).persist(eq(grantsListing));
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) 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