Skip to content

Commit 9a257cd

Browse files
committed
Merge branch 'dev'
2 parents ff49df5 + e187946 commit 9a257cd

File tree

8 files changed

+32
-9
lines changed

8 files changed

+32
-9
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies {
3030
compile mlDataMovementDependency
3131
compile group: 'commons-io', name: 'commons-io', version: '2.5'
3232

33-
compileOnly "com.marklogic:ml-unit-test-client:0.9.1"
33+
compileOnly mlUnitTestDependency
3434

3535
testCompile localGroovy()
3636
testCompile gradleTestKit()
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
buildscript {
22
repositories {
33
jcenter()
4+
mavenLocal()
45

56
// Needed for ml-unit-test-client dependency until it's available via jcenter()
67
maven {
78
url {"https://dl.bintray.com/rjrudin/maven/"}
89
}
910
}
1011
dependencies {
11-
classpath "com.marklogic:ml-unit-test-client:0.9.1"
12+
classpath "com.marklogic:ml-unit-test-client:${mlUnitTestVersion}"
1213
classpath "com.marklogic:ml-gradle:${mlGradleVersion}"
1314
}
1415
}
@@ -18,6 +19,7 @@ apply plugin: "com.marklogic.ml-gradle"
1819

1920
repositories {
2021
jcenter()
22+
mavenLocal()
2123

2224
// Needed for ml-unit-test and ml-unit-test-client dependencies until they're available via jcenter()
2325
maven {
@@ -26,9 +28,9 @@ repositories {
2628
}
2729

2830
dependencies {
29-
mlRestApi "com.marklogic:ml-unit-test:0.9.1"
31+
mlRestApi "com.marklogic:ml-unit-test:${mlUnitTestVersion}"
3032

3133
// For running ml-unit-test tests via JUnit
32-
testCompile "com.marklogic:ml-unit-test-client:0.9.1"
34+
testCompile "com.marklogic:ml-unit-test-client:${mlUnitTestVersion}"
3335
testCompile "junit:junit:4+"
3436
}

examples/unit-test-project/gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
mlGradleVersion=3.6.0
1+
mlGradleVersion=3.6.3
2+
mlUnitTestVersion=0.10.0
23

34
mlHost=localhost
45
mlAppName=unit-test-example
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xdmp:log("Suite teardown")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xdmp:log("Test teardown")

gradle.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
group=com.marklogic
2-
version=3.6.2
3-
mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.6.2
2+
version=3.6.3
3+
4+
mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.6.3
45
mlcpUtilDependency=com.marklogic:mlcp-util:0.9.0
56
mlDataMovementDependency=com.marklogic:marklogic-data-movement-components:1.0
7+
mlUnitTestDependency=com.marklogic:ml-unit-test-client:0.10.0

src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ class MarkLogicPlugin implements Plugin<Project> {
276276
"Can use -PsuiteName to override the name of the test suite, and -PtestName to override the name of the test module.")
277277
project.task("mlUnitTest", type: UnitTestTask, group: unitTestGroup, description: "Run tests found under /test/suites in the modules database. " +
278278
"Connects to MarkLogic via the REST API server defined by mlTestRestPort (or by mlRestPort if mlTestRestPort is not set), and uses mlRest* properties for authentication. " +
279-
"Use -PunitTestResultPath to override where test result files are written, which defaults to build/test-results/marklogic-unit-test.")
279+
"Use -PunitTestResultPath to override where test result files are written, which defaults to build/test-results/marklogic-unit-test. " +
280+
"Use -PrunTeardown and -PrunSuiteTeardown to control whether teardown and suite teardown scripts are run; these default to 'true' and can be set to 'false' instead. ")
280281

281282
logger.info("Finished initializing ml-gradle\n")
282283
}

src/main/groovy/com/marklogic/gradle/task/test/UnitTestTask.groovy

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,22 @@ class UnitTestTask extends MarkLogicTask {
2525
def client = appConfig.getTestRestPort() != null ? appConfig.newTestDatabaseClient() : appConfig.newDatabaseClient()
2626
try {
2727
def testManager = new TestManager(client)
28-
def suites = testManager.runAllSuites()
28+
29+
boolean runTeardown = true
30+
boolean runSuiteTeardown = true
31+
if (project.hasProperty("runTeardown")) {
32+
runTeardown = Boolean.parseBoolean(project.property("runTeardown"))
33+
}
34+
if (project.hasProperty("runSuiteTeardown")) {
35+
runSuiteTeardown = Boolean.parseBoolean(project.property("runSuiteTeardown"))
36+
}
37+
38+
println "Run teardown scripts: " + runTeardown
39+
println "Run suite teardown scripts: " + runSuiteTeardown
40+
println "Running all suites..."
41+
long start = System.currentTimeMillis()
42+
def suites = testManager.runAllSuites(runTeardown, runSuiteTeardown)
43+
println "Done running all suites; time: " + (System.currentTimeMillis() - start) + "ms"
2944
def report = new DefaultJUnitTestReporter().reportOnJUnitTestSuites(suites)
3045
println report
3146

0 commit comments

Comments
 (0)