Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
.DS_Store
build
out
.classpath
.settings
.project
marklogic-unit-test-client/bin/
gradle-local.properties
.vscode
2 changes: 1 addition & 1 deletion .travis/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ] ; then
cd ml-unit-test-client
cd marklogic-unit-test-client
../gradlew build test
fi
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Change Log

## [v0.12.0](https://github.com/marklogic-community/marklogic-unit-test/tree/v0.12.0) (2018-09-20)
[Full Changelog](https://github.com/marklogic-community/marklogic-unit-test/compare/0.11.2...v0.12.0)

**Merged pull requests:**

- Change to marklogic [\#40](https://github.com/marklogic-community/marklogic-unit-test/pull/40) ([dmcassel](https://github.com/dmcassel))

## [0.11.2](https://github.com/marklogic-community/marklogic-unit-test/tree/0.11.2) (2018-09-20)
[Full Changelog](https://github.com/marklogic-community/marklogic-unit-test/compare/0.11.1...0.11.2)

**Closed issues:**

- Unit testing with ml-data-hub:2.0.4 [\#34](https://github.com/marklogic-community/marklogic-unit-test/issues/34)
- Set up github pages for docs [\#24](https://github.com/marklogic-community/marklogic-unit-test/issues/24)

**Merged pull requests:**

- Expand support for http helpers for REST tests [\#39](https://github.com/marklogic-community/marklogic-unit-test/pull/39) ([ryanjdew](https://github.com/ryanjdew))
- better error reporting; added helpers [\#35](https://github.com/marklogic-community/marklogic-unit-test/pull/35) ([dmcassel](https://github.com/dmcassel))
- Issue 13: Report suite-setup.xqy failures [\#33](https://github.com/marklogic-community/marklogic-unit-test/pull/33) ([jonesyface](https://github.com/jonesyface))
- Issue 28 [\#31](https://github.com/marklogic-community/marklogic-unit-test/pull/31) ([dmcassel](https://github.com/dmcassel))
- adding new files [\#30](https://github.com/marklogic-community/marklogic-unit-test/pull/30) ([dmcassel](https://github.com/dmcassel))
- Adding travis support [\#27](https://github.com/marklogic-community/marklogic-unit-test/pull/27) ([paxtonhare](https://github.com/paxtonhare))

## [0.11.1](https://github.com/marklogic-community/marklogic-unit-test/tree/0.11.1) (2018-06-05)
[Full Changelog](https://github.com/marklogic-community/marklogic-unit-test/compare/0.11...0.11.1)

**Fixed bugs:**

- assert-equal-json should ignore key order [\#19](https://github.com/marklogic-community/marklogic-unit-test/issues/19)

**Closed issues:**

- Configure code coverage via REST endpoint [\#15](https://github.com/marklogic-community/marklogic-unit-test/issues/15)

**Merged pull requests:**

- fixing \#19 [\#22](https://github.com/marklogic-community/marklogic-unit-test/pull/22) ([paxtonhare](https://github.com/paxtonhare))
- adding param to enable codeCoverage via ml-unit-test.xqy endpoint and… [\#20](https://github.com/marklogic-community/marklogic-unit-test/pull/20) ([hansenmc](https://github.com/hansenmc))
- run setup/teardown with coverage and ensure all executed lines included in wanted lines [\#18](https://github.com/marklogic-community/marklogic-unit-test/pull/18) ([hansenmc](https://github.com/hansenmc))

## [0.11](https://github.com/marklogic-community/marklogic-unit-test/tree/0.11) (2018-05-22)
[Full Changelog](https://github.com/marklogic-community/marklogic-unit-test/compare/0.10.0...0.11)

**Closed issues:**

- Use ml-unit-test without depending on rjrudin bintray repository [\#9](https://github.com/marklogic-community/marklogic-unit-test/issues/9)

**Merged pull requests:**

- updating notice per legal [\#8](https://github.com/marklogic-community/marklogic-unit-test/pull/8) ([dmcassel](https://github.com/dmcassel))
- code coverage [\#4](https://github.com/marklogic-community/marklogic-unit-test/pull/4) ([hansenmc](https://github.com/hansenmc))
- Added functionality to output alternative report formats via user-defined XSLT [\#1](https://github.com/marklogic-community/marklogic-unit-test/pull/1) ([jonesyface](https://github.com/jonesyface))

## [0.10.0](https://github.com/marklogic-community/marklogic-unit-test/tree/0.10.0) (2018-05-02)
[Full Changelog](https://github.com/marklogic-community/marklogic-unit-test/compare/0.9.1...0.10.0)

**Closed issues:**

- TestManager does not run teardown or suiteTeardown [\#2](https://github.com/marklogic-community/marklogic-unit-test/issues/2)

**Merged pull requests:**

- run teardown by default [\#3](https://github.com/marklogic-community/marklogic-unit-test/pull/3) ([dmcassel](https://github.com/dmcassel))
- Teardown scripts are now invoked by default as part of a single test [\#7](https://github.com/marklogic-community/marklogic-unit-test/pull/7) ([rjrudin](https://github.com/rjrudin))
- Develop [\#6](https://github.com/marklogic-community/marklogic-unit-test/pull/6) ([dmcassel](https://github.com/dmcassel))

## [0.9.1](https://github.com/marklogic-community/marklogic-unit-test/tree/0.9.1) (2018-02-22)


\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
34 changes: 17 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to ml-unit-test
# Contributing to marklogic-unit-test

ml-unit-test welcomes new contributors. This document will guide you through
marklogic-unit-test welcomes new contributors. This document will guide you through
the process.

- [Question or Problem?](#question)
Expand Down Expand Up @@ -31,22 +31,22 @@ information will increase the chances of your issue being dealt with quickly:

* **Overview of the Issue** - if an error is being thrown a stack trace helps
* **Motivation for or Use Case** - explain why this is a bug for you
* **ml-unit-test Version** - is it a named version or from our dev branch
* **marklogic-unit-test Version** - is it a named version or from our dev branch
* **Operating System** - Mac, windows? details help
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
causing the problem (line of code or commit)

### Submitting a Pull Request

#### Fork ml-unit-test
#### Fork marklogic-unit-test

Fork the project [on GitHub](https://github.com/marklogic-community/ml-unit-test/fork) and clone
Fork the project [on GitHub](https://github.com/marklogic-community/marklogic-unit-test/fork) and clone
your copy.

```sh
$ git clone git@github.com:username/ml-unit-test.git
$ cd ml-unit-test
$ git remote add upstream git://github.com/marklogic-community/ml-unit-test.git
$ git clone git@github.com:username/marklogic-unit-test.git
$ cd marklogic-unit-test
$ git remote add upstream git://github.com/marklogic-community/marklogic-unit-test.git
```

All bug fixes and new features go into the dev branch.
Expand Down Expand Up @@ -118,17 +118,17 @@ $ git rebase upstream/dev

#### Test your code

We are working hard to improve ml-unit-test's testing. If you add new functions
then please write unit tests in `ml-unit-test-client/src/test/ml-modules/root/test/suites/`.
We are working hard to improve marklogic-unit-test's testing. If you add new functions
then please write unit tests in `marklogic-unit-test-client/src/test/ml-modules/root/test/suites/`.
When finished, verify that the self-test works.

To deploy the ml-unit-test project by itself, run the following commands:
To deploy the marklogic-unit-test project by itself, run the following commands:

- cd ml-unit-test-client
- cd marklogic-unit-test-client
- gradle mlDeploy

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

##### Running Tests in the GUI
Expand All @@ -137,7 +137,7 @@ Point a browser to http://localhost:8090/test/.

##### Running Tests with Gradle

From the `ml-unit-test-client` directory, run `gradle test`.
From the `marklogic-unit-test-client` directory, run `gradle test`.

Make sure that all tests pass. Please, do not submit patches that fail.

Expand All @@ -149,7 +149,7 @@ $ git push origin my-feature-branch

#### Submit the pull request

Go to https://github.com/username/ml-unit-test and select your feature branch.
Go to https://github.com/username/marklogic-unit-test and select your feature branch.
Click the 'Pull Request' button and fill out the form.

Pull requests are usually reviewed within a few days. If you get comments that
Expand Down Expand Up @@ -189,5 +189,5 @@ from the main (upstream) repository:
git pull --ff upstream dev
```

[issue tracker]: https://github.com/marklogic/ml-unit-test/issues
[.editorconfig]: http://editorconfig.org/
[issue tracker]: https://github.com/marklogic/marklogic-unit-test/issues
[.editorconfig]: http://editorconfig.org/
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
ml-unit-test includes the [original Roxy unit test framework for MarkLogic](https://github.com/marklogic-community/roxy/wiki/Unit-Testing) and
# MarkLogic Unit Test

marklogic-unit-test includes the [original Roxy unit test framework for MarkLogic](https://github.com/marklogic-community/roxy/wiki/Unit-Testing) and
provides a few new features:

1. A REST endpoint for listing and running unit tests
1. A small Java library for integrating MarkLogic unit tests into existing test frameworks like JUnit
1. The ability to depend on this module as a true third-party dependency via ml-gradle

To try this out locally, check out the [ml-gradle example project](https://github.com/marklogic-community/ml-gradle/tree/dev/examples/unit-test-project).
You can use that project's build.gradle file as an example of how to use ml-unit-test in your own project.
You can use that project's build.gradle file as an example of how to use marklogic-unit-test in your own project.

## Releasing

To do a release:

1. Increment the `version` property in `{PROJECT}/gradle.properties`
2. In `{PROJECT}/`, run `github_changelog_generator --token $your-github-token --future-release v1.0.0`

If running on Windows, you'll need to use different cache file paths, such as `--cache-file C:\tmp\github-changelog-http-cache --cache-log C:\tmp\github-changelog-logger.log`.

3. Commit the CHANGELOG.md
4. Push changes to GitHub
5. Do a PR to bring changes from the develop branch onto master
6. Follow steps at https://help.github.com/articles/creating-releases/.

### Publishing to bintray

To publish this project, you need to publish both marklogic-unit-test-modules and marklogic-unit-test-client.

1. In `{PROJECT}/gradle.properties`, add these properties `myBintrayUser`, `myBintrayKey`
2. `cd marklogic-unit-test-client`
3. `gradle bintrayUpload`
4. `cd ../marklogic-unit-test-modules`
5. `gradle bintrayUpload`
6. Point a browser to `https://bintray.com/marklogic-community/Maven/marklogic-unit-test-modules` and click "Publish"
6. Point a browser to `https://bintray.com/marklogic-community/Maven/marklogic-unit-test-client` and click "Publish"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=com.marklogic
version=0.11.2
version=0.12.0
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ publishing {
publications {
mainJava(MavenPublication) {
from components.java
artifactId "ml-unit-test-client"
artifactId "marklogic-unit-test-client"
}
sourcesJava(MavenPublication) {
from components.java
artifactId "ml-unit-test-client"
artifactId "marklogic-unit-test-client"
artifact sourcesJar
}
}
Expand All @@ -52,10 +52,11 @@ if (project.hasProperty("myBintrayUser")) {
key = myBintrayKey
publications = ["mainJava", "sourcesJava"]
pkg {
repo = "maven"
repo = "Maven"
name = project.name
userOrg = 'marklogic-community'
licenses = ["Apache-2.0"]
vcsUrl = "https://github.com/rjrudin/" + project.name + ".git"
vcsUrl = "https://github.com/marklogic-community/" + project.name + ".git"
version {
name = project.version
released = new Date()
Expand All @@ -75,7 +76,7 @@ import module namespace sec = "http://marklogic.com/xdmp/security"
declare option xdmp:mapping "false";

try {
sec:remove-credential("ml-unit-test-credentials")
sec:remove-credential("marklogic-unit-test-credentials")
} catch (\$e) {()};

xquery version "1.0-ml";
Expand All @@ -86,7 +87,7 @@ import module namespace sec = "http://marklogic.com/xdmp/security"
declare option xdmp:mapping "false";

sec:create-credential(
"ml-unit-test-credentials",
"marklogic-unit-test-credentials",
"Credentials for ML Rest Helper Calls",
"${mlUsername}",
"${mlPassword}",
Expand Down
13 changes: 13 additions & 0 deletions marklogic-unit-test-client/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These properties are used for the test application that ml-gradle deploys so we can test out marklogic-unit-test
mlAppName=marklogic-unit-test-testapp
mlHost=localhost
mlUsername=admin
mlPassword=admin
mlRestPort=8090

# Load both the marklogic-unit-test framework code and some test modules
mlModulePaths=../marklogic-unit-test-modules/src/main/ml-modules,src/test/ml-modules

# This defaults to src/main/ml-config, but marklogic-unit-test doesn't have any configuration files itself. So the config
# files are stored under src/test for the sole purpose of running tests on marklogic-unit-test.
mlConfigPath=src/test/ml-config
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import java.util.List;

/**
* Provides methods for talking to the ml-unit-test REST extension.
* Provides methods for talking to the marklogic-unit-test REST extension.
*/
public class TestManager extends ResourceManager {

public final static String FORMAT_JUNIT = "junit";

/**
* The "none" format means that the XML will be returned from the ml-unit-test endpoint without any additional
* The "none" format means that the XML will be returned from the marklogic-unit-test endpoint without any additional
* formatting applied to it.
*/
public final static String FORMAT_NONE = "";
Expand All @@ -31,7 +31,7 @@ public TestManager(DatabaseClient client) {
public TestManager(DatabaseClient client, ServiceResponseUnmarshaller unitTestXmlParser) {
super();
this.unitTestXmlParser = unitTestXmlParser;
client.init("ml-unit-test", this);
client.init("marklogic-unit-test", this);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ task sourcesJar(type: Jar) {
}

task modulesJar(type: Jar) {
description = "Jar up the ml-unit-test MarkLogic modules into a package that can be published"
description = "Jar up the marklogic-unit-test MarkLogic modules into a package that can be published"
from("src/main/ml-modules") {
into("ml-unit-test-modules/ml-modules")
into("marklogic-unit-test-modules/ml-modules")
}
destinationDir file("build/libs")
baseName "ml-unit-test-modules"
baseName "marklogic-unit-test-modules"
}

// Define the artifacts, in addition to the jar registered by the "java" plugin
Expand All @@ -36,11 +36,11 @@ artifacts {
publishing {
publications {
sourcesJava(MavenPublication) {
artifactId "ml-unit-test-modules"
artifactId "marklogic-unit-test-modules"
artifact sourcesJar
}
mainModules(MavenPublication) {
artifactId "ml-unit-test-modules"
artifactId "marklogic-unit-test-modules"
artifact modulesJar
}
}
Expand All @@ -52,10 +52,11 @@ if (project.hasProperty("myBintrayUser")) {
key = myBintrayKey
publications = ["sourcesJava", "mainModules"]
pkg {
repo = "maven"
repo = "Maven"
name = project.name
userOrg = 'marklogic-community'
licenses = ["Apache-2.0"]
vcsUrl = "https://github.com/rjrudin/" + project.name + ".git"
vcsUrl = "https://github.com/marklogic-community/" + project.name + ".git"
version {
name = project.version
released = new Date()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Convert default ml-unit-test report XML output to valid JUnit report XML
Convert default marklogic-unit-test report XML output to valid JUnit report XML
-->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
Expand Down Expand Up @@ -83,4 +83,4 @@
<xsl:value-of select="."/>
</xsl:template>

</xsl:stylesheet>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ declare private function helper:assert-throws-error_($function as xdmp:function,
declare variable $local-url as xs:string := xdmp:get-request-protocol() || "://localhost:" || xdmp:get-request-port();
declare variable $helper:DEFAULT_HTTP_OPTIONS := element xdmp-http:options {
let $credential-id := xdmp:invoke-function(function() {
xdmp:apply(xdmp:function(xs:QName('sec:credential-get-id'), "/MarkLogic/security.xqy"), "ml-unit-test-credentials")
xdmp:apply(xdmp:function(xs:QName('sec:credential-get-id'), "/MarkLogic/security.xqy"), "marklogic-unit-test-credentials")
}, map:entry("database", xdmp:security-database()))
return
element xdmp-http:credential-id {$credential-id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<xsl:template name="html-head">
<head>
<title>ml-unit-test</title>
<title>marklogic-unit-test</title>
<link rel="stylesheet" type="text/css" href="css/coverage.css" />
</head>
</xsl:template>
Expand All @@ -43,4 +43,4 @@
<xsl:value-of select="if ($wanted ne 0) then min((100, round(100 * $covered div $wanted))) else 0"/>
</xsl:function>

</xsl:stylesheet>
</xsl:stylesheet>
Loading