From 8e8a3a894f61ab5f76dbbbf1f90d7b6d2f57a4ae Mon Sep 17 00:00:00 2001 From: kimchy Date: Thu, 30 Dec 2010 16:08:38 +0200 Subject: [PATCH] upgrade testing framework jars, improve build scripts to share the testing jars --- .idea/libraries/hamcrest.xml | 3 ++- .idea/libraries/testng.xml | 4 +++- build.gradle | 24 +++++++++++++++++++ modules/benchmark/micro/build.gradle | 10 -------- modules/elasticsearch/build.gradle | 12 ---------- modules/test/integration/build.gradle | 13 ---------- modules/test/testng/build.gradle | 7 ------ .../elasticsearch/util/testng/Listeners.java | 2 +- .../util/testng/LoggingListener.java | 2 ++ plugins/analysis/icu/build.gradle | 13 ---------- plugins/cloud/aws/build.gradle | 12 ---------- plugins/hadoop/build.gradle | 12 ---------- plugins/lang/groovy/build.gradle | 12 ---------- plugins/lang/javascript/build.gradle | 12 ---------- plugins/lang/python/build.gradle | 12 ---------- plugins/mapper/attachments/build.gradle | 13 ---------- plugins/river/couchdb/build.gradle | 12 ---------- plugins/river/rabbitmq/build.gradle | 13 ---------- plugins/river/twitter/build.gradle | 13 ---------- plugins/river/wikipedia/build.gradle | 12 ---------- plugins/transport/memcached/build.gradle | 11 --------- plugins/transport/thrift/build.gradle | 12 ---------- 22 files changed, 32 insertions(+), 204 deletions(-) diff --git a/.idea/libraries/hamcrest.xml b/.idea/libraries/hamcrest.xml index 36a68821384..2bc65d43dd0 100644 --- a/.idea/libraries/hamcrest.xml +++ b/.idea/libraries/hamcrest.xml @@ -1,7 +1,8 @@ - + + diff --git a/.idea/libraries/testng.xml b/.idea/libraries/testng.xml index 6df8a2dbdad..c7eeb7964b0 100644 --- a/.idea/libraries/testng.xml +++ b/.idea/libraries/testng.xml @@ -1,7 +1,9 @@ - + + + diff --git a/build.gradle b/build.gradle index b6bbd442fa1..02cd18be1d6 100644 --- a/build.gradle +++ b/build.gradle @@ -40,6 +40,30 @@ allprojects { plugins.withType(JavaPlugin).whenPluginAdded { sourceCompatibility = 1.6 targetCompatibility = 1.6 + + test { + useTestNG() + String testSuiteName = project.name + suiteName = project.name + workingDir = rootProject.projectDir + options { + suiteNamte = testSuiteName + listeners << 'org.elasticsearch.util.testng.Listeners' + } + systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") + systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") + } + + dependencies { + if (project.name != "test-testng") { + testCompile project(':test-testng') + } + testCompile('org.testng:testng:5.14.6') { transitive = false } + testCompile('com.beust:jcommander:1.5') { transitive = false } + testCompile('org.beanshell:bsh:2.0b4') { transitive = false } + testCompile('org.hamcrest:hamcrest-core:1.3.RC2') { transitive = false } + testCompile('org.hamcrest:hamcrest-library:1.3.RC2') { transitive = false } + } } repositories { diff --git a/modules/benchmark/micro/build.gradle b/modules/benchmark/micro/build.gradle index e594bf9cea7..4e7d14cebbd 100644 --- a/modules/benchmark/micro/build.gradle +++ b/modules/benchmark/micro/build.gradle @@ -13,14 +13,4 @@ sourceSets.test.resources.srcDirs 'src/test/java' dependencies { compile project(':elasticsearch') - - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } diff --git a/modules/elasticsearch/build.gradle b/modules/elasticsearch/build.gradle index a6d06691a64..f30e0fac531 100644 --- a/modules/elasticsearch/build.gradle +++ b/modules/elasticsearch/build.gradle @@ -41,10 +41,6 @@ dependencies { compile 'org.apache.lucene:lucene-analyzers:3.0.3' compile 'org.apache.lucene:lucene-queries:3.0.3' compile 'org.apache.lucene:lucene-fast-vector-highlighter:3.0.3' - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile('org.hamcrest:hamcrest-all:1.1') { transitive = false } } configurations { @@ -79,14 +75,6 @@ javadoc { maxMemory = "1g" } -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") -} - task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from sourceSets.main.allSource diff --git a/modules/test/integration/build.gradle b/modules/test/integration/build.gradle index e605afefee1..4e7d14cebbd 100644 --- a/modules/test/integration/build.gradle +++ b/modules/test/integration/build.gradle @@ -13,17 +13,4 @@ sourceSets.test.resources.srcDirs 'src/test/java' dependencies { compile project(':elasticsearch') - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") - systemProperties["java.net.preferIPv4Stack"] = "true" } diff --git a/modules/test/testng/build.gradle b/modules/test/testng/build.gradle index 2b1fc655885..cb52fa78a8a 100644 --- a/modules/test/testng/build.gradle +++ b/modules/test/testng/build.gradle @@ -11,12 +11,5 @@ sourceSets.test.resources.srcDirs 'src/test/java' dependencies { compile('org.testng:testng:5.10:jdk15') { transitive = false } - compile('org.slf4j:slf4j-api:1.5.11') { transitive = false } - compile('org.slf4j:slf4j-log4j12:1.5.11') { transitive = false } compile('log4j:log4j:1.2.15') { transitive = false } } - -test { - useTestNG() - systemProperties['es.test.log.conf'] = 'log4j-gradle.properties' -} diff --git a/modules/test/testng/src/main/java/org/elasticsearch/util/testng/Listeners.java b/modules/test/testng/src/main/java/org/elasticsearch/util/testng/Listeners.java index b487c8d2a29..b9f41faa6d8 100644 --- a/modules/test/testng/src/main/java/org/elasticsearch/util/testng/Listeners.java +++ b/modules/test/testng/src/main/java/org/elasticsearch/util/testng/Listeners.java @@ -28,7 +28,7 @@ import org.testng.ITestResult; */ public class Listeners implements ITestListener { - private final ITestListener[] listeners = new ITestListener[]{new DotTestListener(), new LoggingListener()}; + private final ITestListener[] listeners = new ITestListener[]{new LoggingListener()}; @Override public void onTestStart(ITestResult result) { for (ITestListener listener : listeners) { diff --git a/modules/test/testng/src/main/java/org/elasticsearch/util/testng/LoggingListener.java b/modules/test/testng/src/main/java/org/elasticsearch/util/testng/LoggingListener.java index 58619cf98b1..d18cedd1249 100644 --- a/modules/test/testng/src/main/java/org/elasticsearch/util/testng/LoggingListener.java +++ b/modules/test/testng/src/main/java/org/elasticsearch/util/testng/LoggingListener.java @@ -37,6 +37,8 @@ public class LoggingListener extends TestListenerAdapter { String logsDir = context.getOutputDirectory() + "/logs"; deleteRecursively(new File(logsDir), false); System.setProperty("test.log.dir", logsDir); + System.setProperty("es.path.data", context.getOutputDirectory() + "/data"); + System.setProperty("es.path.work", context.getOutputDirectory() + "/work"); } @Override public void onTestStart(ITestResult result) { diff --git a/plugins/analysis/icu/build.gradle b/plugins/analysis/icu/build.gradle index cea2bba47de..9ec68f7e3c1 100644 --- a/plugins/analysis/icu/build.gradle +++ b/plugins/analysis/icu/build.gradle @@ -36,19 +36,6 @@ dependencies { distLib('com.ibm.icu:icu4j:4.4') { transitive = false } compile('org.apache.lucene:lucene-collation:3.0.3') { transitive = false } distLib('org.apache.lucene:lucene-collation:3.0.3') { transitive = false } - - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/cloud/aws/build.gradle b/plugins/cloud/aws/build.gradle index c45850c9cd8..68aff69b3ab 100644 --- a/plugins/cloud/aws/build.gradle +++ b/plugins/cloud/aws/build.gradle @@ -40,18 +40,6 @@ dependencies { distLib("commons-codec:commons-codec:1.3") { transitive = false } distLib("commons-logging:commons-logging:1.1.1") { transitive = false } distLib("commons-httpclient:commons-httpclient:3.0.1") { transitive = false } - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/hadoop/build.gradle b/plugins/hadoop/build.gradle index b10661958e8..1654c0adf28 100644 --- a/plugins/hadoop/build.gradle +++ b/plugins/hadoop/build.gradle @@ -33,18 +33,6 @@ dependencies { distLib("org.apache.hadoop:hadoop-core:0.20.2") { transitive = false } distLib("commons-logging:commons-logging:1.1.1") { transitive = false } - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/lang/groovy/build.gradle b/plugins/lang/groovy/build.gradle index c120397b6a8..576f885d486 100644 --- a/plugins/lang/groovy/build.gradle +++ b/plugins/lang/groovy/build.gradle @@ -32,21 +32,9 @@ dependencies { groovy group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.7.6' distLib('org.codehaus.groovy:groovy-all:1.7.6') { transitive = false } - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' testCompile('junit:junit:4.8.1') {transitive = false} } -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") -} - task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { [explodedDistDir]*.mkdirs() diff --git a/plugins/lang/javascript/build.gradle b/plugins/lang/javascript/build.gradle index 74c0c950d5c..98b256bbdef 100644 --- a/plugins/lang/javascript/build.gradle +++ b/plugins/lang/javascript/build.gradle @@ -32,18 +32,6 @@ dependencies { compile('rhino:js:1.7R2') distLib('rhino:js:1.7R2') { transitive = false } - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/lang/python/build.gradle b/plugins/lang/python/build.gradle index b00793a2d0e..e7b3b6cebe0 100644 --- a/plugins/lang/python/build.gradle +++ b/plugins/lang/python/build.gradle @@ -32,18 +32,6 @@ dependencies { compile('org.python:jython:2.5.2rc2') { transitive = false } distLib('org.python:jython:2.5.2rc2') { transitive = false } - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/mapper/attachments/build.gradle b/plugins/mapper/attachments/build.gradle index fc4678815ba..d209d8a8705 100644 --- a/plugins/mapper/attachments/build.gradle +++ b/plugins/mapper/attachments/build.gradle @@ -34,19 +34,6 @@ dependencies { compile('org.apache.tika:tika-app:0.8') { transitive = false } distLib('org.apache.tika:tika-app:0.8') { transitive = false } - - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/river/couchdb/build.gradle b/plugins/river/couchdb/build.gradle index 0c1d7b33591..43a494c45af 100644 --- a/plugins/river/couchdb/build.gradle +++ b/plugins/river/couchdb/build.gradle @@ -31,18 +31,6 @@ configurations { dependencies { compile project(':elasticsearch') - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/river/rabbitmq/build.gradle b/plugins/river/rabbitmq/build.gradle index 131c091671b..ed9b3b7fc9a 100644 --- a/plugins/river/rabbitmq/build.gradle +++ b/plugins/river/rabbitmq/build.gradle @@ -36,19 +36,6 @@ dependencies { compile("commons-io:commons-io:1.2") { transitive = false } distLib('com.rabbitmq:amqp-client:2.2.0') { transitive = false } distLib("commons-io:commons-io:1.2") { transitive = false } - - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/river/twitter/build.gradle b/plugins/river/twitter/build.gradle index 508d13deb3f..5af49322e41 100644 --- a/plugins/river/twitter/build.gradle +++ b/plugins/river/twitter/build.gradle @@ -34,19 +34,6 @@ dependencies { compile('org.twitter4j:twitter4j-core:2.1.7') { transitive = false } distLib('org.twitter4j:twitter4j-core:2.1.7') { transitive = false } - - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/river/wikipedia/build.gradle b/plugins/river/wikipedia/build.gradle index c09c57a5795..73ddda2f0b0 100644 --- a/plugins/river/wikipedia/build.gradle +++ b/plugins/river/wikipedia/build.gradle @@ -31,18 +31,6 @@ configurations { dependencies { compile project(':elasticsearch') - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { diff --git a/plugins/transport/memcached/build.gradle b/plugins/transport/memcached/build.gradle index 5583acb0a90..84dbbbfe9d8 100644 --- a/plugins/transport/memcached/build.gradle +++ b/plugins/transport/memcached/build.gradle @@ -36,20 +36,9 @@ repositories { dependencies { compile project(':elasticsearch') - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' testCompile 'spy:memcached:2.5' } -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") -} - task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { [explodedDistDir]*.mkdirs() diff --git a/plugins/transport/thrift/build.gradle b/plugins/transport/thrift/build.gradle index ff1cae0a689..1917e4c268c 100644 --- a/plugins/transport/thrift/build.gradle +++ b/plugins/transport/thrift/build.gradle @@ -40,18 +40,6 @@ dependencies { distLib("org.elasticsearch:es-libthrift:0.5.0") { transitive = false } distLib 'org.slf4j:slf4j-api:1.5.11' distLib('org.slf4j:slf4j-log4j12:1.5.11') { transitive = false } - - testCompile project(':test-testng') - testCompile('org.testng:testng:5.10:jdk15') { transitive = false } - testCompile 'org.hamcrest:hamcrest-all:1.1' -} - -test { - useTestNG() - jmvArgs = ["-ea", "-Xmx1024m"] - suiteName = project.name - listeners = ["org.elasticsearch.util.testng.Listeners"] - systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties") } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << {