Given the following citrus-context.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:citrus="http://www.citrusframework.org/schema/config"
xmlns:citrus-http="http://www.citrusframework.org/schema/http/config"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.citrusframework.org/schema/config http://www.citrusframework.org/schema/config/citrus-config.xsd
http://www.citrusframework.org/schema/http/config http://www.citrusframework.org/schema/http/config/citrus-http-config.xsd">
<citrus:global-variables>
<citrus:file
path="classpath:endpoints.properties" />
</citrus:global-variables>
<citrus-http:client
id="service_endpoint"
request-url="${Service.Endpoint.URL}"
request-method="GET"
content-type="text/xml"
charset="UTF-8"
timeout="60000" />
</beans>
Instead of evaluating ${Service.Endpoint.URL}
to http://foo.io/service
I get the following error:
com.consol.citrus.exceptions.TestCaseFailedException: Illegal character in path at index 1: ${Service.Endpoint.URL}
...
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 1: ${Service.Endpoint.URL}
...
Caused by: java.net.URISyntaxException: Illegal character in path at index 1: ${Service.Endpoint.URL}
Is it this because of a configuration issue, or is the current set-up not possible?
Please add a Spring property placeholder configurer to your application context. The configurer is able to evaluate property expressions in Spring bean definitions. The Citrus global variables are not taken into account at design time when the Spring beans are parsed in the application context.
<context:property-placeholder location="classpath:endpoint.properties"/>
The property placeholder is using the special context:
Spring bean namespace. So you need to declare this namespace in your configuration file:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:citrus="http://www.citrusframework.org/schema/config"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
...">