Skip to content

ml-development-tools now uses test-app #1597

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
Aug 30, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ bin
repairXMLFull.xml
xml-with-props.xml

ml-development-tools/src/test/ml-modules
ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/generated
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ 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:

./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
2 changes: 0 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ def runAllTests(String type, String version, Boolean useReverseProxy){
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
cd java-client-api
mkdir -p ml-development-tools/build/test-results/test
./gradlew ml-development-tools:setupTestServer || true
./gradlew ml-development-tools:generateTests || true
./gradlew ml-development-tools:test || true
'''

Expand Down
15 changes: 3 additions & 12 deletions ml-development-tools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,11 @@ compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}

task setupTestServer(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
main = 'com.marklogic.client.test.dbfunction.FntestconfKt'
args = [ 'setup' ]
}
task generateTests(type: JavaExec) {
dependsOn setupTestServer
classpath = sourceSets.test.runtimeClasspath
main = 'com.marklogic.client.test.dbfunction.FntestgenKt'
args = [ './src/test/', 'latest' ]
}
task teardownTestServer(type: JavaExec) {
dependsOn test
classpath = sourceSets.test.runtimeClasspath
main = 'com.marklogic.client.test.dbfunction.FntestconfKt'
args = [ 'teardown' ]
}

// Allows running "./gradlew test" without having to remember to generate the tests first.
test.dependsOn generateTests
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static DatabaseClient makeRestClientImpl(DatabaseClientFactory.DigestAut
return makeClientImpl(auth, "8012", false);
}
private static DatabaseClient makeTestClientImpl(DatabaseClientFactory.DigestAuthContext auth) {
return makeClientImpl(auth, "8016", true);
return makeClientImpl(auth, "8013", true);
}
private static DatabaseClient makeClientImpl(
DatabaseClientFactory.DigestAuthContext auth, String defaultPort, boolean withCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

// IMPORTANT: Do not edit. This file is generated.

import java.util.stream.Stream;
import com.marklogic.client.io.Format;
import java.util.stream.Stream;


import com.marklogic.client.DatabaseClient;
Expand Down Expand Up @@ -48,40 +48,55 @@ final class AnyDocumentBundleImpl implements AnyDocumentBundle {
private DatabaseClient dbClient;
private BaseProxy baseProxy;

private BaseProxy.DBFunctionRequest req_sendReceiveManyDocs;
private BaseProxy.DBFunctionRequest req_sendReceiveRequiredDoc;
private BaseProxy.DBFunctionRequest req_sendReceiveOptionalDoc;
private BaseProxy.DBFunctionRequest req_sendReceiveAnyDocs;
private BaseProxy.DBFunctionRequest req_sendReceiveRequiredDoc;
private BaseProxy.DBFunctionRequest req_sendReceiveManyDocs;
private BaseProxy.DBFunctionRequest req_sendReceiveMappedDoc;

private AnyDocumentBundleImpl(DatabaseClient dbClient, JSONWriteHandle servDecl) {
this.dbClient = dbClient;
this.baseProxy = new BaseProxy("/dbf/test/anyDocument/", servDecl);

this.req_sendReceiveManyDocs = this.baseProxy.request(
"sendReceiveManyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
this.req_sendReceiveRequiredDoc = this.baseProxy.request(
"sendReceiveRequiredDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
this.req_sendReceiveOptionalDoc = this.baseProxy.request(
"sendReceiveOptionalDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
this.req_sendReceiveAnyDocs = this.baseProxy.request(
"sendReceiveAnyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
this.req_sendReceiveRequiredDoc = this.baseProxy.request(
"sendReceiveRequiredDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
this.req_sendReceiveManyDocs = this.baseProxy.request(
"sendReceiveManyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
this.req_sendReceiveMappedDoc = this.baseProxy.request(
"sendReceiveMappedDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
}

@Override
public Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
return sendReceiveManyDocs(
this.req_sendReceiveManyDocs.on(this.dbClient), uris, docs
public com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc) {
return sendReceiveOptionalDoc(
this.req_sendReceiveOptionalDoc.on(this.dbClient), uri, doc
);
}
private Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(BaseProxy.DBFunctionRequest request, Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
private com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(BaseProxy.DBFunctionRequest request, String uri, com.marklogic.client.io.InputStreamHandle doc) {
return request
.withParams(
BaseProxy.atomicParam("uris", false, BaseProxy.StringType.fromString(uris)),
BaseProxy.documentParam("docs", false, docs)
).responseMultiple(false, Format.UNKNOWN)
BaseProxy.atomicParam("uri", true, BaseProxy.StringType.fromString(uri)),
BaseProxy.documentParam("doc", true, doc)
).responseSingle(true, Format.UNKNOWN)
.asHandle(new com.marklogic.client.io.InputStreamHandle());
}

@Override
public Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
return sendReceiveAnyDocs(
this.req_sendReceiveAnyDocs.on(this.dbClient), uris, docs
);
}
private Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(BaseProxy.DBFunctionRequest request, Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
return request
.withParams(
BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)),
BaseProxy.documentParam("docs", true, docs)
).responseMultiple(true, Format.UNKNOWN)
.asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle());
}

Expand All @@ -101,32 +116,17 @@ private com.marklogic.client.io.InputStreamHandle sendReceiveRequiredDoc(BasePro
}

@Override
public com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc) {
return sendReceiveOptionalDoc(
this.req_sendReceiveOptionalDoc.on(this.dbClient), uri, doc
);
}
private com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(BaseProxy.DBFunctionRequest request, String uri, com.marklogic.client.io.InputStreamHandle doc) {
return request
.withParams(
BaseProxy.atomicParam("uri", true, BaseProxy.StringType.fromString(uri)),
BaseProxy.documentParam("doc", true, doc)
).responseSingle(true, Format.UNKNOWN)
.asHandle(new com.marklogic.client.io.InputStreamHandle());
}

@Override
public Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
return sendReceiveAnyDocs(
this.req_sendReceiveAnyDocs.on(this.dbClient), uris, docs
public Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
return sendReceiveManyDocs(
this.req_sendReceiveManyDocs.on(this.dbClient), uris, docs
);
}
private Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(BaseProxy.DBFunctionRequest request, Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
private Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(BaseProxy.DBFunctionRequest request, Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
return request
.withParams(
BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)),
BaseProxy.documentParam("docs", true, docs)
).responseMultiple(true, Format.UNKNOWN)
BaseProxy.atomicParam("uris", false, BaseProxy.StringType.fromString(uris)),
BaseProxy.documentParam("docs", false, docs)
).responseMultiple(false, Format.UNKNOWN)
.asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle());
}

Expand All @@ -150,40 +150,40 @@ private com.marklogic.client.io.StringHandle sendReceiveMappedDoc(BaseProxy.DBFu
}

/**
* Invokes the sendReceiveManyDocs operation on the database server
* Invokes the sendReceiveOptionalDoc operation on the database server
*
* @param uris provides input
* @param docs provides input
* @param uri provides input
* @param doc provides input
* @return as output
*/
Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs);
com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc);

/**
* Invokes the sendReceiveRequiredDoc operation on the database server
* Invokes the sendReceiveAnyDocs operation on the database server
*
* @param uri provides input
* @param doc provides input
* @param uris provides input
* @param docs provides input
* @return as output
*/
com.marklogic.client.io.InputStreamHandle sendReceiveRequiredDoc(String uri, com.marklogic.client.io.InputStreamHandle doc);
Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs);

/**
* Invokes the sendReceiveOptionalDoc operation on the database server
* Invokes the sendReceiveRequiredDoc operation on the database server
*
* @param uri provides input
* @param doc provides input
* @return as output
*/
com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc);
com.marklogic.client.io.InputStreamHandle sendReceiveRequiredDoc(String uri, com.marklogic.client.io.InputStreamHandle doc);

/**
* Invokes the sendReceiveAnyDocs operation on the database server
* Invokes the sendReceiveManyDocs operation on the database server
*
* @param uris provides input
* @param docs provides input
* @return as output
*/
Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs);
Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs);

/**
* Invokes the sendReceiveMappedDoc operation on the database server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public interface DecoratorBaseBundle {
* @return an object for executing database operations
*/
static DecoratorBaseBundle on(DatabaseClient db) {
return on(db, null);
return on(db, null);
}
/**
* Creates a DecoratorBaseBundle object for executing operations on the database server.
Expand Down Expand Up @@ -54,34 +54,34 @@ private DecoratorBaseBundleImpl(DatabaseClient dbClient, JSONWriteHandle servDec
this.baseProxy = new BaseProxy("/dbf/test/decoratorBase/", servDecl);

this.req_docify = this.baseProxy.request(
"docify.sjs", BaseProxy.ParameterValuesKind.SINGLE_ATOMIC);
"docify.sjs", BaseProxy.ParameterValuesKind.SINGLE_ATOMIC);
}

@Override
public com.fasterxml.jackson.databind.JsonNode docify(String value) {
return docify(
this.req_docify.on(this.dbClient), value
);
this.req_docify.on(this.dbClient), value
);
}
private com.fasterxml.jackson.databind.JsonNode docify(BaseProxy.DBFunctionRequest request, String value) {
return BaseProxy.JsonDocumentType.toJsonNode(
request
.withParams(
BaseProxy.atomicParam("value", true, BaseProxy.StringType.fromString(value))
).responseSingle(true, Format.JSON)
return BaseProxy.JsonDocumentType.toJsonNode(
request
.withParams(
BaseProxy.atomicParam("value", true, BaseProxy.StringType.fromString(value))
).responseSingle(true, Format.JSON)
);
}
}

return new DecoratorBaseBundleImpl(db, serviceDeclaration);
}

/**
* Invokes the docify operation on the database server
*
* @param value provides input
* @return as output
*/
/**
* Invokes the docify operation on the database server
*
* @param value provides input
* @return as output
*/
com.fasterxml.jackson.databind.JsonNode docify(String value);

}
Loading