Perhaps I'm not understanding how to use this correctly, but I expect the
test class included below to pass. I am seeing expected rollback behavior
when not using the @DataSet insert data (testDaoRollback()). When using it
(testDaoAndDataSetRollback()), only the DAO insert is rolled back. It
seems they are on separate transactions?
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/spring-config-domain-test.xml"})
@TransactionConfiguration(transactionManager = "transactionManager",
defaultRollback = true)
@Transactional
public class ObjectActionRuleDaoTest extends
AbstractTransactionalDataSetTestCase {
@Autowired
private iObjectActionRuleDao objectActionRuleDao;
@Test
public void testDaoRollback() {
assertEquals(0, objectActionRuleDao.findAll().size());
ObjectActionRule oar = new ObjectActionRule();
oar.setId(1L);
objectActionRuleDao.merge(oar);
assertEquals(1, objectActionRuleDao.findAll().size());
}
@Test
@DataSet("classpath:/ObjectActionRule.db.xml")
public void testDaoAndDataSetRollback() {
assertEquals(1, objectActionRuleDao.findAll().size());
ObjectActionRule oar = new ObjectActionRule();
oar.setId(2L);
objectActionRuleDao.merge(oar);
assertEquals(2, objectActionRuleDao.findAll().size());
}
@AfterTransaction
public void checkEmpty() {
assertEquals(0, objectActionRuleDao.findAll().size());
}
}
I would've asked on a mailing list, but didn't see one...
Original issue reported on code.google.com by jflorent...@gmail.com on 7 Jan 2010 at 4:37
Original issue reported on code.google.com by
jflorent...@gmail.com
on 7 Jan 2010 at 4:37