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

Commit 4758386

Browse files
committed
#183 Added mlForestsPerHost
1 parent 56d70b4 commit 4758386

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
group=com.marklogic
22
javadocsDir=../gh-pages-marklogic-java/javadocs
3-
version=3.0-alpha3
4-
mlJavaclientUtilVersion=3.0-alpha3
3+
version=3.0-beta1
4+
mlJavaclientUtilVersion=3.0-beta1

src/main/java/com/marklogic/appdeployer/DefaultAppConfigFactory.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,18 @@ public AppConfig newAppConfig() {
231231
c.setContentForestsPerHost(Integer.parseInt(prop));
232232
}
233233

234+
/**
235+
* For any database besides the content database, configure the number of forests per host.
236+
*/
237+
prop = getProperty("mlForestsPerHost");
238+
if (prop != null) {
239+
logger.info("Forests per host: " + prop);
240+
String[] tokens = prop.split(",");
241+
for (int i = 0; i < tokens.length; i += 2) {
242+
c.getForestCounts().put(tokens[i], Integer.parseInt(tokens[i + 1]));
243+
}
244+
}
245+
234246
/**
235247
* This property can specify a comma-delimited list of database names and replica counts as a simple way of
236248
* setting up forest replicas - e.g. Documents,1,Security,2.

src/test/java/com/marklogic/appdeployer/DefaultAppConfigFactoryTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.marklogic.appdeployer;
22

33
import java.util.List;
4+
import java.util.Map;
45
import java.util.Properties;
56

67
import com.marklogic.client.DatabaseClientFactory;
@@ -102,6 +103,7 @@ public void allProperties() {
102103
p.setProperty("mlAppServicesSimpleSsl", "true");
103104

104105
p.setProperty("mlContentForestsPerHost", "17");
106+
p.setProperty("mlForestsPerHost", "some-db,2,other-db,3");
105107
p.setProperty("mlModulePermissions", "some-perm,read,some-perm,update");
106108
p.setProperty("mlAdditionalBinaryExtensions", ".gradle,.properties");
107109
p.setProperty("mlConfigPath", "src/test/resources/sample-app/empty-ml-config");
@@ -167,6 +169,9 @@ public void allProperties() {
167169
assertEquals(DatabaseClientFactory.SSLHostnameVerifier.ANY, config.getAppServicesSslHostnameVerifier());
168170

169171
assertEquals((Integer) 17, config.getContentForestsPerHost());
172+
Map<String, Integer> forestCounts = config.getForestCounts();
173+
assertEquals(2, (int)forestCounts.get("some-db"));
174+
assertEquals(3, (int)forestCounts.get("other-db"));
170175
assertEquals("some-perm,read,some-perm,update", config.getModulePermissions());
171176
String[] extensions = config.getAdditionalBinaryExtensions();
172177
assertEquals(".gradle", extensions[0]);

0 commit comments

Comments
 (0)