本文整理汇总了Java中org.apache.ibatis.logging.slf4j.Slf4jImpl类的典型用法代码示例。如果您正苦于以下问题:Java Slf4jImpl类的具体用法?Java Slf4jImpl怎么用?Java Slf4jImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Slf4jImpl类属于org.apache.ibatis.logging.slf4j包,在下文中一共展示了Slf4jImpl类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: Configuration
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
public Configuration() {
typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class);
typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
typeAliasRegistry.registerAlias("POOLED", PooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("UNPOOLED", UnpooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
typeAliasRegistry.registerAlias("LRU", LruCache.class);
typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
typeAliasRegistry.registerAlias("WEAK", WeakCache.class);
typeAliasRegistry.registerAlias("DB_VENDOR", VendorDatabaseIdProvider.class);
typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);
typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
typeAliasRegistry.registerAlias("COMMONS_LOGGING", JakartaCommonsLoggingImpl.class);
typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);
typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
typeAliasRegistry.registerAlias("JAVASSIST", JavassistProxyFactory.class);
languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
languageRegistry.register(RawLanguageDriver.class);
}
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:34,代码来源:Configuration.java
示例2: shouldUseSlf4j
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
@Test
public void shouldUseSlf4j() {
LogFactory.useSlf4jLogging();
Log log = LogFactory.getLog(Object.class);
logSomething(log);
assertEquals(log.getClass().getName(), Slf4jImpl.class.getName());
}
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:8,代码来源:LogFactoryTest.java
示例3: Configuration
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
public Configuration() {
// 源码解析: 注册事务工厂别名
typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class);
// 源码解析: 注册数据源工厂别名
typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
typeAliasRegistry.registerAlias("POOLED", PooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("UNPOOLED", UnpooledDataSourceFactory.class);
// 源码解析: 注册缓存别名
typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
typeAliasRegistry.registerAlias("LRU", LruCache.class);
typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
typeAliasRegistry.registerAlias("WEAK", WeakCache.class);
// 源码解析: 注册VendorDatabaseIdProvider别名
typeAliasRegistry.registerAlias("DB_VENDOR", VendorDatabaseIdProvider.class);
// 源码解析: 注册LanguageDriver别名
typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);
// 源码解析: 注册日志实现别名
typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
typeAliasRegistry.registerAlias("COMMONS_LOGGING", JakartaCommonsLoggingImpl.class);
typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);
// 源码解析: 注册代理工厂别名
typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
typeAliasRegistry.registerAlias("JAVASSIST", JavassistProxyFactory.class);
languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
languageRegistry.register(RawLanguageDriver.class);
}
开发者ID:txazo,项目名称:mybatis,代码行数:41,代码来源:Configuration.java
示例4: shouldSuccessfullyLoadXMLConfigFile
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
@Test
public void shouldSuccessfullyLoadXMLConfigFile() throws Exception {
String resource = "org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
XMLConfigBuilder builder = new XMLConfigBuilder(inputStream);
Configuration config = builder.parse();
assertThat(config.getAutoMappingBehavior(), is(AutoMappingBehavior.NONE));
assertThat(config.getAutoMappingUnknownColumnBehavior(), is(AutoMappingUnknownColumnBehavior.WARNING));
assertThat(config.isCacheEnabled(), is(false));
assertThat(config.getProxyFactory(), is(instanceOf(CglibProxyFactory.class)));
assertThat(config.isLazyLoadingEnabled(), is(true));
assertThat(config.isAggressiveLazyLoading(), is(false));
assertThat(config.isMultipleResultSetsEnabled(), is(false));
assertThat(config.isUseColumnLabel(), is(false));
assertThat(config.isUseGeneratedKeys(), is(true));
assertThat(config.getDefaultExecutorType(), is(ExecutorType.BATCH));
assertThat(config.getDefaultStatementTimeout(), is(10));
assertThat(config.getDefaultFetchSize(), is(100));
assertThat(config.isMapUnderscoreToCamelCase(), is(true));
assertThat(config.isSafeRowBoundsEnabled(), is(true));
assertThat(config.getLocalCacheScope(), is(LocalCacheScope.STATEMENT));
assertThat(config.getJdbcTypeForNull(), is(JdbcType.NULL));
assertThat(config.getLazyLoadTriggerMethods(), is((Set<String>) new HashSet<String>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx"))));
assertThat(config.isSafeResultHandlerEnabled(), is(false));
assertThat(config.getDefaultScriptingLanuageInstance(), is(instanceOf(RawLanguageDriver.class)));
assertThat(config.isCallSettersOnNulls(), is(true));
assertThat(config.getLogPrefix(), is("mybatis_"));
assertThat(config.getLogImpl().getName(), is(Slf4jImpl.class.getName()));
assertThat(config.getVfsImpl().getName(), is(JBoss6VFS.class.getName()));
assertThat(config.getConfigurationFactory().getName(), is(String.class.getName()));
}
开发者ID:txazo,项目名称:mybatis,代码行数:34,代码来源:XmlConfigBuilderTest.java
示例5: Configuration
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
public Configuration() {
typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
typeAliasRegistry.registerAlias("MANAGED",
ManagedTransactionFactory.class);
typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
typeAliasRegistry
.registerAlias("POOLED", PooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("UNPOOLED",
UnpooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
typeAliasRegistry.registerAlias("LRU", LruCache.class);
typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
typeAliasRegistry.registerAlias("WEAK", WeakCache.class);
typeAliasRegistry.registerAlias("DB_VENDOR",
VendorDatabaseIdProvider.class);
typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);
typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
typeAliasRegistry.registerAlias("COMMONS_LOGGING",
JakartaCommonsLoggingImpl.class);
typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);
typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
typeAliasRegistry.registerAlias("JAVASSIST",
JavassistProxyFactory.class);
languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
languageRegistry.register(RawLanguageDriver.class);
}
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:40,代码来源:Configuration.java
示例6: Configuration
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
public Configuration() {
typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class);
typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
typeAliasRegistry.registerAlias("POOLED", PooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("UNPOOLED", UnpooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
typeAliasRegistry.registerAlias("LRU", LruCache.class);
typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
typeAliasRegistry.registerAlias("WEAK", WeakCache.class);
typeAliasRegistry.registerAlias("DB_VENDOR", VendorDatabaseIdProvider.class);
typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);
typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
typeAliasRegistry.registerAlias("COMMONS_LOGGING", JakartaCommonsLoggingImpl.class);
typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);
typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
typeAliasRegistry.registerAlias("JAVASSIST", JavassistProxyFactory.class);
languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
languageRegistry.register(RawLanguageDriver.class);
}
开发者ID:whatlookingfor,项目名称:spring-boot-sample,代码行数:34,代码来源:Configuration.java
示例7: Configuration
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
public Configuration() {
//注册更多的类型别名,至于为何不直接在TypeAliasRegistry里注册,还需进一步研究
typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class);
typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
typeAliasRegistry.registerAlias("POOLED", PooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("UNPOOLED", UnpooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
typeAliasRegistry.registerAlias("LRU", LruCache.class);
typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
typeAliasRegistry.registerAlias("WEAK", WeakCache.class);
typeAliasRegistry.registerAlias("DB_VENDOR", VendorDatabaseIdProvider.class);
typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);
typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
typeAliasRegistry.registerAlias("COMMONS_LOGGING", JakartaCommonsLoggingImpl.class);
typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);
typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
typeAliasRegistry.registerAlias("JAVASSIST", JavassistProxyFactory.class);
languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
languageRegistry.register(RawLanguageDriver.class);
}
开发者ID:shurun19851206,项目名称:mybaties,代码行数:35,代码来源:Configuration.java
示例8: Configuration
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
public Configuration() {
//事务类型
typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class);
//数据源与连接池类型
typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
typeAliasRegistry.registerAlias("POOLED", PooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("UNPOOLED", UnpooledDataSourceFactory.class);
typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
typeAliasRegistry.registerAlias("LRU", LruCache.class);
typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
typeAliasRegistry.registerAlias("WEAK", WeakCache.class);
typeAliasRegistry.registerAlias("DB_VENDOR", VendorDatabaseIdProvider.class);
typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);
typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
typeAliasRegistry.registerAlias("COMMONS_LOGGING", JakartaCommonsLoggingImpl.class);
typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);
typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
typeAliasRegistry.registerAlias("JAVASSIST", JavassistProxyFactory.class);
languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
languageRegistry.register(RawLanguageDriver.class);
}
开发者ID:toulezu,项目名称:play,代码行数:35,代码来源:Configuration.java
示例9: shouldSuccessfullyLoadXMLConfigFile
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
@Test
public void shouldSuccessfullyLoadXMLConfigFile() throws Exception {
String resource = "org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
XMLConfigBuilder builder = new XMLConfigBuilder(inputStream);
Configuration config = builder.parse();
assertThat(config.getAutoMappingBehavior(), is(AutoMappingBehavior.NONE));
assertThat(config.isCacheEnabled(), is(false));
assertThat(config.getProxyFactory(), is(instanceOf(CglibProxyFactory.class)));
assertThat(config.isLazyLoadingEnabled(), is(true));
assertThat(config.isAggressiveLazyLoading(), is(false));
assertThat(config.isMultipleResultSetsEnabled(), is(false));
assertThat(config.isUseColumnLabel(), is(false));
assertThat(config.isUseGeneratedKeys(), is(true));
assertThat(config.getDefaultExecutorType(), is(ExecutorType.BATCH));
assertThat(config.getDefaultStatementTimeout(), is(10));
assertThat(config.getDefaultFetchSize(), is(100));
assertThat(config.isMapUnderscoreToCamelCase(), is(true));
assertThat(config.isSafeRowBoundsEnabled(), is(true));
assertThat(config.getLocalCacheScope(), is(LocalCacheScope.STATEMENT));
assertThat(config.getJdbcTypeForNull(), is(JdbcType.NULL));
assertThat(config.getLazyLoadTriggerMethods(), is((Set<String>) new HashSet<String>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx"))));
assertThat(config.isSafeResultHandlerEnabled(), is(false));
assertThat(config.getDefaultScriptingLanuageInstance(), is(instanceOf(RawLanguageDriver.class)));
assertThat(config.isCallSettersOnNulls(), is(true));
assertThat(config.getLogPrefix(), is("mybatis_"));
assertThat(config.getLogImpl().getName(), is(Slf4jImpl.class.getName()));
assertThat(config.getConfigurationFactory().getName(), is(String.class.getName()));
}
开发者ID:toulezu,项目名称:play,代码行数:32,代码来源:XmlConfigBuilderTest.java
示例10: shouldSuccessfullyLoadXMLConfigFile
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
@Test
public void shouldSuccessfullyLoadXMLConfigFile() throws Exception {
String resource = "org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
Properties props = new Properties();
props.put("prop2", "cccc");
XMLConfigBuilder builder = new XMLConfigBuilder(inputStream, null, props);
Configuration config = builder.parse();
assertThat(config.getAutoMappingBehavior(), is(AutoMappingBehavior.NONE));
assertThat(config.getAutoMappingUnknownColumnBehavior(), is(AutoMappingUnknownColumnBehavior.WARNING));
assertThat(config.isCacheEnabled(), is(false));
assertThat(config.getProxyFactory(), is(instanceOf(CglibProxyFactory.class)));
assertThat(config.isLazyLoadingEnabled(), is(true));
assertThat(config.isAggressiveLazyLoading(), is(false));
assertThat(config.isMultipleResultSetsEnabled(), is(false));
assertThat(config.isUseColumnLabel(), is(false));
assertThat(config.isUseGeneratedKeys(), is(true));
assertThat(config.getDefaultExecutorType(), is(ExecutorType.BATCH));
assertThat(config.getDefaultStatementTimeout(), is(10));
assertThat(config.getDefaultFetchSize(), is(100));
assertThat(config.isMapUnderscoreToCamelCase(), is(true));
assertThat(config.isSafeRowBoundsEnabled(), is(true));
assertThat(config.getLocalCacheScope(), is(LocalCacheScope.STATEMENT));
assertThat(config.getJdbcTypeForNull(), is(JdbcType.NULL));
assertThat(config.getLazyLoadTriggerMethods(), is((Set<String>) new HashSet<String>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx"))));
assertThat(config.isSafeResultHandlerEnabled(), is(false));
assertThat(config.getDefaultScriptingLanuageInstance(), is(instanceOf(RawLanguageDriver.class)));
assertThat(config.isCallSettersOnNulls(), is(true));
assertThat(config.getLogPrefix(), is("mybatis_"));
assertThat(config.getLogImpl().getName(), is(Slf4jImpl.class.getName()));
assertThat(config.getVfsImpl().getName(), is(JBoss6VFS.class.getName()));
assertThat(config.getConfigurationFactory().getName(), is(String.class.getName()));
assertTrue(config.getTypeAliasRegistry().getTypeAliases().get("blogauthor").equals(Author.class));
assertTrue(config.getTypeAliasRegistry().getTypeAliases().get("blog").equals(Blog.class));
assertTrue(config.getTypeAliasRegistry().getTypeAliases().get("cart").equals(Cart.class));
assertThat(config.getTypeHandlerRegistry().getTypeHandler(Integer.class), is(instanceOf(CustomIntegerTypeHandler.class)));
assertThat(config.getTypeHandlerRegistry().getTypeHandler(Long.class), is(instanceOf(CustomLongTypeHandler.class)));
assertThat(config.getTypeHandlerRegistry().getTypeHandler(String.class), is(instanceOf(CustomStringTypeHandler.class)));
assertThat(config.getTypeHandlerRegistry().getTypeHandler(String.class, JdbcType.VARCHAR), is(instanceOf(CustomStringTypeHandler.class)));
ExampleObjectFactory objectFactory = (ExampleObjectFactory)config.getObjectFactory();
assertThat(objectFactory.getProperties().size(), is(1));
assertThat(objectFactory.getProperties().getProperty("objectFactoryProperty"), is("100"));
assertThat(config.getObjectWrapperFactory(), is(instanceOf(CustomObjectWrapperFactory.class)));
assertThat(config.getReflectorFactory(), is(instanceOf(CustomReflectorFactory.class)));
ExamplePlugin plugin = (ExamplePlugin)config.getInterceptors().get(0);
assertThat(plugin.getProperties().size(), is(1));
assertThat(plugin.getProperties().getProperty("pluginProperty"), is("100"));
Environment environment = config.getEnvironment();
assertThat(environment.getId(), is("development"));
assertThat(environment.getDataSource(), is(instanceOf(UnpooledDataSource.class)));
assertThat(environment.getTransactionFactory(), is(instanceOf(JdbcTransactionFactory.class)));
assertThat(config.getDatabaseId(), is("derby"));
assertThat(config.getMapperRegistry().getMappers().size(), is(4));
assertThat(config.getMapperRegistry().hasMapper(CachedAuthorMapper.class), is(true));
assertThat(config.getMapperRegistry().hasMapper(CustomMapper.class), is(true));
assertThat(config.getMapperRegistry().hasMapper(BlogMapper.class), is(true));
assertThat(config.getMapperRegistry().hasMapper(NestedBlogMapper.class), is(true));
}
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:70,代码来源:XmlConfigBuilderTest.java
示例11: shouldSuccessfullyLoadXMLConfigFile
import org.apache.ibatis.logging.slf4j.Slf4jImpl; //导入依赖的package包/类
@Test
public void shouldSuccessfullyLoadXMLConfigFile() throws Exception {
String resource = "org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
Properties props = new Properties();
props.put("prop2", "cccc");
XMLConfigBuilder builder = new XMLConfigBuilder(inputStream, null, props);
Configuration config = builder.parse();
assertThat(config.getAutoMappingBehavior()).isEqualTo(AutoMappingBehavior.NONE);
assertThat(config.getAutoMappingUnknownColumnBehavior()).isEqualTo(AutoMappingUnknownColumnBehavior.WARNING);
assertThat(config.isCacheEnabled()).isFalse();
assertThat(config.getProxyFactory()).isInstanceOf(CglibProxyFactory.class);
assertThat(config.isLazyLoadingEnabled()).isTrue();
assertThat(config.isAggressiveLazyLoading()).isTrue();
assertThat(config.isMultipleResultSetsEnabled()).isFalse();
assertThat(config.isUseColumnLabel()).isFalse();
assertThat(config.isUseGeneratedKeys()).isTrue();
assertThat(config.getDefaultExecutorType()).isEqualTo(ExecutorType.BATCH);
assertThat(config.getDefaultStatementTimeout()).isEqualTo(10);
assertThat(config.getDefaultFetchSize()).isEqualTo(100);
assertThat(config.isMapUnderscoreToCamelCase()).isTrue();
assertThat(config.isSafeRowBoundsEnabled()).isTrue();
assertThat(config.getLocalCacheScope()).isEqualTo(LocalCacheScope.STATEMENT);
assertThat(config.getJdbcTypeForNull()).isEqualTo(JdbcType.NULL);
assertThat(config.getLazyLoadTriggerMethods()).isEqualTo((Set<String>) new HashSet<String>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx")));
assertThat(config.isSafeResultHandlerEnabled()).isFalse();
assertThat(config.getDefaultScriptingLanuageInstance()).isInstanceOf(RawLanguageDriver.class);
assertThat(config.isCallSettersOnNulls()).isTrue();
assertThat(config.getLogPrefix()).isEqualTo("mybatis_");
assertThat(config.getLogImpl().getName()).isEqualTo(Slf4jImpl.class.getName());
assertThat(config.getVfsImpl().getName()).isEqualTo(JBoss6VFS.class.getName());
assertThat(config.getConfigurationFactory().getName()).isEqualTo(String.class.getName());
assertTrue(config.getTypeAliasRegistry().getTypeAliases().get("blogauthor").equals(Author.class));
assertTrue(config.getTypeAliasRegistry().getTypeAliases().get("blog").equals(Blog.class));
assertTrue(config.getTypeAliasRegistry().getTypeAliases().get("cart").equals(Cart.class));
assertThat(config.getTypeHandlerRegistry().getTypeHandler(Integer.class)).isInstanceOf(CustomIntegerTypeHandler.class);
assertThat(config.getTypeHandlerRegistry().getTypeHandler(Long.class)).isInstanceOf(CustomLongTypeHandler.class);
assertThat(config.getTypeHandlerRegistry().getTypeHandler(String.class)).isInstanceOf(CustomStringTypeHandler.class);
assertThat(config.getTypeHandlerRegistry().getTypeHandler(String.class, JdbcType.VARCHAR)).isInstanceOf(CustomStringTypeHandler.class);
assertThat(config.getTypeHandlerRegistry().getTypeHandler(RoundingMode.class)).isInstanceOf(EnumOrdinalTypeHandler.class);
ExampleObjectFactory objectFactory = (ExampleObjectFactory)config.getObjectFactory();
assertThat(objectFactory.getProperties().size()).isEqualTo(1);
assertThat(objectFactory.getProperties().getProperty("objectFactoryProperty")).isEqualTo("100");
assertThat(config.getObjectWrapperFactory()).isInstanceOf(CustomObjectWrapperFactory.class);
assertThat(config.getReflectorFactory()).isInstanceOf(CustomReflectorFactory.class);
ExamplePlugin plugin = (ExamplePlugin)config.getInterceptors().get(0);
assertThat(plugin.getProperties().size()).isEqualTo(1);
assertThat(plugin.getProperties().getProperty("pluginProperty")).isEqualTo("100");
Environment environment = config.getEnvironment();
assertThat(environment.getId()).isEqualTo("development");
assertThat(environment.getDataSource()).isInstanceOf(UnpooledDataSource.class);
assertThat(environment.getTransactionFactory()).isInstanceOf(JdbcTransactionFactory.class);
assertThat(config.getDatabaseId()).isEqualTo("derby");
assertThat(config.getMapperRegistry().getMappers().size()).isEqualTo(4);
assertThat(config.getMapperRegistry().hasMapper(CachedAuthorMapper.class)).isTrue();
assertThat(config.getMapperRegistry().hasMapper(CustomMapper.class)).isTrue();
assertThat(config.getMapperRegistry().hasMapper(BlogMapper.class)).isTrue();
assertThat(config.getMapperRegistry().hasMapper(NestedBlogMapper.class)).isTrue();
inputStream.close();
}
开发者ID:mybatis,项目名称:mybatis-3,代码行数:71,代码来源:XmlConfigBuilderTest.java
注:本文中的org.apache.ibatis.logging.slf4j.Slf4jImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论