Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop bug fixes related to LoadUserArtifactsCommand #1782

Merged
merged 2 commits into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package com.marklogic.hub.deploy.commands;

import com.marklogic.appdeployer.AppConfig;
import com.marklogic.appdeployer.command.AbstractCommand;
import com.marklogic.appdeployer.command.CommandContext;
import com.marklogic.appdeployer.command.SortOrderConstants;
import com.marklogic.appdeployer.command.modules.LoadModulesCommand;
import com.marklogic.client.DatabaseClient;
import com.marklogic.client.document.DocumentWriteSet;
import com.marklogic.client.document.JSONDocumentManager;
Expand Down Expand Up @@ -50,7 +50,7 @@
* Loads user artifacts like mappings and entities. This will be deployed after triggers
*/
@Component
public class LoadUserArtifactsCommand extends LoadModulesCommand {
public class LoadUserArtifactsCommand extends AbstractCommand {

@Autowired
private HubConfig hubConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ public void testProjectScaffolding() throws IOException

//checking if triggers are written
assertTrue(stagingTriggersClient.newServerEval().xquery("fn:count(fn:doc())").eval().next().getNumber().intValue() == 1);
assertTrue(finalTriggersClient.newServerEval().xquery("fn:count(fn:doc())").eval().next().getNumber().intValue() == 1);
//we write 3 triggers as part of installation
assertTrue(finalTriggersClient.newServerEval().xquery("fn:count(fn:doc())").eval().next().getNumber().intValue() == 4);

}

Expand Down Expand Up @@ -211,7 +212,7 @@ public void testInstallUserModules() throws IOException, ParserConfigurationExce
HubConfig hubConfig = getHubAdminConfig();

int totalCount = getDocCount(HubConfig.DEFAULT_MODULES_DB_NAME, null);
installUserModules(hubConfig, true);
installUserModules(hubConfig, false);

assertEquals(
getResource("data-hub-test/plugins/entities/test-entity/harmonize/final/collector.xqy"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ class DataHubPlugin implements Plugin<Project> {
.mustRunAfter(["mlClearModulesDatabase"])

// This isn't likely to be used, but it's being kept for regression purposes for now
project.task("hubDeployUserModules", group: deployGroup, type: DeployUserModulesTask, description: "Installs user modules from the plugins and src/main/entity-config directories.")
project.task("hubDeployUserModules", group: deployGroup, type: DeployUserModulesTask,
description: "Installs user modules from the plugins and src/main/entity-config directories.")
.finalizedBy(["hubDeployUserArtifacts"])

project.task("hubDeployUserArtifacts", group: deployGroup, type: DeployUserArtifactsTask,
description: "Installs user artifacts such as entities and mappings.")
.mustRunAfter(["hubDeployUserModules"])

// HubWatchTask extends ml-gradle's WatchTask to ensure that modules are loaded from the hub-specific locations.
project.tasks.replace("mlWatch", HubWatchTask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.gradle.api.tasks.TaskAction
class DeployUserArtifactsTask extends HubTask {

@TaskAction
void deployUserModules() {
void deployUserArtifacts() {
if (!isHubInstalled()) {
println("Data Hub is not installed.")
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class BaseTest extends Specification {
static final int MOD_COUNT_WITH_TRACE_MODULES = 26
static final int MOD_COUNT = 5
// this value under good security conditions is 2 because hub-admin-user cannot read options files directly.
static final int MOD_COUNT_NO_OPTIONS_NO_TRACES = 109
// 2 additional modules have been added for triggers
static final int MOD_COUNT_NO_OPTIONS_NO_TRACES = 111
static final TemporaryFolder testProjectDir = new TemporaryFolder()
static File buildFile
static File propertiesFile
Expand Down