Search in sources :

Example 41 with PersonExternalIdentifier

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());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 42 with PersonExternalIdentifier

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());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 43 with PersonExternalIdentifier

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());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 44 with PersonExternalIdentifier

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();
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Url(org.orcid.jaxb.model.common_v2.Url) Test(org.junit.Test)

Example 45 with PersonExternalIdentifier

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();
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Test(org.junit.Test)

Aggregations

PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)104 Test (org.junit.Test)93 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)52 OtherName (org.orcid.jaxb.model.record_v2.OtherName)46 Address (org.orcid.jaxb.model.record_v2.Address)45 Keyword (org.orcid.jaxb.model.record_v2.Keyword)44 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)43 Email (org.orcid.jaxb.model.record_v2.Email)41 Biography (org.orcid.jaxb.model.record_v2.Biography)34 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)34 Addresses (org.orcid.jaxb.model.record_v2.Addresses)32 Emails (org.orcid.jaxb.model.record_v2.Emails)32 Keywords (org.orcid.jaxb.model.record_v2.Keywords)32 Person (org.orcid.jaxb.model.record_v2.Person)32 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)32 Name (org.orcid.jaxb.model.record_v2.Name)30 DBUnitTest (org.orcid.test.DBUnitTest)21 Response (javax.ws.rs.core.Response)19 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)19 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)19