This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 268b1cf4519 CAMEL-20378: Languages should be thread-safe and be configured only via properties array, all in the same way. 268b1cf4519 is described below commit 268b1cf451967eb749d37e879197ff49d9742ce4 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Feb 5 14:18:52 2024 +0100 CAMEL-20378: Languages should be thread-safe and be configured only via properties array, all in the same way. --- .../apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy | 7 ++++++- .../resources/routes/routes-with-languages-configuration.groovy | 5 ++++- .../org/apache/camel/dsl/kotlin/KotlinRoutesBuilderLoaderTest.kt | 8 ++++---- .../test/resources/routes/routes-with-languages-configuration.kts | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/groovy/org/apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/groovy/org/apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy index 107f1452e18..e836e897160 100644 --- a/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/groovy/org/apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/groovy/org/apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy @@ -147,8 +147,13 @@ class GroovyRouteBuilderLoaderTest extends Specification { loadRoute('/routes/routes-with-languages-configuration.groovy') then: + context.start() + + with(context.resolveLanguage('bean'), BeanLanguage) { + (!validate) + } with(context.resolveLanguage('myBean'), BeanLanguage) { - (!isValidate()); + validate } } diff --git a/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-languages-configuration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-languages-configuration.groovy index feeba851b73..19ee4fca5f9 100644 --- a/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-languages-configuration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-languages-configuration.groovy @@ -20,8 +20,11 @@ import org.apache.camel.language.bean.BeanLanguage camel { languages { + bean(BeanLanguage) { + validate = false + } myBean(BeanLanguage) { - validate = false; + validate = true } } } diff --git a/dsl/camel-kotlin-dsl/src/test/kotlin/org/apache/camel/dsl/kotlin/KotlinRoutesBuilderLoaderTest.kt b/dsl/camel-kotlin-dsl/src/test/kotlin/org/apache/camel/dsl/kotlin/KotlinRoutesBuilderLoaderTest.kt index a0c954c72be..454c349051e 100644 --- a/dsl/camel-kotlin-dsl/src/test/kotlin/org/apache/camel/dsl/kotlin/KotlinRoutesBuilderLoaderTest.kt +++ b/dsl/camel-kotlin-dsl/src/test/kotlin/org/apache/camel/dsl/kotlin/KotlinRoutesBuilderLoaderTest.kt @@ -34,7 +34,6 @@ import org.apache.camel.support.DefaultHeaderFilterStrategy import org.apache.camel.support.PluginHelper import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatExceptionOfType -import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test class KotlinRoutesBuilderLoaderTest { @@ -152,18 +151,19 @@ class KotlinRoutesBuilderLoaderTest { } @Test - @Disabled fun `load integration with languages configuration`() { val ctx = DefaultCamelContext() val res = PluginHelper.getResourceLoader(ctx).resolveResource("/routes/routes-with-languages-configuration.kts") PluginHelper.getRoutesLoader(ctx).loadRoutes(res) + ctx.start() + val bean = ctx.resolveLanguage("bean") as BeanLanguage - assertThat(bean.isValidate).isTrue() + assertThat(bean.isValidate).isFalse() val mybean = ctx.resolveLanguage("my-bean") as BeanLanguage - assertThat(mybean.isValidate).isFalse() + assertThat(mybean.isValidate).isTrue() } @Test diff --git a/dsl/camel-kotlin-dsl/src/test/resources/routes/routes-with-languages-configuration.kts b/dsl/camel-kotlin-dsl/src/test/resources/routes/routes-with-languages-configuration.kts index 2c260c513ea..1987daf4e5d 100644 --- a/dsl/camel-kotlin-dsl/src/test/resources/routes/routes-with-languages-configuration.kts +++ b/dsl/camel-kotlin-dsl/src/test/resources/routes/routes-with-languages-configuration.kts @@ -19,10 +19,10 @@ import org.apache.camel.language.bean.BeanLanguage camel { languages { language<BeanLanguage>("bean") { - validate = false + isValidate = false } language<BeanLanguage>("my-bean") { - validate = true + isValidate = true } } } \ No newline at end of file