[
https://issues.apache.org/jira/browse/CAMEL-10694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Baltej Singh updated CAMEL-10694:
---------------------------------
Description:
The simple example that shows the issues with various {{}},
=$simple{file:onlyname} and ${bean:...} combinations
------------fileNaming.properties ------------ trace=false in.path=c:/temp/in
{noformat}
in.path0=c:/temp/test/in0
in.path1=c:/temp/test/in1
in.path2=c:/temp/test/in2
in.path3=c:/temp/test/in3
archive.path=c:/temp/test/archive/
common.fname.pattern=$simple{file:onlyname}
datetime.fname.pattern=$simple{date:now:yyyy-MM-dd_hh-mm-ss.SSS}-$simple{file:onlyname}
incounter.datetime.fname.pattern=${bean:inboundCounter.incrementAndGet}-$simple{date:now:yyyy-MM-dd_hh-mm-ss.SSS}
{noformat}
----------End fileNaming.properties ------------
{noformat}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:p="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-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean
class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer"
id="bridgePropertyPlaceholder">
<p:property name="location"
value="classpath:fileNaming.properties" />
</bean>
<bean class="java.util.concurrent.atomic.AtomicLong"
id="inboundCounter" />
<camelContext id="testFileNamingContext" trace="{{trace}}"
xmlns="http://camel.apache.org/schema/spring">
<route id="workingRoute">
<camel:description>This route produces:
C:\temp\test\in\done\0-workingRoute-testNaming.xml</camel:description>
<from
uri="file:c:/temp/test/in?moveFailed=.failed/$simple{file:onlyname}&move=done/${bean:inboundCounter.getAndIncrement}-workingRoute-$simple{file:onlyname}"
/>
<log message="workingRoute" />
<to id="_toW" uri="mock://complete" />
</route>
<route id="errorRoute0">
<camel:description>Using {{common.fname.pattern}}
causes inboundCounter bean reference to fail. This route produces:
C:\temp\test\in0\done\inboundCounter.getAndIncrement-errorRoute0-testNaming.xml
</camel:description>
<from
uri="file:c:/temp/test/in0?move=done/${bean:inboundCounter.getAndIncrement}-errorRoute0-{{common.fname.pattern}}"
/>
<log message="errorRoute0" />
<to id="_to0" uri="mock://complete" />
</route>
<route id="errorRoute1">
<camel:description>Using {{in.path1}} and
{{archive.path}} causes inboundCounter bean reference to fail. This route
produces:
C:\temp\test\archive\inboundCounter.getAndIncrement-errorRoute1-testNaming.xml
</camel:description>
<from
uri="file:{{in.path1}}?move={{archive.path}}/${bean:inboundCounter.getAndIncrement}-errorRoute1-$simple{file:onlyname}"
/>
<log message="errorRoute1" />
<to id="_to1" uri="mock://complete" />
</route>
<route id="errorRoute2">
<camel:description>This route produces:
C:\temp\test\in2\done\inboundCounter.getAndIncrement-errorRoute2-testNaming.xml</camel:description>
<from
uri="file:{{in.path2}}?move=done/${bean:inboundCounter.getAndIncrement}-errorRoute2-{{common.fname.pattern}}"
/>
<log message="errorRoute2" />
<to id="_to2" uri="mock://complete" />
</route>
<route id="errorRoute3">
<camel:description>This route produces:
C:\temp\test\archive\inboundCounter.getAndIncrement-errorRoute3-testNaming.xml
</camel:description>
<from
uri="file:{{in.path3}}?move={{archive.path}}/${bean:inboundCounter.getAndIncrement}-errorRoute3-{{common.fname.pattern}}"
/>
<log message="errorRoute3" />
<to id="_to3" uri="mock://complete" />
</route>
</camelContext>
</beans>
{noformat}
------------
Note that NO errors are thrown in console
-------------
[pache.camel.spring.Main.main()] SpringCamelContext INFO Total 5
routes, of which 5 are started.
[pache.camel.spring.Main.main()] SpringCamelContext INFO Apache
Camel 2.18.1 (CamelContext: testFileNamingContext) started in 2.402 seconds
[d #3 - file://c:/temp/test/in0] errorRoute0 INFO
errorRoute0
[d #4 - file://c:/temp/test/in1] errorRoute1 INFO
errorRoute1
[d #5 - file://c:/temp/test/in2] errorRoute2 INFO
errorRoute2
[d #6 - file://c:/temp/test/in3] errorRoute3 INFO
errorRoute3
[d #6 - file://c:/temp/test/in3] errorRoute3 INFO
errorRoute3
=====================
C:\temp\test>tree
Folder PATH listing for volume RAW7121218
Volume serial number is 0C09-AE01
C:.
├───archive
├───in
│ └───done
├───in0
│ └───done
├───in1
├───in2
│ └───done
└───in3
C:\temp\test>ls -1R
.:
archive
in
in0
in1
in2
in3
./archive:
inboundCounter.getAndIncrement-errorRoute1-testNaming.xml
inboundCounter.getAndIncrement-errorRoute3-testNaming.xml
./in:
done
./in/done:
0-workingRoute-testNaming.xml
./in0:
done
./in0/done:
inboundCounter.getAndIncrement-errorRoute0-testNaming.xml
./in1:
./in2:
done
./in2/done:
inboundCounter.getAndIncrement-errorRoute2-testNaming.xml
./in3:
was:
The simple example that shows the issues with various {{}},
=$simple{file:onlyname} and ${bean:...} combinations
------------fileNaming.properties ------------ trace=false in.path=c:/temp/in
in.path0=c:/temp/test/in0
in.path1=c:/temp/test/in1
in.path2=c:/temp/test/in2
in.path3=c:/temp/test/in3
archive.path=c:/temp/test/archive/
common.fname.pattern=$simple{file:onlyname}
datetime.fname.pattern=$simple{date:now:yyyy-MM-dd_hh-mm-ss.SSS}-$simple{file:onlyname}
incounter.datetime.fname.pattern=${bean:inboundCounter.incrementAndGet}-$simple{date:now:yyyy-MM-dd_hh-mm-ss.SSS}
----------End fileNaming.properties ------------
{noformat}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:p="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-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean
class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer"
id="bridgePropertyPlaceholder">
<p:property name="location"
value="classpath:fileNaming.properties" />
</bean>
<bean class="java.util.concurrent.atomic.AtomicLong"
id="inboundCounter" />
<camelContext id="testFileNamingContext" trace="{{trace}}"
xmlns="http://camel.apache.org/schema/spring">
<route id="workingRoute">
<camel:description>This route produces:
C:\temp\test\in\done\0-workingRoute-testNaming.xml</camel:description>
<from
uri="file:c:/temp/test/in?moveFailed=.failed/$simple{file:onlyname}&move=done/${bean:inboundCounter.getAndIncrement}-workingRoute-$simple{file:onlyname}"
/>
<log message="workingRoute" />
<to id="_toW" uri="mock://complete" />
</route>
<route id="errorRoute0">
<camel:description>Using {{common.fname.pattern}}
causes inboundCounter bean reference to fail. This route produces:
C:\temp\test\in0\done\inboundCounter.getAndIncrement-errorRoute0-testNaming.xml
</camel:description>
<from
uri="file:c:/temp/test/in0?move=done/${bean:inboundCounter.getAndIncrement}-errorRoute0-{{common.fname.pattern}}"
/>
<log message="errorRoute0" />
<to id="_to0" uri="mock://complete" />
</route>
<route id="errorRoute1">
<camel:description>Using {{in.path1}} and
{{archive.path}} causes inboundCounter bean reference to fail. This route
produces:
C:\temp\test\archive\inboundCounter.getAndIncrement-errorRoute1-testNaming.xml
</camel:description>
<from
uri="file:{{in.path1}}?move={{archive.path}}/${bean:inboundCounter.getAndIncrement}-errorRoute1-$simple{file:onlyname}"
/>
<log message="errorRoute1" />
<to id="_to1" uri="mock://complete" />
</route>
<route id="errorRoute2">
<camel:description>This route produces:
C:\temp\test\in2\done\inboundCounter.getAndIncrement-errorRoute2-testNaming.xml</camel:description>
<from
uri="file:{{in.path2}}?move=done/${bean:inboundCounter.getAndIncrement}-errorRoute2-{{common.fname.pattern}}"
/>
<log message="errorRoute2" />
<to id="_to2" uri="mock://complete" />
</route>
<route id="errorRoute3">
<camel:description>This route produces:
C:\temp\test\archive\inboundCounter.getAndIncrement-errorRoute3-testNaming.xml
</camel:description>
<from
uri="file:{{in.path3}}?move={{archive.path}}/${bean:inboundCounter.getAndIncrement}-errorRoute3-{{common.fname.pattern}}"
/>
<log message="errorRoute3" />
<to id="_to3" uri="mock://complete" />
</route>
</camelContext>
</beans>
{noformat}
------------
Note that NO errors are thrown in console
-------------
[pache.camel.spring.Main.main()] SpringCamelContext INFO Total 5
routes, of which 5 are started.
[pache.camel.spring.Main.main()] SpringCamelContext INFO Apache
Camel 2.18.1 (CamelContext: testFileNamingContext) started in 2.402 seconds
[d #3 - file://c:/temp/test/in0] errorRoute0 INFO
errorRoute0
[d #4 - file://c:/temp/test/in1] errorRoute1 INFO
errorRoute1
[d #5 - file://c:/temp/test/in2] errorRoute2 INFO
errorRoute2
[d #6 - file://c:/temp/test/in3] errorRoute3 INFO
errorRoute3
[d #6 - file://c:/temp/test/in3] errorRoute3 INFO
errorRoute3
=====================
C:\temp\test>tree
Folder PATH listing for volume RAW7121218
Volume serial number is 0C09-AE01
C:.
├───archive
├───in
│ └───done
├───in0
│ └───done
├───in1
├───in2
│ └───done
└───in3
C:\temp\test>ls -1R
.:
archive
in
in0
in1
in2
in3
./archive:
inboundCounter.getAndIncrement-errorRoute1-testNaming.xml
inboundCounter.getAndIncrement-errorRoute3-testNaming.xml
./in:
done
./in/done:
0-workingRoute-testNaming.xml
./in0:
done
./in0/done:
inboundCounter.getAndIncrement-errorRoute0-testNaming.xml
./in1:
./in2:
done
./in2/done:
inboundCounter.getAndIncrement-errorRoute2-testNaming.xml
./in3:
> Some combinations of {{}} properties refernce, bean and simple language fail
> ----------------------------------------------------------------------------
>
> Key: CAMEL-10694
> URL: https://issues.apache.org/jira/browse/CAMEL-10694
> Project: Camel
> Issue Type: Bug
> Components: camel-core, camel-spring
> Affects Versions: 2.18.1
> Environment: Windows
> Reporter: Baltej Singh
> Attachments: fileNaming.properties, testNaming.xml
>
>
> The simple example that shows the issues with various {{}},
> =$simple{file:onlyname} and ${bean:...} combinations
> ------------fileNaming.properties ------------ trace=false in.path=c:/temp/in
> {noformat}
> in.path0=c:/temp/test/in0
> in.path1=c:/temp/test/in1
> in.path2=c:/temp/test/in2
> in.path3=c:/temp/test/in3
> archive.path=c:/temp/test/archive/
> common.fname.pattern=$simple{file:onlyname}
> datetime.fname.pattern=$simple{date:now:yyyy-MM-dd_hh-mm-ss.SSS}-$simple{file:onlyname}
> incounter.datetime.fname.pattern=${bean:inboundCounter.incrementAndGet}-$simple{date:now:yyyy-MM-dd_hh-mm-ss.SSS}
> {noformat}
> ----------End fileNaming.properties ------------
> {noformat}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:camel="http://camel.apache.org/schema/spring"
> xmlns:p="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-3.0.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
> <bean
> class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer"
> id="bridgePropertyPlaceholder">
> <p:property name="location"
> value="classpath:fileNaming.properties" />
> </bean>
>
> <bean class="java.util.concurrent.atomic.AtomicLong"
> id="inboundCounter" />
>
> <camelContext id="testFileNamingContext" trace="{{trace}}"
> xmlns="http://camel.apache.org/schema/spring">
> <route id="workingRoute">
> <camel:description>This route produces:
> C:\temp\test\in\done\0-workingRoute-testNaming.xml</camel:description>
> <from
>
> uri="file:c:/temp/test/in?moveFailed=.failed/$simple{file:onlyname}&move=done/${bean:inboundCounter.getAndIncrement}-workingRoute-$simple{file:onlyname}"
> />
> <log message="workingRoute" />
> <to id="_toW" uri="mock://complete" />
> </route>
> <route id="errorRoute0">
> <camel:description>Using {{common.fname.pattern}}
> causes inboundCounter bean reference to fail. This route produces:
> C:\temp\test\in0\done\inboundCounter.getAndIncrement-errorRoute0-testNaming.xml
> </camel:description>
> <from
>
> uri="file:c:/temp/test/in0?move=done/${bean:inboundCounter.getAndIncrement}-errorRoute0-{{common.fname.pattern}}"
> />
> <log message="errorRoute0" />
> <to id="_to0" uri="mock://complete" />
> </route>
>
> <route id="errorRoute1">
> <camel:description>Using {{in.path1}} and
> {{archive.path}} causes inboundCounter bean reference to fail. This route
> produces:
> C:\temp\test\archive\inboundCounter.getAndIncrement-errorRoute1-testNaming.xml
> </camel:description>
> <from
>
> uri="file:{{in.path1}}?move={{archive.path}}/${bean:inboundCounter.getAndIncrement}-errorRoute1-$simple{file:onlyname}"
> />
> <log message="errorRoute1" />
> <to id="_to1" uri="mock://complete" />
> </route>
> <route id="errorRoute2">
> <camel:description>This route produces:
> C:\temp\test\in2\done\inboundCounter.getAndIncrement-errorRoute2-testNaming.xml</camel:description>
> <from
>
> uri="file:{{in.path2}}?move=done/${bean:inboundCounter.getAndIncrement}-errorRoute2-{{common.fname.pattern}}"
> />
> <log message="errorRoute2" />
> <to id="_to2" uri="mock://complete" />
> </route>
> <route id="errorRoute3">
> <camel:description>This route produces:
> C:\temp\test\archive\inboundCounter.getAndIncrement-errorRoute3-testNaming.xml
> </camel:description>
> <from
>
> uri="file:{{in.path3}}?move={{archive.path}}/${bean:inboundCounter.getAndIncrement}-errorRoute3-{{common.fname.pattern}}"
> />
> <log message="errorRoute3" />
> <to id="_to3" uri="mock://complete" />
> </route>
> </camelContext>
> </beans>
> {noformat}
> ------------
> Note that NO errors are thrown in console
> -------------
> [pache.camel.spring.Main.main()] SpringCamelContext INFO Total 5
> routes, of which 5 are started.
> [pache.camel.spring.Main.main()] SpringCamelContext INFO Apache
> Camel 2.18.1 (CamelContext: testFileNamingContext) started in 2.402 seconds
> [d #3 - file://c:/temp/test/in0] errorRoute0 INFO
> errorRoute0
> [d #4 - file://c:/temp/test/in1] errorRoute1 INFO
> errorRoute1
> [d #5 - file://c:/temp/test/in2] errorRoute2 INFO
> errorRoute2
> [d #6 - file://c:/temp/test/in3] errorRoute3 INFO
> errorRoute3
> [d #6 - file://c:/temp/test/in3] errorRoute3 INFO
> errorRoute3
> =====================
> C:\temp\test>tree
> Folder PATH listing for volume RAW7121218
> Volume serial number is 0C09-AE01
> C:.
> ├───archive
> ├───in
> │ └───done
> ├───in0
> │ └───done
> ├───in1
> ├───in2
> │ └───done
> └───in3
> C:\temp\test>ls -1R
> .:
> archive
> in
> in0
> in1
> in2
> in3
> ./archive:
> inboundCounter.getAndIncrement-errorRoute1-testNaming.xml
> inboundCounter.getAndIncrement-errorRoute3-testNaming.xml
> ./in:
> done
> ./in/done:
> 0-workingRoute-testNaming.xml
> ./in0:
> done
> ./in0/done:
> inboundCounter.getAndIncrement-errorRoute0-testNaming.xml
> ./in1:
> ./in2:
> done
> ./in2/done:
> inboundCounter.getAndIncrement-errorRoute2-testNaming.xml
> ./in3:
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)