Search in sources :

Example 41 with PersonExternalIdentifier

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

the class PersonValidatorTest method validateExternalIdentifier_invalidPutCodeOnUpdateTest.

@Test(expected = PutCodeRequiredException.class)
public void validateExternalIdentifier_invalidPutCodeOnUpdateTest() {
    PersonExternalIdentifier extId = getPersonExternalIdentifier();
    extId.setPutCode(null);
    PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), false, true, Visibility.PUBLIC, true);
    fail();
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test)

Example 42 with PersonExternalIdentifier

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

the class PersonValidatorTest method validateExternalIdentifier_invalidRelationship2_flagOffTest.

@Test
public void validateExternalIdentifier_invalidRelationship2_flagOffTest() {
    PersonExternalIdentifier extId = getPersonExternalIdentifier();
    extId.setRelationship(Relationship.PART_OF);
    PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), true, true, Visibility.PUBLIC, false);
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test)

Example 43 with PersonExternalIdentifier

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

the class PersonValidatorTest method validateExternalIdentifier_visibilityDoesntChangeTest.

@Test(expected = VisibilityMismatchException.class)
public void validateExternalIdentifier_visibilityDoesntChangeTest() {
    PersonExternalIdentifier extId = getPersonExternalIdentifier();
    extId.setPutCode(1L);
    extId.setVisibility(Visibility.LIMITED);
    PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), false, true, Visibility.PUBLIC, true);
    fail();
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test)

Example 44 with PersonExternalIdentifier

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

the class PersonValidatorTest method validateExternalIdentifier_invalidUrl_nullUrlTest.

@Test(expected = OrcidValidationException.class)
public void validateExternalIdentifier_invalidUrl_nullUrlTest() {
    PersonExternalIdentifier extId = getPersonExternalIdentifier();
    extId.setUrl(null);
    PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), true, true, Visibility.PUBLIC, true);
    fail();
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test)

Example 45 with PersonExternalIdentifier

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

the class JpaJaxbExternalIdentifierAdapterTest method fromExternalIdentifierEntityToExternalIdentifier.

@Test
public void fromExternalIdentifierEntityToExternalIdentifier() {
    ExternalIdentifierEntity entity = getExternalIdentifierEntity();
    PersonExternalIdentifier extId = jpaJaxbExternalIdentifierAdapter.toExternalIdentifier(entity);
    assertNotNull(extId);
    assertNotNull(extId.getCreatedDate());
    assertNotNull(extId.getCreatedDate().getValue());
    assertNotNull(extId.getLastModifiedDate());
    assertNotNull(extId.getLastModifiedDate().getValue());
    assertEquals("common-name", extId.getType());
    assertEquals("id-reference", extId.getValue());
    assertNotNull(extId.getUrl());
    assertEquals("http://myurl.com", extId.getUrl().getValue());
    assertEquals(Long.valueOf(123), extId.getPutCode());
    assertNotNull(extId.getSource());
    assertEquals("APP-0000000000000000", extId.getSource().retrieveSourcePath());
    assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value());
    assertNotNull(extId.getCreatedDate());
    assertNotNull(extId.getLastModifiedDate());
}
Also used : ExternalIdentifierEntity(org.orcid.persistence.jpa.entities.ExternalIdentifierEntity) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test)

Aggregations

PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)93 Test (org.junit.Test)68 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)42 PersonExternalIdentifiers (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers)40 Address (org.orcid.jaxb.model.v3.dev1.record.Address)39 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)39 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)38 Email (org.orcid.jaxb.model.v3.dev1.record.Email)36 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)31 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)31 Addresses (org.orcid.jaxb.model.v3.dev1.record.Addresses)30 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)30 Keywords (org.orcid.jaxb.model.v3.dev1.record.Keywords)30 ResearcherUrls (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls)30 Person (org.orcid.jaxb.model.v3.dev1.record.Person)28 Name (org.orcid.jaxb.model.v3.dev1.record.Name)27 DBUnitTest (org.orcid.test.DBUnitTest)21 Response (javax.ws.rs.core.Response)19 Record (org.orcid.jaxb.model.v3.dev1.record.Record)15 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)15