Skip to content

Commit 65c884c

Browse files
artembilangaryrussell
authored andcommitted
Enable nohttp Gradle plugin
* Add `io.spring.nohttp` Gradle plugin into the build script and allow it only on CI server, since it is going to parse every file * Fix tests do not use `http` any more * Fix `test.html` in the `mail` modules tests to exclude a Namespace for OExchange XRD protocol * Fix some files for new line in the end of file according Checkstyle violations
1 parent 9fa9d1b commit 65c884c

File tree

8 files changed

+73
-58
lines changed

8 files changed

+73
-58
lines changed

build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
99
classpath "org.asciidoctor:asciidoctor-gradle-plugin:1.5.6"
1010
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
11+
classpath 'io.spring.nohttp:nohttp-gradle:0.0.1.RELEASE'
1112
}
1213
}
1314

@@ -67,6 +68,9 @@ subprojects { subproject ->
6768
apply plugin: 'checkstyle'
6869
apply plugin: 'kotlin'
6970
apply plugin: 'kotlin-spring'
71+
if (System.getenv('TRAVIS') || System.getenv('bamboo_buildKey')) {
72+
apply plugin: 'io.spring.nohttp'
73+
}
7074

7175
sourceSets {
7276
test {
@@ -307,6 +311,14 @@ subprojects { subproject ->
307311
toolVersion = "8.20"
308312
}
309313

314+
315+
if (System.getenv('TRAVIS') || System.getenv('bamboo_buildKey')) {
316+
nohttp {
317+
source.include 'src/**'
318+
source.exclude '**/*.gif', '**/*.ks'
319+
}
320+
}
321+
310322
artifacts {
311323
archives sourcesJar
312324
archives javadocJar

spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java

Lines changed: 47 additions & 46 deletions
Large diffs are not rendered by default.

spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageInboundTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.net.URISyntaxException;
2424
import java.text.ParseException;
2525
import java.text.SimpleDateFormat;
26+
import java.util.Arrays;
2627
import java.util.Calendar;
2728
import java.util.Collections;
2829
import java.util.Date;
@@ -43,7 +44,6 @@
4344
import org.springframework.http.MediaType;
4445
import org.springframework.integration.mapping.HeaderMapper;
4546
import org.springframework.messaging.MessageHeaders;
46-
import org.springframework.util.CollectionUtils;
4747

4848
/**
4949
* @author Oleg Zhurakousky
@@ -146,7 +146,7 @@ public void validateAllowAsHttpMethodArray() {
146146
public void validateAllowAsCollectionOfString() {
147147
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
148148
Map<String, Object> messageHeaders = new HashMap<>();
149-
messageHeaders.put("Allow", CollectionUtils.arrayToList(new String[] { "GET", "POST" }));
149+
messageHeaders.put("Allow", Arrays.asList("GET", "POST"));
150150
HttpHeaders headers = new HttpHeaders();
151151

152152
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);
@@ -159,7 +159,7 @@ public void validateAllowAsCollectionOfString() {
159159
public void validateAllowAsCollectionOfHttpMethods() {
160160
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
161161
Map<String, Object> messageHeaders = new HashMap<>();
162-
messageHeaders.put("Allow", CollectionUtils.arrayToList(new HttpMethod[] { HttpMethod.GET, HttpMethod.POST }));
162+
messageHeaders.put("Allow", Arrays.asList(HttpMethod.GET, HttpMethod.POST));
163163
HttpHeaders headers = new HttpHeaders();
164164

165165
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);
@@ -277,11 +277,11 @@ public void validateLastModifiedAsDate() throws ParseException {
277277
public void validateLocation() throws URISyntaxException {
278278
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
279279
Map<String, Object> messageHeaders = new HashMap<>();
280-
messageHeaders.put("Location", "http://www.foo.com/");
280+
messageHeaders.put("Location", "https://www.example.com/");
281281
HttpHeaders headers = new HttpHeaders();
282282
mapper.fromHeaders(new MessageHeaders(messageHeaders), headers);
283283

284-
assertThat(headers.getLocation().toString()).isEqualTo(new URI("http://www.foo.com/").toString());
284+
assertThat(headers.getLocation().toString()).isEqualTo(new URI("https://www.example.com/").toString());
285285
}
286286

287287
// Transfer Encoding tests
@@ -406,7 +406,7 @@ public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHt
406406
}
407407

408408
@Test
409-
public void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixEmptyString() {
409+
void validateCustomHeaderNamePatternsAndStandardResponseHeadersMappedToHttpHeadersWithCustomPrefixEmptyString() {
410410
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
411411
mapper.setUserDefinedHeaderPrefix("");
412412
mapper.setOutboundHeaderNames("foo*", "HTTP_RESPONSE_HEADERS");

spring-integration-jpa/src/test/resources/H2-PopulateData.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ values ('1001', 'First One','Last One','M','1980-1-1',NOW());
33
insert into Student(rollNumber, firstName,lastName, gender, dateOfBirth,lastUpdated)
44
values ('1002', 'First Two','Last Two','F','1984-1-1',NOW());
55
insert into Student(rollNumber, firstName,lastName, gender, dateOfBirth,lastUpdated)
6-
values ('1003', 'First Three','Last Three','F','1984-3-3',NOW());
6+
values ('1003', 'First Three','Last Three','F','1984-3-3',NOW());

spring-integration-mail/src/test/java/org/springframework/integration/mail/config/test.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
<meta content="n" name="session-loggedin" />
3232
<title id="page_title">Twitter</title>
3333
<link href="https://a1.twimg.com/a/1295478501/images/twitter_57.png" rel="apple-touch-icon" />
34+
<!--// CHECKSTYLE:OFF-->
3435
<link href="/oexchange.xrd" rel="http://www.oexchange.org/spec/0.8/rel/related-target" type="application/xrd+xml" />
36+
<!--// CHECKSTYLE:ON-->
3537
<link href="https://a1.twimg.com/a/1295478501/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
3638
<link href="https://a1.twimg.com/a/1295478501/stylesheets/fronts.css?1295482593" media="screen" rel="stylesheet" type="text/css" />
3739

spring-integration-sftp/src/main/resources/JSCH_LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
2727
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
2828
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2929
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

spring-integration-stomp/src/test/java/org/springframework/integration/stomp/inbound/StompInboundChannelAdapterWebSocketIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public StompSessionManager stompSessionManager(WebSocketStompClient stompClient)
270270
webSocketStompSessionManager.setAutoReceipt(true);
271271
webSocketStompSessionManager.setRecoveryInterval(1000);
272272
WebSocketHttpHeaders handshakeHeaders = new WebSocketHttpHeaders();
273-
handshakeHeaders.setOrigin("http://www.foo.com/");
273+
handshakeHeaders.setOrigin("https://www.example.com/");
274274
webSocketStompSessionManager.setHandshakeHeaders(handshakeHeaders);
275275
StompHeaders stompHeaders = new StompHeaders();
276276
stompHeaders.setHeartbeat(new long[] { 10000, 10000 });
@@ -327,7 +327,7 @@ public DefaultHandshakeHandler handshakeHandler() {
327327
public void registerStompEndpoints(StompEndpointRegistry registry) {
328328
registry.addEndpoint("/ws")
329329
.setHandshakeHandler(handshakeHandler())
330-
.setAllowedOrigins("http://www.foo.com/")
330+
.setAllowedOrigins("https://www.example.com/")
331331
.addInterceptors(new HandshakeInterceptor() {
332332

333333
@Override

spring-integration-websocket/src/test/java/org/springframework/integration/websocket/server/WebSocketServerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public WebSocketClient webSocketClient() {
196196
public IntegrationWebSocketContainer clientWebSocketContainer() {
197197
ClientWebSocketContainer clientWebSocketContainer =
198198
new ClientWebSocketContainer(webSocketClient(), server().getWsBaseUrl() + "/ws");
199-
clientWebSocketContainer.setOrigin("http://www.foo.com/");
199+
clientWebSocketContainer.setOrigin("https://www.example.com/");
200200
return clientWebSocketContainer;
201201
}
202202

@@ -271,7 +271,7 @@ public ServerWebSocketContainer serverWebSocketContainer() {
271271
return new ServerWebSocketContainer("/ws")
272272
.setHandshakeHandler(handshakeHandler())
273273
.setDecoratorFactories(testWebSocketHandlerDecoratorFactory())
274-
.setAllowedOrigins("http://www.foo.com/")
274+
.setAllowedOrigins("https://www.example.com/")
275275
.withSockJs();
276276
}
277277

0 commit comments

Comments
 (0)