Skip to content

Commit 1397b06

Browse files
authored
Merge pull request #1597 from marklogic/feature/ml-dev-tools-test-app
ml-development-tools now uses test-app
2 parents c3e2f48 + 3e41061 commit 1397b06

File tree

13 files changed

+154
-345
lines changed

13 files changed

+154
-345
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ bin
3333
repairXMLFull.xml
3434
xml-with-props.xml
3535

36+
ml-development-tools/src/test/ml-modules
37+
ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/generated

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ 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:
45+
46+
./gradlew ml-development-tools:test
47+
4448
You can also undeploy the test application if you do not wish to keep it around on your MarkLogic instance:
4549

4650
./gradlew mlUndeploy -i -Pconfirm=true

Jenkinsfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ def runAllTests(String type, String version, Boolean useReverseProxy){
5050
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
5151
cd java-client-api
5252
mkdir -p ml-development-tools/build/test-results/test
53-
./gradlew ml-development-tools:setupTestServer || true
54-
./gradlew ml-development-tools:generateTests || true
5553
./gradlew ml-development-tools:test || true
5654
'''
5755

ml-development-tools/build.gradle

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,11 @@ compileTestKotlin {
7575
kotlinOptions.jvmTarget = '1.8'
7676
}
7777

78-
task setupTestServer(type: JavaExec) {
79-
classpath = sourceSets.test.runtimeClasspath
80-
main = 'com.marklogic.client.test.dbfunction.FntestconfKt'
81-
args = [ 'setup' ]
82-
}
8378
task generateTests(type: JavaExec) {
84-
dependsOn setupTestServer
8579
classpath = sourceSets.test.runtimeClasspath
8680
main = 'com.marklogic.client.test.dbfunction.FntestgenKt'
8781
args = [ './src/test/', 'latest' ]
8882
}
89-
task teardownTestServer(type: JavaExec) {
90-
dependsOn test
91-
classpath = sourceSets.test.runtimeClasspath
92-
main = 'com.marklogic.client.test.dbfunction.FntestconfKt'
93-
args = [ 'teardown' ]
94-
}
83+
84+
// Allows running "./gradlew test" without having to remember to generate the tests first.
85+
test.dependsOn generateTests

ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/DBFunctionTestUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private static DatabaseClient makeRestClientImpl(DatabaseClientFactory.DigestAut
4040
return makeClientImpl(auth, "8012", false);
4141
}
4242
private static DatabaseClient makeTestClientImpl(DatabaseClientFactory.DigestAuthContext auth) {
43-
return makeClientImpl(auth, "8016", true);
43+
return makeClientImpl(auth, "8013", true);
4444
}
4545
private static DatabaseClient makeClientImpl(
4646
DatabaseClientFactory.DigestAuthContext auth, String defaultPort, boolean withCheck

ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

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

5-
import java.util.stream.Stream;
65
import com.marklogic.client.io.Format;
6+
import java.util.stream.Stream;
77

88

99
import com.marklogic.client.DatabaseClient;
@@ -48,40 +48,55 @@ final class AnyDocumentBundleImpl implements AnyDocumentBundle {
4848
private DatabaseClient dbClient;
4949
private BaseProxy baseProxy;
5050

51-
private BaseProxy.DBFunctionRequest req_sendReceiveManyDocs;
52-
private BaseProxy.DBFunctionRequest req_sendReceiveRequiredDoc;
5351
private BaseProxy.DBFunctionRequest req_sendReceiveOptionalDoc;
5452
private BaseProxy.DBFunctionRequest req_sendReceiveAnyDocs;
53+
private BaseProxy.DBFunctionRequest req_sendReceiveRequiredDoc;
54+
private BaseProxy.DBFunctionRequest req_sendReceiveManyDocs;
5555
private BaseProxy.DBFunctionRequest req_sendReceiveMappedDoc;
5656

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

61-
this.req_sendReceiveManyDocs = this.baseProxy.request(
62-
"sendReceiveManyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
63-
this.req_sendReceiveRequiredDoc = this.baseProxy.request(
64-
"sendReceiveRequiredDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
6561
this.req_sendReceiveOptionalDoc = this.baseProxy.request(
6662
"sendReceiveOptionalDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
6763
this.req_sendReceiveAnyDocs = this.baseProxy.request(
6864
"sendReceiveAnyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
65+
this.req_sendReceiveRequiredDoc = this.baseProxy.request(
66+
"sendReceiveRequiredDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
67+
this.req_sendReceiveManyDocs = this.baseProxy.request(
68+
"sendReceiveManyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
6969
this.req_sendReceiveMappedDoc = this.baseProxy.request(
7070
"sendReceiveMappedDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED);
7171
}
7272

7373
@Override
74-
public Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
75-
return sendReceiveManyDocs(
76-
this.req_sendReceiveManyDocs.on(this.dbClient), uris, docs
74+
public com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc) {
75+
return sendReceiveOptionalDoc(
76+
this.req_sendReceiveOptionalDoc.on(this.dbClient), uri, doc
7777
);
7878
}
79-
private Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(BaseProxy.DBFunctionRequest request, Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
79+
private com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(BaseProxy.DBFunctionRequest request, String uri, com.marklogic.client.io.InputStreamHandle doc) {
8080
return request
8181
.withParams(
82-
BaseProxy.atomicParam("uris", false, BaseProxy.StringType.fromString(uris)),
83-
BaseProxy.documentParam("docs", false, docs)
84-
).responseMultiple(false, Format.UNKNOWN)
82+
BaseProxy.atomicParam("uri", true, BaseProxy.StringType.fromString(uri)),
83+
BaseProxy.documentParam("doc", true, doc)
84+
).responseSingle(true, Format.UNKNOWN)
85+
.asHandle(new com.marklogic.client.io.InputStreamHandle());
86+
}
87+
88+
@Override
89+
public Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
90+
return sendReceiveAnyDocs(
91+
this.req_sendReceiveAnyDocs.on(this.dbClient), uris, docs
92+
);
93+
}
94+
private Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(BaseProxy.DBFunctionRequest request, Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
95+
return request
96+
.withParams(
97+
BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)),
98+
BaseProxy.documentParam("docs", true, docs)
99+
).responseMultiple(true, Format.UNKNOWN)
85100
.asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle());
86101
}
87102

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

103118
@Override
104-
public com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc) {
105-
return sendReceiveOptionalDoc(
106-
this.req_sendReceiveOptionalDoc.on(this.dbClient), uri, doc
107-
);
108-
}
109-
private com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(BaseProxy.DBFunctionRequest request, String uri, com.marklogic.client.io.InputStreamHandle doc) {
110-
return request
111-
.withParams(
112-
BaseProxy.atomicParam("uri", true, BaseProxy.StringType.fromString(uri)),
113-
BaseProxy.documentParam("doc", true, doc)
114-
).responseSingle(true, Format.UNKNOWN)
115-
.asHandle(new com.marklogic.client.io.InputStreamHandle());
116-
}
117-
118-
@Override
119-
public Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
120-
return sendReceiveAnyDocs(
121-
this.req_sendReceiveAnyDocs.on(this.dbClient), uris, docs
119+
public Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
120+
return sendReceiveManyDocs(
121+
this.req_sendReceiveManyDocs.on(this.dbClient), uris, docs
122122
);
123123
}
124-
private Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(BaseProxy.DBFunctionRequest request, Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
124+
private Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(BaseProxy.DBFunctionRequest request, Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs) {
125125
return request
126126
.withParams(
127-
BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)),
128-
BaseProxy.documentParam("docs", true, docs)
129-
).responseMultiple(true, Format.UNKNOWN)
127+
BaseProxy.atomicParam("uris", false, BaseProxy.StringType.fromString(uris)),
128+
BaseProxy.documentParam("docs", false, docs)
129+
).responseMultiple(false, Format.UNKNOWN)
130130
.asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle());
131131
}
132132

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

152152
/**
153-
* Invokes the sendReceiveManyDocs operation on the database server
153+
* Invokes the sendReceiveOptionalDoc operation on the database server
154154
*
155-
* @param uris provides input
156-
* @param docs provides input
155+
* @param uri provides input
156+
* @param doc provides input
157157
* @return as output
158158
*/
159-
Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs);
159+
com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc);
160160

161161
/**
162-
* Invokes the sendReceiveRequiredDoc operation on the database server
162+
* Invokes the sendReceiveAnyDocs operation on the database server
163163
*
164-
* @param uri provides input
165-
* @param doc provides input
164+
* @param uris provides input
165+
* @param docs provides input
166166
* @return as output
167167
*/
168-
com.marklogic.client.io.InputStreamHandle sendReceiveRequiredDoc(String uri, com.marklogic.client.io.InputStreamHandle doc);
168+
Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs);
169169

170170
/**
171-
* Invokes the sendReceiveOptionalDoc operation on the database server
171+
* Invokes the sendReceiveRequiredDoc operation on the database server
172172
*
173173
* @param uri provides input
174174
* @param doc provides input
175175
* @return as output
176176
*/
177-
com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc);
177+
com.marklogic.client.io.InputStreamHandle sendReceiveRequiredDoc(String uri, com.marklogic.client.io.InputStreamHandle doc);
178178

179179
/**
180-
* Invokes the sendReceiveAnyDocs operation on the database server
180+
* Invokes the sendReceiveManyDocs operation on the database server
181181
*
182182
* @param uris provides input
183183
* @param docs provides input
184184
* @return as output
185185
*/
186-
Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveAnyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs);
186+
Stream<com.marklogic.client.io.InputStreamHandle> sendReceiveManyDocs(Stream<String> uris, Stream<com.marklogic.client.io.InputStreamHandle> docs);
187187

188188
/**
189189
* Invokes the sendReceiveMappedDoc operation on the database server

ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/DecoratorBaseBundle.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface DecoratorBaseBundle {
2424
* @return an object for executing database operations
2525
*/
2626
static DecoratorBaseBundle on(DatabaseClient db) {
27-
return on(db, null);
27+
return on(db, null);
2828
}
2929
/**
3030
* Creates a DecoratorBaseBundle object for executing operations on the database server.
@@ -54,34 +54,34 @@ private DecoratorBaseBundleImpl(DatabaseClient dbClient, JSONWriteHandle servDec
5454
this.baseProxy = new BaseProxy("/dbf/test/decoratorBase/", servDecl);
5555

5656
this.req_docify = this.baseProxy.request(
57-
"docify.sjs", BaseProxy.ParameterValuesKind.SINGLE_ATOMIC);
57+
"docify.sjs", BaseProxy.ParameterValuesKind.SINGLE_ATOMIC);
5858
}
5959

6060
@Override
6161
public com.fasterxml.jackson.databind.JsonNode docify(String value) {
6262
return docify(
63-
this.req_docify.on(this.dbClient), value
64-
);
63+
this.req_docify.on(this.dbClient), value
64+
);
6565
}
6666
private com.fasterxml.jackson.databind.JsonNode docify(BaseProxy.DBFunctionRequest request, String value) {
67-
return BaseProxy.JsonDocumentType.toJsonNode(
68-
request
69-
.withParams(
70-
BaseProxy.atomicParam("value", true, BaseProxy.StringType.fromString(value))
71-
).responseSingle(true, Format.JSON)
67+
return BaseProxy.JsonDocumentType.toJsonNode(
68+
request
69+
.withParams(
70+
BaseProxy.atomicParam("value", true, BaseProxy.StringType.fromString(value))
71+
).responseSingle(true, Format.JSON)
7272
);
7373
}
7474
}
7575

7676
return new DecoratorBaseBundleImpl(db, serviceDeclaration);
7777
}
7878

79-
/**
80-
* Invokes the docify operation on the database server
81-
*
82-
* @param value provides input
83-
* @return as output
84-
*/
79+
/**
80+
* Invokes the docify operation on the database server
81+
*
82+
* @param value provides input
83+
* @return as output
84+
*/
8585
com.fasterxml.jackson.databind.JsonNode docify(String value);
8686

8787
}

0 commit comments

Comments
 (0)