Search in sources :

Example 1 with OrcidProfileToSolrDocument

use of org.orcid.listener.solr.OrcidProfileToSolrDocument in project ORCID-Source by ORCID.

the class OrcidRecordToSolrDocumentTest method test12SameAs20.

@Test
public void test12SameAs20() throws IOException, SolrServerException, JAXBException {
    OrcidProfileToSolrDocument v12 = new OrcidProfileToSolrDocument();
    OrcidRecordToSolrDocument v20 = new OrcidRecordToSolrDocument(false);
    Record record = getRecord("/v20record.xml");
    OrcidMessage message = getOrcidMessage();
    OrcidSolrDocument v12Doc = v12.convert(message.getOrcidProfile());
    OrcidSolrDocument v20Doc = v20.convert(record, new ArrayList<Funding>());
    Assert.assertEquals(v12Doc.getOrcid(), v20Doc.getOrcid());
    Assert.assertEquals(v12Doc.getFamilyName(), v20Doc.getFamilyName());
    Assert.assertEquals(v12Doc.getGivenNames(), v20Doc.getGivenNames());
    Assert.assertEquals(v12Doc.getGivenAndFamilyNames(), v20Doc.getGivenAndFamilyNames());
    Assert.assertTrue(v12Doc.getDigitalObjectIds().containsAll(v20Doc.getDigitalObjectIds()));
    Assert.assertTrue(v20Doc.getDigitalObjectIds().containsAll(v12Doc.getDigitalObjectIds()));
    Assert.assertTrue(v12Doc.getWorkTitles().containsAll(v20Doc.getWorkTitles()));
    Assert.assertTrue(v20Doc.getWorkTitles().containsAll(v12Doc.getWorkTitles()));
    Assert.assertTrue(v12Doc.getCit().containsAll(v20Doc.getCit()));
    Assert.assertTrue(v20Doc.getCit().containsAll(v12Doc.getCit()));
    Assert.assertTrue(v12Doc.getAgr().containsAll(v20Doc.getAgr()));
    Assert.assertTrue(v20Doc.getAgr().containsAll(v12Doc.getAgr()));
    Assert.assertEquals(v12Doc.getProfileLastModifiedDate(), v20Doc.getProfileLastModifiedDate());
    Assert.assertEquals(v12Doc.getProfileSubmissionDate(), v20Doc.getProfileSubmissionDate());
}
Also used : OrcidRecordToSolrDocument(org.orcid.listener.solr.OrcidRecordToSolrDocument) Funding(org.orcid.jaxb.model.record_v2.Funding) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) Record(org.orcid.jaxb.model.record_v2.Record) OrcidProfileToSolrDocument(org.orcid.listener.solr.OrcidProfileToSolrDocument) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)1 Funding (org.orcid.jaxb.model.record_v2.Funding)1 Record (org.orcid.jaxb.model.record_v2.Record)1 OrcidProfileToSolrDocument (org.orcid.listener.solr.OrcidProfileToSolrDocument)1 OrcidRecordToSolrDocument (org.orcid.listener.solr.OrcidRecordToSolrDocument)1 OrcidSolrDocument (org.orcid.utils.solr.entities.OrcidSolrDocument)1