Skip to content

Commit 7ae042f

Browse files
author
admitrov
committed
build(deps): add spring-boot-starter-jdbc dependency for enhanced testing support
1 parent b2650eb commit 7ae042f

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

embedded-memsql/pom.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,16 @@
3838
<artifactId>tomcat-jdbc</artifactId>
3939
<scope>test</scope>
4040
</dependency>
41+
<dependency>
42+
<groupId>org.springframework.boot</groupId>
43+
<artifactId>spring-boot-starter-jdbc</artifactId>
44+
<scope>test</scope>
45+
<exclusions>
46+
<exclusion>
47+
<groupId>org.springframework.boot</groupId>
48+
<artifactId>spring-boot-starter-logging</artifactId>
49+
</exclusion>
50+
</exclusions>
51+
</dependency>
4152
</dependencies>
42-
</project>
53+
</project>

embedded-memsql/src/test/java/com/playtika/testcontainer/memsql/NonAutoConfiguredDatasourceDependsOnTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public class NonAutoConfiguredDatasourceDependsOnTest {
3333
JdbcTemplate jdbcTemplate;
3434

3535
@Test
36-
public void shouldConnectToMemSql() throws Exception {
36+
public void shouldConnectToMemSql() {
3737
assertThat(jdbcTemplate.queryForObject("select @@version_comment", String.class)).contains("SingleStoreDB");
3838
}
3939

4040
@Test
41-
public void shouldSetupDependsOnForAllDataSources() throws Exception {
41+
public void shouldSetupDependsOnForAllDataSources() {
4242
String[] beanNamesForType = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(beanFactory, DataSource.class);
4343
assertThat(beanNamesForType)
4444
.as("Non auto-configured datasource should be present")
@@ -78,5 +78,10 @@ public DataSource customDatasource() {
7878
poolConfiguration.setTestOnReturn(true);
7979
return new org.apache.tomcat.jdbc.pool.DataSource(poolConfiguration);
8080
}
81+
82+
@Bean
83+
public JdbcTemplate jdbcTemplate(DataSource customDatasource) {
84+
return new JdbcTemplate(customDatasource);
85+
}
8186
}
8287
}

0 commit comments

Comments
 (0)