Search in sources :

Example 36 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.

the class WorkManagerTest method displayIndexIsSetTo_0_FromAPI.

@Test
public void displayIndexIsSetTo_0_FromAPI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Work w1 = getWork("fromAPI-1");
    w1 = workManager.createWork(claimedOrcid, w1, true);
    WorkEntity w = workDao.find(w1.getPutCode());
    assertNotNull(w1);
    assertEquals(Long.valueOf(0), w.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) WorkEntity(org.orcid.persistence.jpa.entities.WorkEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 37 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.

the class WorkManagerTest method testAddWorkToUnclaimedRecordPreserveWorkVisibility.

@Test
public void testAddWorkToUnclaimedRecordPreserveWorkVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Work work = getWork(null);
    work = workManager.createWork(unclaimedOrcid, work, true);
    work = workManager.getWork(unclaimedOrcid, work.getPutCode(), 0);
    assertNotNull(work);
    assertEquals("Work title", work.getWorkTitle().getTitle().getContent());
    assertEquals(Visibility.PUBLIC, work.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 38 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity 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 39 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity 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 40 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity 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)

Aggregations

SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)111 Test (org.junit.Test)58 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)57 BaseTest (org.orcid.core.BaseTest)44 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)28 Date (java.util.Date)19 HashMap (java.util.HashMap)15 OrcidDuplicatedElementException (org.orcid.core.exception.OrcidDuplicatedElementException)14 Work (org.orcid.jaxb.model.record_v2.Work)14 OrgEntity (org.orcid.persistence.jpa.entities.OrgEntity)13 Visibility (org.orcid.jaxb.model.common_v2.Visibility)12 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)11 Transactional (org.springframework.transaction.annotation.Transactional)11 Funding (org.orcid.jaxb.model.record_v2.Funding)10 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)6 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)6 OrgAffiliationRelationEntity (org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)6 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)6 WorkEntity (org.orcid.persistence.jpa.entities.WorkEntity)6 GroupIdRecord (org.orcid.jaxb.model.groupid_v2.GroupIdRecord)5