Search in sources :

Example 86 with PersonExternalIdentifier

use of org.orcid.jaxb.model.v3.dev1.record.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.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 87 with PersonExternalIdentifier

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

the class ExternalIdentifierManagerTest method testAddEqualsExternalIdentifiersFromDifferentSource.

@Test
public void testAddEqualsExternalIdentifiersFromDifferentSource() {
    PersonExternalIdentifier extId = getExternalIdentifier();
    extId.setType(extId.getType() + System.currentTimeMillis());
    // Create from client # 1
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    PersonExternalIdentifier extId1 = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
    assertNotNull(extId1);
    assertNotNull(extId1.getPutCode());
    // Create from client # 2
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_2_ID)));
    PersonExternalIdentifier extId2 = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
    assertNotNull(extId2);
    assertNotNull(extId2.getPutCode());
    // Verify both ext ids are not the same one
    assertNotEquals(extId1.getPutCode(), extId2.getPutCode());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 88 with PersonExternalIdentifier

use of org.orcid.jaxb.model.v3.dev1.record.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.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 89 with PersonExternalIdentifier

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

the class ExternalIdentifierManagerTest method getAllTest.

@Test
public void getAllTest() {
    String orcid = "0000-0000-0000-0003";
    PersonExternalIdentifiers elements = externalIdentifierManager.getExternalIdentifiers(orcid);
    assertNotNull(elements);
    assertNotNull(elements.getExternalIdentifiers());
    assertEquals(5, elements.getExternalIdentifiers().size());
    boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
    for (PersonExternalIdentifier element : elements.getExternalIdentifiers()) {
        if (13 == element.getPutCode()) {
            found1 = true;
        } else if (14 == element.getPutCode()) {
            found2 = true;
        } else if (15 == element.getPutCode()) {
            found3 = true;
        } else if (16 == element.getPutCode()) {
            found4 = true;
        } else if (17 == element.getPutCode()) {
            found5 = true;
        } else {
            fail("Invalid put code found: " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    assertTrue(found5);
}
Also used : PersonExternalIdentifiers(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 90 with PersonExternalIdentifier

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

the class ExternalIdentifierManagerTest method displayIndexIsSetTo_0_FromAPI.

@Test
public void displayIndexIsSetTo_0_FromAPI() {
    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, true);
    extId1 = externalIdentifierManager.getExternalIdentifier(claimedOrcid, extId1.getPutCode());
    assertNotNull(extId1);
    assertEquals(Long.valueOf(0), extId1.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

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