use of org.orcid.persistence.jpa.entities.SourceEntity 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());
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method testAddMultipleModifiesIndexingStatus.
@Test
public void testAddMultipleModifiesIndexingStatus() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Funding f1 = getFunding("F1");
f1 = profileFundingManager.createFunding(claimedOrcid, f1, true);
Funding f2 = getFunding("F2");
f2 = profileFundingManager.createFunding(claimedOrcid, f2, true);
Funding f3 = getFunding("F3");
f3 = profileFundingManager.createFunding(claimedOrcid, f3, true);
ProfileFundingEntity entity1 = profileFundingDao.find(f1.getPutCode());
ProfileFundingEntity entity2 = profileFundingDao.find(f2.getPutCode());
ProfileFundingEntity entity3 = profileFundingDao.find(f3.getPutCode());
assertNotNull(entity1.getDisplayIndex());
assertNotNull(entity2.getDisplayIndex());
assertNotNull(entity3.getDisplayIndex());
assertEquals(Long.valueOf(0), entity3.getDisplayIndex());
//Rollback all changes
profileFundingDao.remove(entity1.getId());
profileFundingDao.remove(entity2.getId());
profileFundingDao.remove(entity3.getId());
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method displayIndexIsSetTo_1_FromUI.
@Test
public void displayIndexIsSetTo_1_FromUI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Funding f1 = getFunding("fromUI-1");
f1 = profileFundingManager.createFunding(claimedOrcid, f1, false);
ProfileFundingEntity f = profileFundingDao.find(f1.getPutCode());
assertNotNull(f);
assertEquals(Long.valueOf(1), f.getDisplayIndex());
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateGroupId_invalidPutCodeTest.
@Test(expected = InvalidPutCodeException.class)
public void validateGroupId_invalidPutCodeTest() {
SourceEntity source = mock(SourceEntity.class);
when(source.getSourceName()).thenReturn("source name");
GroupIdRecord g = getGroupIdRecord();
g.setPutCode(1L);
activityValidator.validateGroupIdRecord(g, true, source);
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class PersonValidatorTest method getSourceEntity.
private SourceEntity getSourceEntity() {
SourceEntity source = mock(SourceEntity.class);
when(source.getSourceName()).thenReturn("source name");
return source;
}
Aggregations