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

Commit f303c57

Browse files
committed
#88 Tossing flexrepPath into AppConfig
1 parent 95b70fc commit f303c57

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ public class AppConfig {
102102
// Comma-delimited string used for configuring forest replicas
103103
private String databaseNamesAndReplicaCounts;
104104

105-
105+
// Path to use for DeployFlexrepCommand
106+
private String flexrepPath;
107+
106108
public AppConfig() {
107109
this(DEFAULT_MODULES_PATH, DEFAULT_SCHEMAS_PATH);
108110
}
@@ -489,4 +491,12 @@ public FileFilter getAssetFileFilter() {
489491
public void setAssetFileFilter(FileFilter assetFileFilter) {
490492
this.assetFileFilter = assetFileFilter;
491493
}
494+
495+
public String getFlexrepPath() {
496+
return flexrepPath;
497+
}
498+
499+
public void setFlexrepPath(String flexrepPath) {
500+
this.flexrepPath = flexrepPath;
501+
}
492502
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ public AppConfig newAppConfig() {
107107
c.setDatabaseNamesAndReplicaCounts(prop);
108108
}
109109

110+
prop = getProperty("mlFlexrepPath");
111+
if (prop != null) {
112+
logger.info("Flexrep path: " + prop);
113+
c.setFlexrepPath(prop);
114+
}
110115
return c;
111116
}
112117

src/main/java/com/marklogic/appdeployer/command/flexrep/DeployFlexrepCommand.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@
2121
*/
2222
public class DeployFlexrepCommand extends AbstractCommand implements UndoableCommand {
2323

24-
private String path;
25-
2624
public DeployFlexrepCommand() {
27-
this("master");
28-
}
29-
30-
public DeployFlexrepCommand(String path) {
31-
this.path = path;
3225
setExecuteSortOrder(SortOrderConstants.DEPLOY_OTHER_SERVERS);
3326
}
3427

@@ -72,6 +65,7 @@ public void undo(CommandContext context) {
7265
}
7366

7467
protected File getFlexrepBaseDir(AppConfig appConfig) {
68+
String path = appConfig.getFlexrepPath();
7569
if (path == null) {
7670
return null;
7771
}
@@ -88,9 +82,4 @@ protected File getFlexrepBaseDir(AppConfig appConfig) {
8882

8983
return flexrepBaseDir;
9084
}
91-
92-
public void setPath(String path) {
93-
this.path = path;
94-
}
95-
9685
}

src/test/java/com/marklogic/appdeployer/command/flexrep/DeployFlexrepTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public void noFlexrepDir() {
6060
public void masterFlexrep() {
6161
appConfig.getConfigDir().setBaseDir(new File("src/test/resources/sample-app/flexrep-combined"));
6262

63-
initializeAppDeployer(new DeployContentDatabasesCommand(1), new DeployTriggersDatabaseCommand(), new DeployFlexrepCommand("master"));
63+
appConfig.setFlexrepPath("master");
64+
initializeAppDeployer(new DeployContentDatabasesCommand(1), new DeployTriggersDatabaseCommand(), new DeployFlexrepCommand());
6465

6566
appDeployer.deploy(appConfig);
6667

@@ -82,7 +83,8 @@ public void masterFlexrep() {
8283
public void replicaFlexrep() {
8384
appConfig.getConfigDir().setBaseDir(new File("src/test/resources/sample-app/flexrep-combined"));
8485

85-
initializeAppDeployer(new DeployContentDatabasesCommand(1), new DeployTriggersDatabaseCommand(), new DeployFlexrepCommand("replica"));
86+
appConfig.setFlexrepPath("replica");
87+
initializeAppDeployer(new DeployContentDatabasesCommand(1), new DeployTriggersDatabaseCommand(), new DeployFlexrepCommand());
8688

8789
appDeployer.deploy(appConfig);
8890

0 commit comments

Comments
 (0)