Search in sources :

Example 1 with SqlSessionTemplate

use of org.mybatis.spring.SqlSessionTemplate in project pinpoint by naver.

the class SqlSessionTemplateITBase method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    Configuration configuration = mock(Configuration.class);
    TransactionFactory transactionFactory = mock(TransactionFactory.class);
    DataSource dataSource = mock(DataSource.class);
    Environment environment = new Environment("test", transactionFactory, dataSource);
    when(configuration.getEnvironment()).thenReturn(environment);
    when(this.sqlSessionFactory.getConfiguration()).thenReturn(configuration);
    when(this.sqlSessionFactory.openSession(EXECUTOR_TYPE)).thenReturn(this.sqlSessionProxy);
    this.sqlSessionTemplate = new SqlSessionTemplate(this.sqlSessionFactory, EXECUTOR_TYPE);
}
Also used : SqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate) Configuration(org.apache.ibatis.session.Configuration) TransactionFactory(org.apache.ibatis.transaction.TransactionFactory) Environment(org.apache.ibatis.mapping.Environment) DataSource(javax.sql.DataSource) Before(org.junit.Before)

Aggregations

DataSource (javax.sql.DataSource)1 Environment (org.apache.ibatis.mapping.Environment)1 Configuration (org.apache.ibatis.session.Configuration)1 TransactionFactory (org.apache.ibatis.transaction.TransactionFactory)1 Before (org.junit.Before)1 SqlSessionTemplate (org.mybatis.spring.SqlSessionTemplate)1