Skip to content

Commit 7f87ad8

Browse files
committed
MLE-26918 Fixing binary test on ARM, and bumping Gradle to 9.3.1
The Gradle bump should "just work". Also hoping this triggers publication of the library internally, which doesn't seem to have happened for the last PR.
1 parent 5f25dcc commit 7f87ad8

File tree

4 files changed

+93
-92
lines changed

4 files changed

+93
-92
lines changed

.copyrightconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ startyear: 2010
1111
# - Dotfiles already skipped automatically
1212
# Enable by removing the leading '# ' from the next line and editing values.
1313
# filesexcluded: third_party/*, docs/generated/*.md, assets/*.png, scripts/temp_*.py, vendor/lib.js
14-
filesexcluded: .github/*, README.md, Jenkinsfile, gradle/*, docker-compose.yaml, docker-compose.yml, *.gradle, gradle.properties, gradlew, gradlew.bat, **/test/resources/**, *.md, pom.xml, *.properties, *.json, *.xml, CODEOWNERS, *.txt, *.xqy
14+
filesexcluded: .github/*, README.md, Jenkinsfile, gradle/*, docker-compose.yaml, docker-compose.yml, *.gradle, *.properties, gradlew, gradlew.bat, **/test/resources/**, *.md, pom.xml, *.json, *.xml, CODEOWNERS, *.txt, *.xqy

gradle/wrapper/gradle-wrapper.jar

718 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
Lines changed: 91 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2+
* Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
33
*/
44
package com.marklogic.client.test;
55

@@ -8,106 +8,107 @@
88
import com.marklogic.client.document.DocumentManager.Metadata;
99
import com.marklogic.client.io.*;
1010
import com.marklogic.client.test.junit5.RequiresML11;
11+
import jakarta.xml.bind.DatatypeConverter;
1112
import org.custommonkey.xmlunit.exceptions.XpathException;
12-
import org.junit.jupiter.api.AfterAll;
1313
import org.junit.jupiter.api.BeforeAll;
1414
import org.junit.jupiter.api.Test;
15+
import org.junit.jupiter.api.condition.DisabledOnOs;
16+
import org.junit.jupiter.api.condition.OS;
1517
import org.junit.jupiter.api.extension.ExtendWith;
1618
import org.w3c.dom.Document;
1719

18-
import jakarta.xml.bind.DatatypeConverter;
1920
import java.io.File;
2021
import java.io.IOException;
2122
import java.util.Random;
2223

2324
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
2425
import static org.junit.jupiter.api.Assertions.*;
2526

