From f27a6410c61f45cdfc1f95e471f5a461762c62ca Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 12 Jan 2024 10:04:02 -0500 Subject: [PATCH] Some Gradle build optimizations --- build.gradle | 13 ++++++------- gradle.properties | 2 +- .../bus/ApplicationContextMessageBusTests.java | 14 ++++++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 359a655890..174725ad4b 100644 --- a/build.gradle +++ b/build.gradle @@ -322,11 +322,6 @@ configure(javaProjects) { subproject -> compileKotlin.dependsOn updateCopyrights - test { - maxHeapSize = '2g' - jvmArgs '-XX:+HeapDumpOnOutOfMemoryError' - } - tasks.register('testAll', Test) { dependsOn['check'] } gradle.taskGraph.whenReady { graph -> @@ -335,7 +330,7 @@ configure(javaProjects) { subproject -> } } - tasks.withType(Test).all { + tasks.withType(Test).configureEach { // suppress all console output during testing unless running `gradle -i` logging.captureStandardOutput(LogLevel.INFO) @@ -347,7 +342,11 @@ configure(javaProjects) { subproject -> useJUnitPlatform() + reports.junitXml.required = false + enableAssertions = false + + forkEvery = 1000 } checkstyle { @@ -542,7 +541,7 @@ project('spring-integration-core') { classpath.from(sourceSets['main'].runtimeClasspath) externalDocumentationLink { url.set(new URL("https://docs.spring.io/spring-integration/docs/$version/api/")) - packageListUrl.set(file("$buildDir/docs/javadoc/element-list").toURI().toURL()) + packageListUrl.set(file('build/docs/javadoc/element-list').toURI().toURL()) } externalDocumentationLink { url.set(new URL('https://projectreactor.io/docs/core/release/api/')) diff --git a/gradle.properties b/gradle.properties index 074a0c76a5..19e0fb7b05 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ version=6.3.0-SNAPSHOT -org.gradle.jvmargs=-Xmx1536M -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 kotlin.jvm.target.validation.mode=IGNORE org.gradle.caching=true org.gradle.parallel=true diff --git a/spring-integration-core/src/test/java/org/springframework/integration/bus/ApplicationContextMessageBusTests.java b/spring-integration-core/src/test/java/org/springframework/integration/bus/ApplicationContextMessageBusTests.java index 45c882d09c..8388f97f5a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/bus/ApplicationContextMessageBusTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/bus/ApplicationContextMessageBusTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 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. @@ -149,7 +149,7 @@ public class ApplicationContextMessageBusTests { this.context.registerEndpoint("testEndpoint2", endpoint2); this.context.refresh(); inputChannel.send(new GenericMessage<>("testing")); - Message message1 = outputChannel1.receive(10000); + Message message1 = outputChannel1.receive(100); Message message2 = outputChannel2.receive(0); assertThat(message1 == null ^ message2 == null).as("exactly one message should be null").isTrue(); } @@ -187,8 +187,7 @@ public class ApplicationContextMessageBusTests { this.context.registerEndpoint("testEndpoint2", endpoint2); this.context.refresh(); inputChannel.send(new GenericMessage<>("testing")); - latch.await(500, TimeUnit.MILLISECONDS); - assertThat(latch.getCount()).as("both handlers should have been invoked").isEqualTo(0); + assertThat(latch.await(500, TimeUnit.MILLISECONDS)).isTrue(); Message message1 = outputChannel1.receive(500); Message message2 = outputChannel2.receive(500); assertThat(message1).as("both handlers should have replied to the message").isNotNull(); @@ -208,9 +207,9 @@ public class ApplicationContextMessageBusTests { channelAdapter.setOutputChannel(outputChannel); this.context.registerEndpoint("testChannel", channelAdapter); this.context.refresh(); - latch.await(2000, TimeUnit.MILLISECONDS); + assertThat(latch.await(2, TimeUnit.SECONDS)).isTrue(); Message message = errorChannel.receive(5000); - assertThat(outputChannel.receive(100)).isNull(); + assertThat(outputChannel.receive(10)).isNull(); assertThat(message).as("message should not be null").isNotNull(); assertThat(message instanceof ErrorMessage).isTrue(); Throwable exception = ((ErrorMessage) message).getPayload(); @@ -235,8 +234,7 @@ public class ApplicationContextMessageBusTests { this.context.registerEndpoint("testEndpoint", endpoint); this.context.refresh(); errorChannel.send(new ErrorMessage(new RuntimeException("test-exception"))); - latch.await(1000, TimeUnit.MILLISECONDS); - assertThat(latch.getCount()).as("handler should have received error message").isEqualTo(0); + assertThat(latch.await(1, TimeUnit.SECONDS)).isTrue(); }