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

Commit ae2e675

Browse files
committed
#120 Some renaming and cleanup
1 parent 333cb0e commit ae2e675

File tree

5 files changed

+28
-26
lines changed

5 files changed

+28
-26
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
import java.io.File;
1313

14-
import java.io.File;
15-
1614
/**
1715
* Defaults to the content database name in the AppConfig instance. Can be overridden via the databaseNameOrId property.
1816
*/
@@ -46,7 +44,7 @@ protected void deployConfigs(CommandContext context, ConfigDir configDir, String
4644

4745
@Override
4846
protected void storeTokenForResourceId(SaveReceipt receipt, CommandContext context) {
49-
String targetId = currentConfigManager.getDomainID(receipt.getResourceId());
47+
String targetId = currentConfigManager.getDomainId(receipt.getResourceId());
5048
String key = "%%flexrep-domains-id-" + receipt.getResourceId() + "%%";
5149
if (logger.isInfoEnabled()) {
5250
logger.info(format("Storing token with key '%s' and value '%s'", key, targetId));

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import com.marklogic.appdeployer.command.CommandContext;
77
import com.marklogic.appdeployer.command.SortOrderConstants;
88
import com.marklogic.mgmt.resource.ResourceManager;
9-
import com.marklogic.mgmt.resource.flexrep.PullsManager;
9+
import com.marklogic.mgmt.resource.flexrep.PullManager;
1010

1111
import java.io.File;
1212

1313
public class DeployPullsCommand extends AbstractResourceCommand {
1414

15-
ResourceManager pullsManager;
15+
private ResourceManager pullManager;
1616

1717
public DeployPullsCommand() {
1818
setExecuteSortOrder(SortOrderConstants.DEPLOY_FLEXREP_PULLS);
@@ -25,7 +25,7 @@ protected File[] getResourceDirs(CommandContext context) {
2525

2626
@Override
2727
protected ResourceManager getResourceManager(CommandContext context) {
28-
return pullsManager;
28+
return pullManager;
2929
}
3030

3131
@Override
@@ -40,7 +40,7 @@ public void execute(CommandContext context) {
4040
}
4141

4242
protected void deployFlexRepPulls(CommandContext context, ConfigDir configDir, String databaseIdOrName) {
43-
pullsManager = new PullsManager(context.getManageClient(), databaseIdOrName);
43+
pullManager = new PullManager(context.getManageClient(), databaseIdOrName);
4444
processExecuteOnResourceDir(context, configDir.getFlexrepPullsDir());
4545
}
4646

src/main/java/com/marklogic/mgmt/resource/flexrep/ConfigManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void enableAllFlexrepTargets() {
4848
}
4949
}
5050

51-
public String getDomainID(String configName) {
51+
public String getDomainId(String configName) {
5252
Fragment f = getManageClient().getXml(getResourcesPath() +"/" + configName);
5353
return f.getElementValue("/node()/db:id");
5454
}

src/main/java/com/marklogic/mgmt/resource/flexrep/PullsManager.java renamed to src/main/java/com/marklogic/mgmt/resource/flexrep/PullManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import com.marklogic.mgmt.ManageClient;
44
import com.marklogic.mgmt.resource.AbstractResourceManager;
55

6-
public class PullsManager extends AbstractResourceManager {
6+
public class PullManager extends AbstractResourceManager {
7+
78
private String databaseIdOrName;
89

9-
public PullsManager(ManageClient client, String databaseIdOrName) {
10+
public PullManager(ManageClient client, String databaseIdOrName) {
1011
super(client);
1112
this.databaseIdOrName = databaseIdOrName;
1213
}

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

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.marklogic.mgmt.resource.cpf.CpfConfigManager;
88
import com.marklogic.mgmt.resource.cpf.DomainManager;
99
import com.marklogic.mgmt.resource.cpf.PipelineManager;
10-
import com.marklogic.mgmt.resource.flexrep.PullsManager;
10+
import com.marklogic.mgmt.resource.flexrep.PullManager;
1111
import org.junit.After;
1212
import org.junit.Test;
1313

@@ -107,31 +107,34 @@ public void replicaFlexrep() {
107107
}
108108

109109
@Test
110-
public void flexPull() {
111-
110+
public void deployPullConfiguration() {
112111
appConfig.getFirstConfigDir().setBaseDir(new File("src/test/resources/sample-app/flexrep-config"));
113112

114113
initializeAppDeployer(new DeployContentDatabasesCommand(1), new DeployTriggersDatabaseCommand(),
115114
new DeployCpfConfigsCommand(), new DeployDomainsCommand(), new DeployPipelinesCommand(),
116115
new DeployConfigsCommand(), new DeployTargetsCommand(), new DeployOtherDatabasesCommand(), new DeployPullsCommand());
117116

118-
appDeployer.deploy(appConfig);
119-
assertConfigAndTargetAreDeployed();
117+
try {
118+
appDeployer.deploy(appConfig);
119+
120+
assertConfigAndTargetAreDeployed();
120121

121-
final String pullName = "docs2go";
122-
PullsManager pullsMangager = new PullsManager(manageClient, "other-sample-app-content");
123-
assertTrue(pullsMangager.exists(pullName));
122+
final String pullName = "docs2go";
123+
PullManager pullManager = new PullManager(manageClient, "other-sample-app-content");
124+
assertTrue(pullManager.exists(pullName));
124125

125-
// Run deploy again to make sure nothing blows up
126-
appDeployer.deploy(appConfig);
126+
// Run deploy again to make sure nothing blows up
127+
appDeployer.deploy(appConfig);
127128

128-
ConfigManager mgr = new ConfigManager(manageClient, appConfig.getContentDatabaseName());
129-
mgr.deleteAllConfigs();
130-
assertTrue("All of the configs should have been deleted, including their targets", mgr.getAsXml()
131-
.getListItemIdRefs().isEmpty());
129+
ConfigManager mgr = new ConfigManager(manageClient, appConfig.getContentDatabaseName());
130+
mgr.deleteAllConfigs();
131+
assertTrue("All of the configs should have been deleted, including their targets", mgr.getAsXml()
132+
.getListItemIdRefs().isEmpty());
132133

133-
undeploySampleApp();
134-
assertFalse(new ServerManager(manageClient).exists("master-flexrep-server"));
134+
} finally {
135+
undeploySampleApp();
136+
assertFalse(new ServerManager(manageClient).exists("master-flexrep-server"));
137+
}
135138
}
136139

137140
private void assertConfigAndTargetAreDeployed() {

0 commit comments

Comments
 (0)