diff --git a/camel-k-loader-groovy/pom.xml b/camel-k-loader-groovy/pom.xml index cd51a88f2..00fae2edb 100644 --- a/camel-k-loader-groovy/pom.xml +++ b/camel-k-loader-groovy/pom.xml @@ -37,11 +37,6 @@ camel-core-engine provided - - org.apache.camel - camel-main - provided - org.apache.camel camel-log @@ -65,11 +60,20 @@ provided + + + + org.apache.camel.k camel-k-runtime-main test + + org.apache.camel + camel-main + test + org.apache.camel camel-timer @@ -95,6 +99,11 @@ camel-properties test + + + + + org.codehaus.groovy groovy-test diff --git a/camel-k-loader-js/pom.xml b/camel-k-loader-js/pom.xml index 7b496c712..40edead7d 100644 --- a/camel-k-loader-js/pom.xml +++ b/camel-k-loader-js/pom.xml @@ -43,6 +43,10 @@ ${graalvm.version} + + + + org.apache.camel.k camel-k-runtime-main @@ -83,6 +87,15 @@ camel-properties test + + org.apache.camel + camel-main + test + + + + + org.junit.jupiter diff --git a/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java b/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java index 5193beace..a8782b8d4 100644 --- a/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java +++ b/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java @@ -28,9 +28,9 @@ import org.apache.camel.spi.Registry; public class IntegrationConfiguration extends org.apache.camel.builder.BuilderSupport { - final Registry registry; - final Components components; - final RouteBuilder builder; + public final Registry registry; + public final Components components; + public final RouteBuilder builder; public IntegrationConfiguration(RouteBuilder builder) { super(builder.getContext()); diff --git a/camel-k-loader-js/src/test/java/org/apache/camel/k/loader/js/dsl/IntegrationTest.java b/camel-k-loader-js/src/test/java/org/apache/camel/k/loader/js/dsl/IntegrationTest.java new file mode 100644 index 000000000..c5e0aedfc --- /dev/null +++ b/camel-k-loader-js/src/test/java/org/apache/camel/k/loader/js/dsl/IntegrationTest.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.k.loader.js.dsl; + +import org.apache.camel.component.seda.SedaComponent; +import org.apache.camel.k.Runtime; +import org.apache.camel.k.listener.RoutesConfigurer; +import org.apache.camel.k.main.ApplicationRuntime; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class IntegrationTest { + @Test + public void testComponentConfiguration() throws Exception { + ApplicationRuntime runtime = new ApplicationRuntime(); + runtime.addListener(RoutesConfigurer.forRoutes("classpath:routes-with-component-configuration.js")); + runtime.addListener(Runtime.Phase.Started, r -> { + SedaComponent seda = r.getCamelContext().getComponent("seda", SedaComponent.class); + + assertThat(seda).isNotNull(); + assertThat(seda).hasFieldOrPropertyWithValue("queueSize", 1234); + + runtime.stop(); + }); + + runtime.run(); + } +} diff --git a/camel-k-loader-js/src/test/resources/routes-with-component-configuration.js b/camel-k-loader-js/src/test/resources/routes-with-component-configuration.js new file mode 100644 index 000000000..3f908ef7d --- /dev/null +++ b/camel-k-loader-js/src/test/resources/routes-with-component-configuration.js @@ -0,0 +1,3 @@ + +s = components.get('seda') +s.setQueueSize(1234) \ No newline at end of file