Switchyard Property replacement in camel route to uri
mkoenig Apr 11, 2013 4:29 AMHello,
I‘ve just started using switchyard 0.8 because we are migration from jboss6 to jboss7 and therefore we also want to migrate from jboss esb to switchyard.
Now I have just a simple service which should write the message into a file. The filename should be passed as a property.
The problem is that I cannot get switchyard to replace the property within the to-uri route: <to uri="file:/c:/temp?fileName={{FILENAME}}" />
If I leave the to-uri route away and deploy the route only with the log-route the property is replaced as expected so this works: <log message="EXPJUPDATA: ${body} {{FILENAME}}" />
Am I doing something wrong or is it a bug in switchyard?
Thx in advance.
Marcel
Detail information:
Switchyard version = 0.8.0.Final
My service:
<?xml version="1.0" encoding="UTF-8"?>
<switchyard xmlns="urn:switchyard-config:switchyard:1.0"
xmlns:swyd="urn:switchyard-config:switchyard:1.0"
xmlns:bean="urn:switchyard-component-bean:config:1.0"
xmlns:camel="urn:switchyard-component-camel:config:1.0"
xmlns:file="urn:switchyard-component-camel-file:config:1.0"
xmlns:sca="docs.oasis-open.org/ns/opencsa/sca/200912">
<sca:composite name="test-esb" targetNamespace="urn:web4db-esb:core:0.1.0">
<sca:component name="EXPJUPDATA">
<camel:implementation.camel>
<route xmlns="camel.apache.org/schema/spring">
<from uri="switchyard://EXPJUPDATA" />
<log message="EXPJUPDATA: ${body} {{FILENAME}}" />
<to uri="file:/c:/temp?fileName={{FILENAME}}" />
</route>
</camel:implementation.camel>
<sca:service name="EXPJUPDATA">
<interface.esb inputType="java:java.lang.String" />
</sca:service>
<sca:property name="FILENAME" value="test.tmp.txt"/>
</sca:component>
</sca:composite>
</switchyard>
Test:
@RunWith(SwitchYardRunner.class)
@SwitchYardTestCaseConfig(config = "/switchyard/testExpJupDataResult.xml", mixins = { CDIMixIn.class, PropertyMixIn.class })
public class ExpJupDataServiceTest {
private org.switchyard.test.SwitchYardTestKit _testKit;
private PropertyMixIn propMixIn;
@BeforeDeploy
public void setTestProperties() {
// propMixIn.set("FILENAME", "test.tmp.txt");
// System.setProperty("FILENAME", "test.tmp.txt");
}
@Test
public void testTransformation() throws Exception {
_testKit.newInvoker("EXPJUPDATA").sendInOnly("Test");
}
}
Exception:
ava.lang.Exception: org.switchyard.exception.SwitchYardException
at
org.switchyard.test.SwitchYardRunner.createTest(SwitchYardRunner.java:69)
at
org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:258)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:255)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.switchyard.test.SwitchYardRunner.run(SwitchYardRunner.java:90)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.switchyard.exception.SwitchYardException
at
org.switchyard.component.camel.deploy.CamelActivator.handleImplementation(CamelActivator.java:102)
at
org.switchyard.component.camel.deploy.CamelActivator.activateService(CamelActivator.java:80)
at
org.switchyard.deploy.internal.Deployment.deployImplementations(Deployment.java:460)
at org.switchyard.deploy.internal.Deployment.start(Deployment.java:140)
at
org.switchyard.test.SwitchYardTestKit.deploy(SwitchYardTestKit.java:277)
at
org.switchyard.test.SwitchYardTestKit.start(SwitchYardTestKit.java:180)
at
org.switchyard.test.SwitchYardRunner.createTest(SwitchYardRunner.java:65)
... 19 more
Caused by: java.lang.IllegalArgumentException
at java.net.URI.create(Unknown Source)
at
org.switchyard.component.camel.deploy.CamelActivator.checkSwitchYardReferencedServiceExist(CamelActivator.java:114)
at
org.switchyard.component.camel.deploy.CamelActivator.handleImplementation(CamelActivator.java:94)
... 25 more
Caused by: java.net.URISyntaxException: Illegal character in query at
index 23: file:/c:/temp?fileName={{FILENAME}}
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
... 28 more