Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
#307 Only removing ID property for databases for 3.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrudin committed Oct 12, 2018
1 parent 90c4cd5 commit ecc5858
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group=com.marklogic
javadocsDir=../gh-pages-marklogic-java/javadocs
version=3.9.0
version=3.9.1
mlJavaclientUtilVersion=3.8.1
mlJunitVersion=3.1.0

Empty file modified src/main/java/com/marklogic/mgmt/AbstractManager.java
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.marklogic.mgmt.ManageClient;
import com.marklogic.mgmt.resource.forests.ForestManager;
import com.marklogic.rest.util.Fragment;
import org.springframework.http.ResponseEntity;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -20,7 +21,28 @@ public DatabaseManager(ManageClient manageClient) {
super(manageClient);
}

/**
/**
* This is being added in 3.9.1 to add support for when a database is updated by a user that only has privileges
* to update indexes. In such a scenario, the database-name property cannot exist, even if it's not changing. It's
* also not needed, because the URL for the request specifies the database to update.
*
* It may be safe to make this change for all resource property updates, but it's only being applied for databases
* since that's the immediate need for the Data Hub Framework.
*
* @param client
* @param path
* @param payload
* @return
*/
@Override
protected ResponseEntity<String> putPayload(ManageClient client, String path, String payload) {
if (payloadParser.isJsonPayload(payload)) {
payload = payloadParser.excludeProperties(payload, getIdFieldName());
}
return super.putPayload(client, path, payload);
}

/**
* This will catch and log any exception by default, as the most frequent reason why this fails is because the
* database doesn't exist yet.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.marklogic.appdeployer.command.databases;

import com.marklogic.appdeployer.AbstractAppDeployerTest;
import org.junit.Test;

import java.io.File;

public class CreateAndUpdateDatabaseTest extends AbstractAppDeployerTest {

/**
* TODO Update this test to perform the second deployment as a user that only has privileges to update indexes.
*
*/
@Test
public void test() {
appConfig.getFirstConfigDir().setBaseDir(new File("src/test/resources/sample-app/db-only-config"));

DeployContentDatabasesCommand command = new DeployContentDatabasesCommand(1);
initializeAppDeployer(command);

try {
deploySampleApp();
deploySampleApp();
} finally {
undeploySampleApp();
}
}
}

0 comments on commit ecc5858

Please sign in to comment.