use of org.apache.ibatis.session.SqlSessionFactoryBuilder in project mybatis-3 by mybatis.
the class LogFactoryTest method shouldReadLogImplFromSettings.
@Test
public void shouldReadLogImplFromSettings() throws Exception {
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/logging/mybatis-config.xml");
new SqlSessionFactoryBuilder().build(reader);
reader.close();
Log log = LogFactory.getLog(Object.class);
log.debug("Debug message.");
assertEquals(log.getClass().getName(), NoLoggingImpl.class.getName());
}
use of org.apache.ibatis.session.SqlSessionFactoryBuilder in project mybatis-3 by mybatis.
the class DynamicSqlSourceTest method createDynamicSqlSource.
private DynamicSqlSource createDynamicSqlSource(SqlNode... contents) throws IOException, SQLException {
createBlogDataSource();
final String resource = "org/apache/ibatis/builder/MapperConfig.xml";
final Reader reader = Resources.getResourceAsReader(resource);
SqlSessionFactory sqlMapper = new SqlSessionFactoryBuilder().build(reader);
Configuration configuration = sqlMapper.getConfiguration();
MixedSqlNode sqlNode = mixedContents(contents);
return new DynamicSqlSource(configuration, sqlNode);
}
use of org.apache.ibatis.session.SqlSessionFactoryBuilder in project mybatis-3 by mybatis.
the class BlobInputStreamTypeHandlerTest method setupSqlSessionFactory.
@BeforeClass
public static void setupSqlSessionFactory() throws Exception {
DataSource dataSource = BaseDataTest.createUnpooledDataSource("org/apache/ibatis/type/jdbc.properties");
BaseDataTest.runScript(dataSource, "org/apache/ibatis/type/BlobInputStreamTypeHandlerTest.sql");
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("Production", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
configuration.addMapper(Mapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
use of org.apache.ibatis.session.SqlSessionFactoryBuilder in project mybatis-3 by mybatis.
the class ClobReaderTypeHandlerTest method setupSqlSessionFactory.
@BeforeClass
public static void setupSqlSessionFactory() throws Exception {
DataSource dataSource = BaseDataTest.createUnpooledDataSource("org/apache/ibatis/type/jdbc.properties");
BaseDataTest.runScript(dataSource, "org/apache/ibatis/type/ClobReaderTypeHandlerTest.sql");
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("Production", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
configuration.addMapper(Mapper.class);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
use of org.apache.ibatis.session.SqlSessionFactoryBuilder in project mybatis-3 by mybatis.
the class NestedQueryCacheTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
// create a SqlSessionFactory
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/nested_query_cache/MapperConfig.xml");
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
reader.close();
createBlogDataSource();
}
Aggregations