Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrudin committed May 2, 2018
2 parents ff49df5 + e187946 commit 9a257cd
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
compile mlDataMovementDependency
compile group: 'commons-io', name: 'commons-io', version: '2.5'

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

testCompile localGroovy()
testCompile gradleTestKit()
Expand Down
8 changes: 5 additions & 3 deletions examples/unit-test-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
buildscript {
repositories {
jcenter()
mavenLocal()

// Needed for ml-unit-test-client dependency until it's available via jcenter()
maven {
url {"https://dl.bintray.com/rjrudin/maven/"}
}
}
dependencies {
classpath "com.marklogic:ml-unit-test-client:0.9.1"
classpath "com.marklogic:ml-unit-test-client:${mlUnitTestVersion}"
classpath "com.marklogic:ml-gradle:${mlGradleVersion}"
}
}
Expand All @@ -18,6 +19,7 @@ apply plugin: "com.marklogic.ml-gradle"

repositories {
jcenter()
mavenLocal()

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

dependencies {
mlRestApi "com.marklogic:ml-unit-test:0.9.1"
mlRestApi "com.marklogic:ml-unit-test:${mlUnitTestVersion}"

// For running ml-unit-test tests via JUnit
testCompile "com.marklogic:ml-unit-test-client:0.9.1"
testCompile "com.marklogic:ml-unit-test-client:${mlUnitTestVersion}"
testCompile "junit:junit:4+"
}
3 changes: 2 additions & 1 deletion examples/unit-test-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mlGradleVersion=3.6.0
mlGradleVersion=3.6.3
mlUnitTestVersion=0.10.0

mlHost=localhost
mlAppName=unit-test-example
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xdmp:log("Suite teardown")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xdmp:log("Test teardown")
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
group=com.marklogic
version=3.6.2
mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.6.2
version=3.6.3

mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.6.3
mlcpUtilDependency=com.marklogic:mlcp-util:0.9.0
mlDataMovementDependency=com.marklogic:marklogic-data-movement-components:1.0
mlUnitTestDependency=com.marklogic:ml-unit-test-client:0.10.0
3 changes: 2 additions & 1 deletion src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ class MarkLogicPlugin implements Plugin<Project> {
"Can use -PsuiteName to override the name of the test suite, and -PtestName to override the name of the test module.")
project.task("mlUnitTest", type: UnitTestTask, group: unitTestGroup, description: "Run tests found under /test/suites in the modules database. " +
"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. " +
"Use -PunitTestResultPath to override where test result files are written, which defaults to build/test-results/marklogic-unit-test.")
"Use -PunitTestResultPath to override where test result files are written, which defaults to build/test-results/marklogic-unit-test. " +
"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. ")

logger.info("Finished initializing ml-gradle\n")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,22 @@ class UnitTestTask extends MarkLogicTask {
def client = appConfig.getTestRestPort() != null ? appConfig.newTestDatabaseClient() : appConfig.newDatabaseClient()
try {
def testManager = new TestManager(client)
def suites = testManager.runAllSuites()

boolean runTeardown = true
boolean runSuiteTeardown = true
if (project.hasProperty("runTeardown")) {
runTeardown = Boolean.parseBoolean(project.property("runTeardown"))
}
if (project.hasProperty("runSuiteTeardown")) {
runSuiteTeardown = Boolean.parseBoolean(project.property("runSuiteTeardown"))
}

println "Run teardown scripts: " + runTeardown
println "Run suite teardown scripts: " + runSuiteTeardown
println "Running all suites..."
long start = System.currentTimeMillis()
def suites = testManager.runAllSuites(runTeardown, runSuiteTeardown)
println "Done running all suites; time: " + (System.currentTimeMillis() - start) + "ms"
def report = new DefaultJUnitTestReporter().reportOnJUnitTestSuites(suites)
println report

Expand Down

0 comments on commit 9a257cd

Please sign in to comment.