GH-3686: Apply SF editor config

Fixes https://github.com/spring-projects/spring-integration/issues/3686

* Add `src/idea` with respective editor config for IntelliJ IDEA.
Must be imported into an IDE
* Add `src/eclipse` with respective editor config for Eclipse/STS
* Reformat imports in source code according a new editor config
This commit is contained in:
abilan
2022-11-14 10:55:21 -05:00
parent bca9d27a65
commit 7864658d01
1385 changed files with 7627 additions and 6931 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 the original author or authors.
* Copyright 2016-2022 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.
@@ -69,6 +69,6 @@ public @interface EnableIntegrationGraphController {
* @return the URLs.
* @since 4.3.5
*/
String[] allowedOrigins() default { };
String[] allowedOrigins() default {};
}

View File

@@ -222,7 +222,7 @@ public class HttpInboundEndpointParser extends AbstractSingleBeanDefinitionParse
if (crossOriginElement != null) {
BeanDefinitionBuilder crossOriginBuilder =
BeanDefinitionBuilder.genericBeanDefinition(CrossOrigin.class);
String[] attributes = { "origin", "allowed-headers", "exposed-headers", "max-age", "method" };
String[] attributes = {"origin", "allowed-headers", "exposed-headers", "max-age", "method"};
for (String crossOriginAttribute : attributes) {
IntegrationNamespaceUtils.setValueIfAttributeDefined(crossOriginBuilder, crossOriginElement,
crossOriginAttribute);
@@ -247,7 +247,7 @@ public class HttpInboundEndpointParser extends AbstractSingleBeanDefinitionParse
Element requestMappingElement = DomUtils.getChildElementByTagName(element, "request-mapping");
if (requestMappingElement != null) {
for (String requestMappingAttribute : new String[]{ "params", "headers", "consumes", "produces" }) {
for (String requestMappingAttribute : new String[] {"params", "headers", "consumes", "produces"}) {
IntegrationNamespaceUtils.setValueIfAttributeDefined(requestMappingDefBuilder, requestMappingElement,
requestMappingAttribute);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 the original author or authors.
* Copyright 2015-2022 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.
@@ -34,13 +34,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
*/
public class CrossOrigin {
private String[] origin = { "*" };
private String[] origin = {"*"};
private String[] allowedHeaders = { "*" };
private String[] allowedHeaders = {"*"};
private String[] exposedHeaders = { };
private String[] exposedHeaders = {};
private RequestMethod[] method = { };
private RequestMethod[] method = {};
private Boolean allowCredentials = true;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -191,7 +191,7 @@ public class HttpRequestHandlingController extends HttpRequestHandlingEndpointSu
MapBindingResult errors = new MapBindingResult(new HashMap<String, Object>(), "dummy");
PrintWriter stackTrace = new PrintWriter(new StringWriter());
e.printStackTrace(stackTrace);
errors.reject(this.errorCode, new Object[] { e, e.getMessage(), stackTrace.toString() },
errors.reject(this.errorCode, new Object[] {e, e.getMessage(), stackTrace.toString()},
"A Spring Integration handler raised an exception while handling an HTTP request. " +
"The exception is of type " + e.getClass() + " and it has a message: (" +
e.getMessage() + ")");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -500,7 +500,7 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound
return new RequestEntity<>(requestBody, request.getHeaders(), request.getMethod(), request.getURI());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({"unchecked", "rawtypes"})
protected Object extractRequestBody(ServletServerHttpRequest request) throws IOException {
MediaType contentType = request.getHeaders().getContentType();
if (contentType == null) {

View File

@@ -40,15 +40,15 @@ public class RequestMapping {
private String[] pathPatterns;
private HttpMethod[] methods = { HttpMethod.GET, HttpMethod.POST };
private HttpMethod[] methods = {HttpMethod.GET, HttpMethod.POST};
private String[] params = { };
private String[] params = {};
private String[] headers = { };
private String[] headers = {};
private String[] consumes = { };
private String[] consumes = {};
private String[] produces = { };
private String[] produces = {};
public String getName() {
return this.name;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2022 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.
@@ -35,7 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
public class IntegrationGraphController {
static final String REQUEST_MAPPING_PATH_VARIABLE =
"${" + HttpContextUtils.GRAPH_CONTROLLER_PATH_PROPERTY + ":" +
"${" + HttpContextUtils.GRAPH_CONTROLLER_PATH_PROPERTY + ":" +
HttpContextUtils.GRAPH_CONTROLLER_DEFAULT_PATH + "}";
private final IntegrationGraphServer integrationGraphServer;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -184,10 +184,10 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
private static final Set<String> HTTP_RESPONSE_HEADER_NAMES_LOWER = new HashSet<>();
private static final String[] HTTP_REQUEST_HEADER_NAMES_OUTBOUND_EXCLUSIONS = { };
private static final String[] HTTP_REQUEST_HEADER_NAMES_OUTBOUND_EXCLUSIONS = {};
private static final String[] HTTP_RESPONSE_HEADER_NAMES_INBOUND_EXCLUSIONS =
{ HttpHeaders.CONTENT_LENGTH, HttpHeaders.TRANSFER_ENCODING };
{HttpHeaders.CONTENT_LENGTH, HttpHeaders.TRANSFER_ENCODING};
public static final String HTTP_REQUEST_HEADER_NAME_PATTERN = "HTTP_REQUEST_HEADERS";

View File

@@ -16,9 +16,6 @@
package org.springframework.integration.http;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.isNull;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
@@ -57,6 +54,9 @@ import org.springframework.web.servlet.HandlerAdapter;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.isNull;
/**
* @author Artem Bilan
* @author Gary Russell

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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,9 +16,6 @@
package org.springframework.integration.http.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import java.io.ByteArrayInputStream;
import java.util.Properties;
@@ -32,6 +29,9 @@ import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.InputStreamResource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
/**
* @author Gunnar Hillert
@@ -43,7 +43,7 @@ public class ChainElementsTests {
@Test
public void chainOutboundGateway() throws Exception {
try {
try {
bootStrap("http-outbound-gateway");
fail("Expected a BeanDefinitionParsingException to be thrown.");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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,8 +16,6 @@
package org.springframework.integration.http.config;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,6 +32,8 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.ErrorHandler;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Mark Fisher
* @author Artem Bilan

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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,11 +16,6 @@
package org.springframework.integration.http.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willReturn;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
@@ -29,7 +24,6 @@ import java.util.Map;
import java.util.Properties;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,6 +52,11 @@ import org.springframework.validation.Validator;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.servlet.HandlerMapping;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willReturn;
/**
* @author Mark Fisher

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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,9 +16,6 @@
package org.springframework.integration.http.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.integration.test.util.TestUtils.getPropertyValue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -26,7 +23,6 @@ import java.util.List;
import java.util.Map;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
@@ -52,6 +48,9 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.integration.test.util.TestUtils.getPropertyValue;
/**
* @author Mark Fisher
* @author Iwein Fuld

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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,9 +16,6 @@
package org.springframework.integration.http.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.nio.charset.StandardCharsets;
import java.util.Map;
@@ -51,6 +48,9 @@ import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.DefaultUriBuilderFactory;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Mark Fisher
* @author Gary Russell

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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,9 +16,6 @@
package org.springframework.integration.http.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.nio.charset.StandardCharsets;
import java.util.Map;
@@ -49,6 +46,9 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.util.ObjectUtils;
import org.springframework.web.client.ResponseErrorHandler;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Mark Fisher
* @author Gary Russell

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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,11 +16,6 @@
package org.springframework.integration.http.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -40,6 +35,11 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
/**
* @author Oleg Zhurakousky
* @author Artem Bilan

View File

@@ -16,13 +16,6 @@
package org.springframework.integration.http.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.header;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import java.util.Collections;
import org.junit.jupiter.api.BeforeEach;
@@ -45,6 +38,13 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.header;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
/**
* @author Oleg Zhurakousky
* @author Artem Bilan

View File

@@ -16,15 +16,6 @@
package org.springframework.integration.http.dsl;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic;
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -82,6 +73,15 @@ import org.springframework.web.multipart.support.StandardServletMultipartResolve
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.servlet.DispatcherServlet;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic;
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* @author Artem Bilan
* @author Shiliang Li

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 the original author or authors.
* Copyright 2015-2022 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,8 +16,6 @@
package org.springframework.integration.http.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -32,6 +30,8 @@ import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerExecutionChain;
import org.springframework.web.servlet.HandlerInterceptor;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Artem Bilan
*
@@ -84,11 +84,11 @@ public class CrossOriginTests {
HandlerExecutionChain chain = this.handlerMapping.getHandler(this.request);
CorsConfiguration config = getCorsConfiguration(chain, false);
assertThat(config).isNotNull();
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] { "GET" });
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] {"GET"});
assertThat(config.getAllowedOrigins()).isNull();
assertThat(config.getAllowedOriginPatterns().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedOriginPatterns().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getAllowCredentials()).isTrue();
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getExposedHeaders()).isEmpty();
assertThat(config.getMaxAge()).isEqualTo(1800L);
}
@@ -99,11 +99,11 @@ public class CrossOriginTests {
HandlerExecutionChain chain = this.handlerMapping.getHandler(this.request);
CorsConfiguration config = getCorsConfiguration(chain, false);
assertThat(config).isNotNull();
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] { "DELETE" });
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] {"DELETE"});
assertThat(config.getAllowedOrigins().toArray())
.isEqualTo(new String[] { "https://site1.com", "https://site2.com" });
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] { "header1", "header2" });
assertThat(config.getExposedHeaders().toArray()).isEqualTo(new String[] { "header3", "header4" });
.isEqualTo(new String[] {"https://site1.com", "https://site2.com"});
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] {"header1", "header2"});
assertThat(config.getExposedHeaders().toArray()).isEqualTo(new String[] {"header3", "header4"});
assertThat(config.getMaxAge()).isEqualTo(123L);
assertThat(config.getAllowCredentials()).isEqualTo(false);
}
@@ -116,11 +116,11 @@ public class CrossOriginTests {
HandlerExecutionChain chain = this.handlerMapping.getHandler(this.request);
CorsConfiguration config = getCorsConfiguration(chain, true);
assertThat(config).isNotNull();
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] { "GET" });
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] {"GET"});
assertThat(config.getAllowedOrigins()).isNull();
assertThat(config.getAllowedOriginPatterns().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedOriginPatterns().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getAllowCredentials()).isTrue();
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getExposedHeaders()).isEmpty();
assertThat(config.getMaxAge()).isEqualTo(1800L);
}
@@ -134,10 +134,10 @@ public class CrossOriginTests {
HandlerExecutionChain chain = this.handlerMapping.getHandler(this.request);
CorsConfiguration config = getCorsConfiguration(chain, true);
assertThat(config).isNotNull();
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getAllowedOrigins()).isNull();
assertThat(config.getAllowedOriginPatterns().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedOriginPatterns().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getAllowCredentials()).isTrue();
assertThat(config.getExposedHeaders()).isNull();
assertThat(config.getMaxAge()).isNull();
@@ -151,10 +151,10 @@ public class CrossOriginTests {
HandlerExecutionChain chain = this.handlerMapping.getHandler(this.request);
CorsConfiguration config = getCorsConfiguration(chain, true);
assertThat(config).isNotNull();
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getAllowedOrigins()).isNull();
assertThat(config.getAllowedOriginPatterns().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowedOriginPatterns().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] {"*"});
assertThat(config.getAllowCredentials()).isTrue();
assertThat(config.getExposedHeaders()).isNull();
assertThat(config.getMaxAge()).isNull();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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,9 +16,6 @@
package org.springframework.integration.http.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
@@ -26,7 +23,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import jakarta.servlet.http.Cookie;
import org.apache.commons.logging.LogFactory;
import org.junit.jupiter.api.Test;
@@ -47,6 +43,9 @@ import org.springframework.validation.ObjectError;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.View;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* @author Mark Fisher
* @author Gary Russell
@@ -426,5 +425,4 @@ public class HttpRequestHandlingControllerTests extends AbstractHttpInboundTests
assertThat(modelAndView.getModelMap()).containsEntry("cookiesReply", "first");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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,11 +16,6 @@
package org.springframework.integration.http.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Serializable;
@@ -29,8 +24,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletRequest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanFactory;
@@ -62,7 +57,10 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.SerializationUtils;
import org.springframework.web.multipart.MultipartResolver;
import com.fasterxml.jackson.databind.ObjectMapper;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
/**
* @author Mark Fisher
@@ -297,7 +295,7 @@ public class HttpRequestHandlingMessagingGatewayTests extends AbstractHttpInboun
TestBean testBean = new TestBean();
testBean.setName("T. Bean");
testBean.setAge(42);
request.setContent(new ObjectMapper().writeValueAsBytes(new TestBean[] { testBean }));
request.setContent(new ObjectMapper().writeValueAsBytes(new TestBean[] {testBean}));
MockHttpServletResponse response = new MockHttpServletResponse();
gateway.handleRequest(request, response);
byte[] bytes = response.getContentAsByteArray();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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,9 +16,6 @@
package org.springframework.integration.http.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import java.util.Map;
import org.junit.jupiter.api.Test;
@@ -37,6 +34,9 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.servlet.HandlerMapping;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* @author Oleg Zhurakousky
* @author Gary Russell

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2021 the original author or authors.
* Copyright 2013-2022 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,15 +16,11 @@
package org.springframework.integration.http.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import jakarta.servlet.http.Cookie;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +42,9 @@ import org.springframework.web.servlet.HandlerAdapter;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Artem Bilan
* @author Gary Russell

View File

@@ -16,18 +16,12 @@
package org.springframework.integration.http.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Collections;
import java.util.Enumeration;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanFactory;
@@ -37,6 +31,11 @@ import org.springframework.messaging.Message;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* @author Gary Russell
* @author Artem Bilan

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2022 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,13 +16,6 @@
package org.springframework.integration.http.management;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.handler;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -54,6 +47,13 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.handler;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* @author Artem Bilan
* @author Gary Russell
@@ -78,8 +78,8 @@ public class IntegrationGraphControllerTests {
@Test
public void testIntegrationGraphGet() throws Exception {
this.mockMvc.perform(get("/testIntegration")
.header(HttpHeaders.ORIGIN, "https://foo.bar.com")
.accept(MediaType.APPLICATION_JSON))
.header(HttpHeaders.ORIGIN, "https://foo.bar.com")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(handler().handlerType(IntegrationGraphController.class))

View File

@@ -16,8 +16,6 @@
package org.springframework.integration.http.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -43,6 +41,8 @@ import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Gary Russell
* @author Gunnar Hillert

View File

@@ -16,12 +16,6 @@
package org.springframework.integration.http.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.Serializable;
@@ -37,6 +31,8 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.xml.transform.Source;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Sinks;
import reactor.test.StepVerifier;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanFactory;
@@ -73,8 +69,11 @@ import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.DefaultUriBuilderFactory;
import reactor.core.publisher.Sinks;
import reactor.test.StepVerifier;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* @author Mark Fisher
@@ -204,9 +203,9 @@ public class HttpRequestExecutingMessageHandlerTests {
setBeanFactory(handler);
handler.afterPropertiesSet();
Map<String, Object> form = new LinkedHashMap<>();
form.put("a", new String[]{ "1", "2", "3" });
form.put("a", new String[] {"1", "2", "3"});
form.put("b", "4");
form.put("c", new String[]{ "5" });
form.put("c", new String[] {"5"});
form.put("d", "6");
Message<?> message = MessageBuilder.withPayload(form).build();
@@ -249,9 +248,9 @@ public class HttpRequestExecutingMessageHandlerTests {
setBeanFactory(handler);
handler.afterPropertiesSet();
Map<String, Object> form = new LinkedHashMap<>();
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("c", new String[] {"5"});
form.put("d", "6");
Message<?> message = MessageBuilder.withPayload(form).build();
@@ -297,7 +296,7 @@ public class HttpRequestExecutingMessageHandlerTests {
setBeanFactory(handler);
handler.afterPropertiesSet();
Map<String, Object> form = new LinkedHashMap<>();
form.put("a", new Object[]{ null, 4, null });
form.put("a", new Object[] {null, 4, null});
form.put("b", "4");
Message<?> message = MessageBuilder.withPayload(form).build();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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,10 +16,6 @@
package org.springframework.integration.http.outbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.Mockito.mock;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
@@ -40,6 +36,10 @@ import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.GenericMessage;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.Mockito.mock;
/**
* @author Dave Syer
* @author Mark Fisher

View File

@@ -16,8 +16,6 @@
package org.springframework.integration.http.support;
import static org.assertj.core.api.Assertions.assertThat;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.ParseException;
@@ -44,6 +42,8 @@ import org.springframework.http.MediaType;
import org.springframework.integration.mapping.HeaderMapper;
import org.springframework.messaging.MessageHeaders;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Oleg Zhurakousky
* @author Mark Fisher
@@ -108,7 +108,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
public void validateAllowAsStringArray() {
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
Map<String, Object> messageHeaders = new HashMap<>();
messageHeaders.put("Allow", new String[] { "GET", "POST" });
messageHeaders.put("Allow", new String[] {"GET", "POST"});
HttpHeaders headers = new HttpHeaders();
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);
@@ -121,7 +121,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
public void validateAllowAsHttpMethodArray() {
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
Map<String, Object> messageHeaders = new HashMap<>();
messageHeaders.put("Allow", new HttpMethod[] { HttpMethod.GET, HttpMethod.POST });
messageHeaders.put("Allow", new HttpMethod[] {HttpMethod.GET, HttpMethod.POST});
HttpHeaders headers = new HttpHeaders();
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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,8 +16,6 @@
package org.springframework.integration.http.support;
import static org.assertj.core.api.Assertions.assertThat;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.text.ParseException;
@@ -43,6 +41,8 @@ import org.springframework.messaging.MessageHeaders;
import org.springframework.util.MimeType;
import org.springframework.util.StopWatch;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Oleg Zhurakousky
* @author Mark Fisher
@@ -108,7 +108,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
public void validateAcceptHeaderMultipleAsStringArray() {
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.outboundMapper();
Map<String, Object> messageHeaders = new HashMap<>();
messageHeaders.put("Accept", new String[] { "bar/foo", "text/xml" });
messageHeaders.put("Accept", new String[] {"bar/foo", "text/xml"});
HttpHeaders headers = new HttpHeaders();
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);
@@ -209,7 +209,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
public void validateAcceptCharsetHeaderMultipleAsStringArray() {
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.outboundMapper();
Map<String, Object> messageHeaders = new HashMap<>();
messageHeaders.put("Accept-Charset", new String[] { "UTF-8", "ISO-8859-1" });
messageHeaders.put("Accept-Charset", new String[] {"UTF-8", "ISO-8859-1"});
HttpHeaders headers = new HttpHeaders();
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);
@@ -223,7 +223,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
public void validateAcceptCharsetHeaderMultipleAsCharsetArray() {
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.outboundMapper();
Map<String, Object> messageHeaders = new HashMap<>();
messageHeaders.put("Accept-Charset", new Charset[] { Charset.forName("UTF-8"), Charset.forName("ISO-8859-1") });
messageHeaders.put("Accept-Charset", new Charset[] {Charset.forName("UTF-8"), Charset.forName("ISO-8859-1")});
HttpHeaders headers = new HttpHeaders();
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);
@@ -472,7 +472,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
public void validateIfNoneMatchAsStringArray() {
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.outboundMapper();
Map<String, Object> messageHeaders = new HashMap<>();
messageHeaders.put("If-None-Match", new String[] { "\"1234567\"", "\"123\"" });
messageHeaders.put("If-None-Match", new String[] {"\"1234567\"", "\"123\""});
HttpHeaders headers = new HttpHeaders();
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);