diff --git a/docker-compose.yml b/docker-compose.yml index b6f27bea8..12362df2c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -88,6 +88,8 @@ services: HAITATON_EMAIL_FILTER_USE: false CLAMAV_BASE_URL: http://clamav-api:3030 HAITATON_TESTDATA_ENABLED: true + HAITATON_FEATURE_HANKE_EDITING: true + HAITATON_FEATURE_USER_MANAGEMENT: true depends_on: - db - clamav-api diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeControllerHankeEditingDisabledITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeControllerHankeEditingDisabledITests.kt index efc421bc2..e819e71b3 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeControllerHankeEditingDisabledITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeControllerHankeEditingDisabledITests.kt @@ -21,7 +21,7 @@ private const val BASE_URL = "/hankkeet" @WebMvcTest(HankeController::class, properties = ["haitaton.features.hanke-editing=false"]) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class HankeControllerHankeEditingDisabledITests(@Autowired override val mockMvc: MockMvc) : ControllerTest { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeControllerITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeControllerITests.kt index 0c2c96c9d..37e5b6828 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeControllerITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeControllerITests.kt @@ -48,7 +48,7 @@ private const val BASE_URL = "/hankkeet" */ @WebMvcTest(HankeController::class) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class HankeControllerITests(@Autowired override val mockMvc: MockMvc) : ControllerTest { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeRepositoryITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeRepositoryITests.kt index 5baa4146c..0dfa5e979 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeRepositoryITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeRepositoryITests.kt @@ -12,7 +12,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") internal class HankeRepositoryITests : DatabaseTest() { @Autowired private lateinit var hankeRepository: HankeRepository diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeServiceITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeServiceITests.kt index 736c3aebd..9d3058576 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeServiceITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HankeServiceITests.kt @@ -88,7 +88,7 @@ private const val NAME_SOMETHING = "Som Et Hing" @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") @WithMockUser(USER_NAME) class HankeServiceITests : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HanketunnusServiceImplITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HanketunnusServiceImplITest.kt index a89e5617e..fc04b8f13 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HanketunnusServiceImplITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/HanketunnusServiceImplITest.kt @@ -10,7 +10,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") internal class HanketunnusServiceImplITest : DatabaseTest() { @Autowired lateinit var hanketunnusService: HanketunnusService diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/IntegrationTestConfiguration.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/IntegrationTestConfiguration.kt index 416e47c3b..2e4825655 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/IntegrationTestConfiguration.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/IntegrationTestConfiguration.kt @@ -25,7 +25,6 @@ import io.sentry.protocol.SentryId import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.test.context.TestConfiguration import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Profile import org.springframework.context.event.ContextRefreshedEvent import org.springframework.context.event.EventListener import org.springframework.jdbc.core.JdbcOperations @@ -33,7 +32,6 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.web.SecurityFilterChain @TestConfiguration -@Profile("itest") @EnableConfigurationProperties(GdprProperties::class, FeatureFlags::class) class IntegrationTestConfiguration { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/SpringDocITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/SpringDocITest.kt index adbbe8084..c4b272aab 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/SpringDocITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/SpringDocITest.kt @@ -14,7 +14,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @Testcontainers -@ActiveProfiles("default") +@ActiveProfiles("test") @AutoConfigureMockMvc class SpringdocITest(@Autowired override val mockMvc: MockMvc) : ControllerTest, DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/StatusControllerITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/StatusControllerITests.kt index caa4e92ce..f667f4e9c 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/StatusControllerITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/StatusControllerITests.kt @@ -14,7 +14,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers @WebMvcTest(StatusController::class) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") class StatusControllerITests(@Autowired val mockMvc: MockMvc) { @Autowired lateinit var jdbcOperations: JdbcOperations diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/application/ApplicationControllerITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/application/ApplicationControllerITest.kt index 32dc3b0a6..ded27ff03 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/application/ApplicationControllerITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/application/ApplicationControllerITest.kt @@ -52,7 +52,7 @@ private const val BASE_URL = "/hakemukset" @WebMvcTest(ApplicationController::class) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") class ApplicationControllerITest(@Autowired override val mockMvc: MockMvc) : ControllerTest { @Autowired private lateinit var applicationService: ApplicationService diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/application/ApplicationServiceITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/application/ApplicationServiceITest.kt index 77f49dd86..410f75cfc 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/application/ApplicationServiceITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/application/ApplicationServiceITest.kt @@ -93,7 +93,7 @@ private val dataWithoutAreas = AlluDataFactory.createCableReportApplicationData( @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default", "emailtest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class ApplicationServiceITest : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/application/ApplicationAttachmentControllerITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/application/ApplicationAttachmentControllerITest.kt index 4a781efa7..4e517c2f7 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/application/ApplicationAttachmentControllerITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/application/ApplicationAttachmentControllerITest.kt @@ -64,7 +64,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status @WebMvcTest(ApplicationAttachmentController::class) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class ApplicationAttachmentControllerITest(@Autowired override val mockMvc: MockMvc) : ControllerTest { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/application/ApplicationAttachmentServiceITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/application/ApplicationAttachmentServiceITest.kt index 23540afc3..b14fdc704 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/application/ApplicationAttachmentServiceITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/application/ApplicationAttachmentServiceITest.kt @@ -69,7 +69,7 @@ private const val ALLU_ID = 42 @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") @WithMockUser(USERNAME) @TestPropertySource(locations = ["classpath:application-test.properties"]) class ApplicationAttachmentServiceITest : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/common/FileScanClientITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/common/FileScanClientITest.kt index 57c8a5443..a1ce2b28b 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/common/FileScanClientITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/common/FileScanClientITest.kt @@ -26,7 +26,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") @TestPropertySource(locations = ["classpath:application-test.properties"]) class FileScanClientITest : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/hanke/HankeAttachmentControllerITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/hanke/HankeAttachmentControllerITests.kt index d2cb2da41..33c63d838 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/hanke/HankeAttachmentControllerITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/hanke/HankeAttachmentControllerITests.kt @@ -53,7 +53,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status @WebMvcTest(HankeAttachmentController::class) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class HankeAttachmentControllerITests(@Autowired override val mockMvc: MockMvc) : ControllerTest { @@ -201,7 +201,7 @@ class HankeAttachmentControllerITests(@Autowired override val mockMvc: MockMvc) properties = ["haitaton.features.hanke-editing=false"] ) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class HankeAttachmentControllerHankeEditingDisabledITests( @Autowired override val mockMvc: MockMvc diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/hanke/HankeAttachmentServiceITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/hanke/HankeAttachmentServiceITests.kt index 3d5e0cb80..5aeb52d54 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/hanke/HankeAttachmentServiceITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/attachment/hanke/HankeAttachmentServiceITests.kt @@ -42,7 +42,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") @WithMockUser(USERNAME) @TestPropertySource(locations = ["classpath:application-test.properties"]) class HankeAttachmentServiceITests : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/domain/PublicHankeControllerITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/domain/PublicHankeControllerITests.kt index ad799a2a8..f24d9dfd0 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/domain/PublicHankeControllerITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/domain/PublicHankeControllerITests.kt @@ -26,7 +26,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPat @WebMvcTest(PublicHankeController::class) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") class PublicHankeControllerITests(@Autowired override val mockMvc: MockMvc) : ControllerTest { @Autowired private lateinit var hankeService: HankeService diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/email/EmailSenderServiceFilterITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/email/EmailSenderServiceFilterITest.kt index 70b90d6b6..aa7855f63 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/email/EmailSenderServiceFilterITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/email/EmailSenderServiceFilterITest.kt @@ -24,7 +24,7 @@ import org.testcontainers.junit.jupiter.Testcontainers "haitaton.email.filter.allow-list=test@test.test;something@mail.com" ] ) -@ActiveProfiles("default", "emailtest") +@ActiveProfiles("test") class EmailSenderServiceFilterITest : DatabaseTest() { companion object { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/email/EmailSenderServiceITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/email/EmailSenderServiceITest.kt index 7ac09604c..405b3ee6a 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/email/EmailSenderServiceITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/email/EmailSenderServiceITest.kt @@ -26,7 +26,7 @@ private const val APPLICATION_IDENTIFIER = "JS2300001" @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default", "emailtest") +@ActiveProfiles("test") class EmailSenderServiceITest : DatabaseTest() { companion object { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/gdpr/GdprControllerITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/gdpr/GdprControllerITests.kt index db57cf6be..7d9c26341 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/gdpr/GdprControllerITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/gdpr/GdprControllerITests.kt @@ -35,7 +35,7 @@ private const val USERID = "test-user" @WebMvcTest(controllers = [GdprController::class], properties = ["haitaton.gdpr.disabled=false"]) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERID) class GdprControllerITests(@Autowired var mockMvc: MockMvc) { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/gdpr/GdprServiceITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/gdpr/GdprServiceITest.kt index e7b1bad50..f4172b415 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/gdpr/GdprServiceITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/gdpr/GdprServiceITest.kt @@ -33,7 +33,7 @@ private const val USERID = "test-user" @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") @WithMockUser(USERID) class GdprServiceITest : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/geometria/GeometriatDaoImplITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/geometria/GeometriatDaoImplITest.kt index f4995cee6..a23d71a73 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/geometria/GeometriatDaoImplITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/geometria/GeometriatDaoImplITest.kt @@ -23,7 +23,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") internal class GeometriatDaoImplITest : DatabaseTest() { private val expectedPolygonArea = 1707f diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/geometria/GeometriatServiceImplITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/geometria/GeometriatServiceImplITest.kt index ba3fadaf1..bf257e8e1 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/geometria/GeometriatServiceImplITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/geometria/GeometriatServiceImplITest.kt @@ -25,7 +25,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") @WithMockUser(username = "test") internal class GeometriatServiceImplITest : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/logging/AuditLogServiceITests.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/logging/AuditLogServiceITests.kt index 5801f29e5..e32d379ac 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/logging/AuditLogServiceITests.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/logging/AuditLogServiceITests.kt @@ -25,7 +25,7 @@ import org.testcontainers.junit.jupiter.Testcontainers // Thus, have to use this test containers -way, which uses the proper PostgreSQL. @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") class AuditLogServiceITests : DatabaseTest() { @Autowired private lateinit var entityManager: EntityManager diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/HankeKayttajaControllerITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/HankeKayttajaControllerITest.kt index 7fac1f1c5..5adaa70cc 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/HankeKayttajaControllerITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/HankeKayttajaControllerITest.kt @@ -46,12 +46,9 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status private const val USERNAME = "testUser" private const val HANKE_TUNNUS = HankeFactory.defaultHankeTunnus -@WebMvcTest( - HankeKayttajaController::class, - properties = ["haitaton.features.user-management=true"], -) +@WebMvcTest(HankeKayttajaController::class) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class HankeKayttajaControllerITest(@Autowired override val mockMvc: MockMvc) : ControllerTest { @@ -454,7 +451,7 @@ class HankeKayttajaControllerITest(@Autowired override val mockMvc: MockMvc) : C properties = ["haitaton.features.user-management=false"], ) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class HankeKayttajaControllerFeatureDisabledITest(@Autowired override val mockMvc: MockMvc) : ControllerTest { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/HankeKayttajaServiceITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/HankeKayttajaServiceITest.kt index 31ef1dd68..b34bd63c9 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/HankeKayttajaServiceITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/HankeKayttajaServiceITest.kt @@ -46,7 +46,7 @@ const val kayttajaTunnistePattern = "[a-zA-z0-9]{24}" @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") @WithMockUser(USERNAME) class HankeKayttajaServiceITest : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/PermissionServiceITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/PermissionServiceITest.kt index e9039ff82..9bcbaacef 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/PermissionServiceITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/permissions/PermissionServiceITest.kt @@ -22,7 +22,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") @WithMockUser(username = "test7358") class PermissionServiceITest : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataControllerDisabledITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataControllerDisabledITest.kt index c318181da..19d17cb58 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataControllerDisabledITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataControllerDisabledITest.kt @@ -28,7 +28,7 @@ private const val BASE_URL = "/testdata" properties = ["haitaton.testdata.enabled=false"], ) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class TestDataControllerDisabledITest(@Autowired override val mockMvc: MockMvc) : ControllerTest { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataControllerEnabledITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataControllerEnabledITest.kt index 42c9a3714..474096f81 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataControllerEnabledITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataControllerEnabledITest.kt @@ -28,7 +28,7 @@ private const val BASE_URL = "/testdata" properties = ["haitaton.testdata.enabled=true"], ) @Import(IntegrationTestConfiguration::class) -@ActiveProfiles("itest") +@ActiveProfiles("test") @WithMockUser(USERNAME) class TestDataControllerEnabledITest(@Autowired override val mockMvc: MockMvc) : ControllerTest { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataServiceITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataServiceITest.kt index 4406dd260..88b2a9448 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataServiceITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/testdata/TestDataServiceITest.kt @@ -25,7 +25,7 @@ private const val USERNAME = "testUser" webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = ["haitaton.testdata.enabled=true"], ) -@ActiveProfiles("default") +@ActiveProfiles("test") @WithMockUser(USERNAME) class TestDataServiceITest : DatabaseTest() { diff --git a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/tormaystarkastelu/TormaystarkasteluTormaysServicePGITest.kt b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/tormaystarkastelu/TormaystarkasteluTormaysServicePGITest.kt index 7d0c0f0d7..3509835ac 100644 --- a/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/tormaystarkastelu/TormaystarkasteluTormaysServicePGITest.kt +++ b/services/hanke-service/src/integrationTest/kotlin/fi/hel/haitaton/hanke/tormaystarkastelu/TormaystarkasteluTormaysServicePGITest.kt @@ -17,7 +17,7 @@ import org.testcontainers.junit.jupiter.Testcontainers @Testcontainers @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("default") +@ActiveProfiles("test") internal class TormaystarkasteluTormaysServicePGITest : DatabaseTest() { @Autowired private lateinit var geometriatDao: GeometriatDao diff --git a/services/hanke-service/src/integrationTest/resources/application-test.properties b/services/hanke-service/src/integrationTest/resources/application-test.properties deleted file mode 100644 index 0d0b10d8c..000000000 --- a/services/hanke-service/src/integrationTest/resources/application-test.properties +++ /dev/null @@ -1 +0,0 @@ -haitaton.clamav.baseUrl=http://localhost:6789 diff --git a/services/hanke-service/src/main/kotlin/fi/hel/haitaton/hanke/configuration/Configuration.kt b/services/hanke-service/src/main/kotlin/fi/hel/haitaton/hanke/configuration/Configuration.kt index b681f4ea4..c3337f42a 100644 --- a/services/hanke-service/src/main/kotlin/fi/hel/haitaton/hanke/configuration/Configuration.kt +++ b/services/hanke-service/src/main/kotlin/fi/hel/haitaton/hanke/configuration/Configuration.kt @@ -42,14 +42,12 @@ import org.springframework.beans.factory.annotation.Value import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Profile import org.springframework.http.client.reactive.ReactorClientHttpConnector import org.springframework.jdbc.core.JdbcOperations import org.springframework.web.reactive.function.client.WebClient import reactor.netty.http.client.HttpClient @Configuration -@Profile("default") @EnableConfigurationProperties( GdprProperties::class, FeatureFlags::class, diff --git a/services/hanke-service/src/main/resources/application.properties b/services/hanke-service/src/main/resources/application.properties index b12aee85f..3f71acba6 100644 --- a/services/hanke-service/src/main/resources/application.properties +++ b/services/hanke-service/src/main/resources/application.properties @@ -22,8 +22,8 @@ haitaton.gdpr.delete-scope=${HAITATON_GDPR_DELETE_SCOPE:haitaton.gdprdelete} #logging.level.org.springframework.security=DEBUG # Disable endpoints that are e.g. in development and should not be in production. -haitaton.features.hanke-editing=${HAITATON_FEATURE_HANKE_EDITING:true} -haitaton.features.user-management=${HAITATON_FEATURE_USER_MANAGEMENT:true} +haitaton.features.hanke-editing=${HAITATON_FEATURE_HANKE_EDITING:false} +haitaton.features.user-management=${HAITATON_FEATURE_USER_MANAGEMENT:false} # For dev and test environments, enable the testdata controller for resetting data haitaton.testdata.enabled=${HAITATON_TESTDATA_ENABLED:false} diff --git a/services/hanke-service/src/test/resources/application-emailtest.properties b/services/hanke-service/src/test/resources/application-test.properties similarity index 70% rename from services/hanke-service/src/test/resources/application-emailtest.properties rename to services/hanke-service/src/test/resources/application-test.properties index f2f05a8c8..1c09dc939 100644 --- a/services/hanke-service/src/test/resources/application-emailtest.properties +++ b/services/hanke-service/src/test/resources/application-test.properties @@ -5,3 +5,6 @@ spring.mail.properties.mail.smtp.auth=false spring.mail.properties.mail.smtp.starttls.enable=false spring.mail.properties.mail.smtp.starttls.required=false spring.mail.properties.mail.debug=false +haitaton.clamav.baseUrl=http://localhost:6789 +haitaton.features.hanke-editing=true +haitaton.features.user-management=true