Skip to content

Commit d9ec4cf

Browse files
authored
Merge pull request #1599 from marklogic/feature/dev-tools-project
Added example project for testing ml-development-tools
2 parents 86b1ef2 + e4eb309 commit d9ec4cf

File tree

8 files changed

+77
-1
lines changed

8 files changed

+77
-1
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ Individual tests can be run in the following manner (replace `GraphsTest` with t
4141

4242
./gradlew marklogic-client-api:test --tests GraphsTest
4343

44-
Tests for the ml-development-tools Gradle plugin can be run via:
44+
Tests for the `ml-development-tools` Gradle plugin can be run via:
4545

4646
./gradlew ml-development-tools:test
4747

4848
You can also undeploy the test application if you do not wish to keep it around on your MarkLogic instance:
4949

5050
./gradlew mlUndeploy -i -Pconfirm=true
51+
52+
To test the `ml-development-tools` Gradle plugin, see the README.md file located at
53+
`ml-development-tools/src/test/example-project`.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
This is a simple project for testing out the ml-development-tools Gradle plugin.
2+
3+
To try this out, first run `./gradlew publishToMavenLocal` from the root directory of your clone of this
4+
repository. Then update the `build.gradle` file in this directory to reference the version number of the
5+
plugin you published. You can then try each of the tasks in the `build.gradle` file to verify that Data Services
6+
Java classes are generated correctly.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal()
4+
mavenCentral()
5+
}
6+
dependencies {
7+
classpath "com.marklogic:ml-development-tools:6.3-SNAPSHOT"
8+
}
9+
}
10+
11+
plugins {
12+
id 'java'
13+
}
14+
15+
apply plugin: "com.marklogic.ml-development-tools"
16+
17+
18+
group 'org.example'
19+
version '1.0-SNAPSHOT'
20+
21+
repositories {
22+
mavenCentral()
23+
}
24+
25+
dependencies {
26+
implementation 'com.marklogic:marklogic-client-api:6.3-SNAPSHOT'
27+
}
28+
29+
task testFullPath(type: com.marklogic.client.tools.gradle.EndpointProxiesGenTask) {
30+
serviceDeclarationFile = "/Users/rrudin/workspace/java-client-api/example-project/src/main/ml-modules/root/inventory/service.json"
31+
}
32+
33+
task testProjectPath(type: com.marklogic.client.tools.gradle.EndpointProxiesGenTask) {
34+
serviceDeclarationFile = "src/main/ml-modules/root/inventory/service.json"
35+
}

ml-development-tools/src/test/example-project/settings.gradle

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"functionName": "lookup",
3+
"params": [
4+
{
5+
"name": "productCode",
6+
"datatype": "string"
7+
},
8+
{
9+
"name": "customerId",
10+
"datatype": "unsignedLong"
11+
}
12+
],
13+
"return": {
14+
"datatype": "jsonDocument"
15+
}
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
// declareUpdate(); // Note: uncomment if changing the database state
3+
4+
var productCode; // instanceof xs.string
5+
var customerId; // instanceof xs.unsignedLong
6+
7+
// Doesn't matter what happens next, this file just needs to exist so that
8+
// Data Services Java classes can be generated from it.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"endpointDirectory" : "/inventory/",
3+
"$javaClass" : "org.example.inventory.DynamicPricer"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"endpointDirectory" : "/inventory/",
3+
"$javaClass" : "org.example.inventory.DynamicPricer"
4+
}

0 commit comments

Comments
 (0)