Skip to content

Commit 8bf7df5

Browse files
committed
Merge branch 'develop'
2 parents 63a8aa4 + 61f2db7 commit 8bf7df5

39 files changed

+636
-795
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,17 @@ When finished, verify that the self-test works.
124124
To deploy the marklogic-unit-test project by itself, run the following commands:
125125

126126
- cd marklogic-unit-test-client
127-
- gradle mlDeploy
127+
- ../gradlew -i mlDeploy
128128

129-
That process will create an application server on port 8090 (create a file
129+
That process will create an application server on port 8008 (create a file
130130
marklogic-unit-test-client/gradle-local.properties and copy the `mlRestPort` property
131131
to change the port.)
132132

133+
For modifications to code in the ./marklogic-junit 5 project, please see the README file in that project.
134+
133135
##### Running Tests in the GUI
134136

135-
Point a browser to http://localhost:8090/test/.
137+
Point a browser to http://localhost:8008/test/.
136138

137139
##### Running Tests with Gradle
138140

README.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,51 @@ Testing MarkLogic from a Java project is made easy with marklogic-junit5:
1919

2020
MarkLogic unit test can easily be integrated into your project as an [ml-bundle](https://github.com/marklogic-community/ml-gradle/wiki/Bundles).
2121
The following steps will configure a project to import and use marklogic-unit-tests.
22-
23-
If you'd like to skip straight to the end, you can check out a [working example project](https://github.com/marklogic-community/ml-gradle/tree/dev/examples/unit-test-project).
22+
23+
If you'd like to skip straight to the end, you can check out a [working example project](https://github.com/marklogic-community/ml-gradle/tree/dev/examples/unit-test-project).
2424
You can use that project's `build.gradle` file as an example of how to use marklogic-unit-test in your own project.
2525

2626
### Add marklogic-unit-test to `build.gradle`
2727

2828
```groovy
2929
buildscript {
3030
repositories {
31-
jcenter()
32-
mavenLocal()
31+
mavenCentral()
3332
}
3433
dependencies {
35-
classpath "com.marklogic:marklogic-unit-test-client:1.0.0"
36-
classpath "com.marklogic:ml-gradle:3.14.0"
34+
classpath "com.marklogic:marklogic-unit-test-client:1.1.0"
35+
classpath "com.marklogic:ml-gradle:4.2.1"
3736
}
3837
}
3938
4039
apply plugin: "com.marklogic.ml-gradle"
4140
4241
repositories {
43-
jcenter()
42+
mavenCentral()
4443
}
4544
4645
dependencies {
47-
mlBundle "com.marklogic:marklogic-unit-test-modules:1.0.0"
46+
mlBundle "com.marklogic:marklogic-unit-test-modules:1.1.0"
4847
}
4948
```
5049

5150
### Add Test Properties to `gradle.properties`
5251

5352
```properties
54-
// Settings for any ml-gradle project
55-
mlHost=localhost // Assuming local development
56-
mlAppName=my-app // Application name, defaults to my-app
57-
mlRestPort=8003 // Application Port, defaults to 8003
58-
mlUsername= // Username used to manage MarkLogic
59-
mlPassword= // Password used to manage MarkLogic
53+
# Settings for any ml-gradle project
54+
mlHost=localhost # Assuming local development
55+
mlAppName=my-app # Application name, defaults to my-app
56+
mlRestPort=8003 # Application Port, defaults to 8003
57+
mlUsername= # Username used to manage MarkLogic
58+
mlPassword= # Password used to manage MarkLogic
6059

6160

62-
// Settings specific to marklogic-unit-test
63-
mlTestRestPort=8004 // Testing port, view and run tests from this port
61+
# Settings specific to marklogic-unit-test
62+
mlTestRestPort=8004 # Testing port, view and run tests from this port
6463

65-
// ml-gradle supports deploying to multiple environments (https://github.com/marklogic-community/ml-gradle/wiki/Configuring-ml-gradle#environment-based-properties).\
66-
// Add the following line to gradle-{env}.properties files for which you would like to deploy the tests. Typically
67-
// tests are only deployed to environments that execute automated tests, like local development and CI environments.
64+
# ml-gradle supports deploying to multiple environments (https://github.com/marklogic-community/ml-gradle/wiki/Configuring-ml-gradle#environment-based-properties).\
65+
# Add the following line to gradle-{env}.properties files for which you would like to deploy the tests. Typically
66+
# tests are only deployed to environments that execute automated tests, like local development and CI environments.
6867
mlModulePaths=src/main/ml-modules,src/test/ml-modules
6968
```
7069

@@ -94,6 +93,11 @@ Creating test suites is easy using the mlGenerateUnitTestSuite gradle task. Run
9493
./gradlew mlGenerateUnitTestSuite
9594
```
9695

96+
More options exist for mlGenerateUnitTestSuite, consult the gradle help
97+
```sh
98+
./gradlew help --task mlGenerateUnitTestSuite
99+
```
100+
97101
Now a new test suite has been generated in `src/test/ml-modules/root/test/suites` called `SampleTestSuite`.
98102

99103
If `mlWatch` is being used, refreshing the web browser at http://localhost:8004/test/ will now show the newly created

build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
subprojects {
2+
apply plugin: "java-library"
3+
apply plugin: "maven-publish"
4+
apply plugin: "signing"
5+
6+
group = "com.marklogic"
7+
version = "1.1.0"
8+
9+
sourceCompatibility = "8"
10+
targetCompatibility = "8"
11+
12+
repositories {
13+
mavenCentral()
14+
15+
// For local development
16+
mavenLocal()
17+
}
18+
19+
javadoc.failOnError = false
20+
// Ignores warnings on params that don't have descriptions, which is a little too noisy
21+
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
22+
}

gradle.properties

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
group=com.marklogic
2-
version=1.0.0
1+
# Define these on the command line to publish to OSSRH
2+
# See https://central.sonatype.org/publish/publish-gradle/#credentials for more information
3+
mavenCentralUsername=
4+
mavenCentralPassword=
5+
mavenCentralUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
6+
#signing.keyId=YourKeyId
7+
#signing.password=YourPublicKeyPassword
8+
#signing.secretKeyRingFile=PathToYourKeyRingFile

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
6+
# Using 6.9 until ml-gradle 4.3 is available, which will support 7.x
7+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip

marklogic-junit5/README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,25 @@ public class SearchTest extends AbstractSpringMarkLogicTest {
3939
If you'd like to use marklogic-junit5 on a regular ml-gradle project (not a DHF project), then
4040
start with the ml-gradle example project to see a working example with instructions on how to get started.
4141

42-
## Getting started on a Data Hub Framework project
42+
## Getting started on a Data Hub Framework project
4343

44-
If you're working on a Data Hub Framework (DHF) project and you're like to start writing JUnit tests to verify your application
45-
features, then check out the DHF example project to see a working example with instructions on how to get started.
44+
As of DHF 5.5, support exists within DHF 5 for writing tests and should be used instead of this project.
45+
See [this example project](https://github.com/marklogic/marklogic-data-hub/tree/master/examples/reference-entity-model#testing-support)
46+
for more information.
4647

48+
If you're using DHF 4, see [the DHF 4 example project](https://github.com/marklogic-community/marklogic-unit-test/tree/1.0.0/marklogic-junit5/examples/simple-dhf4)
49+
from the 1.0.0 tag of this repository.
50+
51+
## Running the tests within this project
52+
53+
If you'd like to run the tests within this project, you'll first need to create a gradle-local.properties file in this
54+
project that defines your admin user's password - e.g.
55+
56+
mlPassword=admin
57+
58+
The tests will make use of MarkLogic's out-of-the-box Documents database. Be sure you do not have anything of importance
59+
in this database, as it will be cleared before each test is run.
60+
61+
You can then run the tests via Gradle:
62+
63+
../gradlew clean test

marklogic-junit5/build.gradle

Lines changed: 70 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,90 @@
11
plugins {
2-
id "java"
3-
id "maven-publish"
4-
id "com.jfrog.bintray" version "1.8.4"
5-
id "com.github.jk1.dependency-license-report" version "1.3"
6-
id "net.saliman.properties" version "1.4.6"
7-
}
8-
9-
sourceCompatibility = "1.8"
10-
targetCompatibility = "1.8"
11-
12-
repositories {
13-
jcenter()
2+
id "com.github.jk1.dependency-license-report" version "1.17"
143
}
154

165
dependencies {
17-
compile project(":marklogic-unit-test-client")
18-
compile "com.marklogic:ml-javaclient-util:3.11.0"
19-
compile "jaxen:jaxen:1.1.6"
20-
compile "org.junit.jupiter:junit-jupiter-api:5.4.1"
21-
compile "org.junit.jupiter:junit-jupiter-params:5.4.1"
22-
compile "org.springframework:spring-context:5.0.8.RELEASE"
23-
compile "org.springframework:spring-test:5.0.8.RELEASE"
6+
api project(":marklogic-unit-test-client")
7+
api "com.marklogic:ml-javaclient-util:4.3.0"
8+
api "org.jdom:jdom2:2.0.6"
9+
api "org.junit.jupiter:junit-jupiter:5.7.2"
10+
api "org.springframework:spring-context:5.3.9"
11+
api "org.springframework:spring-test:5.3.9"
12+
api "com.fasterxml.jackson.core:jackson-databind:2.11.1"
13+
api "org.slf4j:slf4j-api:1.7.31"
2414

25-
// Support for DHF is provided, but a client must specify their own version of the DHF library to use
26-
compileOnly ("com.marklogic:marklogic-data-hub:4.2.2") {
27-
exclude module: "ml-javaclient-util"
28-
}
15+
implementation "jaxen:jaxen:1.2.0"
2916

30-
// Needed by Gradle 4.6+ - see https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-gradle/
31-
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.4.1"
17+
testImplementation "org.junit.jupiter:junit-jupiter:5.7.2"
3218

3319
// Forcing Spring to use logback instead of commons-logging
34-
testRuntime "ch.qos.logback:logback-classic:1.1.8"
35-
testRuntime group: "org.slf4j", name: "jcl-over-slf4j", version: "1.7.22"
36-
testRuntime group: "org.slf4j", name: "slf4j-api", version: "1.7.22"
20+
testImplementation "ch.qos.logback:logback-classic:1.2.4"
21+
testImplementation "org.slf4j:jcl-over-slf4j:1.7.31"
22+
testImplementation "org.slf4j:slf4j-api:1.7.31"
3723
}
3824

39-
// Needed by Gradle 4.6+ - see https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-gradle/
4025
test {
4126
useJUnitPlatform()
4227
}
4328

4429
task sourcesJar(type: Jar, dependsOn: classes) {
45-
classifier "sources"
46-
from sourceSets.main.allJava
30+
classifier 'sources'
31+
from sourceSets.main.allSource
4732
}
4833

49-
publishing {
50-
publications {
51-
mainJava(MavenPublication) {
52-
from components.java
53-
artifactId project.name
54-
}
55-
sourcesJava(MavenPublication) {
56-
from components.java
57-
artifactId project.name
58-
artifact sourcesJar
59-
}
60-
}
34+
task javadocJar(type: Jar, dependsOn: javadoc) {
35+
classifier "javadoc"
36+
from javadoc
6137
}
6238

63-
if (project.hasProperty("myBintrayUser")) {
64-
bintray {
65-
user = myBintrayUser
66-
key = myBintrayKey
67-
publications = ["mainJava", "sourcesJava"]
68-
pkg {
69-
repo = "Maven"
70-
name = project.name
71-
userOrg = 'marklogic-community'
72-
licenses = ["Apache-2.0"]
73-
vcsUrl = "https://github.com/marklogic-community/marklogic-unit-test.git"
74-
version {
75-
name = project.version
76-
released = new Date()
77-
}
78-
}
79-
}
39+
artifacts {
40+
archives javadocJar, sourcesJar
41+
}
42+
signing {
43+
sign configurations.archives
44+
}
45+
46+
publishing {
47+
publications {
48+
mainJava(MavenPublication) {
49+
pom {
50+
name = "${group}:${project.name}"
51+
description = "Supports testing MarkLogic applications"
52+
packaging = "jar"
53+
url = "https://github.com/marklogic-community/${project.name}"
54+
licenses {
55+
license {
56+
name = "The Apache License, Version 2.0"
57+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
58+
}
59+
}
60+
developers {
61+
developer {
62+
id = "marklogic"
63+
name = "MarkLogic Github Contributors"
64+
65+
organization = "MarkLogic"
66+
organizationUrl = "https://www.marklogic.com"
67+
}
68+
}
69+
scm {
70+
url = "[email protected]:marklogic-community/${project.name}.git"
71+
connection = "scm:[email protected]:marklogic-community/${project.name}.git"
72+
developerConnection = "scm:[email protected]:marklogic-community/${project.name}.git"
73+
}
74+
}
75+
from components.java
76+
artifact sourcesJar
77+
artifact javadocJar
78+
}
79+
}
80+
repositories {
81+
maven {
82+
name = "central"
83+
url = mavenCentralUrl
84+
credentials {
85+
username mavenCentralUsername
86+
password mavenCentralPassword
87+
}
88+
}
89+
}
8090
}

marklogic-junit5/examples/simple-dhf4/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

marklogic-junit5/examples/simple-dhf4/README.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)