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

Commit 732f71c

Browse files
committed
#78 Fixed issue with mlContentForestsPerHost not being supported
1 parent 9d9a747 commit 732f71c

File tree

4 files changed

+73
-1
lines changed

4 files changed

+73
-1
lines changed

CHANGELOG.mdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ml-app-deployer releases
22

3+
## 2.0rc4 - TBD
4+
5+
* [#78](https://github.com/rjrudin/ml-app-deployer/issues/78) Added support for mlContentForestsPerHost
6+
* [#77](https://github.com/rjrudin/ml-app-deployer/issues/77) Support Spring Boot-style properties with a "marklogic." prefix
7+
38
## 2.0rc3 - 2016-01-17
49

510
* [#74](https://github.com/rjrudin/ml-app-deployer/issues/74) New command for verifying that MarkLogic version is at least 8

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ public AppConfig newAppConfig() {
7070
c.setRestAdminPassword(mlPassword);
7171
}
7272

73+
prop = getProperty("mlContentForestsPerHost");
74+
if (prop != null) {
75+
logger.info("Content forests per host: " + prop);
76+
c.setContentForestsPerHost(Integer.parseInt(prop));
77+
}
78+
7379
prop = getProperty("mlModulePermissions");
7480
if (prop != null) {
7581
logger.info("Module permissions: " + prop);
@@ -84,7 +90,8 @@ public AppConfig newAppConfig() {
8490
}
8591

8692
if (getProperty("mlSimpleSsl") != null) {
87-
logger.info("Using simple SSL context and 'ANY' hostname verifier for authenticating against client REST API server");
93+
logger.info(
94+
"Using simple SSL context and 'ANY' hostname verifier for authenticating against client REST API server");
8895
c.setSimpleSslConfig();
8996
}
9097

src/main/java/com/marklogic/mgmt/util/SimplePropertySource.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ public SimplePropertySource(String... propNamesAndValues) {
1313
}
1414
}
1515

16+
public SimplePropertySource(Properties props) {
17+
this.props = props;
18+
}
19+
1620
@Override
1721
public String getProperty(String name) {
1822
return props.getProperty(name);

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

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

3+
import java.util.Properties;
4+
35
import org.junit.Assert;
46
import org.junit.Test;
57

@@ -33,4 +35,58 @@ public void unrecognizedProperties() {
3335
assertEquals("Should use default", "localhost", config.getHost());
3436
assertEquals("Should use default", "admin", config.getRestAdminUsername());
3537
}
38+
39+
/**
40+
* As of 2016-01-18
41+
*/
42+
@Test
43+
public void allProperties() {
44+
Properties p = new Properties();
45+
p.setProperty("mlHost", "prophost");
46+
p.setProperty("mlAppName", "propname");
47+
p.setProperty("mlRestPort", "4321");
48+
p.setProperty("mlTestRestPort", "8765");
49+
p.setProperty("mlUsername", "propuser1");
50+
p.setProperty("mlPassword", "proppassword");
51+
p.setProperty("mlRestAdminUsername", "propuser2");
52+
p.setProperty("mlRestAdminPassword", "proppassword2");
53+
p.setProperty("mlContentForestsPerHost", "17");
54+
p.setProperty("mlModulePermissions", "some-perm,read,some-perm,update");
55+
p.setProperty("mlAdditionalBinaryExtensions", ".gradle,.properties");
56+
p.setProperty("mlConfigDir", "src/test/resources/sample-app/empty-ml-config");
57+
p.setProperty("mlSimpleSsl", "anyvalue");
58+
59+
sut = new DefaultAppConfigFactory(new SimplePropertySource(p));
60+
AppConfig config = sut.newAppConfig();
61+
62+
assertEquals("prophost", config.getHost());
63+
assertEquals("propname", config.getName());
64+
assertEquals((Integer) 4321, config.getRestPort());
65+
assertEquals((Integer) 8765, config.getTestRestPort());
66+
assertEquals("propuser2", config.getRestAdminUsername());
67+
assertEquals("proppassword2", config.getRestAdminPassword());
68+
assertEquals((Integer) 17, config.getContentForestsPerHost());
69+
assertEquals("some-perm,read,some-perm,update", config.getModulePermissions());
70+
String[] extensions = config.getAdditionalBinaryExtensions();
71+
assertEquals(".gradle", extensions[0]);
72+
assertEquals(".properties", extensions[1]);
73+
assertTrue(config.getConfigDir().getBaseDir().getAbsolutePath().contains("empty-ml-config"));
74+
assertNotNull(config.getRestSslContext());
75+
assertNotNull(config.getRestSslHostnameVerifier());
76+
}
77+
78+
@Test
79+
public void mlUsernameAndPassword() {
80+
sut = new DefaultAppConfigFactory(
81+
new SimplePropertySource("mlUsername", "customuser", "mlPassword", "custompassword"));
82+
AppConfig config = sut.newAppConfig();
83+
84+
assertEquals("When mlRestAdminUsername is not set, mlUsername should be used", "customuser",
85+
config.getRestAdminUsername());
86+
assertEquals("When mlRestAdminPassword is not set, mlPassword should be used", "custompassword",
87+
config.getRestAdminPassword());
88+
89+
assertNull("SSL context should be null by default", config.getRestSslContext());
90+
assertNull("SSL hostname verifier should be null by default", config.getRestSslHostnameVerifier());
91+
}
3692
}

0 commit comments

Comments
 (0)