@Rollback static class EmptyClassLevelRollbackTestCase { public void test() { } }
@Rollback(false) static class ClassLevelRollbackWithExplicitValueTestCase { public void test() { } }
@Rollback public void test() { } }
@Rollback(false) public void test() { } }
@Rollback(false) interface RollbackFalseTestInterface { }
/** * Extension of {@link CommitForRequiresNewEjbTxDaoTests} which sets the default * rollback semantics for the {@link TransactionalTestExecutionListener} to * {@code true}. The transaction managed by the TestContext framework will be * rolled back after each test method. Consequently, any work performed in * transactional methods that participate in the test-managed transaction will * be rolled back automatically. On the other hand, any work performed in * transactional methods that do <strong>not</strong> participate in the * test-managed transaction will not be affected by the rollback of the * test-managed transaction. For example, such work may in fact be committed * outside the scope of the test-managed transaction. * * @author Sam Brannen * @since 4.0.1 */ @Rollback public class RollbackForRequiresNewEjbTxDaoTests extends CommitForRequiresNewEjbTxDaoTests { /* test methods in superclass */ }
/** * Extension of {@link CommitForRequiresNewEjbTxDaoTestNGTests} which sets the default * rollback semantics for the {@link TransactionalTestExecutionListener} to * {@code true}. The transaction managed by the TestContext framework will be * rolled back after each test method. Consequently, any work performed in * transactional methods that participate in the test-managed transaction will * be rolled back automatically. On the other hand, any work performed in * transactional methods that do <strong>not</strong> participate in the * test-managed transaction will not be affected by the rollback of the * test-managed transaction. For example, such work may in fact be committed * outside the scope of the test-managed transaction. * * @author Sam Brannen * @since 4.0.1 */ @Test(suiteName = "Rollback for REQUIRES_NEW") @Rollback public class RollbackForRequiresNewEjbTxDaoTestNGTests extends CommitForRequiresNewEjbTxDaoTestNGTests { /* test methods in superclass */ }
@Rollback public class RollbackForRequiredEjbTxDaoTestNGTests extends CommitForRequiredEjbTxDaoTestNGTests {
@ContextConfiguration(classes = EmbeddedPersonDatabaseTestsConfig.class, inheritLocations = false) @Transactional("txMgr") @Rollback(true) public class DefaultRollbackTrueRollbackAnnotationTransactionalTests extends AbstractTransactionalSpringRunnerTests {
@ContextConfiguration(classes = EmbeddedPersonDatabaseTestsConfig.class, inheritLocations = false) @Transactional("txMgr") @Rollback(false) public class DefaultRollbackFalseRollbackAnnotationTransactionalTests extends AbstractTransactionalSpringRunnerTests {
@Rollback public class RollbackForRequiredEjbTxDaoTests extends CommitForRequiredEjbTxDaoTests {
@Test(groups="createProducts", dataProvider="setupProducts", dataProviderClass=ProductDataProvider.class) @Rollback(false) @Transactional public void createProducts(Product product) { product = catalogService.saveProduct(product); assert(product.getId() != null); savedProducts.add(product); }
@Test(groups = "createId") @Rollback(false) @Transactional public void createId() { IdGeneration idGeneration = new IdGenerationImpl(); idGeneration.setType("IdGenerationTest"); idGeneration.setBatchStart(1L); idGeneration.setBatchSize(10L); em.persist(idGeneration); }
@Test(groups = { "deleteGiftWrapOrderItemsById" }, dependsOnGroups = { "readGiftWrapOrderItemsById" }) @Rollback(false) public void deleteGiftWrapOrderItemsById() { OrderItem result = orderItemDao.readOrderItemById(giftWrapItemId); orderItemDao.delete(result); assert orderItemDao.readOrderItemById(giftWrapItemId) == null; }
@Test(groups = { "createOrder" }, dataProvider = "basicOrder", dataProviderClass = OrderDataProvider.class, dependsOnGroups = { "readCustomer", "createPhone" }) @Rollback(false) @Transactional public void createOrder(Order order) { userName = "customer1"; Customer customer = customerService.readCustomerByUsername(userName); assert order.getId() == null; order.setCustomer(customer); order = orderDao.save(order); assert order.getId() != null; orderId = order.getId(); }
@Test(groups = { "createDiscreteOrderItem" }, dataProvider = "basicDiscreteOrderItem", dataProviderClass = OrderItemDataProvider.class, dependsOnGroups = { "createOrder", "createSku" }) @Rollback(false) @Transactional public void createDiscreteOrderItem(DiscreteOrderItem orderItem) { Sku si = skuDao.readFirstSku(); assert si.getId() != null; orderItem.setSku(si); assert orderItem.getId() == null; orderItem = (DiscreteOrderItem) orderItemDao.save(orderItem); assert orderItem.getId() != null; orderItemId = orderItem.getId(); }
@Test @Rollback(false) @Override public void modifyTestDataWithinTransaction() { assertInTransaction(true); assertEquals("Adding jane", 1, addPerson(jdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(jdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within a transaction.", 3, countRowsInPersonTable(jdbcTemplate)); }
@Test @Rollback(false) @Override public void modifyTestDataWithinTransaction() { assertInTransaction(true); assertEquals("Adding jane", 1, addPerson(jdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(jdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within a transaction.", 3, countRowsInPersonTable(jdbcTemplate)); }
@Test @Rollback @Override public void modifyTestDataWithinTransaction() { assertInTransaction(true); assertEquals("Deleting bob", 1, deletePerson(jdbcTemplate, BOB)); assertEquals("Adding jane", 1, addPerson(jdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(jdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within a transaction.", 2, countRowsInPersonTable(jdbcTemplate)); }
@Test @Rollback @Override public void modifyTestDataWithinTransaction() { assertInTransaction(true); assertEquals("Deleting bob", 1, deletePerson(jdbcTemplate, BOB)); assertEquals("Adding jane", 1, addPerson(jdbcTemplate, JANE)); assertEquals("Adding sue", 1, addPerson(jdbcTemplate, SUE)); assertEquals("Verifying the number of rows in the person table within a transaction.", 2, countRowsInPersonTable(jdbcTemplate)); }