use of org.springframework.test.annotation.Rollback in project ORCID-Source by ORCID.
the class OrcidOauth2AuthorizationDetailsDaoTest method testFindByClientId.
@Test
@Transactional
@Rollback
public void testFindByClientId() throws Exception {
List<OrcidOauth2TokenDetail> all = orcidOauth2TokenDetailDao.getAll();
assertEquals(5, all.size());
for (OrcidOauth2TokenDetail detail : all) {
List<OrcidOauth2TokenDetail> allForClient = orcidOauth2TokenDetailDao.findByClientId(detail.getClientDetailsId());
assertEquals(1, allForClient.size());
}
}
use of org.springframework.test.annotation.Rollback in project ORCID-Source by ORCID.
the class OrcidOauth2AuthoriziationCodeDetailDaoTest method testOrcidOauth2AuthoriziationCodeDetailDaoPersist.
@Test
@Transactional
@Rollback
public void testOrcidOauth2AuthoriziationCodeDetailDaoPersist() {
OrcidOauth2AuthoriziationCodeDetail detail = getOrcidOauth2AuthoriziationCodeDetail();
orcidOauth2AuthoriziationCodeDetailDao.persist(detail);
OrcidOauth2AuthoriziationCodeDetail anotherDetail = orcidOauth2AuthoriziationCodeDetailDao.find(detail.getId());
assertNotNull(anotherDetail);
checkValues(anotherDetail);
anotherDetail = orcidOauth2AuthoriziationCodeDetailDao.removeAndReturn(anotherDetail.getId());
assertNotNull(anotherDetail);
anotherDetail = orcidOauth2AuthoriziationCodeDetailDao.find(anotherDetail.getId());
assertNull(anotherDetail);
}
use of org.springframework.test.annotation.Rollback in project ORCID-Source by ORCID.
the class ProfileDaoTest method testUpdateDefaultVisibility.
@Test
@Rollback(true)
public void testUpdateDefaultVisibility() {
ProfileEntity entity1 = profileDao.find("1000-0000-0000-0001");
ProfileEntity entity6 = profileDao.find("0000-0000-0000-0006");
assertEquals(Visibility.PUBLIC, entity1.getActivitiesVisibilityDefault());
assertEquals(Visibility.PUBLIC, entity6.getActivitiesVisibilityDefault());
// Set it private
assertTrue(profileDao.updateDefaultVisibility("0000-0000-0000-0006", Visibility.PRIVATE));
entity1 = profileDao.find("1000-0000-0000-0001");
entity6 = profileDao.find("0000-0000-0000-0006");
assertEquals(Visibility.PUBLIC, entity1.getActivitiesVisibilityDefault());
assertEquals(Visibility.PRIVATE, entity6.getActivitiesVisibilityDefault());
// Set it limited
assertTrue(profileDao.updateDefaultVisibility("0000-0000-0000-0006", Visibility.LIMITED));
entity1 = profileDao.find("1000-0000-0000-0001");
entity6 = profileDao.find("0000-0000-0000-0006");
assertEquals(Visibility.PUBLIC, entity1.getActivitiesVisibilityDefault());
assertEquals(Visibility.LIMITED, entity6.getActivitiesVisibilityDefault());
// Set it public again
assertTrue(profileDao.updateDefaultVisibility("0000-0000-0000-0006", Visibility.PUBLIC));
entity1 = profileDao.find("1000-0000-0000-0001");
entity6 = profileDao.find("0000-0000-0000-0006");
assertEquals(Visibility.PUBLIC, entity1.getActivitiesVisibilityDefault());
assertEquals(Visibility.PUBLIC, entity6.getActivitiesVisibilityDefault());
}
use of org.springframework.test.annotation.Rollback in project ORCID-Source by ORCID.
the class ResearcherUrlDaoTest method testfindResearcherUrl.
@Test
@Rollback(true)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testfindResearcherUrl() {
ResearcherUrlEntity researcherUrl = researcherUrlDao.getResearcherUrl("4444-4444-4444-4441", 1L);
assertNotNull(researcherUrl);
assertEquals("444_1", researcherUrl.getUrlName());
try {
researcherUrl = researcherUrlDao.getResearcherUrl("4444-4444-4444-5555", 1L);
fail();
} catch (NoResultException e) {
}
}
use of org.springframework.test.annotation.Rollback in project ORCID-Source by ORCID.
the class ResearcherUrlDaoTest method testAddResearcherUrl.
@Test
@Rollback(true)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testAddResearcherUrl() {
assertEquals(6, researcherUrlDao.getResearcherUrls("4444-4444-4444-4443", 0L).size());
ResearcherUrlEntity newRUrl = new ResearcherUrlEntity();
newRUrl.setDateCreated(new Date());
newRUrl.setLastModified(new Date());
newRUrl.setClientSourceId("APP-5555555555555555");
newRUrl.setUrl("www.4443.com");
newRUrl.setUrlName("test");
newRUrl.setUser(new ProfileEntity("4444-4444-4444-4443"));
newRUrl.setVisibility(Visibility.PUBLIC);
newRUrl = researcherUrlDao.merge(newRUrl);
assertNotNull(newRUrl);
assertEquals(7, researcherUrlDao.getResearcherUrls("4444-4444-4444-4443", 0L).size());
for (ResearcherUrlEntity rUrl : researcherUrlDao.getResearcherUrls("4444-4444-4444-4443", 0L)) {
if ("www.4443.com".equals(rUrl.getUrl())) {
assertEquals("APP-5555555555555555", rUrl.getElementSourceId());
}
}
}
Aggregations