fixed test to run in different environments
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
http://www.springframework.org/schema/integration/ws
|
||||
http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd">
|
||||
|
||||
<ws:outbound-gateway id="gateway" request-channel="input" uri="http://localhost/test/{foo}/{bar}" interceptor="interceptor">
|
||||
<ws:uri-variable name="foo" expression="payload.substring(1,4)"/>
|
||||
<ws:uri-variable name="bar" expression="headers.bar"/>
|
||||
<ws:outbound-gateway id="gateway" request-channel="input" uri="http://springsource.org/{foo}-{bar}" interceptor="interceptor">
|
||||
<ws:uri-variable name="foo" expression="payload.substring(1,7)"/>
|
||||
<ws:uri-variable name="bar" expression="headers.x"/>
|
||||
</ws:outbound-gateway>
|
||||
|
||||
<bean id="interceptor" class="org.springframework.integration.ws.config.UriVariableTests$TestClientInterceptor"/>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.integration.ws.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -36,6 +37,7 @@ import org.springframework.ws.client.WebServiceClientException;
|
||||
import org.springframework.ws.client.WebServiceIOException;
|
||||
import org.springframework.ws.client.support.interceptor.ClientInterceptor;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
import org.springframework.ws.soap.SoapMessageCreationException;
|
||||
import org.springframework.ws.transport.context.TransportContext;
|
||||
import org.springframework.ws.transport.context.TransportContextHolder;
|
||||
import org.springframework.ws.transport.http.HttpUrlConnection;
|
||||
@@ -55,15 +57,17 @@ public class UriVariableTests {
|
||||
public void checkUriVariables() {
|
||||
MessageChannel input = context.getBean("input", MessageChannel.class);
|
||||
TestClientInterceptor interceptor = context.getBean("interceptor", TestClientInterceptor.class);
|
||||
Message<?> message = MessageBuilder.withPayload("<FOO/>").setHeader("bar", "BAR").build();
|
||||
Message<?> message = MessageBuilder.withPayload("<spring/>").setHeader("x", "integration").build();
|
||||
try {
|
||||
input.send(message);
|
||||
}
|
||||
catch (MessageHandlingException e) {
|
||||
// expected
|
||||
assertEquals(WebServiceIOException.class, e.getCause().getClass());
|
||||
Class<?> causeType = e.getCause().getClass();
|
||||
assertTrue(WebServiceIOException.class.equals(causeType) // offline
|
||||
|| SoapMessageCreationException.class.equals(causeType));
|
||||
}
|
||||
assertEquals("http://localhost/test/FOO/BAR", interceptor.getLastUri().toString());
|
||||
assertEquals("http://springsource.org/spring-integration", interceptor.getLastUri().toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user