diff --git a/src/main/java/de/avatic/lcc/repositories/NomenclatureRepository.java b/src/main/java/de/avatic/lcc/repositories/NomenclatureRepository.java index 357f189..5b4bdff 100644 --- a/src/main/java/de/avatic/lcc/repositories/NomenclatureRepository.java +++ b/src/main/java/de/avatic/lcc/repositories/NomenclatureRepository.java @@ -1,7 +1,6 @@ package de.avatic.lcc.repositories; import de.avatic.lcc.database.dialect.SqlDialectProvider; -import de.avatic.lcc.service.api.EUTaxationApiService; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; diff --git a/src/test/java/de/avatic/lcc/config/RepositoryTestConfig.java b/src/test/java/de/avatic/lcc/config/RepositoryTestConfig.java index 6bab904..d228534 100644 --- a/src/test/java/de/avatic/lcc/config/RepositoryTestConfig.java +++ b/src/test/java/de/avatic/lcc/config/RepositoryTestConfig.java @@ -1,15 +1,10 @@ package de.avatic.lcc.config; -import de.avatic.lcc.database.dialect.MySQLDialectProvider; -import de.avatic.lcc.database.dialect.MSSQLDialectProvider; -import de.avatic.lcc.database.dialect.SqlDialectProvider; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; -import org.springframework.context.annotation.Profile; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; @@ -26,12 +21,14 @@ import javax.sql.DataSource; @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan( - basePackages = "de.avatic.lcc.repositories", + basePackages = { + "de.avatic.lcc.repositories", + "de.avatic.lcc.database.dialect" + }, excludeFilters = @ComponentScan.Filter( type = FilterType.ASSIGNABLE_TYPE, classes = { de.avatic.lcc.repositories.error.DumpRepository.class, - de.avatic.lcc.repositories.NomenclatureRepository.class, de.avatic.lcc.repositories.premise.DestinationRepository.class } ) @@ -48,17 +45,6 @@ public class RepositoryTestConfig { return new NamedParameterJdbcTemplate(dataSource); } - @Bean - @Profile("mysql") - public SqlDialectProvider mysqlDialectProvider() { - System.out.println("RepositoryTestConfig: Creating MySQLDialectProvider"); - return new MySQLDialectProvider(); - } - - @Bean - @Profile("mssql") - public SqlDialectProvider mssqlDialectProvider() { - System.out.println("RepositoryTestConfig: Creating MSSQLDialectProvider"); - return new MSSQLDialectProvider(); - } + // SqlDialectProvider beans are now provided by @Component annotations in + // MySQLDialectProvider and MSSQLDialectProvider classes } diff --git a/src/test/java/de/avatic/lcc/repositories/NomenclatureRepositoryIntegrationTest.java b/src/test/java/de/avatic/lcc/repositories/NomenclatureRepositoryIntegrationTest.java index 171be77..ad5ac1f 100644 --- a/src/test/java/de/avatic/lcc/repositories/NomenclatureRepositoryIntegrationTest.java +++ b/src/test/java/de/avatic/lcc/repositories/NomenclatureRepositoryIntegrationTest.java @@ -29,19 +29,22 @@ class NomenclatureRepositoryIntegrationTest extends AbstractRepositoryIntegratio @BeforeEach void setupTestData() { - // Insert test HS codes into the nomenclature table - String sql = "INSERT INTO nomenclature (hs_code, description) VALUES (?, ?)"; + // Clean up nomenclature table + jdbcTemplate.update("DELETE FROM nomenclature"); - executeRawSql(sql, "8471300000", "Portable automatic data processing machines, weighing not more than 10 kg"); - executeRawSql(sql, "8471410000", "Comprising in the same housing at least a central processing unit"); - executeRawSql(sql, "8471420000", "Other, presented in the form of systems"); - executeRawSql(sql, "8471490000", "Other automatic data processing machines"); - executeRawSql(sql, "8471500000", "Processing units other than those of subheading 8471.41 or 8471.49"); - executeRawSql(sql, "8471600000", "Input or output units"); - executeRawSql(sql, "8471700000", "Storage units"); - executeRawSql(sql, "8471800000", "Other units of automatic data processing machines"); - executeRawSql(sql, "9403200000", "Other metal furniture"); - executeRawSql(sql, "9403300000", "Wooden furniture of a kind used in offices"); + // Insert test HS codes into the nomenclature table (only hs_code column exists) + String sql = "INSERT INTO nomenclature (hs_code) VALUES (?)"; + + executeRawSql(sql, "8471300000"); + executeRawSql(sql, "8471410000"); + executeRawSql(sql, "8471420000"); + executeRawSql(sql, "8471490000"); + executeRawSql(sql, "8471500000"); + executeRawSql(sql, "8471600000"); + executeRawSql(sql, "8471700000"); + executeRawSql(sql, "8471800000"); + executeRawSql(sql, "9403200000"); + executeRawSql(sql, "9403300000"); } @Test