Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 2bf7f7d

Browse files
committed
#87 Pattern for asset modules to load works properly now
1 parent 320fd9e commit 2bf7f7d

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
group=com.marklogic
22
javadocsDir=../gh-pages-marklogic-java/javadocs
3-
version=3.3.0
3+
version=3.3.1

src/main/java/com/marklogic/client/ext/modulesloader/impl/DefaultModulesLoader.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,16 @@ protected void loadAssets(Modules modules, Set<Resource> loadedModules) {
263263
DocumentFileReader dfr = assetFileLoader.getDocumentFileReader();
264264
if (dfr instanceof DefaultDocumentFileReader) {
265265
DefaultDocumentFileReader reader = (DefaultDocumentFileReader)dfr;
266-
reader.addFileFilter(pathname -> includeFilenamePattern.matcher(pathname.getAbsolutePath()).matches());
266+
reader.addDocumentFileProcessor(documentFile -> {
267+
File f = documentFile.getFile();
268+
if (f == null) {
269+
return null;
270+
}
271+
if (!includeFilenamePattern.matcher(f.getAbsolutePath()).matches()) {
272+
return null;
273+
}
274+
return documentFile;
275+
});
267276
}
268277
}
269278

src/test/java/com/marklogic/client/ext/datamovement/job/ExportDocumentsToSingleFileTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void configureWithProperties() throws Exception {
4343

4444
String exportedXml = new String(FileCopyUtils.copyToByteArray(job.getExportFile()));
4545
logger.info("Exported XML: " + exportedXml);
46-
assertTrue(exportedXml.startsWith("<results><record><test>"));
46+
assertTrue(exportedXml.startsWith("<results>\n<record><test>"));
4747
assertTrue(exportedXml.endsWith("</test></record></results>"));
4848
}
4949
}

src/test/java/com/marklogic/client/ext/modulesloader/impl/LoadModulesTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public void withFilenamePattern() {
7474
verifyModuleCountWithPattern(".*transforms.*", "Should only load the 5 transforms", 5);
7575
verifyModuleCountWithPattern(".*services.*", "Should only load the 3 services", 3);
7676
verifyModuleCountWithPattern(".*", "Should load every file", 26);
77-
verifyModuleCountWithPattern(".*/ext.*", "Should only load the 7 assets under /ext", 7);
77+
verifyModuleCountWithPattern(".*/ext.*(lib|dots)/.*xqy", "Should only load the xqy asset modules " +
78+
"under ext/lib and ext/path/with/dots", 2);
7879
}
7980

8081
private void verifyModuleCountWithPattern(String pattern, String message, int count) {

0 commit comments

Comments
 (0)