Skip to content

Added example project for testing ml-development-tools #1599

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

Merged
merged 1 commit into from
Sep 5, 2023
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
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ Individual tests can be run in the following manner (replace `GraphsTest` with t

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

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

./gradlew ml-development-tools:test

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

./gradlew mlUndeploy -i -Pconfirm=true

To test the `ml-development-tools` Gradle plugin, see the README.md file located at
`ml-development-tools/src/test/example-project`.
6 changes: 6 additions & 0 deletions ml-development-tools/src/test/example-project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is a simple project for testing out the ml-development-tools Gradle plugin.

To try this out, first run `./gradlew publishToMavenLocal` from the root directory of your clone of this
repository. Then update the `build.gradle` file in this directory to reference the version number of the
plugin you published. You can then try each of the tasks in the `build.gradle` file to verify that Data Services
Java classes are generated correctly.
35 changes: 35 additions & 0 deletions ml-development-tools/src/test/example-project/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "com.marklogic:ml-development-tools:6.3-SNAPSHOT"
}
}

plugins {
id 'java'
}

apply plugin: "com.marklogic.ml-development-tools"


group 'org.example'
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
}

dependencies {
implementation 'com.marklogic:marklogic-client-api:6.3-SNAPSHOT'
}

task testFullPath(type: com.marklogic.client.tools.gradle.EndpointProxiesGenTask) {
serviceDeclarationFile = "/Users/rrudin/workspace/java-client-api/example-project/src/main/ml-modules/root/inventory/service.json"
}

task testProjectPath(type: com.marklogic.client.tools.gradle.EndpointProxiesGenTask) {
serviceDeclarationFile = "src/main/ml-modules/root/inventory/service.json"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"functionName": "lookup",
"params": [
{
"name": "productCode",
"datatype": "string"
},
{
"name": "customerId",
"datatype": "unsignedLong"
}
],
"return": {
"datatype": "jsonDocument"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';
// declareUpdate(); // Note: uncomment if changing the database state

var productCode; // instanceof xs.string
var customerId; // instanceof xs.unsignedLong

// Doesn't matter what happens next, this file just needs to exist so that
// Data Services Java classes can be generated from it.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"endpointDirectory" : "/inventory/",
"$javaClass" : "org.example.inventory.DynamicPricer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"endpointDirectory" : "/inventory/",
"$javaClass" : "org.example.inventory.DynamicPricer"
}