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

Commit ecc5858

Browse files
committed
#307 Only removing ID property for databases for 3.9.1
1 parent 90c4cd5 commit ecc5858

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
group=com.marklogic
22
javadocsDir=../gh-pages-marklogic-java/javadocs
3-
version=3.9.0
3+
version=3.9.1
44
mlJavaclientUtilVersion=3.8.1
55
mlJunitVersion=3.1.0
66

src/main/java/com/marklogic/mgmt/AbstractManager.java

100644100755
File mode changed.

src/main/java/com/marklogic/mgmt/resource/databases/DatabaseManager.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.marklogic.mgmt.ManageClient;
55
import com.marklogic.mgmt.resource.forests.ForestManager;
66
import com.marklogic.rest.util.Fragment;
7+
import org.springframework.http.ResponseEntity;
78

89
import java.util.ArrayList;
910
import java.util.List;
@@ -20,7 +21,28 @@ public DatabaseManager(ManageClient manageClient) {
2021
super(manageClient);
2122
}
2223

23-
/**
24+
/**
25+
* This is being added in 3.9.1 to add support for when a database is updated by a user that only has privileges
26+
* to update indexes. In such a scenario, the database-name property cannot exist, even if it's not changing. It's
27+
* also not needed, because the URL for the request specifies the database to update.
28+
*
29+
* It may be safe to make this change for all resource property updates, but it's only being applied for databases
30+
* since that's the immediate need for the Data Hub Framework.
31+
*
32+
* @param client
33+
* @param path
34+
* @param payload
35+
* @return
36+
*/
37+
@Override
38+
protected ResponseEntity<String> putPayload(ManageClient client, String path, String payload) {
39+
if (payloadParser.isJsonPayload(payload)) {
40+
payload = payloadParser.excludeProperties(payload, getIdFieldName());
41+
}
42+
return super.putPayload(client, path, payload);
43+
}
44+
45+
/**
2446
* This will catch and log any exception by default, as the most frequent reason why this fails is because the
2547
* database doesn't exist yet.
2648
*
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.marklogic.appdeployer.command.databases;
2+
3+
import com.marklogic.appdeployer.AbstractAppDeployerTest;
4+
import org.junit.Test;
5+
6+
import java.io.File;
7+
8+
public class CreateAndUpdateDatabaseTest extends AbstractAppDeployerTest {
9+
10+
/**
11+
* TODO Update this test to perform the second deployment as a user that only has privileges to update indexes.
12+
*
13+
*/
14+
@Test
15+
public void test() {
16+
appConfig.getFirstConfigDir().setBaseDir(new File("src/test/resources/sample-app/db-only-config"));
17+
18+
DeployContentDatabasesCommand command = new DeployContentDatabasesCommand(1);
19+
initializeAppDeployer(command);
20+
21+
try {
22+
deploySampleApp();
23+
deploySampleApp();
24+
} finally {
25+
undeploySampleApp();
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)