Search in sources :

Example 1 with XMLLanguageDriver

use of org.apache.ibatis.scripting.xmltags.XMLLanguageDriver in project mybatis-3 by mybatis.

the class XmlConfigBuilderTest method shouldSuccessfullyLoadMinimalXMLConfigFile.

@Test
void shouldSuccessfullyLoadMinimalXMLConfigFile() throws Exception {
    // System.setProperty(XPathParser.KEY_USE_XSD, "true");
    String resource = "org/apache/ibatis/builder/xsd/MinimalMapperConfig.xml";
    try (InputStream inputStream = Resources.getResourceAsStream(resource)) {
        XMLConfigBuilder builder = new XMLConfigBuilder(inputStream);
        Configuration config = builder.parse();
        assertNotNull(config);
        assertEquals(AutoMappingBehavior.PARTIAL, config.getAutoMappingBehavior());
        assertEquals(AutoMappingUnknownColumnBehavior.NONE, config.getAutoMappingUnknownColumnBehavior());
        assertTrue(config.isCacheEnabled());
        assertTrue(config.getProxyFactory() instanceof JavassistProxyFactory);
        assertFalse(config.isLazyLoadingEnabled());
        assertFalse(config.isAggressiveLazyLoading());
        assertTrue(config.isMultipleResultSetsEnabled());
        assertTrue(config.isUseColumnLabel());
        assertFalse(config.isUseGeneratedKeys());
        assertEquals(ExecutorType.SIMPLE, config.getDefaultExecutorType());
        assertNull(config.getDefaultStatementTimeout());
        assertNull(config.getDefaultFetchSize());
        assertFalse(config.isMapUnderscoreToCamelCase());
        assertFalse(config.isSafeRowBoundsEnabled());
        assertEquals(LocalCacheScope.SESSION, config.getLocalCacheScope());
        assertEquals(JdbcType.OTHER, config.getJdbcTypeForNull());
        assertEquals(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString")), config.getLazyLoadTriggerMethods());
        assertTrue(config.isSafeResultHandlerEnabled());
        assertTrue(config.getDefaultScriptingLanguageInstance() instanceof XMLLanguageDriver);
        assertFalse(config.isCallSettersOnNulls());
        assertNull(config.getLogPrefix());
        assertNull(config.getLogImpl());
        assertNull(config.getConfigurationFactory());
        assertFalse(config.isShrinkWhitespacesInSql());
    } finally {
    // System.clearProperty(XPathParser.KEY_USE_XSD);
    }
}
Also used : JavassistProxyFactory(org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory) InputStream(java.io.InputStream) XMLConfigBuilder(org.apache.ibatis.builder.xml.XMLConfigBuilder) XMLLanguageDriver(org.apache.ibatis.scripting.xmltags.XMLLanguageDriver) Test(org.junit.jupiter.api.Test)

Aggregations

InputStream (java.io.InputStream)1 XMLConfigBuilder (org.apache.ibatis.builder.xml.XMLConfigBuilder)1 JavassistProxyFactory (org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory)1 XMLLanguageDriver (org.apache.ibatis.scripting.xmltags.XMLLanguageDriver)1 Test (org.junit.jupiter.api.Test)1