use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method testAddExternalIdentifierToUnclaimedRecordPreserveExternalIdentifierVisibility.
@Test
public void testAddExternalIdentifierToUnclaimedRecordPreserveExternalIdentifierVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId = getExternalIdentifier();
extId = externalIdentifierManager.createExternalIdentifier(unclaimedOrcid, extId, true);
extId = externalIdentifierManager.getExternalIdentifier(unclaimedOrcid, extId.getPutCode());
assertNotNull(extId);
assertEquals(Visibility.PUBLIC, extId.getVisibility());
}
use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method testAddExternalIdentifierToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddExternalIdentifierToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId = getExternalIdentifier();
extId = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
extId = externalIdentifierManager.getExternalIdentifier(claimedOrcid, extId.getPutCode());
assertNotNull(extId);
assertEquals(Visibility.LIMITED, extId.getVisibility());
}
use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method displayIndexIsSetTo_1_FromUI.
@Test
public void displayIndexIsSetTo_1_FromUI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId = getExternalIdentifier();
extId.setType(extId.getType() + System.currentTimeMillis());
PersonExternalIdentifier extId1 = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, false);
extId1 = externalIdentifierManager.getExternalIdentifier(claimedOrcid, extId1.getPutCode());
assertNotNull(extId1);
assertEquals(Long.valueOf(1), extId1.getDisplayIndex());
}
use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class PersonValidatorTest method validateExternalIdentifier_invalidUrl_emptyUrlTest.
@Test(expected = OrcidValidationException.class)
public void validateExternalIdentifier_invalidUrl_emptyUrlTest() {
PersonExternalIdentifier extId = getPersonExternalIdentifier();
extId.setUrl(new Url());
PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), true, true, Visibility.PUBLIC, true);
fail();
}
use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class PersonValidatorTest method validateExternalIdentifier_invalidTypeTest.
@Test(expected = OrcidValidationException.class)
public void validateExternalIdentifier_invalidTypeTest() {
PersonExternalIdentifier extId = getPersonExternalIdentifier();
extId.setType(null);
PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), true, true, Visibility.PUBLIC, true);
fail();
}
Aggregations