-
Couldn't load subscription status.
- Fork 80
Setup Test Resources
If the mlTestRestPort property is specified in your gradle.properties file and given a port number value, then the next time you deploy your MarkLogic application, the following additional resources are created.
- A test database with a default name of
${mlAppName}-test-content- The database properties are a replica of
${mlAppName}-content
- The database properties are a replica of
- A test REST server named
${mlAppName}-test- The application server properties are a replica of
${mlAppName} - The database points to
${mlAppName}-test-content - The modules database points to
${mlAppName}-modules
- The application server properties are a replica of
The benefit of having a separate test database is that you can run tests, such as with marklogic-unit-test, against the test database without the tests being impacted by data in your main database. Additionally, the marklogic-junit5 library attempts to clear most of the database before it runs a test. You may not want that done against your main database, which may contain a large amount of data that you use for ad hoc testing.
Assuming the use of a file named content-database.json in the databases directory - e.g. src/main/ml-config/databases/content-database.json - ml-gradle will then apply any updates made in content-database.json to both the main and test content databases. For this to work though, the content-database.json must contain the following:
"database-name": "%%DATABASE%%",
ml-gradle will first replace the %%DATABASE%% token with the main content database name and update that database. It will then update that token with the test database name and update that database.
As of version 3.3.1, the names of the REST server and test REST server can be modified by manipulating the mlAppConfig object in build.gradle:
ext {
mlAppConfig.restServerName = "my-custom-name"
mlAppConfig.testRestServerName = "my-custom-test-name"
}