|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2016 the original author or authors.
|
|
|
|
|
* Copyright 2012-2017 the original author or authors.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
@ -57,4 +57,70 @@ public class DevToolsPooledDataSourceAutoConfigurationTests
|
|
|
|
|
verify(statement, times(0)).execute("SHUTDOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void h2ServerIsNotShutdown() throws SQLException {
|
|
|
|
|
ConfigurableApplicationContext context = createContext("org.h2.Driver",
|
|
|
|
|
"jdbc:h2:hsql://localhost", DataSourceAutoConfiguration.class,
|
|
|
|
|
DataSourceSpyConfiguration.class);
|
|
|
|
|
Statement statement = configureDataSourceBehaviour(
|
|
|
|
|
context.getBean(DataSource.class));
|
|
|
|
|
context.close();
|
|
|
|
|
verify(statement, times(0)).execute("SHUTDOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void inMemoryh2IsShutdown() throws SQLException {
|
|
|
|
|
ConfigurableApplicationContext context = createContext("org.h2.Driver",
|
|
|
|
|
"jdbc:h2:mem:test", DataSourceAutoConfiguration.class,
|
|
|
|
|
DataSourceSpyConfiguration.class);
|
|
|
|
|
Statement statement = configureDataSourceBehaviour(
|
|
|
|
|
context.getBean(DataSource.class));
|
|
|
|
|
context.close();
|
|
|
|
|
verify(statement, times(1)).execute("SHUTDOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void hsqlServerIsNotShutdown() throws SQLException {
|
|
|
|
|
ConfigurableApplicationContext context = createContext("org.hsqldb.jdbcDriver",
|
|
|
|
|
"jdbc:hsqldb:hsql://localhost", DataSourceAutoConfiguration.class,
|
|
|
|
|
DataSourceSpyConfiguration.class);
|
|
|
|
|
Statement statement = configureDataSourceBehaviour(
|
|
|
|
|
context.getBean(DataSource.class));
|
|
|
|
|
context.close();
|
|
|
|
|
verify(statement, times(0)).execute("SHUTDOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void inMemoryHsqlIsShutdown() throws SQLException {
|
|
|
|
|
ConfigurableApplicationContext context = createContext("org.hsqldb.jdbcDriver",
|
|
|
|
|
"jdbc:hsqldb:mem:test", DataSourceAutoConfiguration.class,
|
|
|
|
|
DataSourceSpyConfiguration.class);
|
|
|
|
|
Statement statement = configureDataSourceBehaviour(
|
|
|
|
|
context.getBean(DataSource.class));
|
|
|
|
|
context.close();
|
|
|
|
|
verify(statement, times(1)).execute("SHUTDOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void derbyClientIsNotShutdown() throws SQLException {
|
|
|
|
|
ConfigurableApplicationContext context = createContext(
|
|
|
|
|
"org.apache.derby.jdbc.ClientDriver", "jdbc:derby://localhost",
|
|
|
|
|
DataSourceAutoConfiguration.class, DataSourceSpyConfiguration.class);
|
|
|
|
|
Statement statement = configureDataSourceBehaviour(
|
|
|
|
|
context.getBean(DataSource.class));
|
|
|
|
|
context.close();
|
|
|
|
|
verify(statement, times(0)).execute("SHUTDOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void inMemoryDerbyIsShutdown() throws SQLException {
|
|
|
|
|
ConfigurableApplicationContext context = createContext(
|
|
|
|
|
"org.apache.derby.jdbc.EmbeddedDriver", "jdbc:derby:memory:test",
|
|
|
|
|
DataSourceAutoConfiguration.class, DataSourceSpyConfiguration.class);
|
|
|
|
|
Statement statement = configureDataSourceBehaviour(
|
|
|
|
|
context.getBean(DataSource.class));
|
|
|
|
|
context.close();
|
|
|
|
|
verify(statement, times(1)).execute("SHUTDOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|