Search in sources :

Example 36 with ExternalIDs

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

the class OrcidSecurityManagerTestBase method createPeerReviewSummary.

protected PeerReviewSummary createPeerReviewSummary(Visibility v, String sourceId, String extIdValue) {
    PeerReviewSummary p = new PeerReviewSummary();
    p.setVisibility(v);
    p.setGroupId(EXTID_SHARED);
    setSource(p, sourceId);
    ExternalID extId = new ExternalID();
    extId.setValue(extIdValue);
    ExternalIDs extIds = new ExternalIDs();
    extIds.getExternalIdentifier().add(extId);
    addSharedExtId(extIds);
    p.setExternalIdentifiers(extIds);
    return p;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID)

Example 37 with ExternalIDs

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

the class OrcidSecurityManagerTestBase method createFundingSummary.

protected FundingSummary createFundingSummary(Visibility v, String sourceId, String extIdValue) {
    FundingSummary f = new FundingSummary();
    f.setVisibility(v);
    setSource(f, sourceId);
    ExternalID extId = new ExternalID();
    extId.setValue(extIdValue);
    ExternalIDs extIds = new ExternalIDs();
    extIds.getExternalIdentifier().add(extId);
    addSharedExtId(extIds);
    f.setExternalIdentifiers(extIds);
    return f;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)

Example 38 with ExternalIDs

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

the class ActivityValidatorTest method validateDuplicatedExtIds_duplicatesFoundTest.

@SuppressWarnings("deprecation")
@Test(expected = OrcidDuplicatedActivityException.class)
public void validateDuplicatedExtIds_duplicatesFoundTest() {
    SourceEntity source1 = mock(SourceEntity.class);
    when(source1.getSourceName()).thenReturn("source name");
    when(source1.getSourceId()).thenReturn("APP-00000000000000");
    SourceClientId sourceClientId = new SourceClientId();
    sourceClientId.setPath("APP-00000000000000");
    Source source2 = mock(Source.class);
    when(source2.getSourceName()).thenReturn(new SourceName("source name"));
    when(source2.getSourceClientId()).thenReturn(sourceClientId);
    ExternalIDs extIds1 = getExternalIDs();
    ExternalIDs extIds2 = getExternalIDs();
    activityValidator.checkExternalIdentifiersForDuplicates(extIds1, extIds2, source2, source1);
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) SourceClientId(org.orcid.jaxb.model.v3.dev1.common.SourceClientId) SourceName(org.orcid.jaxb.model.v3.dev1.common.SourceName) Source(org.orcid.jaxb.model.v3.dev1.common.Source) Test(org.junit.Test)

Example 39 with ExternalIDs

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

the class ExternalIDValidatorTest method testValidateFunding.

@Test
public void testValidateFunding() {
    ExternalID id1 = new ExternalID();
    id1.setRelationship(Relationship.SELF);
    id1.setType("grant_number");
    id1.setValue("value1");
    id1.setUrl(new Url("http://value1.com"));
    ExternalIDs ids = new ExternalIDs();
    ids.getExternalIdentifier().add(id1);
    validator.validateFunding(ids);
    ExternalID id2 = new ExternalID();
    id2.setRelationship(Relationship.SELF);
    id2.setType("INVALID");
    id2.setValue("value2");
    id2.setUrl(new Url("http://value1.com"));
    ids.getExternalIdentifier().add(id2);
    // IDS one valid, one invalid
    try {
        validator.validateFunding(ids);
        fail("no exception thrown for invalid type");
    } catch (Exception e) {
        if (!(e instanceof ActivityIdentifierValidationException))
            throw e;
    }
    // both valid
    id2.setType("grant_number");
    validator.validateFunding(ids);
    // IDS one valid, one invalid due to null
    id2.setType(null);
    try {
        validator.validateFunding(ids);
        fail("no exception thrown for invalid type");
    } catch (Exception e) {
        if (!(e instanceof ActivityIdentifierValidationException))
            throw e;
    }
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Url(org.orcid.jaxb.model.v3.dev1.common.Url) ActivityIdentifierValidationException(org.orcid.core.exception.ActivityIdentifierValidationException) ActivityIdentifierValidationException(org.orcid.core.exception.ActivityIdentifierValidationException) Test(org.junit.Test)

Example 40 with ExternalIDs

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

the class ExternalIDValidatorTest method testEmptyRelationshipOnExternalIds_flagOff.

@Test
public void testEmptyRelationshipOnExternalIds_flagOff() {
    ExternalIDs extIds = new ExternalIDs();
    ExternalID id1 = new ExternalID();
    id1.setRelationship(Relationship.SELF);
    id1.setType("doi");
    id1.setValue("value1");
    id1.setUrl(new Url("http://value1.com"));
    ExternalID id2 = new ExternalID();
    id2.setRelationship(null);
    id2.setType("doi");
    id2.setValue("value1");
    id2.setUrl(new Url("http://value1.com"));
    ExternalID id3 = new ExternalID();
    id3.setRelationship(Relationship.SELF);
    id3.setType("doi");
    id3.setValue("value1");
    id3.setUrl(new Url("http://value1.com"));
    extIds.getExternalIdentifier().add(id1);
    extIds.getExternalIdentifier().add(id2);
    extIds.getExternalIdentifier().add(id3);
    validator.validateWorkOrPeerReview(extIds);
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Url(org.orcid.jaxb.model.v3.dev1.common.Url) Test(org.junit.Test)

Aggregations

ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)75 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)72 Url (org.orcid.jaxb.model.v3.dev1.common.Url)49 Test (org.junit.Test)45 Title (org.orcid.jaxb.model.v3.dev1.common.Title)23 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)22 Response (javax.ws.rs.core.Response)20 DBUnitTest (org.orcid.test.DBUnitTest)20 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)19 List (java.util.List)15 Work (org.orcid.jaxb.model.v3.dev1.record.Work)14 TransientNonEmptyString (org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString)8 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)8 WorkBulk (org.orcid.jaxb.model.v3.dev1.record.WorkBulk)7 BaseTest (org.orcid.core.BaseTest)6 JSONUrl (org.orcid.core.adapter.jsonidentifier.JSONUrl)6 DisambiguatedOrganization (org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization)6 Organization (org.orcid.jaxb.model.v3.dev1.common.Organization)6 OrganizationAddress (org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress)6 FundingTitle (org.orcid.jaxb.model.v3.dev1.record.FundingTitle)6