Search in sources :

Example 86 with Rollback

use of org.springframework.test.annotation.Rollback in project spring-data-document-examples by spring-projects.

the class CustomerRepositoryTests method testCheckOneEntity.

@Transactional
@Rollback(false)
@Test
public void testCheckOneEntity() {
    Customer c = customerRepository.findOne(idUsed);
    Assert.assertNotNull(c);
    Assert.assertEquals("Nilsson", c.getLastName());
}
Also used : Customer(org.springframework.data.mongodb.examples.custsvc.domain.Customer) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 87 with Rollback

use of org.springframework.test.annotation.Rollback in project spring-data-document-examples by spring-projects.

the class CustomerRepositoryTests method testCheckOneEntityHasDocument.

@Transactional
@Rollback(false)
@Test
public void testCheckOneEntityHasDocument() {
    Customer c = customerRepository.findOne(idUsed);
    Assert.assertNotNull(c);
    Assert.assertNotNull(c.getSurveyInfo());
    Assert.assertNotNull(c.getSurveyInfo().getQuestionsAndAnswers());
    Assert.assertEquals("22", c.getSurveyInfo().getQuestionsAndAnswers().get("age"));
}
Also used : Customer(org.springframework.data.mongodb.examples.custsvc.domain.Customer) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 88 with Rollback

use of org.springframework.test.annotation.Rollback in project ORCID-Source by ORCID.

the class OrcidOauth2AuthorizationDetailsDaoTest method testFindByAuthenticationKey.

@Test
@Transactional
@Rollback
public void testFindByAuthenticationKey() throws Exception {
    List<OrcidOauth2TokenDetail> all = orcidOauth2TokenDetailDao.getAll();
    assertEquals(5, all.size());
    for (OrcidOauth2TokenDetail detail : all) {
        OrcidOauth2TokenDetail another = orcidOauth2TokenDetailDao.findByTokenValue(detail.getTokenValue());
        assertNotNull(another);
        assertEquals(detail.getId(), another.getId());
        assertTrue(detail.getTokenExpiration().after(new Date()));
        assertTrue(detail.getRefreshTokenExpiration().after(new Date()));
    }
}
Also used : OrcidOauth2TokenDetail(org.orcid.persistence.jpa.entities.OrcidOauth2TokenDetail) Date(java.util.Date) Test(org.junit.Test) DBUnitTest(org.orcid.test.DBUnitTest) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 89 with Rollback

use of org.springframework.test.annotation.Rollback in project ORCID-Source by ORCID.

the class OrcidOauth2AuthorizationDetailsDaoTest method testFindById.

@Test
@Transactional
@Rollback
public void testFindById() throws Exception {
    List<OrcidOauth2TokenDetail> all = orcidOauth2TokenDetailDao.getAll();
    assertEquals(5, all.size());
    for (OrcidOauth2TokenDetail detail : all) {
        OrcidOauth2TokenDetail another = orcidOauth2TokenDetailDao.find(detail.getId());
        assertNotNull(another);
        assertEquals(detail.getId(), another.getId());
        assertTrue(detail.getTokenExpiration().after(new Date()));
        String refreshTokenValue = detail.getRefreshTokenValue();
        assertNotNull(refreshTokenValue);
    }
}
Also used : OrcidOauth2TokenDetail(org.orcid.persistence.jpa.entities.OrcidOauth2TokenDetail) Date(java.util.Date) Test(org.junit.Test) DBUnitTest(org.orcid.test.DBUnitTest) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 90 with Rollback

use of org.springframework.test.annotation.Rollback in project ORCID-Source by ORCID.

the class OrcidOauth2AuthorizationDetailsDaoTest method testFindByRefreshTokenValue.

@Test
@Transactional
@Rollback
public void testFindByRefreshTokenValue() throws Exception {
    List<OrcidOauth2TokenDetail> all = orcidOauth2TokenDetailDao.getAll();
    assertEquals(5, all.size());
    for (OrcidOauth2TokenDetail detail : all) {
        String refreshToken = detail.getRefreshTokenValue();
        OrcidOauth2TokenDetail another = orcidOauth2TokenDetailDao.findByRefreshTokenValue(refreshToken);
        assertNotNull(another);
        assertEquals(refreshToken, another.getRefreshTokenValue());
        assertTrue(detail.getTokenExpiration().after(new Date()));
        assertTrue(another.getRefreshTokenExpiration().after(new Date()));
    }
}
Also used : OrcidOauth2TokenDetail(org.orcid.persistence.jpa.entities.OrcidOauth2TokenDetail) Date(java.util.Date) Test(org.junit.Test) DBUnitTest(org.orcid.test.DBUnitTest) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Rollback (org.springframework.test.annotation.Rollback)108 Test (org.junit.Test)104 Transactional (org.springframework.transaction.annotation.Transactional)81 DBUnitTest (org.orcid.test.DBUnitTest)46 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)37 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)25 Date (java.util.Date)24 BaseTest (org.orcid.core.BaseTest)13 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)12 OrcidOauth2TokenDetail (org.orcid.persistence.jpa.entities.OrcidOauth2TokenDetail)12 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)11 HashSet (java.util.HashSet)10 ApprovalDate (org.orcid.jaxb.model.message.ApprovalDate)8 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)8 BaseControllerTest (org.orcid.frontend.web.util.BaseControllerTest)7 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)7 SubmissionDate (org.orcid.jaxb.model.message.SubmissionDate)7 Claimed (org.orcid.jaxb.model.message.Claimed)6 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)6 ArrayList (java.util.ArrayList)5