fixed test to run in different environments

This commit is contained in:
Mark Fisher
2011-09-28 07:40:44 -04:00
parent 40ce263281
commit 8a8d8343a2
2 changed files with 10 additions and 6 deletions

View File

@@ -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"/>

View File

@@ -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());
}