1 | package org.cardanofoundation.explorer.api.config.datasource; | |
2 | ||
3 | import javax.sql.DataSource; | |
4 | ||
5 | import lombok.AccessLevel; | |
6 | import lombok.Data; | |
7 | import lombok.Getter; | |
8 | import lombok.Setter; | |
9 | import lombok.experimental.FieldDefaults; | |
10 | ||
11 | import org.springframework.boot.autoconfigure.flyway.FlywayProperties; | |
12 | import org.springframework.boot.context.properties.ConfigurationProperties; | |
13 | import org.springframework.context.annotation.Configuration; | |
14 | ||
15 | import com.zaxxer.hikari.HikariConfig; | |
16 | import com.zaxxer.hikari.HikariDataSource; | |
17 | import org.flywaydb.core.Flyway; | |
18 | ||
19 | @Getter | |
20 | @Setter | |
21 | @FieldDefaults(level = AccessLevel.PRIVATE) | |
22 | @Configuration | |
23 | @ConfigurationProperties(prefix = "multi-datasource") | |
24 | public class MultiDataSourceProperties { | |
25 | ||
26 |
1
1. getDatasourceLedgerSync : replaced return value with null for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties::getDatasourceLedgerSync → NO_COVERAGE |
DataSourceConfig datasourceLedgerSync; |
27 |
1
1. getDatasourceLedgerSyncAgg : replaced return value with null for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties::getDatasourceLedgerSyncAgg → NO_COVERAGE |
DataSourceConfig datasourceLedgerSyncAgg; |
28 |
1
1. getDatasourceExplorer : replaced return value with null for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties::getDatasourceExplorer → NO_COVERAGE |
DataSourceConfig datasourceExplorer; |
29 | ||
30 |
25
1. hashCode : Replaced integer multiplication with division → NO_COVERAGE 2. canEqual : replaced boolean return with true for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::canEqual → NO_COVERAGE 3. hashCode : Replaced integer multiplication with division → NO_COVERAGE 4. canEqual : replaced boolean return with false for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::canEqual → NO_COVERAGE 5. equals : negated conditional → NO_COVERAGE 6. equals : replaced boolean return with false for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::equals → NO_COVERAGE 7. equals : negated conditional → NO_COVERAGE 8. equals : negated conditional → NO_COVERAGE 9. equals : negated conditional → NO_COVERAGE 10. equals : negated conditional → NO_COVERAGE 11. equals : replaced boolean return with true for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::equals → NO_COVERAGE 12. hashCode : Replaced integer addition with subtraction → NO_COVERAGE 13. equals : negated conditional → NO_COVERAGE 14. equals : replaced boolean return with true for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::equals → NO_COVERAGE 15. hashCode : replaced int return with 0 for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::hashCode → NO_COVERAGE 16. toString : replaced return value with "" for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::toString → NO_COVERAGE 17. hashCode : negated conditional → NO_COVERAGE 18. equals : negated conditional → NO_COVERAGE 19. hashCode : Replaced integer addition with subtraction → NO_COVERAGE 20. equals : negated conditional → NO_COVERAGE 21. equals : negated conditional → NO_COVERAGE 22. equals : replaced boolean return with false for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::equals → NO_COVERAGE 23. equals : replaced boolean return with true for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::equals → NO_COVERAGE 24. hashCode : negated conditional → NO_COVERAGE 25. equals : replaced boolean return with true for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::equals → NO_COVERAGE |
@Data |
31 | @FieldDefaults(level = AccessLevel.PRIVATE) | |
32 | public static class DataSourceConfig { | |
33 |
1
1. getHikariConfig : replaced return value with null for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::getHikariConfig → NO_COVERAGE |
HikariConfig hikariConfig; |
34 |
1
1. getFlyway : replaced return value with null for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties$DataSourceConfig::getFlyway → NO_COVERAGE |
FlywayProperties flyway; |
35 | } | |
36 | ||
37 | public DataSource buildDataSource(DataSourceConfig dataSourceConfig) { | |
38 | HikariDataSource hikariDataSource = new HikariDataSource(dataSourceConfig.getHikariConfig()); | |
39 | FlywayProperties flywayProperties = dataSourceConfig.getFlyway(); | |
40 |
2
1. buildDataSource : negated conditional → NO_COVERAGE 2. buildDataSource : negated conditional → NO_COVERAGE |
if (flywayProperties != null && flywayProperties.isEnabled()) { |
41 | Flyway.configure() | |
42 | .dataSource(hikariDataSource) | |
43 | .locations(flywayProperties.getLocations().toArray(new String[0])) | |
44 | .sqlMigrationPrefix(flywayProperties.getSqlMigrationPrefix()) | |
45 | .sqlMigrationSeparator(flywayProperties.getSqlMigrationSeparator()) | |
46 | .sqlMigrationSuffixes(flywayProperties.getSqlMigrationSuffixes().toArray(new String[0])) | |
47 | .group(flywayProperties.isGroup()) | |
48 | .defaultSchema(flywayProperties.getDefaultSchema()) | |
49 | .schemas(flywayProperties.getSchemas().toArray(new String[0])) | |
50 | .validateOnMigrate(flywayProperties.isValidateOnMigrate()) | |
51 | .outOfOrder(flywayProperties.isOutOfOrder()) | |
52 | .load() | |
53 | .migrate(); | |
54 | } | |
55 |
1
1. buildDataSource : replaced return value with null for org/cardanofoundation/explorer/api/config/datasource/MultiDataSourceProperties::buildDataSource → NO_COVERAGE |
return hikariDataSource; |
56 | } | |
57 | } | |
Mutations | ||
26 |
1.1 |
|
27 |
1.1 |
|
28 |
1.1 |
|
30 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10 11.11 12.12 13.13 14.14 15.15 16.16 17.17 18.18 19.19 20.20 21.21 22.22 23.23 24.24 25.25 |
|
33 |
1.1 |
|
34 |
1.1 |
|
40 |
1.1 2.2 |
|
55 |
1.1 |