ramz123
ramz123

Reputation: 199

How to run mlunittest in adidfferent database in marklogic

I am running mlunittest in my FINAL database currently and it causing failure of some unittest cases. Is there any way to run the test cases in a different database

Upvotes: 0

Views: 49

Answers (2)

grtjn
grtjn

Reputation: 20414

It is easy enough to target mlUnitTest to a different app-server, as pointed out by @rjrudin. It basically comes down to adding this to your build.gradle, and tweaking it as needed:

ext {
  mlUnitTest.databaseClientConfig.host = mlHost
  mlUnitTest.databaseClientConfig.port = 8880 // probably a port that differs from mlRestPort and mlTestRestPort
  mlUnitTest.databaseClientConfig.username = mlUsername
  mlUnitTest.databaseClientConfig.password = mlPassword
  // Other properties that can be set
  // mlUnitTest.databaseClientConfig.securityContextType
  // mlUnitTest.databaseClientConfig.database
  // mlUnitTest.databaseClientConfig.sslContext
  // mlUnitTest.databaseClientConfig.sslHostnameVerifier
  // mlUnitTest.databaseClientConfig.certFile
  // mlUnitTest.databaseClientConfig.certPassword 
  // mlUnitTest.databaseClientConfig.externalName
  // mlUnitTest.databaseClientConfig.trustManager
}

Note that DHF comes with app servers for FINAL as well as STAGING, but if you added an additional test-content database, you will also need to add a separate app server pointing to that database.

HTH!

Upvotes: 0

rjrudin
rjrudin

Reputation: 2236

See https://github.com/marklogic-community/ml-gradle/tree/master/examples/unit-test-project for examples of how to configure which app server the mlUnitTest task talks to.

Upvotes: 1

Related Questions