INT-3155: Add Gradle Task 'testAll'
* Add to `LongRunningIntegrationTest` ability to read `System.properties` Note, ENV property 'RUN_LONG_INTEGRATION_TESTS' has a preference in case of value `true` * Add Gradle task `testAll` * Upgrade to Gradle 1.7 * Improve build performance by adding 'inputs'/'outputs' to some tasks JIRA: https://jira.springsource.org/browse/INT-3155 Polishing Remove inputs/outputs. Polish RouterConcurrencyTest.
This commit is contained in:
committed by
Gary Russell
parent
7101120589
commit
dd5c9cc18c
35
build.gradle
35
build.gradle
@@ -116,6 +116,13 @@ subprojects { subproject ->
|
||||
jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=org.springframework.integration.*"
|
||||
}
|
||||
|
||||
task testAll() {
|
||||
doFirst {
|
||||
tasks.test.systemProperty 'RUN_LONG_INTEGRATION_TESTS', 'true'
|
||||
}
|
||||
finalizedBy test
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allJava
|
||||
@@ -126,21 +133,23 @@ subprojects { subproject ->
|
||||
from javadoc
|
||||
}
|
||||
|
||||
task checkTestConfigs << {
|
||||
def configFiles = []
|
||||
sourceSets.test.java.srcDirs.each {
|
||||
fileTree(it).include('**/*.xml').exclude('**/log4j.xml').each { configFile ->
|
||||
def configXml = new XmlParser(false, false).parse(configFile)
|
||||
task checkTestConfigs {
|
||||
doLast {
|
||||
def configFiles = []
|
||||
sourceSets.test.java.srcDirs.each {
|
||||
fileTree(it).include('**/*.xml').exclude('**/log4j.xml').each { configFile ->
|
||||
def configXml = new XmlParser(false, false).parse(configFile)
|
||||
|
||||
if (configXml.@'xsi:schemaLocation' ==~ /.*spring-[a-z-]*\d\.\d\.xsd.*/) {
|
||||
configFiles << configFile
|
||||
if (configXml.@'xsi:schemaLocation' ==~ /.*spring-[a-z-]*\d\.\d\.xsd.*/) {
|
||||
configFiles << configFile
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (configFiles) {
|
||||
throw new InvalidUserDataException('Hardcoded XSD version in the config files:\n' +
|
||||
configFiles.collect {relativePath(it)}.join('\n') +
|
||||
'\nPlease, use versionless schemaLocations for Spring XSDs to avoid issues with builds on different versions of dependencies.')
|
||||
if (configFiles) {
|
||||
throw new InvalidUserDataException('Hardcoded XSD version in the config files:\n' +
|
||||
configFiles.collect {relativePath(it)}.join('\n') +
|
||||
'\nPlease, use versionless schemaLocations for Spring XSDs to avoid issues with builds on different versions of dependencies.')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -758,5 +767,5 @@ task dist(dependsOn: assemble) {
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
description = 'Generates gradlew[.bat] scripts'
|
||||
gradleVersion = '1.6'
|
||||
gradleVersion = '1.7'
|
||||
}
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Thu May 16 22:49:11 EDT 2013
|
||||
#Sun Sep 29 12:56:14 EEST 2013
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
|
||||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.7-bin.zip
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
*/
|
||||
package org.springframework.integration.router;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -32,6 +33,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.junit.Test;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.integration.Message;
|
||||
@@ -86,12 +88,12 @@ public class RouterConcurrencyTest {
|
||||
router.setBeanFactory(beanFactory);
|
||||
|
||||
ExecutorService exec = Executors.newFixedThreadPool(2);
|
||||
final List<ConversionService> returns = new ArrayList<ConversionService>();
|
||||
final List<ConversionService> returns = Collections.synchronizedList(
|
||||
new ArrayList<ConversionService>());
|
||||
Runnable runnable = new Runnable() {
|
||||
|
||||
public void run() {
|
||||
ConversionService requiredConversionService = router.getRequiredConversionService();
|
||||
System.out.println("Adding " + requiredConversionService);
|
||||
returns.add(requiredConversionService);
|
||||
}
|
||||
};
|
||||
@@ -99,7 +101,7 @@ public class RouterConcurrencyTest {
|
||||
exec.execute(runnable);
|
||||
exec.shutdown();
|
||||
exec.awaitTermination(10, TimeUnit.SECONDS);
|
||||
assertTrue(returns.size() == 2);
|
||||
assertEquals(2, returns.size());
|
||||
assertNotNull(returns.get(0));
|
||||
assertNotNull(returns.get(1));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.junit.runners.model.Statement;
|
||||
* variable RUN_LONG_INTEGRATION_TESTS on a CI nightly build to ensure coverage.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
* @since 3.0
|
||||
*
|
||||
*/
|
||||
@@ -34,10 +35,22 @@ public class LongRunningIntegrationTest extends TestWatcher {
|
||||
|
||||
private final static Log logger = LogFactory.getLog(LongRunningIntegrationTest.class);
|
||||
|
||||
private static final String RUN_LONG_PROP = "RUN_LONG_INTEGRATION_TESTS";
|
||||
|
||||
private boolean shouldRun = false;
|
||||
|
||||
public LongRunningIntegrationTest() {
|
||||
for(String value: new String[]{System.getenv(RUN_LONG_PROP), System.getProperty(RUN_LONG_PROP)}) {
|
||||
if ("true".equalsIgnoreCase(value)) {
|
||||
this.shouldRun = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
boolean shouldRun = "true".equalsIgnoreCase(System.getenv("RUN_LONG_INTEGRATION_TESTS"));
|
||||
if (!shouldRun) {
|
||||
if (!this.shouldRun) {
|
||||
logger.info("Skipping long running test " + description.getDisplayName());
|
||||
return new Statement() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user