use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method useCacheRefNamespaceIsUndefined.
@Test
public void useCacheRefNamespaceIsUndefined() {
MapperBuilderAssistant builder = new MapperBuilderAssistant(new Configuration(), "resource");
expectedException.expect(IncompleteElementException.class);
expectedException.expectMessage(is("No cache for namespace 'eee' could be found."));
builder.useCacheRef("eee");
}
use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method resolveTypeHandlerNoAssignable.
@Test
public void resolveTypeHandlerNoAssignable() {
BaseBuilder builder = new BaseBuilder(new Configuration()) {
{
}
};
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("Type java.lang.Integer is not a valid TypeHandler because it does not implement TypeHandler interface"));
builder.resolveTypeHandler(String.class, "integer");
}
use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method shouldSuccessfullyLoadXMLMapperFile.
@Test
public void shouldSuccessfullyLoadXMLMapperFile() throws Exception {
Configuration configuration = new Configuration();
String resource = "org/apache/ibatis/builder/AuthorMapper.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
XMLMapperBuilder builder = new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments());
builder.parse();
}
use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method resolveJdbcTypeWithUndefinedValue.
@Test
public void resolveJdbcTypeWithUndefinedValue() {
BaseBuilder builder = new BaseBuilder(new Configuration()) {
{
}
};
expectedException.expect(BuilderException.class);
expectedException.expectMessage(startsWith("Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum"));
expectedException.expectMessage(endsWith("org.apache.ibatis.type.JdbcType.aaa"));
builder.resolveJdbcType("aaa");
}
use of org.apache.ibatis.session.Configuration 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);
}
Aggregations