Search in sources :

Example 1 with SourceName

use of org.orcid.jaxb.model.v3.dev1.common.SourceName 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 2 with SourceName

use of org.orcid.jaxb.model.v3.dev1.common.SourceName in project ORCID-Source by ORCID.

the class ActivityValidatorTest method checkDupesNormalized.

// validate normalization is being used
@Test(expected = OrcidDuplicatedActivityException.class)
public void checkDupesNormalized() {
    ExternalID id1 = new ExternalID();
    id1.setRelationship(Relationship.SELF);
    id1.setType("agr");
    id1.setValue("UPPER");
    ExternalIDs ids1 = new ExternalIDs();
    ids1.getExternalIdentifier().add(id1);
    ExternalID id2 = new ExternalID();
    id2.setRelationship(Relationship.SELF);
    id2.setType("agr");
    id2.setValue("upper");
    id2.setNormalized(new TransientNonEmptyString("upper"));
    ExternalIDs ids2 = new ExternalIDs();
    ids2.getExternalIdentifier().add(id2);
    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);
    activityValidator.checkExternalIdentifiersForDuplicates(ids1, ids2, source2, source1);
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) SourceClientId(org.orcid.jaxb.model.v3.dev1.common.SourceClientId) SourceName(org.orcid.jaxb.model.v3.dev1.common.SourceName) TransientNonEmptyString(org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString) Source(org.orcid.jaxb.model.v3.dev1.common.Source) Test(org.junit.Test)

Example 3 with SourceName

use of org.orcid.jaxb.model.v3.dev1.common.SourceName in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateDuplicatedExtIds_noDuplicatesTest.

/**
 * VALIDATE DUPLICATED EXTERNAL IDENTIFIERS
 */
@SuppressWarnings("deprecation")
@Test
public void validateDuplicatedExtIds_noDuplicatesTest() {
    SourceEntity source1 = mock(SourceEntity.class);
    when(source1.getSourceName()).thenReturn("source name");
    when(source1.getSourceId()).thenReturn("APP-00000000000000");
    SourceOrcid sourceOrcid = new SourceOrcid();
    sourceOrcid.setPath("0000-0000-0000-0000");
    Source source2 = mock(Source.class);
    when(source2.getSourceName()).thenReturn(new SourceName("other source name"));
    when(source2.getSourceOrcid()).thenReturn(sourceOrcid);
    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) SourceName(org.orcid.jaxb.model.v3.dev1.common.SourceName) SourceOrcid(org.orcid.jaxb.model.v3.dev1.common.SourceOrcid) Source(org.orcid.jaxb.model.v3.dev1.common.Source) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 Source (org.orcid.jaxb.model.v3.dev1.common.Source)3 SourceName (org.orcid.jaxb.model.v3.dev1.common.SourceName)3 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)3 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)3 SourceClientId (org.orcid.jaxb.model.v3.dev1.common.SourceClientId)2 SourceOrcid (org.orcid.jaxb.model.v3.dev1.common.SourceOrcid)1 TransientNonEmptyString (org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString)1 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)1