INT-2445 Fix NotWritablePropertyException

Add mapped-request/reply-headers to isEligibleAttribute(..)

Polishing
This commit is contained in:
Oleg Zhurakousky
2012-02-23 16:16:58 -05:00
committed by Gary Russell
parent 48ae843304
commit 1729af3959
5 changed files with 37 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,10 @@ public class WebServiceInboundGatewayParser extends AbstractInboundGatewayParser
@Override
protected boolean isEligibleAttribute(String attributeName) {
return !(attributeName.endsWith("marshaller")) && super.isEligibleAttribute(attributeName);
return !(attributeName.endsWith("marshaller")) &&
!(attributeName.equals("mapped-reply-headers")) &&
!(attributeName.equals("mapped-request-headers")) &&
super.isEligibleAttribute(attributeName);
}
@Override

View File

@@ -23,7 +23,9 @@
<ws:inbound-gateway id="extractsPayload" request-channel="requestsSimple" extract-payload="false"/>
<ws:inbound-gateway id="marshalling" request-channel="requestsMarshalling" error-channel="customErrorChannel"
marshaller="marshaller" unmarshaller="marshaller" />
marshaller="marshaller" unmarshaller="marshaller"
mapped-request-headers="testRequest"
mapped-reply-headers="testReply"/>
<si:channel id="requestsMarshalling">
<si:queue/>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.integration.ws.config;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -136,6 +137,14 @@ public class WebServiceInboundGatewayParserTests {
assertThat(
(MessageChannel) accessor.getPropertyValue("errorChannel"),
is(customErrorChannel));
@SuppressWarnings("unchecked")
List<String> requestHeaders = TestUtils.getPropertyValue(marshallingGateway, "headerMapper.requestHeaderNames", List.class);
@SuppressWarnings("unchecked")
List<String> replyHeaders = TestUtils.getPropertyValue(marshallingGateway, "headerMapper.replyHeaderNames", List.class);
assertEquals(1, requestHeaders.size());
assertEquals(1, replyHeaders.size());
assertTrue(requestHeaders.contains("testRequest"));
assertTrue(replyHeaders.contains("testReply"));
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
package org.springframework.integration.ws.config;
import java.util.List;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
@@ -38,11 +40,14 @@ import org.springframework.ws.client.core.WebServiceMessageCallback;
import org.springframework.ws.client.support.interceptor.ClientInterceptor;
import org.springframework.ws.transport.WebServiceMessageSender;
import static org.junit.Assert.assertEquals;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertNull;
/**
* @author Mark Fisher
* @author Oleg Zhurakousky
*/
public class WebServiceOutboundGatewayParserTests {
@@ -57,6 +62,15 @@ public class WebServiceOutboundGatewayParserTests {
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
Object expected = context.getBean("outputChannel");
assertEquals(expected, accessor.getPropertyValue("outputChannel"));
@SuppressWarnings("unchecked")
List<String> requestHeaders = TestUtils.getPropertyValue(endpoint, "handler.headerMapper.requestHeaderNames", List.class);
@SuppressWarnings("unchecked")
List<String> replyHeaders = TestUtils.getPropertyValue(endpoint, "handler.headerMapper.replyHeaderNames", List.class);
assertEquals(1, requestHeaders.size());
assertEquals(1, replyHeaders.size());
assertTrue(requestHeaders.contains("testRequest"));
assertTrue(replyHeaders.contains("testReply"));
}
@Test

View File

@@ -26,7 +26,9 @@
<ws:outbound-gateway id="gatewayWithReplyChannel"
request-channel="inputChannel"
uri="http://example.org"
reply-channel="outputChannel"/>
reply-channel="outputChannel"
mapped-request-headers="testRequest"
mapped-reply-headers="testReply"/>
<ws:outbound-gateway id="gatewayWithIgnoreEmptyResponsesFalse"
request-channel="inputChannel"