Skip to content

Commit 6130758

Browse files
committed
fixed #314
1 parent 33614c6 commit 6130758

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

marklogic-data-hub/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ mlModulesDbName=data-hub-MODULES
3131
mlTriggersDbName=data-hub-TRIGGERS
3232
mlSchemasDbName=data-hub-SCHEMAS
3333

34-
hubModulesPath=examples/hr-hub/plugins
34+
hubProjectDir=examples/hr-hub
3535

3636
mlReplaceTokensInModules=true
3737
mlUseRoxyTokenPrefix=false

marklogic-data-hub/src/main/java/com/marklogic/hub/DataHub.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ public DataHub(HubConfig hubConfig) {
8787
init(hubConfig);
8888
}
8989

90-
public DataHub(String host, String username, String password) {
91-
hubConfig = new HubConfig();
92-
hubConfig.host = host;
93-
hubConfig.username = username;
94-
hubConfig.password = password;
95-
init(hubConfig);
96-
}
97-
9890
private void init(HubConfig hubConfig) {
9991
this.hubConfig = hubConfig;
10092
if (hubConfig.username != null && hubConfig.password != null) {

ml-data-hub-plugin/src/main/groovy/com/marklogic/gradle/DataHubPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class DataHubPlugin implements Plugin<Project> {
6767
}
6868

6969
void initializeProjectExtensions(Project project) {
70-
HubConfig hubConfig = new DefaultHubConfigFactory(new ProjectPropertySource(project)).newHubConfig()
70+
HubConfig hubConfig = new DefaultHubConfigFactory(project, new ProjectPropertySource(project)).newHubConfig()
7171
project.extensions.add("hubConfig", hubConfig)
7272

7373
DataHub hub = new DataHub(hubConfig)

ml-data-hub-plugin/src/main/java/com.marklogic.hub/DefaultHubConfigFactory.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@
1717

1818
import com.marklogic.mgmt.util.PropertySource;
1919
import com.marklogic.mgmt.util.PropertySourceFactory;
20+
import org.gradle.api.Project;
2021

2122
public class DefaultHubConfigFactory extends PropertySourceFactory {
2223

2324
public DefaultHubConfigFactory() {
2425
super();
2526
};
2627

27-
public DefaultHubConfigFactory(PropertySource propertySource) {
28+
private Project project;
29+
30+
public DefaultHubConfigFactory(Project project, PropertySource propertySource) {
2831
super(propertySource);
32+
this.project = project;
2933
}
3034

3135
public HubConfig newHubConfig() {
@@ -181,6 +185,9 @@ public HubConfig newHubConfig() {
181185
if (prop != null) {
182186
logger.info("REST admin username: " + prop);
183187
c.adminUsername = prop;
188+
if (mlUsername == null) {
189+
c.username = prop;
190+
}
184191
} else if (mlUsername != null) {
185192
logger.info("REST admin username: " + mlUsername);
186193
c.adminUsername = mlUsername;
@@ -189,17 +196,20 @@ public HubConfig newHubConfig() {
189196
prop = getProperty("mlAdminPassword");
190197
if (prop != null) {
191198
c.adminPassword = prop;
199+
if (mlPassword == null) {
200+
c.username = prop;
201+
}
192202
}
193203
else if (mlPassword != null) {
194204
c.adminPassword = mlPassword;
195205
}
196206

197-
prop = getProperty("hubModulesPath");
207+
prop = getProperty("hubProjectDir");
198208
if (prop != null) {
199209
c.projectDir = prop;
200210
}
201211
else {
202-
c.projectDir = ".";
212+
c.projectDir = project.getProjectDir().getAbsolutePath();
203213
}
204214
logger.info("Hub Project Dir: " + c.projectDir);
205215

ml-data-hub-plugin/src/test/groovy/com/marklogic/gradle/task/BaseTest.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ class BaseTest extends Specification {
8585
mlModulesDbName=data-hub-MODULES
8686
mlTriggersDbName=data-hub-TRIGGERS
8787
mlSchemasDbName=data-hub-SCHEMAS
88-
89-
hubModulesPath = ${testProjectDir.root}
9088
"""
9189
}
9290

0 commit comments

Comments
 (0)