-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #1: normalization of imp/exp configuration maps
It is now possible to give explicitely a dump file name and a log file name. The file prefix and log type are used to generate a filename if the value is not present in the map. Signed-off-by: Stanislas Nanchen <stan@hood.ch>
- Loading branch information
Showing
4 changed files
with
96 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
(ns li.elmnt.datapump.impl.common-test | ||
(:require | ||
[li.elmnt.datapump.impl.common :as c] | ||
[midje.sweet :refer :all])) | ||
|
||
(defn statement [test-fn statement] | ||
(str (-> test-fn meta :name) " " statement)) | ||
|
||
(facts "derive-file-name trustful" | ||
(c/derive-file-name "filename.log" nil nil) => "filename.log" | ||
(c/derive-file-name "filename.log" "filename" :dump-file) => "filename.log" | ||
(c/derive-file-name nil "filename" :dump-file) => "filename.dump") | ||
|
||
(def error (throws AssertionError)) | ||
|
||
(facts "derive-file-name defensive" | ||
(c/derive-file-name nil nil :dump-file) => error | ||
(c/derive-file-name nil "filename" nil) => error | ||
(c/derive-file-name nil nil nil) => error) | ||
|
||
(defn derive-file-names-trustful [test-fn] | ||
(facts (statement test-fn "trustful") | ||
(test-fn {:file-prefix "file"} :export) | ||
=> (contains {:log-file "file_exp.log" :dump-file "file.dump"}) | ||
(test-fn {:file-prefix "file" :log-file "logfile"} :export) | ||
=> (contains {:log-file "logfile" :dump-file "file.dump"}) | ||
(test-fn {:file-prefix "file" :dump-file "dumpfile"} :export) | ||
=> (contains {:log-file "file_exp.log" :dump-file "dumpfile"}) | ||
(test-fn {:file-prefix "file" :dump-file "dumpfile" :log-file "logfile"} :export) | ||
=> (contains {:log-file "logfile" :dump-file "dumpfile"}))) | ||
|
||
(derive-file-names-trustful #'c/derive-file-names) | ||
(derive-file-names-trustful #'c/normalize) | ||
|
||
(defn derive-file-names-defensive [test-fn] | ||
(facts (statement test-fn "defensive") | ||
(test-fn {} :export) => error | ||
(test-fn {:log-file "logfile.log"} :export) => error | ||
(test-fn {:dump-file "dumpfile.dump"} :export) => error)) | ||
|
||
(derive-file-names-defensive #'c/derive-file-names) | ||
(derive-file-names-defensive #'c/normalize) |