use of cn.taketoday.transaction.annotation.Transactional in project today-infrastructure by TAKETODAY.
the class ConcreteTransactionalTestNGContextTests method verifyApplicationContextSet.
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void verifyApplicationContextSet() {
TransactionAssert.assertThatTransaction().isNotActive();
assertThat(super.applicationContext).as("The application context should have been set due to ApplicationContextAware semantics.").isNotNull();
Employee employeeBean = (Employee) super.applicationContext.getBean("employee");
assertThat(employeeBean.getName()).as("employee's name.").isEqualTo("John Smith");
}
use of cn.taketoday.transaction.annotation.Transactional in project today-infrastructure by TAKETODAY.
the class InferredDataSourceTransactionalSqlScriptsTests method database2.
@Test
@Transactional("txMgr2")
@Sql(scripts = "data-add-catbert.sql", config = @SqlConfig(transactionManager = "txMgr2"))
void database2() {
assertThatTransaction().isActive();
assertUsers(new JdbcTemplate(dataSource2), "Dilbert", "Catbert");
}
use of cn.taketoday.transaction.annotation.Transactional in project today-infrastructure by TAKETODAY.
the class InferredDataSourceTransactionalSqlScriptsTests method database1.
@Test
@Transactional("txMgr1")
@Sql(scripts = "data-add-dogbert.sql", config = @SqlConfig(transactionManager = "txMgr1"))
void database1() {
assertThatTransaction().isActive();
assertUsers(new JdbcTemplate(dataSource1), "Dilbert", "Dogbert");
}
use of cn.taketoday.transaction.annotation.Transactional in project today-infrastructure by TAKETODAY.
the class HibernateSessionFlushingTests method findSamWithReadOnlySession.
// SPR-16956
@Test
@Transactional(readOnly = true)
public void findSamWithReadOnlySession() {
Person sam = personService.findByName(SAM);
sam.setName("Vlad");
// By setting setDefaultReadOnly(true), the user can no longer modify any entity...
Session session = sessionFactory.getCurrentSession();
session.flush();
session.refresh(sam);
assertThat(sam.getName()).isEqualTo("Sam");
}
use of cn.taketoday.transaction.annotation.Transactional in project today-framework by TAKETODAY.
the class InferredDataSourceTransactionalSqlScriptsTests method database1.
@Test
@Transactional("txMgr1")
@Sql(scripts = "data-add-dogbert.sql", config = @SqlConfig(transactionManager = "txMgr1"))
void database1() {
assertThatTransaction().isActive();
assertUsers(new JdbcTemplate(dataSource1), "Dilbert", "Dogbert");
}
Aggregations