Francesco Boscarino created CAMEL-14212:
-------------------------------------------

             Summary: camel-groovy does not export correct "properties" property
                 Key: CAMEL-14212
                 URL: https://issues.apache.org/jira/browse/CAMEL-14212
             Project: Camel
          Issue Type: Bug
          Components: camel-groovy
    Affects Versions: 2.24.0, 2.20.4
            Reporter: Francesco Boscarino


groovy language is expected to export "properties" as 
org.apache.camel.builder.script.PropertiesFunction but it turns out 
"properties" is a LinkedHashMap without .resolve() method.

Just try the simple context:
{{<?xml version="1.0" encoding="UTF-8"?>}}
{{<beans 
xmlns="http://www.springframework.org/schema/beans"}}{{xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"}}{{xsi:schemaLocation="}}{{http://www.springframework.org/schema/beans
 
http://www.springframework.org/schema/beans/spring-beans.xsd}}{{http://camel.apache.org/schema/spring
 http://camel.apache.org/schema/spring/camel-spring.xsd";>}}
 
{{<bean 
id="properties"class="org.apache.camel.component.properties.PropertiesComponent">}}
{{<property name="location" value="classpath:myprop.properties"/>}}
{{</bean>}}
{{<camelContext xmlns="http://camel.apache.org/schema/spring";>}}
{{<route>}}
{{<from uri="timer:timer?repeatCount=1"/>}}
{{<setBody>}}
{{<groovy>}}{{properties}}{{</groovy>}}
{{</setBody>}}
{{<to uri="log:debug?showAll=true&amp;multiline=true"/>}}
{{</route>}}
{{</camelContext>}}
{{</beans>}}
 
{{The output is:}}

[l-1) thread #2 - timer://timer] debug                          INFO  Exchange[

, Id: ID-mba2015-lan-1574592722421-0-1

, ExchangePattern: InOnly

, Properties: \{CamelCreatedTimestamp=Sun Nov 24 11:52:03 CET 2019, 
CamelExternalRedelivered=false, 
CamelMessageHistory=[DefaultMessageHistory[routeId=route1, node=setBody1], 
DefaultMessageHistory[routeId=route1, node=to1]], CamelTimerCounter=1, 
CamelTimerFiredTime=Sun Nov 24 11:52:03 CET 2019, CamelTimerName=timer, 
CamelTimerPeriod=1000, CamelToEndpoint=log://debug?multiline=true&showAll=true}

, Headers: \{breadcrumbId=ID-mba2015-lan-1574592722421-0-1, firedTime=Sun Nov 
24 11:52:03 CET 2019}

, *BodyType: java.util.LinkedHashMap*

, Body: \{class=class script1574592724113926053069, 
binding=groovy.lang.Binding@748ee9f1}

, Out: null: 

]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to