Skip to content

Commit 0d6295d

Browse files
committed
Merge branch 'release-5.5.0'
2 parents 5e59450 + 4dbfdb7 commit 0d6295d

40 files changed

+4907
-5138
lines changed

CHANGELOG.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
# CHANGELOG
22

3-
## 5.4.0
3+
## 5.5.0
44
#### New Functionality
5+
- [#1294](https://github.com/marklogic/java-client-api/issues/1294) - New Optic features Redaction, generate views - Server release 10.0-7 or above required
6+
7+
#### Improvements and Bug Fixes
8+
- [#1230](https://github.com/marklogic/java-client-api/issues/1230) - Upgraded dependencies
9+
- [#1279](https://github.com/marklogic/java-client-api/issues/1279) - Size task queue for QueryBatcher based on forests, thread counts
10+
- [#1290](https://github.com/marklogic/java-client-api/issues/1290) - QueryBatcher fails with empty criteria
11+
- [#1298](https://github.com/marklogic/java-client-api/issues/1298) - Removed JCenter as repository
512

6-
- [#1260](https://github.com/marklogic/java-client-api/issues/1260) - CtsQueryBuilder for search is available
7-
- [#1280](https://github.com/marklogic/java-client-api/issues/1280) - Optic query DSL - Support for human-oriented representation of Optic query
8-
- [#1282](https://github.com/marklogic/java-client-api/issues/1282) - Optic enhancements - support for document matching, relevance, multiple groups
13+
## 5.4.0
14+
#### New Functionality
15+
- [#1260](https://github.com/marklogic/java-client-api/issues/1260) - CtsQueryBuilder for search is available - Server release 10.0-5 or above required
16+
- [#1280](https://github.com/marklogic/java-client-api/issues/1280) - Optic query DSL - Support for human-oriented representation of Optic query - Server release 10.0-6 or above required
17+
- [#1282](https://github.com/marklogic/java-client-api/issues/1282) - Optic enhancements - support for document matching, relevance, multiple groups - Server release 10.0-6 or above required
918

1019
#### Improvements and Bug Fixes
1120
- [#1256](https://github.com/marklogic/java-client-api/issues/1256) - Clear collections is not working in Java API
1221
- [#1268](https://github.com/marklogic/java-client-api/issues/1268) - Gradle wrapper upgrade to 6.7
13-
- [#1269](https://github.com/marklogic/java-client-api/issues/1269) - Increased concurrency for DMSDK QueryBatcher
22+
- [#1269](https://github.com/marklogic/java-client-api/issues/1269) - Increased concurrency for DMSDK QueryBatcher - Server release 10.0-6 or above required
1423
- [#1283](https://github.com/marklogic/java-client-api/issues/1283) - QueryBatcher fails when using path range query
1524

1625
## 5.3.1

NOTICE.txt

Lines changed: 2074 additions & 3926 deletions
Large diffs are not rendered by default.

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ subprojects {
2020
repositories {
2121
mavenLocal()
2222
mavenCentral()
23-
jcenter()
2423
maven { url "http://repo.maven.apache.org/maven2" }
2524
}
2625

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=5.4.0
3-
releaseVersion=5.4.0
2+
version=5.5.0
3+
releaseVersion=5.5.0
44
describedName=MarkLogic Java Client API
55
publishUrl=file:../marklogic-java/releases

marklogic-client-api-functionaltests/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ repositories {
3030
dependencies {
3131
implementation project (':marklogic-client-api')
3232
implementation group: 'org.skyscreamer', name: 'jsonassert', version: '1.5.0'
33-
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.0'
34-
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.0'
3533
implementation group: 'org.slf4j', name: 'slf4j-api', version:'1.7.25'
3634
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version:'1.2.3'
3735
implementation group: 'commons-io', name: 'commons-io', version: '2.6'

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/datamovement/functionaltests/StringQueryHostBatcherTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public void testAndWordQuery() throws Exception
239239
StringBuilder batchResults = new StringBuilder();
240240
StringBuilder forestResults = new StringBuilder();
241241
StringBuilder batchFailResults = new StringBuilder();
242+
StringBuilder batchIllegalState = new StringBuilder();
242243

243244
// Run a QueryBatcher on the new URIs.
244245
QueryBatcher queryBatcher1 = dmManager.newQueryBatcher(querydef);
@@ -276,7 +277,23 @@ public void testAndWordQuery() throws Exception
276277
else {
277278
fail("testAndWordQuery test failed");
278279
}
279-
} catch (Exception e) {
280+
281+
try {
282+
// Verify Git # 1290
283+
QueryBatcher qb = dmManager.newQueryBatcher(client.newQueryManager().newStringDefinition().withCriteria("")).withBatchSize(10);
284+
285+
qb.onQueryFailure(throwable -> {
286+
throwable.printStackTrace();
287+
batchIllegalState.append(throwable.getMessage());
288+
});
289+
dmManager.startJob(qb);
290+
qb.awaitCompletion();
291+
} catch (Exception ex) {
292+
batchIllegalState.append(ex.getMessage());
293+
System.out.println("Exceptions buffer from empty withCriteria : " + batchIllegalState.toString());
294+
assertTrue("Exception message incorrect", batchIllegalState.toString().contains("Criteria cannot be an empty string"));
295+
}
296+
} catch (Exception e) {
280297
System.out.print(e.getMessage());
281298
} finally {
282299
clearDB();
@@ -1315,6 +1332,9 @@ public void testServerXQueryTransform() throws IOException, ParserConfigurationE
13151332
});
13161333
dmManager.startJob(queryBatcher1);
13171334
queryBatcher1.awaitCompletion(3, TimeUnit.MINUTES);
1335+
while (!queryBatcher1.isStopped()) {
1336+
// Do nothing. Wait for batcher to complete.
1337+
}
13181338

13191339
if (queryBatcher1.isStopped()) {
13201340
// Verify the batch results now.

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/datamovement/functionaltests/TestSplitters.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ public void testWriteOpsMultipleThreads() throws KeyManagementException, NoSuchA
476476
try {
477477
tempJsonFile1 = File.createTempFile("TestWriteOps1", ".json");
478478
BufferedWriter bwJson1 = new BufferedWriter(new FileWriter(tempJsonFile1));
479-
DocumentManager docMgrJson1 = client.newJSONDocumentManager();
480479
dmManager = client.newDataMovementManager();
481480
WriteBatcher wbatcher1 = dmManager.newWriteBatcher();
482481

@@ -530,15 +529,22 @@ public void testWriteOpsMultipleThreads() throws KeyManagementException, NoSuchA
530529
t1.join();
531530
t2.join();
532531

533-
Thread.sleep(1000);
532+
wbatcher1.awaitCompletion();
533+
534534
// Verify docs count
535535
QueryBatcher queryBatcherdMgr = dmManager.newQueryBatcher(
536536
new StructuredQueryBuilder().collection(collectionName))
537537
.withBatchSize(20)
538-
//.withThreadCount(1)
538+
.withThreadCount(1)
539539
.onUrisReady((batch) -> {
540540
cnt1.addAndGet(batch.getItems().length);
541-
});
541+
})
542+
.onQueryFailure(failure -> {
543+
System.out.println("query failed");
544+
failure.printStackTrace(System.out);
545+
dmManager.stopJob(failure.getBatcher());
546+
});
547+
542548
dmManager.startJob(queryBatcherdMgr);
543549
queryBatcherdMgr.awaitCompletion();
544550
assertEquals(2 * nDocs, cnt1.get());
@@ -565,7 +571,6 @@ public void testWriteOpsMultipleThreads() throws KeyManagementException, NoSuchA
565571
jsonfs1.close();
566572
if (jsonfs2 != null)
567573
jsonfs2.close();
568-
docMgrJson1 = null;
569574
} catch (Exception ex) {
570575
System.out.println("Exceptions thrown testSplitterWithMultipleThreads " + ex.getMessage());
571576
} finally {

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/BulkIOCallersFnTest.java

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ public class BulkIOCallersFnTest extends BasicJavaClientREST {
7878

7979
// Egress error endpoint ConfigName
8080
private static String JsonEgressErrorConfigName = "DynamicEgressServicesForJsonError";
81+
// Ingest error endpoint ConfigName
82+
private static String JsonIngestErrorConfigName = "DynamicIngestServicesForTextError";
8183

8284
// Ingest and Egress endpoint ConfigName
8385
private static String IngestEgressSessionFieldsConfigName = "DynamicIngestEgressSessionFields";
@@ -94,6 +96,7 @@ public class BulkIOCallersFnTest extends BasicJavaClientREST {
9496
private static String IngestServicesXmlURI = "/dynamic/fntest/DynamicIngestServices/xml/";
9597
private static String IngestServicesTextURI = "/dynamic/fntest/DynamicIngestServices/text/";
9698
private static String IngestServicesBinURI = "/dynamic/fntest/DynamicIngestServices/bin/";
99+
private static String IngestServicesJsonErrorURI = "/dynamic/fntest/DynamicIngestServicesError/json/";
97100
//Output URI
98101
private static String EgressServicesJsonURI = "/dynamic/fntest/DynamicEgressServices/json/";
99102
private static String EgressServicesJsonErrorURI = "/dynamic/fntest/DynamicEgressServicesError/json/";
@@ -241,6 +244,18 @@ public static void setUp() throws Exception {
241244
file = null;
242245
handle = null;
243246

247+
file = new File(ApiConfigDirPath + JsonIngestErrorConfigName + ".sjs");
248+
handle = new FileHandle(file);
249+
docMgr.write(IngestServicesJsonErrorURI + JsonIngestErrorConfigName +".sjs", metadataHandle, handle);
250+
file = null;
251+
handle = null;
252+
253+
file = new File(ApiConfigDirPath + JsonIngestErrorConfigName + ".api");
254+
handle = new FileHandle(file);
255+
docMgr.write(IngestServicesJsonErrorURI + JsonIngestErrorConfigName +".api", metadataHandle, handle);
256+
file = null;
257+
handle = null;
258+
244259
file = new File(ApiConfigDirPath + IngestEgressSessionFieldsConfigName + ".sjs");
245260
handle = new FileHandle(file);
246261
docMgr.write(IngestEgressSessionFieldsURI + IngestEgressSessionFieldsConfigName +".sjs", metadataHandle, handle);
@@ -652,6 +667,61 @@ public void TestIngestEgressOnTextDocs() throws Exception {
652667
}
653668
}
654669

670+
// Use /dynamic/fntest/DynamicIngestServices/text/DynamicIngestServicesForTextError.sjs endpoint to test Text Documents ingest
671+
// Verify that STOP_ALL_CALLS in client does not throw NPE. Git # 1265
672+
@Test
673+
public void TestIngestOnTextDocsError() throws Exception {
674+
System.out.println("Running TestIngestOnTextDocsError");
675+
StringBuilder errorBuf = new StringBuilder();
676+
try {
677+
int startBatchIdx = 0;
678+
int maxDocSize = 100;
679+
680+
ObjectMapper om = new ObjectMapper();
681+
File apiFile = new File(ApiConfigDirPath + JsonIngestErrorConfigName + ".api");
682+
683+
JsonNode api = om.readTree(new FileReader(apiFile));
684+
JacksonHandle jhAPI = new JacksonHandle(api);
685+
686+
String state = "{\"next\":"+startBatchIdx+"}";
687+
String work = "{\"max\":"+maxDocSize+"}";
688+
689+
InputCaller<String> ingressEndpt = InputCaller.on(dbclient, jhAPI, new StringHandle());
690+
InputCaller.BulkInputCaller<String> inputbulkCaller = ingressEndpt.bulkCaller(ingressEndpt.newCallContext()
691+
.withEndpointConstantsAs(work.getBytes())
692+
.withEndpointStateAs(state));
693+
String[] strContent = { "This is first test document",
694+
"This is second test document",
695+
"This is third test document",
696+
"This is fourth test document",
697+
"This is fifth test document"
698+
};
699+
InputCaller.BulkInputCaller.ErrorListener InerrorListener =
700+
(retryCount, throwable, callContext, inputHandles)
701+
-> {
702+
for(BufferableHandle h:inputHandles) {
703+
errorBuf.append(h.toString());
704+
}
705+
return IOEndpoint.BulkIOEndpointCaller.ErrorDisposition.STOP_ALL_CALLS;
706+
};
707+
708+
Stream<String> input = Stream.of(strContent);
709+
input.forEach(inputbulkCaller::accept);
710+
inputbulkCaller.setErrorListener(InerrorListener);
711+
inputbulkCaller.awaitCompletion();
712+
String errStr = errorBuf.toString();
713+
//System.out.println("Error buffer when STOP_ALL_CALLS " + errorBuf.toString());
714+
Assert.assertTrue(!errStr.contains("Exception"));
715+
Assert.assertTrue(errStr.isEmpty());
716+
717+
} catch (Exception e) {
718+
e.printStackTrace();
719+
}
720+
finally {
721+
System.out.println("End of TestIngestEgressOnTextDocs");
722+
}
723+
}
724+
655725
// Use /dynamic/fntest/DynamicIngestServices/bin/DynamicIngestServicesForBin.sjs endpoint to test Binary Documents ingest
656726
@Test
657727
public void TestIngestEgressOnBinDocs() throws Exception {

0 commit comments

Comments
 (0)