use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class SourceInActivitiesTest method sourceDoesntChange_Funding_Test.
@Test
@Transactional
public void sourceDoesntChange_Funding_Test() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ProfileEntity(userOrcid)));
Funding funding1 = getFunding(userOrcid);
assertNotNull(funding1);
assertNotNull(funding1.getTitle());
assertNotNull(funding1.getTitle().getTitle());
assertFalse(PojoUtil.isEmpty(funding1.getTitle().getTitle().getContent()));
assertEquals(userOrcid, funding1.getSource().retrieveSourcePath());
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Funding funding2 = getFunding(userOrcid);
assertNotNull(funding2.getTitle());
assertNotNull(funding2.getTitle().getTitle());
assertFalse(PojoUtil.isEmpty(funding2.getTitle().getTitle().getContent()));
assertEquals(CLIENT_1_ID, funding2.getSource().retrieveSourcePath());
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_2_ID)));
Funding funding3 = getFunding(userOrcid);
assertNotNull(funding3.getTitle());
assertNotNull(funding3.getTitle().getTitle());
assertFalse(PojoUtil.isEmpty(funding3.getTitle().getTitle().getContent()));
assertEquals(CLIENT_2_ID, funding3.getSource().retrieveSourcePath());
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ProfileEntity(userOrcid)));
Funding funding4 = getFunding(userOrcid);
assertNotNull(funding4.getTitle());
assertNotNull(funding4.getTitle().getTitle());
assertFalse(PojoUtil.isEmpty(funding4.getTitle().getTitle().getContent()));
assertEquals(userOrcid, funding4.getSource().retrieveSourcePath());
Funding fromDb1 = profileFundingManager.getFunding(userOrcid, funding1.getPutCode());
assertNotNull(fromDb1);
assertEquals(userOrcid, fromDb1.getSource().retrieveSourcePath());
Funding fromDb2 = profileFundingManager.getFunding(userOrcid, funding2.getPutCode());
assertNotNull(fromDb2);
assertEquals(CLIENT_1_ID, fromDb2.getSource().retrieveSourcePath());
Funding fromDb3 = profileFundingManager.getFunding(userOrcid, funding3.getPutCode());
assertNotNull(fromDb3);
assertEquals(CLIENT_2_ID, fromDb3.getSource().retrieveSourcePath());
Funding fromDb4 = profileFundingManager.getFunding(userOrcid, funding4.getPutCode());
assertNotNull(fromDb4);
assertEquals(userOrcid, fromDb4.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method displayIndexIsSetTo_0_FromAPI.
@Test
public void displayIndexIsSetTo_0_FromAPI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Funding f1 = getFunding("fromAPI-1");
f1 = profileFundingManager.createFunding(claimedOrcid, f1, true);
ProfileFundingEntity f = profileFundingDao.find(f1.getPutCode());
assertNotNull(f);
assertEquals(Long.valueOf(0), f.getDisplayIndex());
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method testGetAll.
@Test
public void testGetAll() {
String orcid = "0000-0000-0000-0003";
List<Funding> elements = profileFundingManager.getFundingList(orcid, System.currentTimeMillis());
assertNotNull(elements);
assertEquals(5, elements.size());
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (Funding element : elements) {
if (10 == element.getPutCode()) {
found1 = true;
} else if (11 == element.getPutCode()) {
found2 = true;
} else if (12 == element.getPutCode()) {
found3 = true;
} else if (13 == element.getPutCode()) {
found4 = true;
} else if (14 == element.getPutCode()) {
found5 = true;
} else {
fail("Invalid put code found: " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
}
use of org.orcid.jaxb.model.record_rc3.Funding 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.jaxb.model.record_rc3.Funding 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());
}
Aggregations