Search in sources :

Example 1 with Relationship

use of org.orcid.jaxb.model.v3.dev1.record.Relationship in project ORCID-Source by ORCID.

the class JSONExternalIdentifiersConverterV3Test method testConvertTo.

@Test
public void testConvertTo() throws JAXBException {
    Education education = getEducation();
    assertEquals("{\"externalIdentifier\":[{\"type\":\"GRANT_NUMBER\",\"value\":\"external-identifier-value\",\"url\":{\"value\":\"http://tempuri.org\"},\"relationship\":\"SELF\"},{\"type\":\"GRANT_NUMBER\",\"value\":\"external-identifier-value2\",\"url\":{\"value\":\"http://tempuri.org/2\"},\"relationship\":\"SELF\"}]}", converter.convertTo(education.getExternalIdentifiers(), null));
}
Also used : Education(org.orcid.jaxb.model.v3.dev1.record.Education) Test(org.junit.Test)

Example 2 with Relationship

use of org.orcid.jaxb.model.v3.dev1.record.Relationship in project ORCID-Source by ORCID.

the class JSONPeerReviewWorkExternalIdentifierConverterV3Test method testConvertTo.

@Test
public void testConvertTo() throws JAXBException {
    PeerReview peerReview = getPeerReview();
    assertEquals("{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"DOI\",\"workExternalIdentifierId\":{\"content\":\"peer-review:subject-external-identifier-id\"}}", converter.convertTo(peerReview.getSubjectExternalIdentifier(), null));
}
Also used : PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) Test(org.junit.Test)

Example 3 with Relationship

use of org.orcid.jaxb.model.v3.dev1.record.Relationship in project ORCID-Source by ORCID.

the class JSONWorkExternalIdentifiersConverterV3Test method testConvertTo.

@Test
public void testConvertTo() throws JAXBException {
    Work work = getWork();
    assertEquals("{\"workExternalIdentifier\":[{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"AGR\",\"workExternalIdentifierId\":{\"content\":\"work:external-identifier-id\"}}]}", converter.convertTo(work.getExternalIdentifiers(), null));
}
Also used : Work(org.orcid.jaxb.model.v3.dev1.record.Work) Test(org.junit.Test)

Example 4 with Relationship

use of org.orcid.jaxb.model.v3.dev1.record.Relationship in project ORCID-Source by ORCID.

the class ExternalIDValidatorTest method testEmptyRelationshipOnSingleExternalId_flagOff.

@Test
public void testEmptyRelationshipOnSingleExternalId_flagOff() {
    ExternalID id1 = new ExternalID();
    id1.setType("doi");
    id1.setValue("value1");
    id1.setUrl(new Url("http://value1.com"));
    validator.validateWorkOrPeerReview(id1);
    // empty relationship
    id1.setRelationship(null);
    validator.validateWorkOrPeerReview(id1);
}
Also used : ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Url(org.orcid.jaxb.model.v3.dev1.common.Url) Test(org.junit.Test)

Example 5 with Relationship

use of org.orcid.jaxb.model.v3.dev1.record.Relationship in project ORCID-Source by ORCID.

the class JpaJaxbPeerReviewAdapterTest method testToOrgAffiliationRelationEntity.

@Test
public void testToOrgAffiliationRelationEntity() throws JAXBException {
    PeerReview e = getPeerReview(true);
    assertNotNull(e);
    PeerReviewEntity pe = jpaJaxbPeerReviewAdapter.toPeerReviewEntity(e);
    assertNotNull(pe);
    // General info
    assertEquals(Long.valueOf(12345), pe.getId());
    assertEquals(Visibility.PRIVATE.value(), pe.getVisibility().value());
    assertEquals("{\"workExternalIdentifier\":[{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"SOURCE_WORK_ID\",\"workExternalIdentifierId\":{\"content\":\"work:external-identifier-id\"}}]}", pe.getExternalIdentifiersJson());
    assertEquals("reviewer", pe.getRole().value());
    assertEquals("review", pe.getType().value());
    assertEquals("peer-review:url", pe.getUrl());
    // Dates
    assertEquals(Integer.valueOf(2), pe.getCompletionDate().getDay());
    assertEquals(Integer.valueOf(2), pe.getCompletionDate().getMonth());
    assertEquals(Integer.valueOf(1848), pe.getCompletionDate().getYear());
    // Source
    assertNull(pe.getSourceId());
    assertNull(pe.getClientSourceId());
    assertNull(pe.getElementSourceId());
    // Check org values
    assertEquals("common:name", pe.getOrg().getName());
    assertEquals("common:city", pe.getOrg().getCity());
    assertEquals("common:region", pe.getOrg().getRegion());
    assertEquals(org.orcid.jaxb.model.common_v2.Iso3166Country.AF.value(), pe.getOrg().getCountry().value());
    assertEquals("http://dx.doi.org/10.13039/100000001", pe.getOrg().getOrgDisambiguated().getSourceId());
    assertEquals("FUNDREF", pe.getOrg().getOrgDisambiguated().getSourceType());
    // Check subject
    assertEquals("{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"DOI\",\"workExternalIdentifierId\":{\"content\":\"peer-review:subject-external-identifier-id\"}}", pe.getSubjectExternalIdentifiersJson());
    assertEquals("peer-review:subject-container-name", pe.getSubjectContainerName());
    assertEquals("peer-review:subject-name", pe.getSubjectName());
    assertEquals("peer-review:subject-translated-name", pe.getSubjectTranslatedName());
    assertEquals("en", pe.getSubjectTranslatedNameLanguageCode());
    assertEquals("peer-review:subject-url", pe.getSubjectUrl());
    assertEquals(org.orcid.jaxb.model.record_v2.WorkType.JOURNAL_ARTICLE, pe.getSubjectType());
    // Check group id
    assertEquals("orcid-generated:12345", pe.getGroupId());
}
Also used : PeerReviewEntity(org.orcid.persistence.jpa.entities.PeerReviewEntity) PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)10 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)6 Url (org.orcid.jaxb.model.v3.dev1.common.Url)2 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)2 PeerReview (org.orcid.jaxb.model.v3.dev1.record.PeerReview)2 Work (org.orcid.jaxb.model.v3.dev1.record.Work)2 MapperFactory (ma.glasnost.orika.MapperFactory)1 DefaultMapperFactory (ma.glasnost.orika.impl.DefaultMapperFactory)1 Item (org.orcid.jaxb.model.v3.dev1.notification.permission.Item)1 Education (org.orcid.jaxb.model.v3.dev1.record.Education)1 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)1 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)1 ExternalIdentifierEntity (org.orcid.persistence.jpa.entities.ExternalIdentifierEntity)1 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)1 ProfileFundingEntity (org.orcid.persistence.jpa.entities.ProfileFundingEntity)1 PublicationDateEntity (org.orcid.persistence.jpa.entities.PublicationDateEntity)1 WorkEntity (org.orcid.persistence.jpa.entities.WorkEntity)1