99
1010import javax .sql .DataSource ;
1111import java .io .File ;
12+ import java .sql .Connection ;
1213import java .sql .SQLException ;
14+ import java .sql .Statement ;
1315import java .util .Properties ;
1416
1517import static org .junit .jupiter .api .Assertions .*;
@@ -33,19 +35,23 @@ void testBeanRegistration() {
3335 Properties p = celesta .getSetupProperties ();
3436
3537 assertAll (
36- () -> assertEquals (4 , p .size ()),
38+ () -> assertEquals (5 , p .size ()),
3739 () -> assertEquals ("true" , p .getProperty ("h2.in-memory" )),
3840 () -> assertEquals ("false" , p .getProperty ("h2.referential.integrity" )),
3941 () -> assertEquals ("false" , p .getProperty ("skip.dbupdate" )),
40- () -> assertEquals ("false" , p .getProperty ("force.dbinitialize" ))
42+ () -> assertEquals ("false" , p .getProperty ("force.dbinitialize" )),
43+ () -> assertEquals ("false" , p .getProperty ("log.logins" ))
4144 );
4245 shutDownH2 (celesta );
4346 }
4447 }));
4548 }
4649
4750 private void shutDownH2 (Celesta celesta ) throws SQLException {
48- celesta .getConnectionPool ().get ().createStatement ().execute ("SHUTDOWN" );
51+ try (Connection connection = celesta .getConnectionPool ().get ();
52+ Statement statement = connection .createStatement ()) {
53+ statement .execute ("SHUTDOWN" );
54+ }
4955 }
5056
5157
@@ -72,7 +78,7 @@ void testBeanRegistrationWithFullConfiguration() {
7278 Properties p = celesta .getSetupProperties ();
7379
7480 assertAll (
75- () -> assertEquals (9 , p .size ()),
81+ () -> assertEquals (10 , p .size ()),
7682 () -> assertEquals (
7783 "jdbc:h2:mem:celesta;DB_CLOSE_DELAY=-1" ,
7884 p .getProperty ("rdbms.connection.url" )
@@ -84,6 +90,7 @@ void testBeanRegistrationWithFullConfiguration() {
8490 () -> assertEquals ("1234" , p .getProperty ("h2.port" )),
8591 () -> assertEquals ("true" , p .getProperty ("skip.dbupdate" )),
8692 () -> assertEquals ("true" , p .getProperty ("force.dbinitialize" )),
93+ () -> assertEquals ("true" , p .getProperty ("log.logins" )),
8794 () -> assertEquals (
8895 "ru.curs.celesta.spring.boot,ru.curs.celesta.spring" ,
8996 p .getProperty ("celestaScan" )
@@ -133,7 +140,7 @@ void testRegistrationWithExternalConnectionPool() {
133140 try (Celesta celesta = context .getBean (Celesta .class )) {
134141 //Celesta bean is registered
135142 assertNotNull (context .getBean (Celesta .class ));
136- assertTrue ( celesta .getConnectionPool () instanceof DatasourceConnectionPool );
143+ assertInstanceOf ( DatasourceConnectionPool . class , celesta .getConnectionPool ());
137144 shutDownH2 (celesta );
138145 }
139146 }));
0 commit comments