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


The following commit(s) were added to refs/heads/master by this push:
     new 506f4a3  'context' object not available in JavaScript integrations #340
506f4a3 is described below

commit 506f4a3652e3e3090442ce6de3a8dcaf89bbb5a1
Author: lburgazzoli <lburgazz...@gmail.com>
AuthorDate: Wed May 27 18:12:33 2020 +0200

    'context' object not available in JavaScript integrations #340
---
 .../k/loader/js/dsl/IntegrationConfiguration.java      |  3 +++
 .../apache/camel/k/loader/js/dsl/IntegrationTest.java  | 11 +++++++++++
 .../resources/routes-with-context-configuration.js     | 18 ++++++++++++++++++
 3 files changed, 32 insertions(+)

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 904170b..9029efd 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
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.k.loader.js.dsl;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.builder.BuilderSupport;
 import org.apache.camel.builder.EndpointConsumerBuilder;
 import org.apache.camel.builder.endpoint.EndpointBuilderFactory;
@@ -34,6 +35,7 @@ public class IntegrationConfiguration extends BuilderSupport 
implements Endpoint
     public final Registry registry;
     public final Components components;
     public final EndpointRouteBuilder builder;
+    public final CamelContext context;
 
     public IntegrationConfiguration(EndpointRouteBuilder builder) {
         super(builder.getContext());
@@ -41,6 +43,7 @@ public class IntegrationConfiguration extends BuilderSupport 
implements Endpoint
         this.registry = builder.getContext().getRegistry();
         this.components = new Components(builder.getContext());
         this.builder = builder;
+        this.context = builder.getContext();
     }
 
     public RouteDefinition from(String endpoint) {
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
index 7365a98..326ddc5 100644
--- 
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
@@ -69,6 +69,7 @@ public class IntegrationTest {
         assertThat(seda).isNotNull();
         assertThat(seda).hasFieldOrPropertyWithValue("queueSize", 1234);
     }
+
     @Test
     public void testRestConfiguration() {
         configureRoutes(
@@ -125,4 +126,14 @@ public class IntegrationTest {
         assertThat(template.requestBody("direct:wrapper", 
"")).isEqualTo("wrapper");
         assertThat(template.requestBody("direct:function", 
"")).isEqualTo("function");
     }
+
+
+    @Test
+    public void testContextConfiguration() {
+        configureRoutes(
+            "classpath:routes-with-context-configuration.js"
+        );
+
+        assertThat(context.isTypeConverterStatisticsEnabled()).isTrue();
+    }
 }
diff --git 
a/camel-k-loader-js/src/test/resources/routes-with-context-configuration.js 
b/camel-k-loader-js/src/test/resources/routes-with-context-configuration.js
new file mode 100644
index 0000000..53817d7
--- /dev/null
+++ b/camel-k-loader-js/src/test/resources/routes-with-context-configuration.js
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+context.setTypeConverterStatisticsEnabled(true)
\ No newline at end of file

Reply via email to