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

Commit

Permalink
#164 Fixing test for custom forests, was ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Rudin committed May 10, 2017
1 parent 70780d7 commit ef30dc8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void execute(CommandContext context) {
if (count != null) {
this.setForestsPerHost(count);
}

super.execute(context);

AppConfig appConfig = context.getAppConfig();
Expand All @@ -51,7 +51,13 @@ public void execute(CommandContext context) {
DatabaseManager dbMgr = new DatabaseManager(context.getManageClient());
String json = tokenReplacer.replaceTokens(payload, appConfig, true);
SaveReceipt receipt = dbMgr.save(json);
buildDeployForestsCommand(payload, receipt, context).execute(context);
if (shouldCreateForests(context, payload)) {
buildDeployForestsCommand(payload, receipt, context).execute(context);
} else {
if (logger.isInfoEnabled()) {
logger.info("Found custom forests for database, so not creating default forests");
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import com.marklogic.appdeployer.command.databases.DeployContentDatabasesCommand;
import com.marklogic.mgmt.forests.ForestManager;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;

import java.io.File;

/**
* Verifies that directories under ./forests/ are processed correctly.
*/
@Ignore("Failing on travis because it's not using the right hostname for forests, not sure how to fix yet")
public class DeployCustomForestsTest extends AbstractAppDeployerTest {

@After
Expand All @@ -23,17 +21,13 @@ public void tearDown() {

@Test
public void test() {
// To avoid hardcoding host names that might cause the test to fail, we use a custom token and assume that
// the host of the Management API will work
appConfig.getCustomTokens().put("%%CUSTOM_HOST%%", super.manageConfig.getHost());

appConfig.setConfigDir(new ConfigDir(new File("src/test/resources/sample-app/custom-forests")));

initializeAppDeployer(new DeployContentDatabasesCommand(1), new DeployCustomForestsCommand());
deploySampleApp();

ForestManager mgr = new ForestManager(manageClient);
assertTrue("One 'simple' forest should have been created by default", mgr.exists("sample-app-content-1"));
assertFalse("A default forest should not have been created since custom forests exist", mgr.exists("sample-app-content-1"));
assertTrue(mgr.exists("sample-app-content-custom-1"));
assertTrue(mgr.exists("sample-app-content-custom-2"));
assertTrue(mgr.exists("sample-app-content-custom-3"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
{
"forest-name": "sample-app-content-custom-1",
"enabled": true,
"host": "%%CUSTOM_HOST%%",
"database": "%%DATABASE%%"
},
{
"forest-name": "sample-app-content-custom-2",
"enabled": true,
"host": "%%CUSTOM_HOST%%",
"database": "%%DATABASE%%"
}
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"forest-name": "sample-app-content-custom-3",
"enabled": true,
"host": "%%CUSTOM_HOST%%",
"database": "%%DATABASE%%"
}

0 comments on commit ef30dc8

Please sign in to comment.