Only run the uiTest task for the :geode-pulse subproject. Add uiTest to the combined test report. Refactored helper methods out of test.gradle.
This closes #261 Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/1f253c33 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/1f253c33 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/1f253c33 Branch: refs/heads/feature/GEM-983 Commit: 1f253c33b14ea2f4c7f387723cb2e1d91b117df8 Parents: d956305 Author: Jared Stewart <[email protected]> Authored: Fri Oct 14 15:46:00 2016 -0700 Committer: Anthony Baker <[email protected]> Committed: Fri Oct 28 19:43:55 2016 -0700 ---------------------------------------------------------------------- buildSrc/build.gradle | 25 +++++++++ .../geode/gradle/TestPropertiesWriter.groovy | 36 ++++++++++++ geode-pulse/build.gradle | 16 ++++++ gradle/test.gradle | 58 +++----------------- 4 files changed, 86 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1f253c33/buildSrc/build.gradle ---------------------------------------------------------------------- diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 0000000..d7ff581 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +repositories { + mavenCentral() +} + +dependencies { + compile group: 'org.apache.mina', name: 'mina-core', version: '2.0.14' +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1f253c33/buildSrc/src/main/groovy/org/apache/geode/gradle/TestPropertiesWriter.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/geode/gradle/TestPropertiesWriter.groovy b/buildSrc/src/main/groovy/org/apache/geode/gradle/TestPropertiesWriter.groovy new file mode 100644 index 0000000..0f43d3c --- /dev/null +++ b/buildSrc/src/main/groovy/org/apache/geode/gradle/TestPropertiesWriter.groovy @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.geode.gradle; + +import org.apache.mina.util.AvailablePortFinder; + +public class TestPropertiesWriter { + public static void writeTestProperties(File parent, String name) { + Properties props = new Properties(); + props.setProperty('mcast-port', Integer.toString(AvailablePortFinder.getNextAvailable())); + props.setProperty('log-level', 'config'); + File propsFile = new File(testResultsDir(parent, name), 'gemfire.properties'); + BufferedWriter writer = propsFile.newWriter(); + props.store(writer, 'Autogenerated Gemfire properties'); + } + + public static File testResultsDir(File parent, String name) { + return new File(parent, name) + } +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1f253c33/geode-pulse/build.gradle ---------------------------------------------------------------------- diff --git a/geode-pulse/build.gradle b/geode-pulse/build.gradle index 3d19dea..6692484 100755 --- a/geode-pulse/build.gradle +++ b/geode-pulse/build.gradle @@ -1,3 +1,5 @@ +import org.apache.geode.gradle.TestPropertiesWriter + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -126,4 +128,18 @@ war { classpath project(':geode-core').webJar.archivePath } +task uiTest(type:Test) { + useJUnit { + includeCategories 'org.apache.geode.test.junit.categories.UITest' + excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest' + } + + doFirst { + TestPropertiesWriter.writeTestProperties(buildDir, name) + } +} + uiTest.dependsOn war +uiTest.finalizedBy rootProject.combineReports +rootProject.combineReports.mustRunAfter uiTest + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1f253c33/gradle/test.gradle ---------------------------------------------------------------------- diff --git a/gradle/test.gradle b/gradle/test.gradle index 5b895ba..bb8ab39 100644 --- a/gradle/test.gradle +++ b/gradle/test.gradle @@ -1,3 +1,5 @@ +import org.apache.geode.gradle.TestPropertiesWriter + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,31 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import org.apache.mina.util.AvailablePortFinder as MinaAvailablePortFinder - -buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath group: 'org.apache.mina', name: 'mina-core', version: '2.0.14' - } -} - -def testResultsDir(def parent, def name) { - new File(parent, name) -} - -def writeTestProperties(def parent, def name) { - def props = new Properties() - props.setProperty('mcast-port', Integer.toString(MinaAvailablePortFinder.getNextAvailable())) - props.setProperty('log-level', 'config') - def propsFile = new File(testResultsDir(parent, name), 'gemfire.properties') - def writer = propsFile.newWriter() - props.store(writer, 'Autogenerated Gemfire properties') - -} task combineReports(type: TestReport) { description 'Combines the test reports.' @@ -107,7 +84,7 @@ subprojects { } doFirst { - writeTestProperties(buildDir, name) + TestPropertiesWriter.writeTestProperties(buildDir, name) } } @@ -119,18 +96,7 @@ subprojects { forkEvery 1 doFirst { - writeTestProperties(buildDir, name) - } - } - - task uiTest(type:Test) { - useJUnit { - includeCategories 'org.apache.geode.test.junit.categories.UITest' - excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest' - } - - doFirst { - writeTestProperties(buildDir, name) + TestPropertiesWriter.writeTestProperties(buildDir, name) } } @@ -149,7 +115,7 @@ subprojects { forkEvery 1 doFirst { - writeTestProperties(buildDir, name) + TestPropertiesWriter.writeTestProperties(buildDir, name) } reports.junitXml.destination = file "$buildDir/test-reports-flaky" @@ -162,7 +128,7 @@ subprojects { forkEvery 1 doFirst { - writeTestProperties(buildDir, name) + TestPropertiesWriter.writeTestProperties(buildDir, name) } reports.junitXml.destination = file "$buildDir/test-reports-security" @@ -195,7 +161,7 @@ subprojects { //saying the results are never up to date outputs.upToDateWhen { false } - def resultsDir = testResultsDir(buildDir, test.name) + def resultsDir = TestPropertiesWriter.testResultsDir(buildDir, test.name) workingDir resultsDir.absolutePath reports.html.destination = file "$buildDir/reports/$name" @@ -244,13 +210,7 @@ subprojects { } check.dependsOn checkMissedTests - + combineReports.mustRunAfter check, test, integrationTest, distributedTest, flakyTest, checkMissedTests - build.finalizedBy combineReports - check.finalizedBy combineReports - test.finalizedBy combineReports - integrationTest.finalizedBy combineReports - distributedTest.finalizedBy combineReports - flakyTest.finalizedBy combineReports - checkMissedTests.finalizedBy combineReports + [build, check, test, integrationTest, distributedTest, flakyTest, checkMissedTests].each {it.finalizedBy combineReports} }
