Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete user schemas from user schemas database only #416

Merged
merged 3 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to update this? If so, I would do it via a separate PR with an explanation of why it's being updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

com.github.jk1.dependency-license-report" version "1.3" requires at least grade version 3.3
As discussed, upgraded to gradle wrapper version 4.10.2

18 changes: 13 additions & 5 deletions src/main/groovy/com/marklogic/gradle/task/MarkLogicTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,29 @@ class MarkLogicTask extends DefaultTask {
project.hasProperty("mlAdminPassword") ? project.property("mlAdminPassword") : project.property("mlPassword")
}

DatabaseClient newClient() {
newClient(null)
}

/**
* If the "database" property is set, then the DatabaseClient that's returned will use the App-Services port
* (defaults to 8000) to connect to the given database. Otherwise, the DatabaseClient will try to connect to the
* REST API server defined by mlRestPort.
* If the "database" property is set or is passed as a parameter, then the DatabaseClient that's returned will use
* the App-Services port (defaults to 8000) to connect to the given database. Otherwise, the DatabaseClient will
* try to connect to the REST API server defined by mlRestPort.
* @return
*/
DatabaseClient newClient() {
DatabaseClient newClient(String database) {
if (project.hasProperty("database")) {
println "Connecting via the App-Services port to database: " + project.property("database")
return getAppConfig().newAppServicesDatabaseClient(project.property("database"))
}
else if (database != null){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should come first - if a client passes in a non-null value, use that. Else, check for the project property. Else, call newDatabaseClient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cabc11f changes the proirity of task property.

println "Connecting via the App-Services port to database: " + database
return getAppConfig().newAppServicesDatabaseClient(database)
}
else {
getAppConfig().newDatabaseClient()
}
}
}

void deployWithCommandListProperty(String propertyName) {
deployWithCommands(getProject().property(propertyName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DeleteUserSchemasTask extends MarkLogicTask {
String fullQuery = "cts:uris((), (), " + xquery + ") ! xdmp:document-delete(.)"
println "Deleting user schemas in database '" + database + "' via : " + fullQuery

def client = newClient()
def client = newClient(database)
try {
client.newServerEval().xquery(fullQuery).eval()
} finally {
Expand Down