Skip to content

Commit a191925

Browse files
aebadiradMarkLogic Builder
authored andcommitted
DHFPROD-2592: test cleanup, fixing how file collector recognizes binaries after changes to allowing multiple values per type
1 parent 4ce3e48 commit a191925

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/collector/impl/FileCollector.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ public DiskQueue<String> run() {
5959
(filePath, fileAttr) -> fileAttr.isRegularFile())
6060
.forEach(path -> {
6161
File file = path.toFile();
62-
if (fileFormat.get(inputFormat.toLowerCase()).contains(FilenameUtils.getExtension(file.getName()).toLowerCase())) {
62+
String fileName = FilenameUtils.getExtension(file.getName()).toLowerCase();
63+
if (fileFormat.containsKey(inputFormat.toLowerCase()) && fileFormat.get(inputFormat.toLowerCase()).contains(fileName)) {
6364
results.add(path.toFile().getAbsolutePath());
6465
}
65-
else if("binary".equalsIgnoreCase(inputFormat) && !fileFormat.values().contains(FilenameUtils.getExtension(file.getName().toLowerCase()))){
66+
else if("binary".equalsIgnoreCase(inputFormat) && !csvExts.contains(fileName) && !jsonExts.contains(fileName) && !xmlExts.contains(fileName)){
6667
results.add(path.toFile().getAbsolutePath());
6768
}
6869
});

marklogic-data-hub/src/test/java/com/marklogic/hub/flow/FlowRunnerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public void testIngestBinaryAndTxt(){
282282

283283
stepConfig.put("fileLocations", stepDetails);
284284
stepConfig.put("batchSize", "1");
285-
opts.put("outputFormat", "Binary");
285+
opts.put("outputFormat", "binary");
286286
opts.put("collections", coll);
287287
opts.put("permissions", "rest-reader,read");
288288
RunFlowResponse resp = fr.runFlow("testFlow",steps, UUID.randomUUID().toString(), opts, stepConfig);
@@ -295,7 +295,7 @@ public void testIngestBinaryAndTxt(){
295295

296296
stepConfig.put("fileLocations", stepDetails);
297297
stepConfig.put("batchSize", "1");
298-
opts.put("outputFormat", "Text");
298+
opts.put("outputFormat", "text");
299299
RunFlowResponse resp1 = fr.runFlow("testFlow",steps, UUID.randomUUID().toString(), opts, stepConfig);
300300
fr.awaitCompletion();
301301

marklogic-data-hub/src/test/resources/flow-runner-test/flows/testFlow.flow.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"inputFilePath": "input/tabs",
5959
"inputFileType": "csv",
6060
"outputURIReplacement": ".*/input,''",
61-
"separator": "\t"
61+
"separator": "\\t"
6262
},
6363
"options": {
6464
"outputFormat": "json",

0 commit comments

Comments
 (0)