This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit e0e2c09228bee9b10724236bc5ee43b3737bd097
Author: lburgazzoli <lburgazz...@gmail.com>
AuthorDate: Thu Jul 25 07:07:59 2019 +0200

    js: components not exported by base script #112
---
 camel-k-loader-js/pom.xml                          | 13 +++++++
 .../k/loader/js/dsl/IntegrationConfiguration.java  |  6 +--
 .../camel/k/loader/js/dsl/IntegrationTest.java     | 43 ++++++++++++++++++++++
 .../routes-with-component-configuration.js         |  3 ++
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/camel-k-loader-js/pom.xml b/camel-k-loader-js/pom.xml
index 7b496c7..40edead 100644
--- a/camel-k-loader-js/pom.xml
+++ b/camel-k-loader-js/pom.xml
@@ -43,6 +43,10 @@
             <version>${graalvm.version}</version>
         </dependency>
 
+        <!-- ******************************* -->
+        <!-- test deps :: camel              -->
+        <!-- ******************************* -->
+
         <dependency>
             <groupId>org.apache.camel.k</groupId>
             <artifactId>camel-k-runtime-main</artifactId>
@@ -83,6 +87,15 @@
             <artifactId>camel-properties</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-main</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- ******************************* -->
+        <!-- test deps                       -->
+        <!-- ******************************* -->
 
         <dependency>
             <groupId>org.junit.jupiter</groupId>
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 5193bea..a8782b8 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.model.rest.RestDefinition;
 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 0000000..c5e0aed
--- /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 0000000..3f908ef
--- /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

Reply via email to