|
1 | 1 | /* |
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. |
3 | 3 | */ |
4 | 4 | package com.marklogic.client.datamovement.filter; |
5 | 5 |
|
@@ -181,6 +181,43 @@ void noRangeIndexForFieldWithEval() { |
181 | 181 | "fail with a helpful error message. Actual message: " + message); |
182 | 182 | } |
183 | 183 |
|
| 184 | + @Test |
| 185 | + void customTimestampKeyName() { |
| 186 | + filter = IncrementalWriteFilter.newBuilder() |
| 187 | + .hashKeyName("incrementalWriteHash") |
| 188 | + .timestampKeyName("myTimestamp") |
| 189 | + .build(); |
| 190 | + |
| 191 | + writeTenDocuments(); |
| 192 | + |
| 193 | + DocumentMetadataHandle metadata = Common.client.newDocumentManager().readMetadata("/incremental/test/doc-1.xml", |
| 194 | + new DocumentMetadataHandle()); |
| 195 | + |
| 196 | + assertNotNull(metadata.getMetadataValues().get("myTimestamp")); |
| 197 | + assertNotNull(metadata.getMetadataValues().get("incrementalWriteHash")); |
| 198 | + assertFalse(metadata.getMetadataValues().containsKey("incrementalWriteTimestamp")); |
| 199 | + } |
| 200 | + |
| 201 | + /** |
| 202 | + * The thought for this test is that if the user passes null in (which could happen via our Spark connector), |
| 203 | + * they're breaking the feature. So don't let them do that - ignore null and use the default values. |
| 204 | + */ |
| 205 | + @Test |
| 206 | + void nullIsIgnoredForKeyNames() { |
| 207 | + filter = IncrementalWriteFilter.newBuilder() |
| 208 | + .hashKeyName(null) |
| 209 | + .timestampKeyName(null) |
| 210 | + .build(); |
| 211 | + |
| 212 | + writeTenDocuments(); |
| 213 | + |
| 214 | + DocumentMetadataHandle metadata = Common.client.newDocumentManager().readMetadata("/incremental/test/doc-1.xml", |
| 215 | + new DocumentMetadataHandle()); |
| 216 | + |
| 217 | + assertNotNull(metadata.getMetadataValues().get("incrementalWriteHash")); |
| 218 | + assertNotNull(metadata.getMetadataValues().get("incrementalWriteTimestamp")); |
| 219 | + } |
| 220 | + |
184 | 221 | private void verifyIncrementalWriteWorks() { |
185 | 222 | writeTenDocuments(); |
186 | 223 | verifyDocumentsHasHashInMetadataKey(); |
|
0 commit comments