26-
public class BinaryDocumentTest {
27-
@BeforeAll
28-
public static void beforeClass() {
29-
Common.connect();
30-
}
31-
@AfterAll
32-
public static void afterClass() {
33-
}
34-
35-
// a simple base64-encoded binary
36-
final static public String ENCODED_BINARY =
37-
"iVBORw0KGgoAAAANSUhEUgAAAA0AAAATCAYAAABLN4eXAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oIEQEjMtAYogQAAAKvSURBVCjPlZLLbhxFAEVPVVdXVz/G8zCOn0CsKGyQkSIIKzas8xfsWbLkp/gJhCKheIlAJDaj2MYez6u7p7vrxQKUPVc6+yOdK77/4cfXQohJqlOVZdmBSpKY6jQKBM45oVMlgHvrvMuNWRljvlNKq69G2YyqLDg4mLE/2yPNYFRWlFXF/nTC2clRWbc7Fss1IcZzqTA8eWY5eu7p1Hv+WvyBVjnGZOQmI9UKISUqSXDO0bS7Tko0xfGSp18kjM7v+P3+NUMr8T5grWMYLCEErHM474khoCw1t78eU/8mEOpjXpxekJUORIZSCbkxSCnRWpPnBikTqbx31E1DjJHpeIzRhnW9xceI857H5Yr1Zku765jf3DIMtlUAIQRCiFhnabsOH1IEAmstAGWRY11ApykmM0oplTKZjNGZREpJoUueHI0ZFRV7exX7+1Nm0yn9YLm5u2fX96lUseLwxQ0vX8H04i2/XP9Et5H44OkHS920hBDo+56u77GDjcrHjvV1ya3TDO2M01mOUAEAhED+R5IkpKmCiFCOjoc/p+xuLbPpCc+P95HaEqIBIhHoB8t2W/PwsKBudl5FH7GxwUYYouJh5ci7nLbtWW02LBaPvLuef1AdrItKKolJpkivwGrG5QxTCsq8pCxLqqrk7PiIwTmW6y0xRCVTSg4vFnz+raM4+5ur1RtSUZHnOUWeMx5VVFWJTlOstfTWRuk96NIyOUgRRc188RZvgRg/3OffjoFESohxUMvmjqufP+X+MqDTU77+5EvMKKBUQpZpijxHSkluDHvjMW8uL79Rnz07bwSyzDLFqCzwDNw/PNI0O9bbhvVmQ7vb0bQdi+Wq327rl+rko8krodKnCHnofJju+r5oupBstg1KJT7Vuruev185O9zVm/WVUmouYoz83/0DxhRmafe2kasAAAAASUVORK5CYII=";
38-
final static public byte[] BYTES_BINARY = DatatypeConverter.parseBase64Binary(ENCODED_BINARY);
39-
40-
@Test
41-
// Requires MarkLogic 11 or higher now that we're using Docker; the INSTALL_CONVERTERS flag does not work for MarkLogic 10.
42-
@ExtendWith(RequiresML11.class)
43-
public void testReadWrite() throws IOException, XpathException {
44-
String docId = "/test/binary-sample.png";
45-
String mimetype = "image/png";
46-
47-
for (int i: new int[]{0, 1}) {
48-
BinaryDocumentManager docMgr = Common.client.newBinaryDocumentManager();
49-
docMgr.setMetadataExtraction(MetadataExtraction.PROPERTIES);
50-
51-
BytesHandle handle = new BytesHandle().with(BYTES_BINARY).withMimetype(mimetype);
52-
switch (i) {
53-
case 0:
54-
docMgr.write(docId, handle);
55-
break;
56-
case 1:
57-
docMgr.write(docMgr.newWriteSet().add(docId, handle));
58-
break;
59-
default:
60-
fail("unknown case: "+i);
61-
}
62-
63-
DocumentDescriptor desc = docMgr.exists(docId);
64-
assertTrue(desc.getByteLength() != DocumentDescriptor.UNKNOWN_LENGTH);
65-
assertEquals(BYTES_BINARY.length, desc.getByteLength());
66-
67-
byte[] buf = docMgr.read(docId, new BytesHandle()).get();
68-
assertEquals(BYTES_BINARY.length, buf.length);
69-
70-
buf = Common.streamToBytes(docMgr.read(docId, new InputStreamHandle()).get());
71-
assertTrue(buf.length > 0);
72-
73-
switch (i) {
74-
case 0:
75-
handle = new BytesHandle();
76-
buf = docMgr.read(docId, handle, 9, 10).get();
77-
assertEquals(10, buf.length);
78-
assertEquals(10, handle.getByteLength());
79-
break;
80-
case 1:
81-
break;
82-
default:
83-
fail("unknown case: "+i);
84-
}
85-
86-
docMgr.setMetadataCategories(Metadata.PROPERTIES);
87-
Document metadataDocument = docMgr.readMetadata(docId, new DOMHandle()).get();
88-
assertXpathEvaluatesTo("image/png","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='content-type'])", metadataDocument);
89-
assertXpathEvaluatesTo("text HD-HTML","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='filter-capabilities'])", metadataDocument);
90-
assertXpathEvaluatesTo("815","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='size'])", metadataDocument);
91-
92-
docMgr.delete(docId);
93-
}
94-
}
95-
96-
@Test
97-
public void test_issue_758() {
98-
BinaryDocumentManager docMgr = Common.client.newBinaryDocumentManager();
99-
DocumentWriteSet writeset = docMgr.newWriteSet();
100-
FileHandle h1 = new FileHandle(new File(
101-
"../marklogic-client-api-functionaltests/src/test/java/com/marklogic" +
102-
"/client" +
103-
"/functionaltest/data" +
104-
"/Sega-4MB.jpg"));
105-
String uri = "BinaryDocumentTest_" + new Random().nextInt(10000) + "/" + "Sega-4MB.jpg";
106-
writeset.add(uri, h1);
107-
docMgr.write(writeset);
108-
DocumentPage page = docMgr.read(uri);
109-
DocumentRecord rec = page.next();
110-
assertNotNull(rec);
111-
assertEquals(rec.getFormat(),Format.BINARY);
112-
}
27+
class BinaryDocumentTest {
28+
29+
@BeforeAll
30+
public static void beforeClass() {
31+
Common.connect();
32+
}
33+
34+
// a simple base64-encoded binary
35+
final static public String ENCODED_BINARY =
36+
"iVBORw0KGgoAAAANSUhEUgAAAA0AAAATCAYAAABLN4eXAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oIEQEjMtAYogQAAAKvSURBVCjPlZLLbhxFAEVPVVdXVz/G8zCOn0CsKGyQkSIIKzas8xfsWbLkp/gJhCKheIlAJDaj2MYez6u7p7vrxQKUPVc6+yOdK77/4cfXQohJqlOVZdmBSpKY6jQKBM45oVMlgHvrvMuNWRljvlNKq69G2YyqLDg4mLE/2yPNYFRWlFXF/nTC2clRWbc7Fss1IcZzqTA8eWY5eu7p1Hv+WvyBVjnGZOQmI9UKISUqSXDO0bS7Tko0xfGSp18kjM7v+P3+NUMr8T5grWMYLCEErHM474khoCw1t78eU/8mEOpjXpxekJUORIZSCbkxSCnRWpPnBikTqbx31E1DjJHpeIzRhnW9xceI857H5Yr1Zku765jf3DIMtlUAIQRCiFhnabsOH1IEAmstAGWRY11ApykmM0oplTKZjNGZREpJoUueHI0ZFRV7exX7+1Nm0yn9YLm5u2fX96lUseLwxQ0vX8H04i2/XP9Et5H44OkHS920hBDo+56u77GDjcrHjvV1ya3TDO2M01mOUAEAhED+R5IkpKmCiFCOjoc/p+xuLbPpCc+P95HaEqIBIhHoB8t2W/PwsKBudl5FH7GxwUYYouJh5ci7nLbtWW02LBaPvLuef1AdrItKKolJpkivwGrG5QxTCsq8pCxLqqrk7PiIwTmW6y0xRCVTSg4vFnz+raM4+5ur1RtSUZHnOUWeMx5VVFWJTlOstfTWRuk96NIyOUgRRc188RZvgRg/3OffjoFESohxUMvmjqufP+X+MqDTU77+5EvMKKBUQpZpijxHSkluDHvjMW8uL79Rnz07bwSyzDLFqCzwDNw/PNI0O9bbhvVmQ7vb0bQdi+Wq327rl+rko8krodKnCHnofJju+r5oupBstg1KJT7Vuruev185O9zVm/WVUmouYoz83/0DxhRmafe2kasAAAAASUVORK5CYII=";
37+
final static public byte[] BYTES_BINARY = DatatypeConverter.parseBase64Binary(ENCODED_BINARY);
38+
39+
@Test
40+
// Requires MarkLogic 11 or higher now that we're using Docker; the INSTALL_CONVERTERS flag does not work for MarkLogic 10.
41+
@ExtendWith(RequiresML11.class)
42+
@DisabledOnOs(value = OS.LINUX, architectures = "aarch64", disabledReason = "MarkLogic converters not available when " +
43+
"ARM regression tests are run in Jenkins.")
44+
void testReadWrite() throws IOException, XpathException {
45+
String docId = "/test/binary-sample.png";
46+
String mimetype = "image/png";
47+
48+
for (int i : new int[]{0, 1}) {
49+
BinaryDocumentManager docMgr = Common.client.newBinaryDocumentManager();
50+
docMgr.setMetadataExtraction(MetadataExtraction.PROPERTIES);
51+
52+
BytesHandle handle = new BytesHandle().with(BYTES_BINARY).withMimetype(mimetype);
53+
switch (i) {
54+
case 0:
55+
docMgr.write(docId, handle);
56+
break;
57+
case 1:
58+
docMgr.write(docMgr.newWriteSet().add(docId, handle));
59+
break;
60+
default:
61+
fail("unknown case: " + i);
62+
}
63+
64+
DocumentDescriptor desc = docMgr.exists(docId);
65+
assertTrue(desc.getByteLength() != DocumentDescriptor.UNKNOWN_LENGTH);
66+
assertEquals(BYTES_BINARY.length, desc.getByteLength());
67+
68+
byte[] buf = docMgr.read(docId, new BytesHandle()).get();
69+
assertEquals(BYTES_BINARY.length, buf.length);
70+
71+
buf = Common.streamToBytes(docMgr.read(docId, new InputStreamHandle()).get());
72+
assertTrue(buf.length > 0);
73+
74+
switch (i) {
75+
case 0:
76+
handle = new BytesHandle();
77+
buf = docMgr.read(docId, handle, 9, 10).get();
78+
assertEquals(10, buf.length);
79+
assertEquals(10, handle.getByteLength());
80+
break;
81+
case 1:
82+
break;
83+
default:
84+
fail("unknown case: " + i);
85+
}
86+
87+
docMgr.setMetadataCategories(Metadata.PROPERTIES);
88+
Document metadataDocument = docMgr.readMetadata(docId, new DOMHandle()).get();
89+
assertXpathEvaluatesTo("image/png", "string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='content-type'])", metadataDocument);
90+
assertXpathEvaluatesTo("text HD-HTML", "string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='filter-capabilities'])", metadataDocument);
91+
assertXpathEvaluatesTo("815", "string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='size'])", metadataDocument);
92+
93+
docMgr.delete(docId);
94+
}
95+
}
96+
97+
@Test
98+
void test_issue_758() {
99+
BinaryDocumentManager docMgr = Common.client.newBinaryDocumentManager();
100+
DocumentWriteSet writeset = docMgr.newWriteSet();
101+
FileHandle h1 = new FileHandle(new File(
102+
"../marklogic-client-api-functionaltests/src/test/java/com/marklogic" +
103+
"/client" +
104+
"/functionaltest/data" +
105+
"/Sega-4MB.jpg"));
106+
String uri = "BinaryDocumentTest_" + new Random().nextInt(10000) + "/" + "Sega-4MB.jpg";
107+
writeset.add(uri, h1);
108+
docMgr.write(writeset);
109+
DocumentPage page = docMgr.read(uri);
110+
DocumentRecord rec = page.next();
111+
assertNotNull(rec);
112+
assertEquals(rec.getFormat(), Format.BINARY);
113+
}
113114
}

0 commit comments

Comments
 (0)