Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@
<artifactId>nullaway</artifactId>
<version>${nullaway.version}</version>
</path>
<path>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.CollectionUtils;
Expand All @@ -70,6 +68,7 @@
/**
* @author Diego Dupin
* @author Soby Chacko
* @author Eddú Meléndez
*/
@Testcontainers
@EnabledIfEnvironmentVariable(named = "OPENAI_API_KEY", matches = ".+")
Expand All @@ -87,11 +86,6 @@ public class MariaDBStoreIT extends BaseVectorStoreTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withUserConfiguration(TestApplication.class)
.withPropertyValues("test.spring.ai.vectorstore.mariadb.distanceType=COSINE",

// JdbcTemplate configuration
String.format("app.datasource.url=jdbc:mariadb://%s:%d/%s?maxQuerySizeToLog=50000",
mariadbContainer.getHost(), mariadbContainer.getMappedPort(3306), schemaName),
"app.datasource.username=mariadb", "app.datasource.password=mariadbpwd",
"app.datasource.type=com.zaxxer.hikari.HikariDataSource");

List<Document> documents = List.of(
Expand Down Expand Up @@ -432,10 +426,12 @@ public JdbcTemplate myJdbcTemplate(DataSource dataSource) {
}

@Bean
@Primary
@ConfigurationProperties("app.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
DataSourceProperties properties = new DataSourceProperties();
properties.setUrl(mariadbContainer.getJdbcUrl());
properties.setUsername(mariadbContainer.getUsername());
properties.setPassword(mariadbContainer.getPassword());
return properties;
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,18 @@
import org.springframework.ai.vectorstore.observation.VectorStoreObservationDocumentation.LowCardinalityKeyNames;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.jdbc.core.JdbcTemplate;

import static org.assertj.core.api.Assertions.assertThat;

/**
* @author Diego Dupin
* @author Eddú Meléndez
*/
@EnabledIfEnvironmentVariable(named = "OPENAI_API_KEY", matches = ".+")
@Testcontainers
Expand All @@ -77,9 +76,7 @@ public class MariaDBStoreObservationIT {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withUserConfiguration(Config.class)
.withPropertyValues("test.spring.ai.vectorstore.mariadb.distanceType=COSINE",
// JdbcTemplate configuration
"app.datasource.url=" + mariadbContainer.getJdbcUrl(), "app.datasource.username=mariadb",
"app.datasource.password=mariadbpwd", "app.datasource.type=com.zaxxer.hikari.HikariDataSource");
"app.datasource.type=com.zaxxer.hikari.HikariDataSource");

List<Document> documents = List.of(
new Document(getText("classpath:/test/data/spring.ai.txt"), Map.of("meta1", "meta1")),
Expand Down Expand Up @@ -190,10 +187,12 @@ public JdbcTemplate myJdbcTemplate(DataSource dataSource) {
}

@Bean
@Primary
@ConfigurationProperties("app.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
DataSourceProperties properties = new DataSourceProperties();
properties.setUrl(mariadbContainer.getJdbcUrl());
properties.setUsername(mariadbContainer.getUsername());
properties.setPassword(mariadbContainer.getPassword());
return properties;
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.CollectionUtils;
Expand Down Expand Up @@ -412,10 +410,12 @@ public JdbcTemplate myJdbcTemplate(DataSource dataSource) {
}

@Bean
@Primary
@ConfigurationProperties("app.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
DataSourceProperties properties = new DataSourceProperties();
properties.setUrl(oracle23aiContainer.getJdbcUrl());
properties.setUsername(oracle23aiContainer.getUsername());
properties.setPassword(oracle23aiContainer.getPassword());
return properties;
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@
import org.springframework.ai.vectorstore.oracle.OracleVectorStore.OracleVectorStoreDistanceType;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.jdbc.core.JdbcTemplate;

Expand All @@ -64,6 +62,7 @@
/**
* @author Christian Tzolov
* @author Thomas Vitale
* @author Eddú Meléndez
*/
@Testcontainers
public class OracleVectorStoreObservationIT {
Expand All @@ -79,10 +78,6 @@ public class OracleVectorStoreObservationIT {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withUserConfiguration(Config.class)
.withPropertyValues("test.spring.ai.vectorstore.oracle.dimensions=384",
// JdbcTemplate configuration
String.format("app.datasource.url=%s", oracle23aiContainer.getJdbcUrl()),
String.format("app.datasource.username=%s", oracle23aiContainer.getUsername()),
String.format("app.datasource.password=%s", oracle23aiContainer.getPassword()),
"app.datasource.type=oracle.jdbc.pool.OracleDataSource");

List<Document> documents = List.of(
Expand Down Expand Up @@ -213,10 +208,12 @@ public JdbcTemplate myJdbcTemplate(DataSource dataSource) {
}

@Bean
@Primary
@ConfigurationProperties("app.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
DataSourceProperties properties = new DataSourceProperties();
properties.setUrl(oracle23aiContainer.getJdbcUrl());
properties.setUsername(oracle23aiContainer.getUsername());
properties.setPassword(oracle23aiContainer.getPassword());
return properties;
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,19 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;

import static org.assertj.core.api.Assertions.assertThat;

/**
* @author Muthukumaran Navaneethakrishnan
* @author Thomas Vitale
* @author Eddú Meléndez
*/
@Testcontainers
@EnabledIfEnvironmentVariable(named = "OPENAI_API_KEY", matches = ".+")
Expand All @@ -63,11 +62,6 @@ public class PgVectorStoreCustomNamesIT {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withUserConfiguration(TestApplication.class)
.withPropertyValues("test.spring.ai.vectorstore.pgvector.distanceType=COSINE_DISTANCE",

// JdbcTemplate configuration
String.format("app.datasource.url=jdbc:postgresql://%s:%d/%s", postgresContainer.getHost(),
postgresContainer.getMappedPort(5432), "postgres"),
"app.datasource.username=postgres", "app.datasource.password=postgres",
"app.datasource.type=com.zaxxer.hikari.HikariDataSource");

private static void dropTableByName(ApplicationContext context, String name) {
Expand Down Expand Up @@ -232,10 +226,12 @@ public JdbcTemplate myJdbcTemplate(DataSource dataSource) {
}

@Bean
@Primary
@ConfigurationProperties("app.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
DataSourceProperties properties = new DataSourceProperties();
properties.setUrl(postgresContainer.getJdbcUrl());
properties.setUsername(postgresContainer.getUsername());
properties.setPassword(postgresContainer.getPassword());
return properties;
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.CollectionUtils;
Expand All @@ -76,6 +74,7 @@
* @author Thomas Vitale
* @author Jihoon Kim
* @author YeongMin Song
* @author Eddú Meléndez
*/
@Testcontainers
@EnabledIfEnvironmentVariable(named = "OPENAI_API_KEY", matches = ".+")
Expand Down Expand Up @@ -513,10 +512,12 @@ public JdbcTemplate myJdbcTemplate(DataSource dataSource) {
}

@Bean
@Primary
@ConfigurationProperties("app.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
DataSourceProperties properties = new DataSourceProperties();
properties.setUrl(postgresContainer.getJdbcUrl());
properties.setUsername(postgresContainer.getUsername());
properties.setPassword(postgresContainer.getPassword());
return properties;
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@
import org.springframework.ai.vectorstore.pgvector.PgVectorStore.PgIndexType;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.jdbc.core.JdbcTemplate;

Expand All @@ -66,6 +64,7 @@
*
* @author Christian Tzolov
* @author Thomas Vitale
* @author Eddú Meléndez
*/
@EnabledIfEnvironmentVariable(named = "OPENAI_API_KEY", matches = ".+")
@Testcontainers
Expand Down Expand Up @@ -201,10 +200,12 @@ public JdbcTemplate myJdbcTemplate(DataSource dataSource) {
}

@Bean
@Primary
@ConfigurationProperties("app.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
DataSourceProperties properties = new DataSourceProperties();
properties.setUrl(postgresContainer.getJdbcUrl());
properties.setUsername(postgresContainer.getUsername());
properties.setPassword(postgresContainer.getPassword());
return properties;
}

@Bean
Expand Down