1515 */
1616package org .seasar .doma .boot .autoconfigure ;
1717
18+ import static org .hamcrest .CoreMatchers .*;
19+ import static org .junit .Assert .assertThat ;
20+
21+ import java .sql .SQLException ;
22+ import java .sql .SQLTimeoutException ;
23+
24+ import javax .sql .DataSource ;
25+
1826import org .junit .After ;
1927import org .junit .Before ;
2028import org .junit .Test ;
3745import org .springframework .dao .support .PersistenceExceptionTranslator ;
3846import org .springframework .jdbc .datasource .TransactionAwareDataSourceProxy ;
3947
40- import javax .sql .DataSource ;
41-
42- import java .sql .SQLException ;
43- import java .sql .SQLTimeoutException ;
44-
45- import static org .junit .Assert .*;
46- import static org .hamcrest .CoreMatchers .*;
47-
4848public class DomaAutoConfigurationTest {
4949 AnnotationConfigApplicationContext context ;
5050
@@ -138,6 +138,26 @@ public void testExceptionTranslationEnabledSpecifyTrue() {
138138 assertThat (translator , is (instanceOf (DomaPersistenceExceptionTranslator .class )));
139139 }
140140
141+ @ Test
142+ public void testChangeDialect () {
143+ EnvironmentTestUtils .addEnvironment (this .context , "doma.dialect:MYSQL" );
144+ this .context .register (DomaAutoConfiguration .class ,
145+ DataSourceAutoConfiguration .class );
146+ this .context .refresh ();
147+ Dialect dialect = this .context .getBean (Dialect .class );
148+ assertThat (dialect , is (instanceOf (MysqlDialect .class )));
149+ }
150+
151+ @ Test
152+ public void testChangeMaxRows () {
153+ EnvironmentTestUtils .addEnvironment (this .context , "doma.max-rows:100" );
154+ this .context .register (DomaAutoConfiguration .class ,
155+ DataSourceAutoConfiguration .class );
156+ this .context .refresh ();
157+ Config config = this .context .getBean (Config .class );
158+ assertThat (config .getMaxRows (), is (100 ));
159+ }
160+
141161 @ Test
142162 public void testSQLExceptionTranslator () {
143163 this .context .register (DomaAutoConfiguration .class ,
@@ -148,9 +168,9 @@ public void testSQLExceptionTranslator() {
148168 {
149169 // Translated by SQLErrorCodeSQLExceptionTranslator
150170 DataAccessException dataAccessException = translator
151- .translateExceptionIfPossible (new JdbcException ( Message . DOMA2008 ,
152- new SQLException ( "Acquire Lock on H2" , "SqlState" , 50200 ,
153- null )));
171+ .translateExceptionIfPossible (
172+ new JdbcException ( Message . DOMA2008 , new SQLException (
173+ "Acquire Lock on H2" , "SqlState" , 50200 , null )));
154174 assertThat (dataAccessException ,
155175 is (instanceOf (CannotAcquireLockException .class )));
156176 }
0 commit comments