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
24 changes: 19 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.ecsp</groupId>
<artifactId>sql-dao</artifactId>
<version>1.2.2</version>
<version>1.3-SNAPSHOT</version>

<name>SQL DAO Library</name>
<description>DAO framework for SQL databases</description>
Expand Down Expand Up @@ -82,18 +82,19 @@
<properties>
<maven.surefire.version>2.22.0</maven.surefire.version>
<commons.lang3.version>3.13.0</commons.lang3.version>
<utils.version>1.1.0</utils.version>
<utils.version>1.2.SPRING-SNAPSHOT</utils.version>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<hikaricp.version>5.0.1</hikaricp.version>
<awaitility.version>4.3.0</awaitility.version>
<prometheus.client.version>0.6.0</prometheus.client.version>
<spring.boot.version>3.2.5</spring.boot.version>
<spring.boot.version>4.0.2</spring.boot.version>
<springboot.aop>3.5.10</springboot.aop>
<lombok.version>1.18.28</lombok.version>
<postgres.version>42.7.3</postgres.version>
<dropwizard.version>4.2.19</dropwizard.version>
<spring.version>6.1.14</spring.version>
<spring.version>7.0.3</spring.version>
<jacoco.ut.execution.data.file>${project.build.directory}/coverage-reports/jacoco-ut.exec</jacoco.ut.execution.data.file>
<license-tool-plugin.version>1.1.0</license-tool-plugin.version>
<install-plugin.version>3.1.1</install-plugin.version>
Expand Down Expand Up @@ -122,6 +123,19 @@
</sonar.coverage.exclusions>
</properties>

<repositories>
<repository>
<id>org.sonatype.central</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>dash-licenses-releases</id>
Expand Down Expand Up @@ -219,7 +233,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>${spring.boot.version}</version>
<version>${springboot.aop}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.mockito.Mockito;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import io.prometheus.client.CollectorRegistry;
Expand All @@ -68,7 +71,7 @@
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {PostgresDbConfig.class, DefaultPostgresDbCredentialsProvider.class,
SqlDaoApplication.class })
SqlDaoApplication.class, PostgresDbConfigRefreshTest.TestConfig.class })
@TestPropertySource("/application-dao-refresh-test.properties")
class PostgresDbConfigRefreshTest {

Expand All @@ -81,7 +84,7 @@ class PostgresDbConfigRefreshTest {
@Qualifier("targetDataSources")
private Map<String, DataSource> targetDataSources;

@SpyBean
@Autowired
private PostgresDbConfig config;

/** The postgresql container. */
Expand Down Expand Up @@ -124,4 +127,17 @@ static void tearUpPostgresServer() {
CollectorRegistry.defaultRegistry.clear();
postgresqlContainer.stop();
}

/**
* Test configuration to create a spy of PostgresDbConfig.
*/
@TestConfiguration
static class TestConfig {

@Bean
@Primary
public PostgresDbConfig postgresDbConfig(PostgresDbConfig realConfig) {
return Mockito.spy(realConfig);
}
}
}