From a5a78008baa56ee5c9ef4a9e914b35d47ff035bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Z=C3=B6ller?= Date: Sat, 13 Jun 2020 14:49:07 +0200 Subject: [PATCH] #9 - Use {:keys [...]} for map destructuring --- src/clj_test_containers/core.clj | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/clj_test_containers/core.clj b/src/clj_test_containers/core.clj index d142fdf..65a5854 100644 --- a/src/clj_test_containers/core.clj +++ b/src/clj_test_containers/core.clj @@ -7,11 +7,7 @@ (defn create "Sets the properties for a testcontainer instance" - [{image-name :image-name - exposed-ports :exposed-ports - env-vars :env-vars - command :command}] - + [{:keys [image-name exposed-ports env-vars command]}] (let [container (org.testcontainers.containers.GenericContainer. image-name)] (.setExposedPorts container (map int exposed-ports)) @@ -19,7 +15,7 @@ (if (some? env-vars) (doseq [pair env-vars] (.addEnv container (first pair) (second pair)))) - + (if (some? command) (.setCommand container command)) @@ -32,10 +28,7 @@ (defn map-classpath-resource! "Maps a resource in the classpath to the given container path. Should be called before starting the container!" [container-config - {resource-path :resource-path - container-path :container-path - mode :mode}] - + {:keys [resource-path container-path mode]}] (assoc container-config :container (.withClasspathResourceMapping (:container container-config) resource-path container-path @@ -44,10 +37,7 @@ (defn bind-filesystem! "Binds a source from the filesystem to the given container path. Should be called before starting the container!" [container-config - {host-path :host-path - container-path :container-path - mode :mode}] - + {:keys [host-path container-path mode]}] (assoc container-config :container (.withFileSystemBind (:container container-config) host-path container-path @@ -55,10 +45,8 @@ (defn copy-file-to-container! "Copies a file into the running container" - [container-conf {container-path :container-path - path :path - type :type}] - + [container-conf + {:keys [container-path path type]}] (let [mountable-file (cond (= :classpath-resource type) (org.testcontainers.utility.MountableFile/forClasspathResource path) (= :host-path type) (org.testcontainers.utility.MountableFile/forHostPath path)