diff --git a/ontrack-extension-general/src/test/java/net/nemerosa/ontrack/extension/general/MetaInfoPropertyMutationProviderIT.kt b/ontrack-extension-general/src/test/java/net/nemerosa/ontrack/extension/general/MetaInfoPropertyMutationProviderIT.kt index ba1651f9dba..b163df681c8 100644 --- a/ontrack-extension-general/src/test/java/net/nemerosa/ontrack/extension/general/MetaInfoPropertyMutationProviderIT.kt +++ b/ontrack-extension-general/src/test/java/net/nemerosa/ontrack/extension/general/MetaInfoPropertyMutationProviderIT.kt @@ -1,16 +1,16 @@ package net.nemerosa.ontrack.extension.general -import net.nemerosa.ontrack.graphql.AbstractQLKTITJUnit4Support +import net.nemerosa.ontrack.graphql.AbstractQLKTITSupport import net.nemerosa.ontrack.model.structure.ProjectEntity import net.nemerosa.ontrack.model.structure.nameValues import net.nemerosa.ontrack.model.structure.typeName import net.nemerosa.ontrack.model.structure.varName -import org.junit.Test +import org.junit.jupiter.api.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull -class MetaInfoPropertyMutationProviderIT : AbstractQLKTITJUnit4Support() { +class MetaInfoPropertyMutationProviderIT : AbstractQLKTITSupport() { @Test fun `Setting the meta info property at different levels`() { diff --git a/ontrack-it-utils/src/main/java/net/nemerosa/ontrack/it/AbstractDSLTestJUnit4Support.kt b/ontrack-it-utils/src/main/java/net/nemerosa/ontrack/it/AbstractDSLTestJUnit4Support.kt index d65282c133f..2568c78f7e5 100644 --- a/ontrack-it-utils/src/main/java/net/nemerosa/ontrack/it/AbstractDSLTestJUnit4Support.kt +++ b/ontrack-it-utils/src/main/java/net/nemerosa/ontrack/it/AbstractDSLTestJUnit4Support.kt @@ -14,8 +14,11 @@ import net.nemerosa.ontrack.model.settings.PredefinedPromotionLevelService import net.nemerosa.ontrack.model.settings.PredefinedValidationStampService import net.nemerosa.ontrack.model.structure.* import net.nemerosa.ontrack.model.support.OntrackConfigProperties +import net.nemerosa.ontrack.model.support.SettingsRepository import net.nemerosa.ontrack.test.TestUtils import net.nemerosa.ontrack.test.TestUtils.uid +import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.springframework.beans.factory.annotation.Autowired import java.time.LocalDateTime import kotlin.reflect.KClass @@ -39,6 +42,9 @@ abstract class AbstractDSLTestJUnit4Support : AbstractServiceTestJUnit4Support() @Autowired protected lateinit var settingsService: CachedSettingsService + @Autowired + protected lateinit var settingsRepository: SettingsRepository + @Autowired protected lateinit var predefinedPromotionLevelService: PredefinedPromotionLevelService @@ -53,6 +59,15 @@ abstract class AbstractDSLTestJUnit4Support : AbstractServiceTestJUnit4Support() protected final inline fun asUserWith(noinline code: () -> R): R = asUser().with(T::class.java).call(code) + /** + * Removing all settings before any test + */ + @Before + fun clearSettings() { + settingsRepository.clear() + cachedSettingsService.invalidateAll() + } + /** * Kotlin friendly */