diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/MockHttpServletRequest.java b/spring-integration-http/src/test/java/org/springframework/integration/http/MockHttpServletRequest.java deleted file mode 100644 index fea8b4ca44..0000000000 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/MockHttpServletRequest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2002-2011 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.http; - -import org.springframework.core.SpringVersion; - -/** - * Modified version of the MockHttpServletRequest that sets the "Content-Type" - * header so that it will be available from a ServletServerHttpRequest instance. - * - * @author Mark Fisher - * @since 2.0 - */ -public class MockHttpServletRequest extends org.springframework.mock.web.MockHttpServletRequest { - - public MockHttpServletRequest() { - super(); - } - - public MockHttpServletRequest(String method, String url) { - super(method, url); - } - - - @Override - public void setContentType(String contentType) { - String springVersion = SpringVersion.getVersion(); - if (springVersion != null && springVersion.startsWith("3.0")) { - this.addHeader("Content-Type", contentType); - } - else { - super.setContentType(contentType); - } - } - - @Override - public String getContentType() { - return this.getHeader("Content-Type"); - } - -} diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/MockHttpServletResponse.java b/spring-integration-http/src/test/java/org/springframework/integration/http/MockHttpServletResponse.java deleted file mode 100644 index d500d2a0ec..0000000000 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/MockHttpServletResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2002-2011 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.http; - -import org.springframework.core.SpringVersion; - -/** - * Modified version of the MockHttpServletResponse that sets the "Content-Type" - * header so that it will be available from a ServletServerHttpResponse instance. - * - * @author Mark Fisher - * @since 2.0 - */ -public class MockHttpServletResponse extends org.springframework.mock.web.MockHttpServletResponse { - - public MockHttpServletResponse() { - super(); - } - - - @Override - public void setContentType(String contentType) { - String springVersion = SpringVersion.getVersion(); - if (springVersion != null && springVersion.startsWith("3.0")) { - this.addHeader("Content-Type", contentType); - } - else { - super.setContentType(contentType); - } - } - - @Override - public String getContentType() { - return (String) this.getHeader("Content-Type"); - } - -} diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java index 2f38007eb3..f51468d1ee 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java @@ -33,7 +33,6 @@ import javax.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; - import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -44,13 +43,12 @@ import org.springframework.integration.Message; import org.springframework.integration.MessageChannel; import org.springframework.integration.core.PollableChannel; import org.springframework.integration.history.MessageHistory; -import org.springframework.integration.http.MockHttpServletRequest; import org.springframework.integration.http.inbound.HttpRequestHandlingController; import org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway; import org.springframework.integration.http.support.DefaultHttpHeaderMapper; import org.springframework.integration.test.util.TestUtils; +import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; -import org.springframework.test.annotation.ExpectedException; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.MultiValueMap; @@ -177,9 +175,8 @@ public class HttpInboundChannelAdapterParserTests { assertEquals("clinton", message.getHeaders().get("lname")); } - @Test + @Test(expected=SpelEvaluationException.class) // INT-1677 - @ExpectedException(SpelEvaluationException.class) public void withNameAndExpressionsNoPath() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); request.setMethod("POST"); diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java index 22b771b681..df411e3e32 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java @@ -33,7 +33,6 @@ import javax.servlet.http.HttpServletResponse; import org.junit.Test; import org.junit.runner.RunWith; - import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -44,12 +43,12 @@ import org.springframework.integration.MessageHeaders; import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.core.PollableChannel; import org.springframework.integration.core.SubscribableChannel; -import org.springframework.integration.http.MockHttpServletRequest; -import org.springframework.integration.http.MockHttpServletResponse; import org.springframework.integration.http.inbound.HttpRequestHandlingController; import org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway; import org.springframework.integration.http.support.DefaultHttpHeaderMapper; import org.springframework.integration.test.util.TestUtils; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java index bed51dede9..6846a62eef 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -26,8 +26,7 @@ import org.springframework.integration.Message; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; -import org.springframework.integration.http.MockHttpServletRequest; -import org.springframework.integration.http.inbound.HttpRequestHandlingController; +import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.validation.Errors; import org.springframework.validation.ObjectError; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayTests.java index 9bd5a87dda..9dc7b93824 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -26,7 +26,6 @@ import java.util.Arrays; import java.util.List; import org.junit.Test; - import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpOutputMessage; import org.springframework.http.MediaType; @@ -38,8 +37,7 @@ import org.springframework.integration.Message; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; -import org.springframework.integration.http.MockHttpServletRequest; -import org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway; +import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.SerializationUtils; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayWithPathMappingTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayWithPathMappingTests.java index dd9648cf51..be20673939 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayWithPathMappingTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayWithPathMappingTests.java @@ -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. @@ -19,6 +19,7 @@ package org.springframework.integration.http.inbound; import java.util.Map; import org.junit.Test; + import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.integration.Message; @@ -26,7 +27,7 @@ import org.springframework.integration.MessageChannel; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.core.MessageHandler; -import org.springframework.integration.http.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import static org.junit.Assert.assertEquals; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java index ed6a46d4e5..5e753ba1b7 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java @@ -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,11 @@ package org.springframework.integration.http.support; +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; +import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertNull; + import java.net.URI; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -29,7 +34,7 @@ import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.converter.Converter; -import org.springframework.core.convert.support.ConversionServiceFactory; +import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.core.convert.support.GenericConversionService; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -38,12 +43,6 @@ import org.springframework.integration.MessageHeaders; import org.springframework.integration.mapping.HeaderMapper; import org.springframework.util.CollectionUtils; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; - -import static org.junit.Assert.assertNull; - /** * @author Oleg Zhurakousky * @author Mark Fisher @@ -460,7 +459,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { public void validateCustomHeadersWithNonStringValuesAndDefaultConverterOnly() throws Exception{ DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setOutboundHeaderNames(new String[] {"customHeader*"}); - ConversionService cs = ConversionServiceFactory.createDefaultConversionService(); + ConversionService cs = new DefaultConversionService(); DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); beanFactory.registerSingleton("integrationConversionService", cs); mapper.setBeanFactory(beanFactory); @@ -481,7 +480,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests { public void validateCustomHeadersWithNonStringValuesAndDefaultConverterWithCustomConverter() throws Exception{ DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper(); mapper.setOutboundHeaderNames(new String[] {"customHeader*"}); - GenericConversionService cs = ConversionServiceFactory.createDefaultConversionService(); + GenericConversionService cs = new DefaultConversionService(); cs.addConverter(new TestClassConverter()); DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); beanFactory.registerSingleton("integrationConversionService", cs);