checkstyle WhiteAround
WhiteAroundCheck script
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -103,14 +103,14 @@ abstract class HttpAdapterParsingUtils {
|
||||
|
||||
}
|
||||
|
||||
static void setHttpMethodOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){
|
||||
static void setHttpMethodOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
String httpMethod = element.getAttribute("http-method");
|
||||
String httpMethodExpression = element.getAttribute("http-method-expression");
|
||||
|
||||
boolean hasHttpMethod = StringUtils.hasText(httpMethod);
|
||||
boolean hasHttpMethodExpression = StringUtils.hasText(httpMethodExpression);
|
||||
|
||||
if (hasHttpMethod && hasHttpMethodExpression){
|
||||
if (hasHttpMethod && hasHttpMethodExpression) {
|
||||
parserContext.getReaderContext().error("The 'http-method' and 'http-method-expression' are mutually exclusive. " +
|
||||
"You can only have one or the other", element);
|
||||
}
|
||||
@@ -120,23 +120,23 @@ abstract class HttpAdapterParsingUtils {
|
||||
expressionDef = new RootBeanDefinition(LiteralExpression.class);
|
||||
expressionDef.getConstructorArgumentValues().addGenericArgumentValue(httpMethod);
|
||||
}
|
||||
else if (hasHttpMethodExpression){
|
||||
else if (hasHttpMethodExpression) {
|
||||
expressionDef = new RootBeanDefinition(ExpressionFactoryBean.class);
|
||||
expressionDef.getConstructorArgumentValues().addGenericArgumentValue(httpMethodExpression);
|
||||
}
|
||||
if (expressionDef != null){
|
||||
if (expressionDef != null) {
|
||||
builder.addPropertyValue("httpMethodExpression", expressionDef);
|
||||
}
|
||||
}
|
||||
|
||||
static void setExpectedResponseOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){
|
||||
static void setExpectedResponseOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
String expectedResponseType = element.getAttribute("expected-response-type");
|
||||
String expectedResponseTypeExpression = element.getAttribute("expected-response-type-expression");
|
||||
|
||||
boolean hasExpectedResponseType = StringUtils.hasText(expectedResponseType);
|
||||
boolean hasExpectedResponseTypeExpression = StringUtils.hasText(expectedResponseTypeExpression);
|
||||
|
||||
if (hasExpectedResponseType && hasExpectedResponseTypeExpression){
|
||||
if (hasExpectedResponseType && hasExpectedResponseTypeExpression) {
|
||||
parserContext.getReaderContext().error("The 'expected-response-type' and 'expected-response-type-expression' are mutually exclusive. " +
|
||||
"You can only have one or the other", element);
|
||||
}
|
||||
@@ -146,11 +146,11 @@ abstract class HttpAdapterParsingUtils {
|
||||
expressionDef = new RootBeanDefinition(LiteralExpression.class);
|
||||
expressionDef.getConstructorArgumentValues().addGenericArgumentValue(expectedResponseType);
|
||||
}
|
||||
else if (hasExpectedResponseTypeExpression){
|
||||
else if (hasExpectedResponseTypeExpression) {
|
||||
expressionDef = new RootBeanDefinition(ExpressionFactoryBean.class);
|
||||
expressionDef.getConstructorArgumentValues().addGenericArgumentValue(expectedResponseTypeExpression);
|
||||
}
|
||||
if (expressionDef != null){
|
||||
if (expressionDef != null) {
|
||||
builder.addPropertyValue("expectedResponseTypeExpression", expressionDef);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -61,7 +61,7 @@ public class SerializingHttpMessageConverter extends AbstractHttpMessageConverte
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Serializable readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException {
|
||||
try {
|
||||
return (Serializable) new ObjectInputStream(inputMessage.getBody()).readObject();//NOSONAR
|
||||
return (Serializable) new ObjectInputStream(inputMessage.getBody()).readObject(); //NOSONAR
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -64,13 +64,13 @@ public class UploadedMultipartFile implements MultipartFile {
|
||||
this.originalFilename = originalFilename;
|
||||
}
|
||||
|
||||
public UploadedMultipartFile(byte[] bytes, String contentType, String formParameterName,//NOSONAR - direct storage
|
||||
public UploadedMultipartFile(byte[] bytes, String contentType, String formParameterName, //NOSONAR - direct storage
|
||||
String originalFilename) {
|
||||
Assert.notNull(bytes, "bytes must not be null");
|
||||
Assert.hasText(contentType, "contentType is required");
|
||||
Assert.hasText(formParameterName, "formParameterName is required");
|
||||
Assert.hasText(originalFilename, "originalFilename is required");
|
||||
this.bytes = bytes;//NOSONAR - direct storage
|
||||
this.bytes = bytes; //NOSONAR - direct storage
|
||||
this.size = bytes.length;
|
||||
this.file = null;
|
||||
this.contentType = contentType;
|
||||
@@ -87,7 +87,7 @@ public class UploadedMultipartFile implements MultipartFile {
|
||||
@Override
|
||||
public byte[] getBytes() throws IOException {
|
||||
if (this.bytes != null) {
|
||||
return this.bytes;//NOSONAR - direct access
|
||||
return this.bytes; //NOSONAR - direct access
|
||||
}
|
||||
return FileCopyUtils.copyToByteArray(this.file);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -358,8 +358,8 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
try {
|
||||
HttpMethod httpMethod = this.determineHttpMethod(requestMessage);
|
||||
|
||||
if (!this.shouldIncludeRequestBody(httpMethod) && this.extractPayloadExplicitlySet){
|
||||
if (logger.isWarnEnabled()){
|
||||
if (!this.shouldIncludeRequestBody(httpMethod) && this.extractPayloadExplicitlySet) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("The 'extractPayload' attribute has no relevance for the current request since the HTTP Method is '" +
|
||||
httpMethod + "', and no request body will be sent for that method.");
|
||||
}
|
||||
@@ -458,7 +458,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
if (MediaType.APPLICATION_FORM_URLENCODED.equals(httpHeaders.getContentType()) ||
|
||||
MediaType.MULTIPART_FORM_DATA.equals(httpHeaders.getContentType())) {
|
||||
if (!(payload instanceof MultiValueMap)) {
|
||||
payload = this.convertToMultiValueMap((Map<?,?>) payload);
|
||||
payload = this.convertToMultiValueMap((Map<?, ?>) payload);
|
||||
}
|
||||
}
|
||||
return new HttpEntity<Object>(payload, httpHeaders);
|
||||
@@ -492,7 +492,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
// We need to check separately for MULTIPART as well as URLENCODED simply because
|
||||
// MultiValueMap<Object, Object> is actually valid content for serialization
|
||||
if (this.isFormData((Map<Object, ?>) content)) {
|
||||
if (this.isMultipart((Map<String, ?>)content)) {
|
||||
if (this.isMultipart((Map<String, ?>) content)) {
|
||||
contentType = MediaType.MULTIPART_FORM_DATA;
|
||||
}
|
||||
else {
|
||||
@@ -589,9 +589,9 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
}
|
||||
}
|
||||
|
||||
private Object determineExpectedResponseType(Message<?> requestMessage) throws Exception{
|
||||
private Object determineExpectedResponseType(Message<?> requestMessage) throws Exception {
|
||||
Object expectedResponseType = null;
|
||||
if (this.expectedResponseTypeExpression != null){
|
||||
if (this.expectedResponseTypeExpression != null) {
|
||||
expectedResponseType = this.expectedResponseTypeExpression.getValue(this.evaluationContext, requestMessage);
|
||||
}
|
||||
if (expectedResponseType != null) {
|
||||
@@ -600,7 +600,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
|| expectedResponseType instanceof ParameterizedTypeReference,
|
||||
"'expectedResponseType' can be an instance of 'Class<?>', 'String' or 'ParameterizedTypeReference<?>'; "
|
||||
+ "evaluation resulted in a" + expectedResponseType.getClass() + ".");
|
||||
if (expectedResponseType instanceof String && StringUtils.hasText((String) expectedResponseType)){
|
||||
if (expectedResponseType instanceof String && StringUtils.hasText((String) expectedResponseType)) {
|
||||
expectedResponseType = ClassUtils.forName((String) expectedResponseType,
|
||||
getApplicationContext().getClassLoader());
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
* {@link DefaultHttpHeaderMapper#setUserDefinedHeaderPrefix(String)}. The default is 'X-'.
|
||||
* @param outboundHeaderNames The outbound header names.
|
||||
*/
|
||||
public void setOutboundHeaderNames(String[] outboundHeaderNames) {//NOSONAR - false positive
|
||||
public void setOutboundHeaderNames(String[] outboundHeaderNames) { //NOSONAR - false positive
|
||||
if (HTTP_REQUEST_HEADER_NAMES == outboundHeaderNames) {
|
||||
this.isDefaultOutboundMapper = true;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
* {@link DefaultHttpHeaderMapper#setUserDefinedHeaderPrefix(String)}. The default is 'X-'.
|
||||
* @param inboundHeaderNames The inbound header names.
|
||||
*/
|
||||
public void setInboundHeaderNames(String[] inboundHeaderNames) {//NOSONAR - false positive
|
||||
public void setInboundHeaderNames(String[] inboundHeaderNames) { //NOSONAR - false positive
|
||||
this.inboundHeaderNames = inboundHeaderNames != null ?
|
||||
Arrays.copyOf(inboundHeaderNames, inboundHeaderNames.length) : new String[0];
|
||||
this.inboundHeaderNamesLower = new String[this.inboundHeaderNames.length];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2016 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.
|
||||
@@ -193,7 +193,7 @@ public class HttpProxyScenarioTests {
|
||||
|
||||
HttpEntity<?> entity = (HttpEntity<?>) invocation.getArguments()[2];
|
||||
assertThat(entity.getBody(), instanceOf(byte[].class));
|
||||
assertEquals("foo", new String((byte[])entity.getBody()));
|
||||
assertEquals("foo", new String((byte[]) entity.getBody()));
|
||||
|
||||
MultiValueMap<String, String> responseHeaders = new LinkedMultiValueMap<String, String>(httpHeaders);
|
||||
responseHeaders.set("Connection", "close");
|
||||
|
||||
@@ -129,11 +129,11 @@ public class HttpInboundGatewayParserTests {
|
||||
assertEquals(4567L, TestUtils.getPropertyValue(messagingTemplate, "receiveTimeout"));
|
||||
|
||||
boolean registerDefaultConverters =
|
||||
TestUtils.getPropertyValue(this.gateway,"mergeWithDefaultConverters", Boolean.class);
|
||||
TestUtils.getPropertyValue(this.gateway, "mergeWithDefaultConverters", Boolean.class);
|
||||
assertFalse("By default the register-default-converters flag should be false", registerDefaultConverters);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<HttpMessageConverter<?>> messageConverters =
|
||||
TestUtils.getPropertyValue(this.gateway,"messageConverters", List.class);
|
||||
TestUtils.getPropertyValue(this.gateway, "messageConverters", List.class);
|
||||
|
||||
assertTrue("The default converters should have been registered, given there are no custom converters",
|
||||
messageConverters.size() > 0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -170,7 +170,7 @@ public class HttpOutboundChannelAdapterParserTests {
|
||||
assertEquals(customRestTemplate, restTemplate);
|
||||
}
|
||||
|
||||
@Test(expected=BeanDefinitionParsingException.class)
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void failWithRestTemplateAndRestAttributes() {
|
||||
new ClassPathXmlApplicationContext("HttpOutboundChannelAdapterParserTests-fail-context.xml", this.getClass());
|
||||
}
|
||||
@@ -263,7 +263,7 @@ public class HttpOutboundChannelAdapterParserTests {
|
||||
assertThat(this.withPoller1, Matchers.instanceOf(PollingConsumer.class));
|
||||
}
|
||||
|
||||
@Test(expected=BeanDefinitionParsingException.class)
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void failWithUrlAndExpression() {
|
||||
new ClassPathXmlApplicationContext("HttpOutboundChannelAdapterParserTests-url-fail-context.xml", this.getClass());
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class HttpRequestHandlingControllerTests extends AbstractHttpInboundTests
|
||||
assertEquals(1, errors.getErrorCount());
|
||||
ObjectError error = errors.getAllErrors().get(0);
|
||||
assertEquals(3, error.getArguments().length);
|
||||
assertTrue("Wrong message: "+error, ((String)error.getArguments()[1]).startsWith("failed to send Message"));
|
||||
assertTrue("Wrong message: " + error, ((String) error.getArguments()[1]).startsWith("failed to send Message"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -130,7 +130,7 @@ public class HttpRequestHandlingMessagingGatewayWithPathMappingTests extends Abs
|
||||
|
||||
Object result = gateway.doHandleRequest(request, response);
|
||||
assertTrue(result instanceof Message);
|
||||
assertEquals("bill", ((Message<?>)result).getPayload());
|
||||
assertEquals("bill", ((Message<?>) result).getPayload());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -176,7 +176,7 @@ public class HttpRequestHandlingMessagingGatewayWithPathMappingTests extends Abs
|
||||
|
||||
Object result = gateway.doHandleRequest(request, response);
|
||||
assertTrue(result instanceof Message);
|
||||
assertEquals("bill", ((Map<String, Object>) ((Message<?>)result).getPayload()).get("f"));
|
||||
assertEquals("bill", ((Map<String, Object>) ((Message<?>) result).getPayload()).get("f"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -79,7 +79,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
public class HttpRequestExecutingMessageHandlerTests {
|
||||
|
||||
public static ParameterizedTypeReference<List<String>> testParameterizedTypeReference() {
|
||||
return new ParameterizedTypeReference<List<String>>() {};
|
||||
return new ParameterizedTypeReference<List<String>>() { };
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -239,7 +239,7 @@ public class HttpRequestExecutingMessageHandlerTests {
|
||||
setBeanFactory(handler);
|
||||
handler.afterPropertiesSet();
|
||||
Map<String, Object> form = new LinkedHashMap<String, Object>();
|
||||
form.put("a", new int[]{1,2,3});
|
||||
form.put("a", new int[]{1, 2, 3});
|
||||
form.put("b", "4");
|
||||
form.put("c", new String[] { "5" });
|
||||
form.put("d", "6");
|
||||
@@ -743,7 +743,7 @@ public class HttpRequestExecutingMessageHandlerTests {
|
||||
try {
|
||||
handler.handleRequestMessage(message);
|
||||
}
|
||||
catch (Exception e) {}
|
||||
catch (Exception e) { }
|
||||
assertEquals(theURL, restTemplate.actualUrl.get());
|
||||
}
|
||||
|
||||
@@ -760,7 +760,7 @@ public class HttpRequestExecutingMessageHandlerTests {
|
||||
try {
|
||||
handler.handleRequestMessage(message);
|
||||
}
|
||||
catch (Exception e) {}
|
||||
catch (Exception e) { }
|
||||
assertEquals("http://my.RabbitMQ.com/api/queues/%2f/si.test.queue?foo#bar", restTemplate.actualUrl.get());
|
||||
}
|
||||
|
||||
@@ -866,12 +866,12 @@ public class HttpRequestExecutingMessageHandlerTests {
|
||||
|
||||
private final String name;
|
||||
|
||||
public City(String name){
|
||||
public City(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -55,8 +55,8 @@ import org.springframework.util.CollectionUtils;
|
||||
public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
|
||||
// Allow tests
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void validateAllowWithWrongMethodName(){
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void validateAllowWithWrongMethodName() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Allow", "bar");
|
||||
@@ -66,7 +66,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateAllowAsString(){
|
||||
public void validateAllowAsString() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Allow", "GET");
|
||||
@@ -78,7 +78,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateAllowAsStringCaseInsensitive(){
|
||||
public void validateAllowAsStringCaseInsensitive() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("allow", "GET");
|
||||
@@ -90,7 +90,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateAllowAsHttpMethod(){
|
||||
public void validateAllowAsHttpMethod() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Allow", HttpMethod.GET);
|
||||
@@ -102,7 +102,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateAllowAsDelimitedString(){
|
||||
public void validateAllowAsDelimitedString() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Allow", "GET, POST");
|
||||
@@ -115,7 +115,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateAllowAsStringArray(){
|
||||
public void validateAllowAsStringArray() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Allow", new String[]{"GET", "POST"});
|
||||
@@ -128,7 +128,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateAllowAsHttpMethodArray(){
|
||||
public void validateAllowAsHttpMethodArray() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Allow", new HttpMethod[]{HttpMethod.GET, HttpMethod.POST});
|
||||
@@ -141,7 +141,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateAllowAsCollectionOfString(){
|
||||
public void validateAllowAsCollectionOfString() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Allow", CollectionUtils.arrayToList(new String[]{"GET", "POST"}));
|
||||
@@ -154,7 +154,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateAllowAsCollectionOfHttpMethods(){
|
||||
public void validateAllowAsCollectionOfHttpMethods() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Allow", CollectionUtils.arrayToList(new HttpMethod[]{HttpMethod.GET, HttpMethod.POST}));
|
||||
@@ -174,7 +174,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
// ETag tests
|
||||
|
||||
@Test
|
||||
public void validateETag(){
|
||||
public void validateETag() {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("ETag", "\"1234\"");
|
||||
@@ -187,7 +187,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
// Expires tests
|
||||
|
||||
@Test
|
||||
public void validateExpiresAsNumber() throws ParseException{
|
||||
public void validateExpiresAsNumber() throws ParseException {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Expires", 12345678);
|
||||
@@ -200,7 +200,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateExpiresAsString() throws ParseException{
|
||||
public void validateExpiresAsString() throws ParseException {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Expires", "12345678");
|
||||
@@ -212,7 +212,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
assertEquals(simpleDateFormat.parse("Thu, 01 Jan 1970 03:25:45 GMT").getTime(), headers.getExpires());
|
||||
}
|
||||
@Test
|
||||
public void validateExpiresAsDate() throws ParseException{
|
||||
public void validateExpiresAsDate() throws ParseException {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Expires", new Date(12345678));
|
||||
@@ -227,7 +227,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
// Last-Modified tests
|
||||
|
||||
@Test
|
||||
public void validateLastModifiedAsNumber() throws ParseException{
|
||||
public void validateLastModifiedAsNumber() throws ParseException {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Last-Modified", 12345678);
|
||||
@@ -240,7 +240,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateLastModifiedAsString() throws ParseException{
|
||||
public void validateLastModifiedAsString() throws ParseException {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Last-Modified", "12345678");
|
||||
@@ -252,7 +252,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
assertEquals(simpleDateFormat.parse("Thu, 01 Jan 1970 03:25:45 GMT").getTime(), headers.getLastModified());
|
||||
}
|
||||
@Test
|
||||
public void validateLastModifiedAsDate() throws ParseException{
|
||||
public void validateLastModifiedAsDate() throws ParseException {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Last-Modified", new Date(12345678));
|
||||
@@ -267,7 +267,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
// Location tests
|
||||
|
||||
@Test
|
||||
public void validateLocation() throws Exception{
|
||||
public void validateLocation() throws Exception {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Location", "http://foo.com");
|
||||
@@ -280,7 +280,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
// Transfer Encoding tests
|
||||
|
||||
@Test
|
||||
public void validateTransferEncodingNotMappedFromMessageHeaders() throws Exception{
|
||||
public void validateTransferEncodingNotMappedFromMessageHeaders() throws Exception {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
messageHeaders.put("Transfer-Encoding", "chunked");
|
||||
@@ -292,7 +292,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateTransferEncodingMappedFromHttpHeaders() throws Exception{
|
||||
public void validateTransferEncodingMappedFromHttpHeaders() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setInboundHeaderNames(new String[] {"Transfer-Encoding"});
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -305,7 +305,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateTransferEncodingNotMappedFromHttpHeadersByDefault() throws Exception{
|
||||
public void validateTransferEncodingNotMappedFromHttpHeadersByDefault() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -320,7 +320,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
// Pragma tested as part of DefaultHttpHeaderMapperFromMessageOutboundTests
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamesMappedToHttpHeaders() throws Exception{
|
||||
public void validateCustomHeaderNamesMappedToHttpHeaders() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setOutboundHeaderNames(new String[] {"foo", "bar"});
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
@@ -336,7 +336,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamePatternsMappedToHttpHeaders() throws Exception{
|
||||
public void validateCustomHeaderNamePatternsMappedToHttpHeaders() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setOutboundHeaderNames(new String[] {"x*", "*z", "a*f"});
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
@@ -363,7 +363,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeaders() throws Exception{
|
||||
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeaders() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setOutboundHeaderNames(new String[] {"foo*", "HTTP_RESPONSE_HEADERS"});
|
||||
Map<String, Object> messageHeaders = new HashMap<String, Object>();
|
||||
@@ -380,7 +380,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefix() throws Exception{
|
||||
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefix() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setUserDefinedHeaderPrefix("Z-");
|
||||
mapper.setOutboundHeaderNames(new String[] {"foo*", "HTTP_RESPONSE_HEADERS"});
|
||||
@@ -398,7 +398,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixEmptyString() throws Exception{
|
||||
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixEmptyString() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setUserDefinedHeaderPrefix("");
|
||||
mapper.setOutboundHeaderNames(new String[] {"foo*", "HTTP_RESPONSE_HEADERS"});
|
||||
@@ -416,7 +416,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixNull() throws Exception{
|
||||
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixNull() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setUserDefinedHeaderPrefix(null);
|
||||
mapper.setOutboundHeaderNames(new String[] {"foo*", "HTTP_RESPONSE_HEADERS"});
|
||||
@@ -434,7 +434,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamesMappedFromHttpHeaders() throws Exception{
|
||||
public void validateCustomHeaderNamesMappedFromHttpHeaders() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setInboundHeaderNames(new String[] {"foo", "bar"});
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -447,7 +447,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamePatternsMappedFromHttpHeaders() throws Exception{
|
||||
public void validateCustomHeaderNamePatternsMappedFromHttpHeaders() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setInboundHeaderNames(new String[] {"x*", "*z", "a*f"});
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -470,7 +470,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeaderNamePatternsAndStandardRequestHeadersMappedFromHttpHeaders() throws Exception{
|
||||
public void validateCustomHeaderNamePatternsAndStandardRequestHeadersMappedFromHttpHeaders() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setInboundHeaderNames(new String[] {"foo*", "HTTP_REQUEST_HEADERS"});
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -485,7 +485,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeadersWithNonStringValuesAndNoConverter() throws Exception{
|
||||
public void validateCustomHeadersWithNonStringValuesAndNoConverter() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setOutboundHeaderNames(new String[] {"customHeader*"});
|
||||
|
||||
@@ -501,7 +501,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void validateCustomHeadersWithNonStringValuesAndDefaultConverterOnly() throws Exception{
|
||||
public void validateCustomHeadersWithNonStringValuesAndDefaultConverterOnly() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setOutboundHeaderNames(new String[] {"customHeader*"});
|
||||
ConversionService cs = new DefaultConversionService();
|
||||
@@ -522,7 +522,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateCustomHeadersWithNonStringValuesAndDefaultConverterWithCustomConverter() throws Exception{
|
||||
public void validateCustomHeadersWithNonStringValuesAndDefaultConverterWithCustomConverter() throws Exception {
|
||||
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
|
||||
mapper.setOutboundHeaderNames(new String[] {"customHeader*"});
|
||||
GenericConversionService cs = new DefaultConversionService();
|
||||
@@ -557,7 +557,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInt2995IfModifiedSince() throws Exception{
|
||||
public void testInt2995IfModifiedSince() throws Exception {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Date ifModifiedSince = new Date();
|
||||
long ifModifiedSinceTime = ifModifiedSince.getTime();
|
||||
@@ -571,7 +571,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContentTypeHeader() throws Exception{
|
||||
public void testContentTypeHeader() throws Exception {
|
||||
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(MessageHeaders.CONTENT_TYPE, "text/plain");
|
||||
@@ -586,7 +586,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
|
||||
|
||||
}
|
||||
|
||||
public static class TestClassConverter implements Converter<TestClass, String>{
|
||||
public static class TestClassConverter implements Converter<TestClass, String> {
|
||||
|
||||
@Override
|
||||
public String convert(TestClass source) {
|
||||
|
||||
Reference in New Issue
Block a user