FINERACT-1550: Fix repetitive JdbcTemplate/RoutingDataSource injection
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
863d70c081
commit
a20d586c84
@@ -48,6 +48,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@@ -136,4 +137,9 @@ public class TestConfiguration {
|
||||
DataSource mockDataSource = mock(DataSource.class, Mockito.RETURNS_MOCKS);
|
||||
return mockDataSource;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JdbcTemplate jdbcTemplate() {
|
||||
return mock(JdbcTemplate.class);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@ import static org.mockito.Mockito.mock;
|
||||
|
||||
import io.cucumber.java8.En;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.mix.service.XBRLResultServiceImpl;
|
||||
import org.assertj.core.util.Arrays;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
public class MixXbrlTaxonomyStepDefinitions implements En {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MixXbrlTaxonomyStepDefinitions implements En {
|
||||
|
||||
public MixXbrlTaxonomyStepDefinitions() {
|
||||
Given("/^A XBRL template (.*)$/", (String template) -> {
|
||||
this.readService = new XBRLResultServiceImpl(mock(RoutingDataSource.class), null, null);
|
||||
this.readService = new XBRLResultServiceImpl(mock(JdbcTemplate.class), null, null);
|
||||
this.template = template;
|
||||
});
|
||||
|
||||
|
||||
+6
@@ -32,6 +32,7 @@ import org.apache.fineract.portfolio.note.domain.NoteRepository;
|
||||
import org.apache.fineract.portfolio.note.serialization.NoteCommandFromApiJsonDeserializer;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@EnableConfigurationProperties({ FineractProperties.class })
|
||||
public class TestDefaultConfiguration {
|
||||
@@ -52,6 +53,11 @@ public class TestDefaultConfiguration {
|
||||
return mock(RoutingDataSource.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JdbcTemplate jdbcTemplate() {
|
||||
return mock(JdbcTemplate.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NoteRepository noteRepository() {
|
||||
return mock(NoteRepository.class);
|
||||
|
||||
+6
@@ -31,6 +31,7 @@ import org.apache.fineract.portfolio.note.domain.NoteRepository;
|
||||
import org.apache.fineract.portfolio.note.serialization.NoteCommandFromApiJsonDeserializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@ComponentScan("org.apache.fineract.module.service.custom")
|
||||
public class TestOverrideConfiguration {
|
||||
@@ -51,6 +52,11 @@ public class TestOverrideConfiguration {
|
||||
return mock(RoutingDataSource.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JdbcTemplate jdbcTemplate() {
|
||||
return mock(JdbcTemplate.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NoteRepository noteRepository() {
|
||||
return mock(NoteRepository.class);
|
||||
|
||||
Reference in New Issue
Block a user