Skip to content

Commit f6bc28b

Browse files
committed
fixed #517
1 parent a2f0d40 commit f6bc28b

File tree

13 files changed

+98
-10
lines changed

13 files changed

+98
-10
lines changed

marklogic-data-hub/src/main/resources/ml-config/servers/final-server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"port": "%%mlFinalPort%%",
77
"modules-database": "%%mlModulesDbName%%",
88
"content-database": "%%mlFinalDbName%%",
9-
"authentication": "digest",
9+
"authentication": "%%mlFinalAuth%%",
1010
"default-error-format": "json",
1111
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
1212
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",

marklogic-data-hub/src/main/resources/ml-config/servers/job-server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"port": "%%mlJobPort%%",
77
"modules-database": "%%mlModulesDbName%%",
88
"content-database": "%%mlJobDbName%%",
9-
"authentication": "digest",
9+
"authentication": "%%mlJobAuth%%",
1010
"default-error-format": "json",
1111
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
1212
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",

marklogic-data-hub/src/main/resources/ml-config/servers/staging-server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"port": "%%mlStagingPort%%",
77
"modules-database": "%%mlModulesDbName%%",
88
"content-database": "%%mlStagingDbName%%",
9-
"authentication": "digest",
9+
"authentication": "%%mlStagingAuth%%",
1010
"default-error-format": "json",
1111
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
1212
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",

marklogic-data-hub/src/main/resources/ml-config/servers/trace-server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"port": "%%mlTracePort%%",
77
"modules-database": "%%mlModulesDbName%%",
88
"content-database": "%%mlTraceDbName%%",
9-
"authentication": "digest",
9+
"authentication": "%%mlTraceAuth%%",
1010
"default-error-format": "json",
1111
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
1212
"url-rewriter": "/com.marklogic.hub/tracing-rewriter.xml",

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import javax.xml.parsers.ParserConfigurationException
2929

3030
class BaseTest extends Specification {
3131

32-
public static boolean makeProperties = true;
33-
3432
static final TemporaryFolder testProjectDir = new TemporaryFolder()
3533
static File buildFile
3634
static File propertiesFile
@@ -239,10 +237,13 @@ class BaseTest extends Specification {
239237
"""
240238
}
241239

240+
static void createGradleFiles() {
241+
createBuildFile()
242+
createFullPropertiesFile()
243+
}
244+
242245
def setupSpec() {
243246
XMLUnit.setIgnoreWhitespace(true)
244247
testProjectDir.create()
245-
createBuildFile()
246-
createFullPropertiesFile()
247248
}
248249
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package com.marklogic.gradle.task
2+
3+
import org.gradle.testkit.runner.UnexpectedBuildFailure
4+
5+
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
6+
7+
class BasicAuthTest extends BaseTest {
8+
9+
def setupSpec() {
10+
createBuildFile()
11+
runTask("hubInit")
12+
createProperties()
13+
}
14+
15+
void createProperties() {
16+
propertiesFile = new File(testProjectDir.root, 'gradle.properties')
17+
propertiesFile << """
18+
mlHost=localhost
19+
mlAppName=data-hub
20+
21+
mlUsername=admin
22+
mlPassword=admin
23+
24+
mlManageUsername=admin
25+
mlManagePassword=admin
26+
27+
mlAdminUsername=admin
28+
mlAdminPassword=admin
29+
30+
31+
mlStagingAppserverName=data-hub-STAGING
32+
mlStagingPort=8010
33+
mlStagingDbName=data-hub-STAGING
34+
mlStagingForestsPerHost=4
35+
mlStagingAuth=basic
36+
37+
38+
mlFinalAppserverName=data-hub-FINAL
39+
mlFinalPort=8011
40+
mlFinalDbName=data-hub-FINAL
41+
mlFinalForestsPerHost=4
42+
mlFinalAuth=basic
43+
44+
mlTraceAppserverName=data-hub-TRACING
45+
mlTracePort=8012
46+
mlTraceDbName=data-hub-TRACING
47+
mlTraceForestsPerHost=1
48+
mlTraceAuth=basic
49+
50+
mlJobAppserverName=data-hub-JOBS
51+
mlJobPort=8013
52+
mlJobDbName=data-hub-JOBS
53+
mlJobForestsPerHost=1
54+
mlJobAuth=basic
55+
56+
mlModulesDbName=data-hub-MODULES
57+
mlTriggersDbName=data-hub-TRIGGERS
58+
mlSchemasDbName=data-hub-SCHEMAS
59+
"""
60+
}
61+
62+
def "bootstrap a project with basic auth"() {
63+
when:
64+
def result = runTask('mlDeploy')
65+
print(result.output)
66+
67+
then:
68+
notThrown(UnexpectedBuildFailure)
69+
result.task(":mlDeploy").outcome == SUCCESS
70+
}
71+
72+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import static org.gradle.testkit.runner.TaskOutcome.FAILED
99
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
1010

1111
class CreateEntityTaskTest extends BaseTest {
12+
def setupSpec() {
13+
createGradleFiles()
14+
}
15+
1216
def "create entity with no name"() {
1317
when:
1418
def result = runFailTask('hubCreateEntity')

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import static org.gradle.testkit.runner.TaskOutcome.FAILED
99
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
1010

1111
class CreateHarmonizeFlowTaskTest extends BaseTest {
12+
def setupSpec() {
13+
createGradleFiles()
14+
}
15+
1216
def "createHarmonizeFlow with no entityName"() {
1317
when:
1418
def result = runFailTask('hubCreateHarmonizeFlow')

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import static org.gradle.testkit.runner.TaskOutcome.FAILED
99
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
1010

1111
class CreateInputFlowTaskTest extends BaseTest {
12+
def setupSpec() {
13+
createGradleFiles()
14+
}
15+
1216
def "createInputFlow with no entityName"() {
1317
when:
1418
def result = runFailTask('hubCreateInputFlow')

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
88
class InitProjectTaskTest extends BaseTest {
99

1010
def setupSpec() {
11-
makeProperties = false;
11+
createGradleFiles()
1212
}
1313

1414
def "init a hub project"() {

0 commit comments

Comments
 (0)