Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #421 from olegz/INT-2247

  • Loading branch information...
commit 582817de29e3e269008c0f31069f137b51feb1a3 2 parents 66a9df5 + f7ba317
@garyrussell authored
View
55 spring-integration-http/src/test/java/org/springframework/integration/http/MockHttpServletRequest.java
@@ -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");
- }
-
-}
View
51 spring-integration-http/src/test/java/org/springframework/integration/http/MockHttpServletResponse.java
@@ -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");
- }
-
-}
View
7 ...http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java
@@ -33,7 +33,6 @@
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.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 void withNameAndExpressionsAndPath() throws Exception {
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");
View
5 ...ration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java
@@ -33,7 +33,6 @@
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.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;
View
5 ...-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.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;
View
6 ...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.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.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;
View
5 ...rg/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 @@
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.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;
View
19 ...st/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.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.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 void validateCustomHeadersWithNonStringValuesAndNoConverter() throws Exce
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 void validateCustomHeadersWithNonStringValuesAndDefaultConverterOnly() th
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);
Please sign in to comment.
Something went wrong with that request. Please try again.