@Test @DataSet("AbstractDbTestTransactionTest_testingEntity.xml") @DataVerify @DataSetExport(tablesDataSet="AbstractDbTestTransactionTest_testingEntity.xml", doPhysicalExport=false) public void transaction_isRolledBack() { this.em.find(TestingEntity.class, -1L).setName("DoCommit"); this.em.flush(); this.setRollbackOnly(); } public static class Transaction_isRolledBack extends DataVerifier {
if (verifyInfo.getAnnotation().value() == DataVerify.DEFAULT_DATA_VERIFIER.class) { String verifierName = StringUtils.capitalize(JuStringUtils.removeNonAlphabeticalLeadingCharacters(this.testMethodName)); Class<?> defaultVerifier = ReflectUtils.getInnerClass(this.getTestClass(), verifierName); verifierClass = verifyInfo.getAnnotation().value();
@Test @DataSet("AbstractDbTestTransactionTest_testingEntity.xml") @DataVerify @DataSetExport(tablesDataSet="AbstractDbTestTransactionTest_testingEntity.xml", doPhysicalExport=false) public void transaction_isCommitted() { this.em.find(TestingEntity.class, -1L).setName("DoCommit"); } public static class Transaction_isCommitted extends DataVerifier {
@Test @DataSet("AbstractDbTestTransactionTest_testingEntity.xml") @DataVerify @DataSetExport(tablesDataSet="AbstractDbTestTransactionTest_testingEntity.xml", doPhysicalExport=false) public void multipleTransactions_areSupported() { // H2 has a locking strategy that will cause a timeout in this scenario JuAssumeUtils.dbIsNot(this.emUtil, DbType.H2); TestingEntity te1 = new TestingEntity("TE1"); this.em.persist(te1); try (EmfWork ew2 = this.startNewWork()) { TestingEntity te2 = new TestingEntity("TE2"); ew2.getEm().persist(te2); try (EmfWork ew3 = this.startNewWork()) { TestingEntity te3 = new TestingEntity("TE3"); ew3.getEm().persist(te3); } ew2.setRollbackOnly(); } } public static class MultipleTransactions_areSupported extends DataVerifier {