Search in sources :

Example 31 with ResearcherUrl

use of org.orcid.jaxb.model.record_v2.ResearcherUrl in project ORCID-Source by ORCID.

the class ResearcherUrlManagerTest method displayIndexIsSetTo_0_FromAPI.

@Test
public void displayIndexIsSetTo_0_FromAPI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    ResearcherUrl rUrl = getResearcherUrl();
    rUrl.getUrl().setValue(rUrl.getUrl().getValue() + "/fromAPI");
    rUrl = researcherUrlManager.createResearcherUrl(claimedOrcid, rUrl, true);
    rUrl = researcherUrlManager.getResearcherUrl(claimedOrcid, rUrl.getPutCode());
    assertNotNull(rUrl);
    assertEquals(Long.valueOf(0), rUrl.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 32 with ResearcherUrl

use of org.orcid.jaxb.model.record_v2.ResearcherUrl in project ORCID-Source by ORCID.

the class ResearcherUrlManagerTest method displayIndexIsSetTo_1_FromUI.

@Test
public void displayIndexIsSetTo_1_FromUI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    ResearcherUrl rUrl = getResearcherUrl();
    rUrl.getUrl().setValue(rUrl.getUrl().getValue() + "/fromUI");
    rUrl = researcherUrlManager.createResearcherUrl(claimedOrcid, rUrl, false);
    rUrl = researcherUrlManager.getResearcherUrl(claimedOrcid, rUrl.getPutCode());
    assertNotNull(rUrl);
    assertEquals(Long.valueOf(1), rUrl.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 33 with ResearcherUrl

use of org.orcid.jaxb.model.record_v2.ResearcherUrl in project ORCID-Source by ORCID.

the class ResearcherUrlManagerTest method testAddResearcherUrToClaimedRecordPreserveUserDefaultVisibility.

@Test
public void testAddResearcherUrToClaimedRecordPreserveUserDefaultVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    ResearcherUrl rUrl = getResearcherUrl();
    rUrl = researcherUrlManager.createResearcherUrl(claimedOrcid, rUrl, true);
    rUrl = researcherUrlManager.getResearcherUrl(claimedOrcid, rUrl.getPutCode());
    assertNotNull(rUrl);
    assertEquals(Visibility.LIMITED, rUrl.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 34 with ResearcherUrl

use of org.orcid.jaxb.model.record_v2.ResearcherUrl in project ORCID-Source by ORCID.

the class ResearcherUrlManagerTest method getAllTest.

@Test
public void getAllTest() {
    String orcid = "0000-0000-0000-0003";
    ResearcherUrls elements = researcherUrlManager.getResearcherUrls(orcid, System.currentTimeMillis());
    assertNotNull(elements);
    assertNotNull(elements.getResearcherUrls());
    assertEquals(5, elements.getResearcherUrls().size());
    boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
    for (ResearcherUrl element : elements.getResearcherUrls()) {
        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 element found: " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    assertTrue(found5);
}
Also used : ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 35 with ResearcherUrl

use of org.orcid.jaxb.model.record_v2.ResearcherUrl in project ORCID-Source by ORCID.

the class ResearcherUrlManagerTest method testAddResearcherUrlToUnclaimedRecordPreserveResearcherUrlVisibility.

@Test
public void testAddResearcherUrlToUnclaimedRecordPreserveResearcherUrlVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    ResearcherUrl rUrl = getResearcherUrl();
    rUrl = researcherUrlManager.createResearcherUrl(unclaimedOrcid, rUrl, true);
    rUrl = researcherUrlManager.getResearcherUrl(unclaimedOrcid, rUrl.getPutCode());
    assertNotNull(rUrl);
    assertEquals(Visibility.PUBLIC, rUrl.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)86 Test (org.junit.Test)76 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 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)44 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)44 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 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)32 Name (org.orcid.jaxb.model.record_v2.Name)30 Person (org.orcid.jaxb.model.record_v2.Person)30 DBUnitTest (org.orcid.test.DBUnitTest)22 Response (javax.ws.rs.core.Response)20 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)18 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)18