Skip to content

Commit c5811d4

Browse files
committed
Merge branch 'dev'
2 parents 9f9b4b5 + 87e58fc commit c5811d4

40 files changed

+549
-142
lines changed

build.gradle

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
buildscript {
2-
repositories {
3-
jcenter()
4-
maven {
5-
url "https://plugins.gradle.org/m2/"
6-
}
7-
}
8-
dependencies {
9-
classpath "com.gradle.publish:plugin-publish-plugin:0.9.5"
10-
classpath "com.smokejumperit.gradle.license:Gradle-License-Report:0.0.2"
11-
}
12-
}
13-
141
plugins {
152
id "groovy"
163
id "maven-publish"
@@ -21,11 +8,6 @@ plugins {
218
id "com.gradle.plugin-publish" version "0.9.7"
229
}
2310

24-
apply plugin: "com.gradle.plugin-publish"
25-
26-
// gradle dependencyLicenseReport to generate your report in build/reports/dependency-license
27-
apply plugin:'license-report'
28-
2911
sourceCompatibility = "1.7"
3012
targetCompatibility = "1.7"
3113

@@ -90,11 +72,11 @@ pluginBundle {
9072
displayName = 'ml-gradle for MarkLogic'
9173
description = 'Gradle plugin for configuring and deploying applications to MarkLogic'
9274
tags = ['marklogic']
93-
version = "2.9.0"
75+
version = project.version
9476
}
9577
}
9678

9779
mavenCoordinates {
98-
version = "2.9.0"
80+
version = project.version
9981
}
10082
}

examples/local-testing-project/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Set this to the version you used when running
22
# "gradle -Pversion=(something) publishToMavenLocal" on your local ml-gradle repo
3-
mlGradleVersion=2.9.0
3+
mlGradleVersion=3.0.0
44

55
mlHost=localhost
66
mlAppName=example

examples/sample-project/build.gradle

