Browse Source

Merge branch '2.5.x'

Closes gh-27491
pull/27538/head
Andy Wilkinson 5 years ago
parent
commit
11fc231cc9
  1. 8
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTestSchemaCredentialsIntegrationTests.java
  2. 1
      spring-boot-project/spring-boot-test-autoconfigure/src/test/resources/org/springframework/boot/test/autoconfigure/orm/jpa/schema.sql

8
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTestSchemaCredentialsIntegrationTests.java

@ -21,7 +21,7 @@ import javax.sql.DataSource; @@ -21,7 +21,7 @@ import javax.sql.DataSource;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.TestPropertySource;
import org.springframework.jdbc.core.JdbcTemplate;
import static org.assertj.core.api.Assertions.assertThat;
@ -31,8 +31,8 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -31,8 +31,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Andy Wilkinson
*/
@DataJpaTest
@TestPropertySource(properties = { "spring.sql.init.username=alice", "spring.sql.init.password=secret" })
@DataJpaTest(properties = { "spring.sql.init.username=alice", "spring.sql.init.password=secret",
"spring.sql.init.schema-locations=classpath:org/springframework/boot/test/autoconfigure/orm/jpa/schema.sql" })
class DataJpaTestSchemaCredentialsIntegrationTests {
@Autowired
@ -42,6 +42,8 @@ class DataJpaTestSchemaCredentialsIntegrationTests { @@ -42,6 +42,8 @@ class DataJpaTestSchemaCredentialsIntegrationTests {
void replacesDefinedDataSourceWithEmbeddedDefault() throws Exception {
String product = this.dataSource.getConnection().getMetaData().getDatabaseProductName();
assertThat(product).isEqualTo("H2");
assertThat(new JdbcTemplate(this.dataSource).queryForList("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES",
String.class)).contains("EXAMPLE");
}
}

1
spring-boot-project/spring-boot-test-autoconfigure/src/test/resources/org/springframework/boot/test/autoconfigure/orm/jpa/schema.sql

@ -0,0 +1 @@ @@ -0,0 +1 @@
CREATE TABLE example(identifier INT, name varchar(64));
Loading…
Cancel
Save