|
|
|
@ -33,6 +33,7 @@ import org.h2.Driver;
|
|
|
|
|
import org.h2.jdbcx.JdbcDataSource;
|
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.postgresql.ds.PGSimpleDataSource;
|
|
|
|
|
|
|
|
|
|
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
|
|
|
|
|
|
|
|
|
@ -129,6 +130,15 @@ class DataSourceBuilderTests {
|
|
|
|
|
assertThat(h2DataSource.getUser()).isEqualTo("test");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void dataSourceCanBeCreatedWithPGDataSource() {
|
|
|
|
|
this.dataSource = DataSourceBuilder.create().url("jdbc:postgresql://localhost/test")
|
|
|
|
|
.type(PGSimpleDataSource.class).username("test").build();
|
|
|
|
|
assertThat(this.dataSource).isInstanceOf(PGSimpleDataSource.class);
|
|
|
|
|
PGSimpleDataSource pgDataSource = (PGSimpleDataSource) this.dataSource;
|
|
|
|
|
assertThat(pgDataSource.getUser()).isEqualTo("test");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void dataSourceAliasesAreOnlyAppliedToRelevantDataSource() {
|
|
|
|
|
this.dataSource = DataSourceBuilder.create().url("jdbc:h2:test").type(TestDataSource.class).username("test")
|
|
|
|
|