Lines changed: 74 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,28 @@
22
* In order to use ml-gradle, it must be applied. This occurs after the two above blocks for overriding properties so
33
* that those blocks can override properties before ml-gradle initializes itself.
44
*/
5-
plugins {
6-
id "com.marklogic.ml-gradle" version "2.7.1"
5+
buildscript {
6+
repositories {
7+
mavenLocal()
8+
jcenter()
9+
}
10+
dependencies {
11+
classpath "com.marklogic:ml-gradle:3.0-alpha1"
12+
}
13+
}
714

8-
// The following plugins are optional
15+
plugins {
16+
// The following plugins are optional
917

10-
// The Java plugin is used to compile and run JUnit tests
11-
id "java"
18+
// The Java plugin is used to compile and run JUnit tests
19+
id "java"
1220

13-
// These plugins are used to generate IDE files
14-
id "eclipse"
15-
id "idea"
21+
// These plugins are used to generate IDE files
22+
id "eclipse"
23+
id "idea"
1624
}
1725

26+
apply plugin: "com.marklogic.ml-gradle"
1827

1928
/*
2029
* Everything below this line is optional and is intended to show different features provided by ml-gradle.
@@ -26,73 +35,70 @@ plugins {
2635
* dependencies expressed below.
2736
*/
2837
repositories {
29-
jcenter()
38+
jcenter()
39+
mavenLocal()
3040
}
3141

3242

3343
configurations {
34-
// This custom Gradle configuration allows us to specify the classpath for running Corb jobs. This is only needed if
35-
// you want to run Corb jobs via Gradle tasks. More info on Corb can be found at - http://developer.marklogic.com/code/corb.
36-
corb
44+
// This custom Gradle configuration allows us to specify the classpath for running Corb jobs. This is only needed if
45+
// you want to run Corb jobs via Gradle tasks. More info on Corb can be found at - http://developer.marklogic.com/code/corb.
46+
corb
3747
}
3848

39-
4049
/*
4150
* This expresses dependencies on the ml-java and ml-junit libraries. The former is typically used for application
4251
* code, and the latter supports writing JUnit-based tests. A dependency exists on RestAssured to show an option for
4352
* using that library in tests that must invoke MarkLogic HTTP endpoints.
4453
*/
4554
dependencies {
46-
// Needed to compile and run the JUnit tests
47-
testCompile "com.marklogic:ml-junit:2.6.0"
48-
testCompile "com.jayway.restassured:rest-assured:2.4.1"
55+
// Needed to compile and run the JUnit tests
56+
testCompile "com.marklogic:ml-junit:3.0-alpha1"
57+
testCompile "com.jayway.restassured:rest-assured:2.4.1"
4958

50-
// corb jar available from jcenter
51-
corb "com.marklogic:marklogic-corb:2.3.2"
59+
// corb jar available from jcenter
60+
corb "com.marklogic:marklogic-corb:2.3.2"
5261
}
5362

54-
5563
/*
5664
* ml-gradle adds an instance of com.marklogic.appdeployer.AppConfig to the Gradle project under the key "mlAppConfig".
5765
* This instance can be modified to affect the behavior of ml-gradle.
5866
*/
5967
ext {
60-
// mlAppConfig is an instance of com.marklogic.appdeployer.AppConfig
61-
mlAppConfig {
62-
// Example of adding custom tokens; these will then be replaced in any JSON/XML config files
63-
customTokens.put("sample-key", "sample-value")
64-
customTokens.put("%%ODBC_PORT%%", "8102")
65-
customTokens.put("%%XDBC_PORT%%", "8103")
66-
67-
// By default, the createTriggersDatabase attribute is set to true, which results in a triggers database being
68-
// created, even if a databases/triggers-database.json file isn't present. Un-commenting the line will below
69-
// will prevent one from being created (assuming the triggers-database.json file isn't present).
70-
//createTriggersDatabase = false
71-
72-
// Example of adding a path for modules to the list of module paths, which defaults to src/main/ml-modules
73-
// modulePaths.add("src/another-modules-dir")
74-
// You can also override the list of module paths
75-
// modulePaths = ["src/another-modules-dir"]
76-
77-
// You can have multiple config files for your content database. This is useful when you have a dependency on
78-
// a package of MarkLogic modules that requires some content database config, and you don't want to duplicate
79-
// that in your own content-database.json file. Instead, just add the file from your
80-
// build/mlRestApi/(name of dependency)/ml-config/databases directory.
81-
configDir.contentDatabaseFiles.add(new File("src/main/ml-config/databases/more-content-database-config.json"))
82-
83-
// XCC URL for running corb task below and for creating triggers on pre-8.0-4 builds of MarkLogic
84-
contentXccUrl = "xcc://${mlRestAdminUsername}:${mlRestAdminPassword}@${mlHost}:${mlRestPort}"
85-
}
68+
// mlAppConfig is an instance of com.marklogic.appdeployer.AppConfig
69+
mlAppConfig {
70+
// Example of adding custom tokens; these will then be replaced in any JSON/XML config files
71+
customTokens.put("sample-key", "sample-value")
72+
customTokens.put("%%ODBC_PORT%%", "8102")
73+
customTokens.put("%%XDBC_PORT%%", "8103")
74+
75+
// By default, the createTriggersDatabase attribute is set to true, which results in a triggers database being
76+
// created, even if a databases/triggers-database.json file isn't present. Un-commenting the line will below
77+
// will prevent one from being created (assuming the triggers-database.json file isn't present).
78+
//createTriggersDatabase = false
79+
80+
// Example of adding a path for modules to the list of module paths, which defaults to src/main/ml-modules
81+
// modulePaths.add("src/another-modules-dir")
82+
// You can also override the list of module paths
83+
// modulePaths = ["src/another-modules-dir"]
84+
85+
// You can have multiple config files for your content database. This is useful when you have a dependency on
86+
// a package of MarkLogic modules that requires some content database config, and you don't want to duplicate
87+
// that in your own content-database.json file. Instead, just add the file from your
88+
// build/mlRestApi/(name of dependency)/ml-config/databases directory.
89+
configDir.contentDatabaseFiles.add(new File("src/main/ml-config/databases/more-content-database-config.json"))
90+
91+
// XCC URL for running corb task below and for creating triggers on pre-8.0-4 builds of MarkLogic
92+
contentXccUrl = "xcc://${mlRestAdminUsername}:${mlRestAdminPassword}@${mlHost}:${mlRestPort}"
93+
}
8694
}
8795

88-
8996
/*
9097
* For tests that reference test files in the test source tree, we need to tell Gradle to copy these to src/test/resources
9198
* so that they can be found when running "gradle test".
9299
*/
93100
sourceSets.test.resources.srcDir 'src/test/java'
94101

95-
96102
/*
97103
* This is an example of both a custom Gradle task and an easy way of invoking Corb. This depends on "mlLoadModules" to
98104
* ensure that the Corb uris/transform modules are loaded. It also uses as a classpath the custom configuration named
@@ -102,20 +108,19 @@ sourceSets.test.resources.srcDir 'src/test/java'
102108
* to invoke corb from Gradle.
103109
*/
104110
task runCorb(dependsOn: ['mlLoadModules'], type: JavaExec) {
105-
main = 'com.marklogic.developer.corb.Manager'
106-
classpath = configurations.corb
107-
args = [contentXccUrl, '""', 'transform.xqy', '4', 'uris.xqy', '/ext/sample-project/corb/', 'sample-project-modules', 'false']
111+
main = 'com.marklogic.developer.corb.Manager'
112+
classpath = configurations.corb
113+
args = [contentXccUrl, '""', 'transform.xqy', '4', 'uris.xqy', '/ext/sample-project/corb/', 'sample-project-modules', 'false']
108114
}
109115

110-
111116
/*
112117
* The management API has an operation for loading the default CPF pipelines -
113118
* http://docs.marklogic.com/REST/POST/manage/v2/databases/[id-or-name]/pipelines. To load these as part of your
114119
* deployment process, just uncomment the line below. These pipelines will be loaded before your custom pipelines and
115120
* domains, which means you can safely reference them in your domain configuration files.
116121
*/
117122
ext {
118-
//mlAppDeployer.commands.add(new com.marklogic.appdeployer.command.cpf.DeployDefaultPipelinesCommand())
123+
//mlAppDeployer.commands.add(new com.marklogic.appdeployer.command.cpf.DeployDefaultPipelinesCommand())
119124
}
120125

121126
/*
@@ -130,7 +135,6 @@ ext {
130135
// mlDatabaseCommands.add(otherDbCommand)
131136
//}
132137

133-
134138
/*
135139
* Example of a custom command, which in this case performs a merge on a database. The benefit of doing this in a
136140
* command (as opposed to a task) is that a command can be included in the mlDeploy and mlUndeploy tasks by adding it to
@@ -140,41 +144,40 @@ ext {
140144
* Management REST API. Note that this class could also be defined in the Gradle buildSrc directory, which is really a
141145
* better option for keeping your build.gradle file slim.
142146
*/
143-
import com.marklogic.appdeployer.command.AbstractCommand;
144-
import com.marklogic.appdeployer.command.CommandContext;
147+
import com.marklogic.appdeployer.command.AbstractCommand
148+
import com.marklogic.appdeployer.command.CommandContext
145149

146150
class MergeContentDatabaseCommand extends AbstractCommand {
147-
public Integer getExecuteSortOrder() {
148-
return Integer.MAX_VALUE;
149-
}
150-
public void execute(CommandContext context) {
151-
String dbName = context.getAppConfig().getContentDatabaseName();
152-
logger.info("Merging database: " + dbName);
153-
context.getManageClient().postJson("/manage/v2/databases/" + dbName, '{"operation":"merge-database"}');
154-
logger.info("Merged database: " + dbName)
155-
}
151+
public Integer getExecuteSortOrder() {
152+
return Integer.MAX_VALUE;
153+
}
154+
155+
public void execute(CommandContext context) {
156+
String dbName = context.getAppConfig().getContentDatabaseName();
157+
logger.info("Merging database: " + dbName);
158+
context.getManageClient().postJson("/manage/v2/databases/" + dbName, '{"operation":"merge-database"}');
159+
logger.info("Merged database: " + dbName)
160+
}
156161
}
157162

158-
159163
/*
160164
* Example of including our custom command in the deployment process. The order in which it's invoked is determined by
161165
* the command's "getExecuteSortOrder" method.
162166
*/
163167
ext {
164-
//mlAppDeployer.commands.add(new MergeContentDatabaseCommand())
168+
//mlAppDeployer.commands.add(new MergeContentDatabaseCommand())
165169
}
166170

167-
168171
/*
169172
* Below is an example of a custom task that merges a database - just like the command above. The benefit of creating a
170173
* task versus a command is that we can invoke this without running a full mlDeploy. The MarkLogicTask class provides
171174
* access to a number of helpful objects via methods like getAppConfig() and getManageClient().
172175
*/
173176
task mergeContentDatabase(type: com.marklogic.gradle.task.MarkLogicTask) {
174-
description = "Call this task to initiate a merge on the content database"
175-
doLast {
176-
getManageClient().postJson("/manage/v2/databases/" + getAppConfig().getContentDatabaseName(), '{"operation":"merge-database"}')
177-
}
177+
description = "Call this task to initiate a merge on the content database"
178+
doLast {
179+
getManageClient().postJson("/manage/v2/databases/" + getAppConfig().getContentDatabaseName(), '{"operation":"merge-database"}')
180+
}
178181
}
179182

180183
/*

examples/sample-project/src/test/java/sample/GetClientConfigTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.junit.Test;
44

5-
import com.marklogic.client.helper.DatabaseClientConfig;
5+
import com.marklogic.client.ext.helper.DatabaseClientConfig;
66

77
public class GetClientConfigTest extends AbstractSampleProjectTest {
88

examples/sample-project/src/test/java/sample/SampleProjectTestConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.springframework.context.annotation.Configuration;
55
import org.springframework.context.annotation.PropertySource;
66

7-
import com.marklogic.client.helper.DatabaseClientConfig;
7+
import com.marklogic.client.ext.helper.DatabaseClientConfig;
88
import com.marklogic.junit.spring.BasicTestConfig;
99

1010
@Configuration

examples/sample-project/src/test/java/sample/SearchDocumentsViaRestAssuredTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.jayway.restassured.RestAssured;
1010
import com.jayway.restassured.path.json.JsonPath;
1111
import com.marklogic.client.document.XMLDocumentManager;
12-
import com.marklogic.client.helper.DatabaseClientConfig;
12+
import com.marklogic.client.ext.helper.DatabaseClientConfig;
1313
import com.marklogic.client.io.DocumentMetadataHandle;
1414
import com.marklogic.client.io.Format;
1515
import com.marklogic.client.io.StringHandle;
@@ -27,9 +27,9 @@ public void initializeRestAssured() {
2727
logger.info("Initializing RestAssured...");
2828

2929
String protocol = "http://";
30-
30+
3131
/*
32-
* If SSL were enabled on the REST API server, would need to uncomment these lines.
32+
* If SSL were enabled on the REST API server, would need to uncomment these lines.
3333
*/
3434
// protocol = "https://";
3535
// RestAssured.config = RestAssured.config().sslConfig(
@@ -39,7 +39,7 @@ public void initializeRestAssured() {
3939
RestAssured.baseURI = protocol + config.getHost();
4040
RestAssured.port = config.getPort();
4141
RestAssured.authentication = basic(config.getUsername(), config.getPassword());
42-
42+
4343

4444
logger.info("RestAssured URI: " + RestAssured.baseURI);
4545
logger.info("RestAssured port: " + RestAssured.port);

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=com.marklogic
2-
version=2.9.0
3-
mlAppDeployerDependency=com.marklogic:ml-app-deployer:2.9.0
2+
version=3.0.0
3+
mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.0.0
44
mlcpUtilDependency=com.marklogic:mlcp-util:0.3.0
55

0 commit comments

Comments
 (0)