Set .disableContentCompression in build-http-client

The HttpAsyncClientBuilder does not have this option, which leads to
inconsistency of which options to set and runtime behaviour. By disabling it in
the HttpClientBuilder and relying on wrap-decompression, the experience for
end-users is consistent.

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -323,6 +323,11 @@
                     (.setRedirectStrategy
                      (get-redirect-strategy req))
                     (add-retry-handler retry-handler)
+
+                    ;; prefer using clj-http.client/wrap-decompression
+                    ;; for consistency between sync/async client options
+                    (.disableContentCompression)
+
                     ;; By default, get the proxy settings
                     ;; from the jvm or system properties
                     (.setRoutePlanner


Refactor

Refactor

--- src/greenyet/core.clj
+++ src/greenyet/core.clj
@@ -14,13 +14,14 @@

 (import java.io.FileNotFoundException)

-(def ^:private hosts-with-status (atom [{} (tc/now)]))
+(def ^:private statuses (atom [{} (tc/now)]))

-(defn- update-status [[status-map last-changed] key new-status]
-  (let [old-status (get status-map key)]
-    (if (= new-status old-status)
-      [status-map last-changed]
-      [(assoc status-map key new-status) (tc/now)])))
+(defn- update-status [[host-with-statuses last-changed] key new-status]
+  (let [old-status (get host-with-statuses key)]
+    [(assoc host-with-statuses key new-status)
+     (if (= new-status old-status)
+       last-changed
+       (tc/now))]))

 (def ^:private config-dir (System/getenv "CONFIG_DIR"))

@@ -37,7 +38,7 @@
 (defn- poll-status [host status-url-config]
   (go-loop []
     (let [status (status/with-status host status-url-config)]
-      (swap! hosts-with-status update-status host status)
+      (swap! statuses update-status host status)
       (<! (timeout timeout-in-ms))
       (recur))))

@@ -62,7 +63,7 @@
 (def ^:private environment-names (-> "environment_names.yaml" io/resource io/file slurp yaml/parse-string))

 (defn- render [_]
-  (let [[host-with-statuses last-changed] @hosts-with-status]
+  (let [[host-with-statuses last-changed] @statuses]
     (-> (response (view/render (vals host-with-statuses) page-template environment-names))
         (content-type "text/html")
         (header "Last-Modified" (format-date (.toDate last-changed)))


Fixed bug whereby directory entries were missing a trailing / character in the emitted AMP file

--- src/leiningen/amp/impl.clj
+++ src/leiningen/amp/impl.clj
@@ -22,13 +22,13 @@
     (if-not (empty? files)
       (with-open [zip-stream-out (java.util.zip.ZipOutputStream. (io/output-stream zip-file))]
         (doseq [file (rest files)]  ; Discard the first file - it's the directory itself
-          (.putNextEntry zip-stream-out
-                         (java.util.zip.ZipEntry. (.substring (.getPath ^java.io.File file)
-                                                              directory-length)))
-          (if (.isFile ^java.io.File file)
-            (with-open [file-stream-in (io/input-stream file)]
-              (io/copy file-stream-in zip-stream-out)))
-          (.closeEntry zip-stream-out)))))
+          (let [entry-name (str (.substring (.getPath ^java.io.File file)
+                                            directory-length) (if (.isDirectory ^java.io.File file) "/"))]
+            (.putNextEntry zip-stream-out (java.util.zip.ZipEntry. entry-name))
+            (if (.isFile ^java.io.File file)
+              (with-open [file-stream-in (io/input-stream file)]
+                (io/copy file-stream-in zip-stream-out)))
+            (.closeEntry zip-stream-out))))))
   nil)

 (defn- mkdir-p


cs: adds metrics for rate of receiving Mesos status updates and framework messages (#654)

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -91,7 +91,9 @@
     (merge mesos-attributes cook-attributes)))

 (timers/deftimer [cook-mesos scheduler handle-status-update-duration])
+(meters/defmeter [cook-mesos scheduler handle-status-update-rate])
 (timers/deftimer [cook-mesos scheduler handle-framework-message-duration])
+(meters/defmeter [cook-mesos scheduler handle-framework-message-rate])
 (meters/defmeter [cook-mesos scheduler tasks-killed-in-status-update])

 (meters/defmeter [cook-mesos scheduler tasks-completed])
@@ -1482,65 +1484,74 @@
   [configured-framework-id gpu-enabled? conn heartbeat-ch fenzo offers-chan match-trigger-chan handle-progress-message
    sandbox-publisher-state]
   (mesos/scheduler
-    (registered [this driver framework-id master-info]
-                (log/info "Registered with mesos with framework-id " framework-id)
-                (let [value (-> framework-id mesomatic.types/pb->data :value)]
-                  (when (not= configured-framework-id value)
-                    (let [message (str "The framework-id provided by Mesos (" value ") "
-                                       "does not match the one Cook is configured with (" configured-framework-id ")")]
-                      (log/error message)
-                      (throw (ex-info message {:framework-id-mesos value :framework-id-cook configured-framework-id})))))
-                (when (and gpu-enabled? (not (re-matches #"1\.\d+\.\d+" (:version master-info))))
-                  (binding [*out* *err*]
-                    (println "Cannot enable GPU support on pre-mesos 1.0. The version we found was " (:version master-info)))
-                  (log/error "Cannot enable GPU support on pre-mesos 1.0. The version we found was " (:version master-info))
-                  (Thread/sleep 1000)
-                  (System/exit 1))
-                ;; Use future because the thread that runs mesos/scheduler doesn't load classes correctly. for reasons.
-                ;; As Sophie says, you want to future proof your code.
-                (future
-                  (try
-                    (reconcile-jobs conn)
-                    (reconcile-tasks (db conn) driver configured-framework-id fenzo)
-                    (catch Exception e
-                      (log/error e "Reconciliation error")))))
-    (reregistered [this driver master-info]
-                  (log/info "Reregistered with new master")
-                  (future
-                    (try
-                      (reconcile-jobs conn)
-                      (reconcile-tasks (db conn) driver configured-framework-id fenzo)
-                      (catch Exception e
-                        (log/error e "Reconciliation error")))))
+    (registered
+      [this driver framework-id master-info]
+      (log/info "Registered with mesos with framework-id " framework-id)
+      (let [value (-> framework-id mesomatic.types/pb->data :value)]
+        (when (not= configured-framework-id value)
+          (let [message (str "The framework-id provided by Mesos (" value ") "
+                             "does not match the one Cook is configured with (" configured-framework-id ")")]
+            (log/error message)
+            (throw (ex-info message {:framework-id-mesos value :framework-id-cook configured-framework-id})))))
+      (when (and gpu-enabled? (not (re-matches #"1\.\d+\.\d+" (:version master-info))))
+        (binding [*out* *err*]
+          (println "Cannot enable GPU support on pre-mesos 1.0. The version we found was " (:version master-info)))
+        (log/error "Cannot enable GPU support on pre-mesos 1.0. The version we found was " (:version master-info))
+        (Thread/sleep 1000)
+        (System/exit 1))
+      ;; Use future because the thread that runs mesos/scheduler doesn't load classes correctly. for reasons.
+      ;; As Sophie says, you want to future proof your code.
+      (future
+        (try
+          (reconcile-jobs conn)
+          (reconcile-tasks (db conn) driver configured-framework-id fenzo)
+          (catch Exception e
+            (log/error e "Reconciliation error")))))
+    (reregistered
+      [this driver master-info]
+      (log/info "Reregistered with new master")
+      (future
+        (try
+          (reconcile-jobs conn)
+          (reconcile-tasks (db conn) driver configured-framework-id fenzo)
+          (catch Exception e
+            (log/error e "Reconciliation error")))))
     ;; Ignore this--we can just wait for new offers
-    (offer-rescinded [this driver offer-id]
-                     ;; TODO: Rescind the offer in fenzo
-                     )
-    (framework-message [this driver executor-id slave-id message]
-                       (try
-                         (let [{:strs [task-id type] :as parsed-message} (json/read-str (String. ^bytes message "UTF-8"))]
-                           (case type
-                             "directory" (sandbox/update-sandbox sandbox-publisher-state parsed-message)
-                             "heartbeat" (heartbeat/notify-heartbeat heartbeat-ch executor-id slave-id parsed-message)
-                             (async-in-order-processing
-                               task-id #(handle-framework-message conn handle-progress-message parsed-message))))
-                         (catch Exception e
-                           (log/error e "Unable to process framework message"
-                                      {:executor-id executor-id, :message message, :slave-id slave-id}))))
-    (disconnected [this driver]
-                  (log/error "Disconnected from the previous master"))
+    (offer-rescinded
+      [this driver offer-id]
+      (comment "TODO: Rescind the offer in fenzo"))
+    (framework-message
+      [this driver executor-id slave-id message]
+      (meters/mark! handle-framework-message-rate)
+      (try
+        (let [{:strs [task-id type] :as parsed-message} (json/read-str (String. ^bytes message "UTF-8"))]
+          (case type
+            "directory" (sandbox/update-sandbox sandbox-publisher-state parsed-message)
+            "heartbeat" (heartbeat/notify-heartbeat heartbeat-ch executor-id slave-id parsed-message)
+            (async-in-order-processing
+              task-id #(handle-framework-message conn handle-progress-message parsed-message))))
+        (catch Exception e
+          (log/error e "Unable to process framework message"
+                     {:executor-id executor-id, :message message, :slave-id slave-id}))))
+    (disconnected
+      [this driver]
+      (log/error "Disconnected from the previous master"))
     ;; We don't care about losing slaves or executors--only tasks
     (slave-lost [this driver slave-id])
     (executor-lost [this driver executor-id slave-id status])
-    (error [this driver message]
-           (meters/mark! mesos-error)
-           (log/error "Got a mesos error!!!!" message))
-    (resource-offers [this driver offers]
-                     (receive-offers offers-chan match-trigger-chan driver offers))
-    (status-update [this driver status]
-                   (let [task-id (-> status :task-id :value)]
-                     (async-in-order-processing
-                       task-id #(handle-status-update conn driver fenzo status))))))
+    (error
+      [this driver message]
+      (meters/mark! mesos-error)
+      (log/error "Got a mesos error!!!!" message))
+    (resource-offers
+      [this driver offers]
+      (receive-offers offers-chan match-trigger-chan driver offers))
+    (status-update
+      [this driver status]
+      (meters/mark! handle-status-update-rate)
+      (let [task-id (-> status :task-id :value)]
+        (async-in-order-processing
+          task-id #(handle-status-update conn driver fenzo status))))))

 (defn create-datomic-scheduler
   [conn driver-atom pending-jobs-atom offer-cache heartbeat-ch offer-incubate-time-ms mea-culpa-failure-limit


Fix comment, favor (set)

Fix comment, favor (set)

--- src/overseer/core.clj
+++ src/overseer/core.clj
@@ -37,7 +37,7 @@
  (d/pull db '[:*] [:job/id job-id]))

 (defn reserve
-  "Return a transaction clause that reserves the given job, or throws an exception.
+  "Transact the DB to reserve the given job, or throw an exception.
    Requires the overseer.schema/reserve-job database function to be in-schema."
   [conn job-id]
   {:pre [job-id]}
@@ -52,7 +52,7 @@
             db
             ent)
        (map first)
-       (into #{})))
+       (set)))

 (defn transitive-dependents [db job-id]
   "Returns a set of job IDs that transitively depend upon given job ID


async ns-side-effects ast pass

async ns-side-effects ast pass

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -109,6 +109,27 @@
         ))
     (cb)))

+(defn ns-side-effects
+  [env {:keys [op] :as ast} opts bound-vars cb]
+  (if (= :ns op)
+    (let [{:keys [deps uses require-macros use-macros reload reloads]} ast]
+      (letfn [(check-uses-and-load-macros []
+                (when (and (:*analyze-deps* bound-vars) (seq uses))
+                  (ana/check-uses uses env))
+                (when (:*load-macros* bound-vars)
+                  (load-macros :use-macros use-macros reload reloads bound-vars
+                    (fn []
+                      (load-macros :require-macros require-macros reloads reloads bound-vars
+                        (fn []
+                          (when (seq use-macros)
+                            (ana/check-use-macros use-macros env))
+                          (cb ast)))))))]
+        (if (and (:*analyze-deps* bound-vars) (seq deps))
+          (analyze-deps name deps env (dissoc opts :macros-ns)
+            check-uses-and-load-macros)
+          (check-uses-and-load-macros))))
+    (cb ast)))
+
 (defn analyze [env source cb]
   (analyze* env
     {:*cljs-ns*      (or (:ns env) 'cljs.user)


Fix errors following merges of PR #662 and #663


fixed the filter benchmark

fixed the filter benchmark

--- test/selmer/benchmark.clj
+++ test/selmer/benchmark.clj
@@ -1,6 +1,7 @@
 (ns selmer.benchmark
   (:require [clojure.test :refer :all]
             [selmer.parser :refer :all]
+            [selmer.filters :as filters]
             [selmer.util :refer :all]
             [criterium.core :as criterium])
   (:import java.io.StringReader))
@@ -44,7 +45,6 @@

 (deftest ^:benchmark bench-filter-hot-potato []
   (println "BENCH: bench-filter-hot-potato")
+  (filters/add-filter! :inc (fn [^String s] (str (inc (Integer/parseInt s)))))
   (criterium/quick-bench
-   (render-template (parse (java.io.StringReader. (str "{{bar" filter-chain "}}"))
-                        {:custom-filters
-                         {:inc (fn [^String s] (inc (Integer. s)))}}) {:bar "0"})))
+    (render (str "{{bar" filter-chain "}}") {:bar "0"})))


nu virker testen

nu virker testen

--- test/tester/core_test.clj
+++ test/tester/core_test.clj
@@ -4,4 +4,4 @@

 (deftest a-test
   (testing "FIXME, I fail."
-    (is (= 0 1))))
+    (is (= 1 1))))


Remove blacklisted package

Remove blacklisted package

--- src/nightmod/sandbox.clj
+++ src/nightmod/sandbox.clj
@@ -12,7 +12,6 @@
    (jail-test/blacklist-packages
      ["java.lang.reflect"
       "java.security"
-      "java.util.concurrent"
       "java.awt"])
    (jail-test/blacklist-symbols
     '#{alter-var-root eval catch


fixes

fixes

--- src/node/game/cards.cljs
+++ src/node/game/cards.cljs
@@ -30,7 +30,7 @@
    "Aggressive Secretary"
    {:advanceable :always
     :access {:optional {:req (req installed) :prompt "Pay 3[Credits] to use Aggresive Secretary ability?"
-                        :cost [:credit 3] :msg (msg "trash " (:advance-counter card) " programs")}}}
+                        :cost [:credit 2] :msg (msg "trash " (:advance-counter card) " programs")}}}

    "Akamatsu Mem Chip"
    {:effect (effect (gain :memory 1)) :leave-play (effect (lose :memory 1))}
@@ -182,8 +182,8 @@
                                                (when (zero? (:counter %3)) (trash %1 :runner %3)))}}}

    "Data Dealer"
-   {:abilities [{:cost [:click 1] :effect (effect (gain :credit 10))
-                 :msg "forfeit an Agenda and gain 10 [Credits]"}]}
+   {:abilities [{:cost [:click 1] :effect (effect (gain :credit 9))
+                 :msg "forfeit an Agenda and gain 9 [Credits]"}]}

    "Data Folding"
    {:events {:runner-turn-begins {:req (req (>= (:memory runner) 2)) :msg "gain 1 [Credits]"
@@ -413,7 +413,7 @@
    {:prompt "Choose a Connection to install"
     :choices (req (filter #(and (has? % :subtype "Connection")
                                 (<= (:cost %) (:credit runner))) (:deck runner)))
-    :effect (effect (runner-install target) (shuffle! :deck))}
+    :effect (effect (gain :click 1) (runner-install target) (shuffle! :deck))}

    "Hostile Infrastructure"
    {:events {:trash {:req (req (and (= (:side target) :corp) (= side :runner)))


enhanced test about reifying overloaded interface method

--- test/unit/reify_fake.cljc
+++ test/unit/reify_fake.cljc
@@ -224,11 +224,15 @@
    (f/-deftest
      "java.lang.Appendable/append (overloaded method) can be reified with optional fake"
      (f/with-fakes
-       (let [expected (new StringBuffer)
+       (let [my-char-seq "123"
+             expected1 (new StringBuffer)
+             expected2 (new StringBuffer)
              foo (f/reify-fake
                    java.lang.Appendable
-                   (append :optional-fake [[\a] expected]))]
-         (is (= expected (.append foo \a)))))))
+                   (append :optional-fake [[\a] expected1
+                                           [my-char-seq] expected2]))]
+         (is (= expected1 (.append foo \a)))
+         (is (= expected2 (.append foo my-char-seq)))))))

 ; TODO:
 ;#?(:clj


made sure take-until-done still accepts three arguments

--- src/onyx/kafka/utils.clj
+++ src/onyx/kafka/utils.clj
@@ -5,22 +5,23 @@

 (defn take-until-done
   "Reads from a topic until a :done is reached."
-  [zk-addr topic decompress-fn opts]
-  (let [fetch-size (get opts :kafka/fetch-size 307200)
-        kafka-config {"zookeeper.connect" zk-addr
-                      "group.id" "onyx-consumer"
-                      "auto.offset.reset" "smallest"
-                      "auto.commit.enable" "false"
-                      "fetch.message.max.bytes" (str fetch-size)}]
-    (zkcore/with-resource [c (zkconsumer/consumer kafka-config)]
-      zkconsumer/shutdown
-      (->> (zkconsumer/messages c topic)
-           (map (fn [msg] (-> msg
-                              (update :key #(if %
-                                              (decompress-fn %)))
-                              (update :value decompress-fn))))
-           (take-while (fn [v] (not= :done (:value v))))
-           vec))))
+  ([zk-addr topic decompress-fn] (take-until-done zk-addr topic decompress-fn {}))
+  ([zk-addr topic decompress-fn opts]
+   (let [fetch-size (get opts :kafka/fetch-size 307200)
+         kafka-config {"zookeeper.connect" zk-addr
+                       "group.id" "onyx-consumer"
+                       "auto.offset.reset" "smallest"
+                       "auto.commit.enable" "false"
+                       "fetch.message.max.bytes" (str fetch-size)}]
+     (zkcore/with-resource [c (zkconsumer/consumer kafka-config)]
+       zkconsumer/shutdown
+       (->> (zkconsumer/messages c topic)
+            (map (fn [msg] (-> msg
+                               (update :key #(if %
+                                               (decompress-fn %)))
+                               (update :value decompress-fn))))
+            (take-while (fn [v] (not= :done (:value v))))
+            vec)))))

 (defn take-segments


ingesting label collections

ingesting label collections

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -194,10 +194,10 @@
      {:$replaceRoot {:newRoot "$_root"}}]))

 (def steps
-  {:from-edge from-edge
-   :to-edge to-edge
-   :from-vertex from-vertex
-   :to-vertex to-vertex
+  {:fromEdge from-edge
+   :toEdge to-edge
+   :fromVertex from-vertex
+   :toVertex to-vertex
    :from from
    :to to
    :root root
@@ -210,7 +210,7 @@
    :order order
    :offset offset
    :count qount
-   :group-count group-count})
+   :groupCount group-count})

 (defn apply-step
   [steps step]
@@ -296,12 +296,20 @@
 (defn ingest-label-collections!
   [graph element all]
   (let [processed (map (if (= element "vertex") process-vertex process-edge) all)]
-    (doseq [lines (partition-all 1000 processed)]
+    (doseq [lines (partition-all 2000 processed)]
       (let [labels (group-by :label lines)]
         (doseq [[label messages] labels]
+          (log/info "ingesting" (count messages) label)
           (mongo/ensure-collection! graph element label)
-          (pprint/pprint
-           (mongo/bulk-insert! graph label messages)))))))
+          (mongo/bulk-insert! graph label messages))))))
+
+(defn ingest-labels-from-path!
+  [graph path]
+  (doseq [file (kafka/dir->files path)]
+    (let [element (string/lower-case (kafka/path->label (.getName file)))
+          lines (line-seq (io/reader file))
+          parsed (map #(json/parse-string % keyword) lines)]
+      (ingest-batches! graph element parsed))))

 (defn ingest-batches!
   [graph element all]
@@ -355,7 +363,7 @@
         config (config/read-path path)
         graph (mongo/connect! (:mongo config))]
     ;; (ingest-incrementally graph (:input env))
-    (ingest-batches-from-path! graph (:input env))
+    (ingest-labels-from-path! graph (:input env))
     (log/info "ingest complete")))

 (def gods-graph


Fix merge issue

Fix merge issue

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -9,20 +9,6 @@
             [onyx.types :refer [->Leaf]])
   (:import [java.util UUID]))

-<<<<<<< HEAD
-=======
-(defn apply-fn
-  [{:keys [onyx.core/params] :as event} segment]
-  (if-let [f (:onyx.core/fn event)]
-   (operation/apply-function f params segment)
-    segment))
-
-; (defn filter-by-route [messages task-name]
-;   (->> messages
-;        (filter (fn [msg] (some #{task-name} (:flow (:routes msg)))))
-;        (map #(dissoc % :routes :hash-group))))
-
->>>>>>> develop
 (defn into-transient [coll vs]
   (loop [rs (seq vs) updated-coll coll]
     (if rs


Lerduveskytte in da house - Thx Mathias S

--- src/skidskytte/namer.clj
+++ src/skidskytte/namer.clj
@@ -136,6 +136,7 @@
                 "konståkning"
                 "lacrosse"
                 "landhockey"
+                "lerduveskytte"
                 "längdhopp"
                 "löpning"
                 "maraton"


Fix tests with last renames.

Fix tests with last renames.

--- test/buddy/test_buddy_crypto_hashers.clj
+++ test/buddy/test_buddy_crypto_hashers.clj
@@ -1,11 +1,11 @@
 (ns buddy.test_buddy_crypto_hashers
   (:require [clojure.test :refer :all]
             [buddy.codecs :as crypto]
-            [buddy.crypto.hashers.pbkdf2 :as pbkdf2]
-            [buddy.crypto.hashers.bcrypt :as bcrypt]
-            [buddy.crypto.hashers.sha256 :as sha256]
-            [buddy.crypto.hashers.md5 :as md5]
-            [buddy.crypto.hashers.scrypt :as scrypt])
+            [buddy.hashers.pbkdf2 :as pbkdf2]
+            [buddy.hashers.bcrypt :as bcrypt]
+            [buddy.hashers.sha256 :as sha256]
+            [buddy.hashers.md5 :as md5]
+            [buddy.hashers.scrypt :as scrypt])
   (:import (java.util Arrays)))

 (deftest pbkdf2-tests


CMR-6161 addressed default page-size issue

--- search-app/src/cmr/search/models/query.clj
+++ search-app/src/cmr/search/models/query.clj
@@ -230,7 +230,7 @@
 (defmethod common-qm/concept-type->default-query-attribs :autocomplete
   [_]
   {:condition (common-qm/->MatchAllCondition)
-   :page-size :unlimited
+   :page-size common-qm/default-page-size
    :offset common-qm/default-offset
    :sort-keys (common-qm/default-sort-keys :autocomplete)
    :result-format :json


Add the ability to close lightbox clicking out of main div.

--- src/uxbox/ui/lightbox.cljs
+++ src/uxbox/ui/lightbox.cljs
@@ -6,6 +6,7 @@
             [uxbox.data.lightbox :as udl]
             [uxbox.ui.mixins :as mx]
             [uxbox.ui.keyboard :as k]
+            [uxbox.util.dom :as dom]
             [goog.events :as events])
   (:import goog.events.EventType))

@@ -21,9 +22,17 @@
 (defmethod render-lightbox :default [_] nil)

 (defn- on-esc-clicked
-  [e]
-  (when (k/esc? e)
-    (udl/close!)))
+  [event]
+  (when (k/esc? event)
+    (udl/close!)
+    (dom/stop-propagation event)))
+
+(defn- on-out-clicked
+  [own event]
+  (let [parent (mx/get-ref-dom own "parent")
+        current (dom/get-target event)]
+    (when (dom/equals? parent current)
+      (udl/close!))))

 (defn- lightbox-will-mount
   [own]
@@ -46,7 +55,9 @@
   (let [data (rum/react lightbox-l)]
     (html
      [:div.lightbox
-      {:class (when (nil? data) "hide")}
+      {:class (when (nil? data) "hide")
+       :ref "parent"
+       :on-click (partial on-out-clicked own)}
       (render-lightbox data)])))

 (def lightbox


Fix Sente server channel

Fix Sente server channel

--- src/clj/pva_parrot/backend/service.clj
+++ src/clj/pva_parrot/backend/service.clj
@@ -3,6 +3,7 @@
             [ring.middleware.keyword-params :as keyword-params]
             [compojure.core                 :refer :all]
             [taoensso.sente                 :as sente]
+            [taoensso.sente.server-adapters.http-kit :refer (sente-web-server-adapter)]
             [taoensso.timbre                :as timbre :refer (tracef debugf infof warnf errorf)]
             [clojure.data.csv               :as csv]
             [pva-parrot.calc.pca            :as pca]
@@ -10,12 +11,13 @@
             ))

 (let [{:keys [ch-recv send-fn ajax-post-fn ajax-get-or-ws-handshake-fn connected-uids]}
-      (sente/make-channel-socket! {})]
+      (sente/make-channel-socket! sente-web-server-adapter {})]
   (def ring-ajax-post                ajax-post-fn)
   (def ring-ajax-get-or-ws-handshake ajax-get-or-ws-handshake-fn)
   (def ch-chsk                       ch-recv)
   (def chsk-send!                    send-fn)
   (def connected-uids                connected-uids))
+
 (defmulti event-msg-handler :id)

 (defmethod event-msg-handler :default
@@ -24,7 +26,6 @@
     (?reply-fn {:unmatched-event-as-echoed-from-server event})))

 (sente/start-chsk-router! ch-chsk event-msg-handler)
-

 (defmethod event-msg-handler :data-import/csv-sent
   [{:as event-msg :keys [event id ?data ring-req ?reply-fn send-fn]}]
@@ -60,7 +61,6 @@

       (chsk-send! uid reply-msg))))

-
 (defroutes api-handlers
   (GET "/" [] "You found the PVA Parrot backend service!")
   (GET  "/chsk" request (ring-ajax-get-or-ws-handshake request))


Add cumulative original recoverable

Add cumulative original recoverable

--- src/clj_simple_chart/ncs/discovery.clj
+++ src/clj_simple_chart/ncs/discovery.clj
@@ -4,6 +4,7 @@
             [clojure.set :refer [rename-keys]]
             [clj-simple-chart.ncs.resource :as resource]
             [clj-simple-chart.ncs.reserve :as reserve]
+            [clj-simple-chart.ncs.production-cumulative-yearly-fields :as production]
             [clojure.test :as test]))

 (def url "http://factpages.npd.no/ReportServer?/FactPages/TableView/discovery&rs:Command=Render&rc:Toolbar=false&rc:Parameters=f&rs:Format=CSV&Top100=false&IpAddress=81.191.112.135&CultureCode=en")
@@ -87,6 +88,11 @@
                  (sort-by :name)
                  (vec)))

+
+(def start-year (->> parsed
+                     (map :year)
+                     (apply min)))
+
 (def producing-field-names (->> parsed
                                 (filter #(= :producing (:status %)))
                                 (map :name)
@@ -100,3 +106,18 @@
                                 (distinct)
                                 (sort)
                                 (vec)))
+
+(defn cumulative-original-recoverable-by-status
+  [status year kind]
+  {:pre [(some #{kind} [:fldRecoverableLiquids :fldRecoverableGas])
+         (some #{status} (vals status-map))]}
+  (->> parsed
+       (filter #(= status (:status %)))
+       (filter #(<= (:year %) year))
+       (map kind)
+       (reduce + 0)
+       (double)))
+
+(test/is (< (cumulative-original-recoverable-by-status :producing 2000 :fldRecoverableLiquids)
+            (cumulative-original-recoverable-by-status :producing 2010 :fldRecoverableLiquids)))
+


misc round improvements

misc round improvements

--- src/wordup/logic/board.clj
+++ src/wordup/logic/board.clj
@@ -1,8 +1,20 @@
 (ns wordup.logic.board
-  (:require [clojure.set :as set])
-  (:use [clojure.tools.logging :only (spy)]))
+  (:require [clojure.set :as set]
+            [clojure.tools.logging :as log]))

 (def letters-list (map char (concat (range 65 91))))
+
+(def letters-weighed (zipmap letters-list
+                        [9 2 2 4 12 2 3 2 9 1 1 4 2 6 8 2 1 6 4 6 4 2 2 1 2 1]))
+
+(def weighed-letters-list
+  (->> letters-weighed
+    (map #(repeat (val %) (key %)))
+    flatten))
+
+(defn random-weighed-letter
+  []
+  (rand-nth weighed-letters-list))

 (defn random-letter
   []
@@ -10,8 +22,7 @@

 (defn random-row
   [length]
-  (-> []
-    (into (repeatedly length random-letter))))
+  (into [] (repeatedly length random-weighed-letter)))

 (defn board-width
   [board]
@@ -28,8 +39,7 @@

 (defn random-board
   [x y]
-  (-> []
-    (into (repeatedly y #(random-row x)))))
+  (into [] (repeatedly y #(random-row x))))

 (defn str-board
   [board]
@@ -104,9 +114,9 @@
   [board words]
   (sort #(> (count %1) (count %2)) (filter #(contains-word? board %) @words)))

-(defn print-board!
+(defn log-board!
   [board]
-  (println (str-board board)))
+  (log/info (str "\n" (str-board board))))

 ; (ns wordup.logic.board)
 ; (use 'wordup.logic.dict)


Remove duplicates in cmd-for-cat

Remove duplicates in cmd-for-cat

--- src/yetibot/core/hooks.clj
+++ src/yetibot/core/hooks.clj
@@ -31,7 +31,10 @@
            ;; regex that triggers the cmd)
            (comp (partial take-nth 2) rest))
          (filter
-           (fn [cmd] ((set (:yb/cat (meta cmd))) search-cat))))))
+           (fn [cmd] ((set (:yb/cat (meta cmd))) search-cat)))
+         ;; remove duplicates since multiple regexes can trigger the same
+         ;; command
+         set)))

 (defonce re-prefix->topic (atom {}))

@@ -72,7 +75,7 @@
    implement its own default behavior."
   [callback cmd-with-args {:keys [chat-source user opts settings] :as extra}]
   ;; (info "handle-with-hooked-cmds" extra)
-  (let [[cmd args] (split-command-and-args cmd-with-args)]
+  (let [[cmd args] (split-command-and-args cmd-with-args)]
     ;; find the top level command and its corresponding sub-cmds
     (if-let [[cmd-re sub-cmds] (find-sub-cmds cmd)]
       ;; Now try to find a matching sub-commands


Better test current behavior.

Better test current behavior.

--- test-cljs/frontend/test_datetime.cljs
+++ test-cljs/frontend/test_datetime.cljs
@@ -1,6 +1,6 @@
 (ns frontend.test-datetime
   (:require [frontend.datetime :as datetime])
-  (:require-macros [cemerick.cljs.test :refer (is deftest testing)]))
+  (:require-macros [cemerick.cljs.test :refer (is are deftest testing)]))

 (deftest milli-to-float-duration-works
   (testing "basic"
@@ -42,12 +42,30 @@

 (deftest format-duration-works
   (testing "full units"
-    (testing "singular"
-      (is (= (datetime/time-ago 1000) "1 second")))
-    (testing "plural"
-      (is (= (datetime/time-ago 480000) "8 minutes"))))
-  (testing "abbreviated  units"
-    (testing "singular"
-      (is (= (datetime/time-ago 3600000) "1 hour")))
-    (testing "plural"
-      (is (= (datetime/time-ago (* 3600000 48)) "2 days")))))
+    (are [ms formatted] (= (datetime/time-ago ms) formatted)
+      1000 "1 second"
+      2000 "2 seconds"
+      (* 60 1000) "1 minute"
+      (* 60 2000) "2 minutes"
+      (* 60 60 1000) "1 hour"
+      (* 60 60 2000) "2 hours"
+      (* 24 60 60 1000) "1 day"
+      (* 24 60 60 2000) "2 days"
+      (* 30 24 60 60 1000) "1 month"
+      (* 30 24 60 60 2000) "2 months"
+      (* 12 30 24 60 60 1000) "1 year"
+      (* 12 30 24 60 60 2000) "2 years"))
+  (testing "abbreviated units"
+    (are [ms formatted] (= (datetime/time-ago-abbreviated ms) formatted)
+      1000 "1 sec"
+      2000 "2 secs"
+      (* 60 1000) "1 min"
+      (* 60 2000) "2 mins"
+      (* 60 60 1000) "1 hr"
+      (* 60 60 2000) "2 hrs"
+      (* 24 60 60 1000) "1 day"
+      (* 24 60 60 2000) "2 days"
+      (* 30 24 60 60 1000) "1 month"
+      (* 30 24 60 60 2000) "2 months"
+      (* 12 30 24 60 60 1000) "1 year"
+      (* 12 30 24 60 60 2000) "2 years")))


Fix instrumentation test.

Fix instrumentation test.

--- test/riemann/test/instrumentation.clj
+++ test/riemann/test/instrumentation.clj
@@ -23,9 +23,9 @@

              ; Should emit a rate and quantiles
              (is (= ["riemann meow rate"
-                     "riemann meow 0"
-                     "riemann meow 3/5"
-                     "riemann meow 1.0"]
+                     "riemann meow latency 0"
+                     "riemann meow latency 3/5"
+                     "riemann meow latency 1.0"]
                     (map :service es)))

              ; Uses unix-time


add a test case to incomplete-extractors?-test

--- test/synthesis_crawlers/core_test.clj
+++ test/synthesis_crawlers/core_test.clj
@@ -83,5 +83,6 @@
 (deftest incomplete-extractors?-test
   (testing "returns true value iff the specified extractor is incomplete"
     (is (incomplete-extractors? {"html" {:a "body" :b nil}}))
+    (is (incomplete-extractors? {"" {:a nil :b nil}}))
     (is (not (incomplete-extractors? {"html" {:a "body" :b "header"}})))
     ))


Use new instantiate-with fn.

Use new instantiate-with fn.

--- test/isla/test/story.clj
+++ test/isla/test/story.clj
@@ -16,15 +16,13 @@
   (let [story-str (str "palace is a room")
         story (init-story story-str)]
     (is (= (get (:rooms story) "palace")
-           (assoc (story-utils/instantiate-type (get types "room"))
-             :name "palace")))))
+           (instantiate-with "room" :name "palace")))))

 (deftest test-player-alteration
   (let [story-str (str "my name is 'mary'")
         story (init-story story-str)]
     (is (= (:player story)
-           (assoc (story-utils/instantiate-type (get types "_player"))
-             :name "mary")))))
+           (instantiate-with "_player" :name "mary")))))

 (deftest test-room-alteration
   (let [summary "The floors are made of marble."
@@ -32,8 +30,7 @@
                         palace summary is '" summary "'")
         story (init-story story-str)]
     (is (= (get (:rooms story) "palace")
-           (assoc (story-utils/instantiate-type (get types "room"))
-             :name "palace" :summary summary)))))
+           (instantiate-with "room" :name "palace" :summary summary)))))

 (deftest test-room-connection
   (let [story-str (str "palace is a room
@@ -41,9 +38,8 @@
                         palace exit is garden")
         story (init-story story-str)]
     (is (= (get (:rooms story) "palace")
-           (assoc (story-utils/instantiate-type (get types "room"))
-             :name "palace"
-             :exit (story-utils/instantiate-type (get types "room")))))))
+           (instantiate-with "room" :name "palace"
+                             :exit (instantiate-with "room" :name "garden"))))))

 ;; story telling


Fix typo

Fix typo

--- src/exploud/asgard.clj
+++ src/exploud/asgard.clj
@@ -309,7 +309,7 @@
   (last (:groups (application region application-name))))

 (defn security-groups
-  "Retrives all security groups within a particular region."
+  "Retrieves all security groups within a particular region."
   [region]
   (let [{:keys [body status]} (http/simple-get (security-groups-list-url
                                                 region))]


Print out epoch number when printing mse-loss (#35)

In the network/train function, there's an unused epoch-count atom keeping track of the current epoch. Might be useful to print out the current epoch number when printing out that epoch's result.

--- cortex/src/cortex/nn/network.cljc
+++ cortex/src/cortex/nn/network.cljc
@@ -119,7 +119,7 @@
                                 opt-network
                                 batch-index-seq)]
                     (when test-data
-                      (println "epoch mse-loss:" (evaluate-mse network test-data test-labels)))
+                      (println "epoch" @epoch-count " mse-loss:" (evaluate-mse network test-data test-labels)))
                     [optimizer network]))
                 [optimizer network]
                 epoch-batches)]


* benchmark/cljs/benchmark_runner.cljs: basic hash-coll perf test

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -85,7 +85,14 @@
              [:i 8] [:j 9] [:k 10] [:l 11] [:m 12] [:n 13] [:o 14] [:p 15]
              [:q 16] [:r 17] [:s 18] [:t 19] [:u 20] [:v 21] [:w 22] [:x 23]
              [:y 24] [:z 25] [:a0 26] [:b0 27] [:c0 28] [:d0 29] [:e0 30] [:f0 31]]))
-(simple-benchmark [key :f0] (hash key) 100000)
+(simple-benchmark [key :f0] (hash key) 1000000)
+(simple-benchmark [key :f0] (hash key) 1)
+(def hash-coll-test
+  (loop [i 0 r []]
+    (if (< i 1000)
+      (recur (inc i) (conj r (str "foo" i)))
+      r)))
+(simple-benchmark [coll hash-coll-test] (hash-coll coll) 100)
 (simple-benchmark [coll pmap] (:f0 coll) 100000)
 (simple-benchmark [coll pmap] (get coll :f0) 100000)
 (simple-benchmark [coll pmap] (-lookup coll :f0 nil) 100000)


ARM: sunxi: Remove Makefile.boot file

ARM: sunxi: Remove Makefile.boot file

Since we've been a multi-platform enabled kernel from the beginning,
Makefile.boot has always been dead code.

Remove it.

Signed-off-by: Maxime Ripard <2d324f4ca95610bde432fa2af2f28cd21110687d@free-electrons.com>

--- arch/arm/mach-sunxi/Makefile.boot
+++ arch/arm/mach-sunxi/Makefile.boot
@@ -1 +0,0 @@
-zreladdr-$(CONFIG_ARCH_SUNXI)	+= 0x40008000


[PDOK-2044] log stacktrace

[PDOK-2044] log stacktrace

--- src/main/clojure/pdok/featured/api.clj
+++ src/main/clojure/pdok/featured/api.clj
@@ -86,7 +86,8 @@
              (swap! stats assoc-in [:processing] nil)
              (stats-on-callback callback-chan request run-stats)))
          (catch Exception e
-           (let [processor (shutdown processor)
+           (let [ _ (log/error e)
+                 processor (shutdown processor)
                  error-stats (assoc request :error (str e))]
              (log/warn error-stats)
              (swap! stats update-in [:errored] #(conj % error-stats))


CMR-4945: fix failing tests

CMR-4945: fix failing tests

--- system-int-test/test/cmr/system_int_test/ingest/bulk_update/bulk_update_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/bulk_update/bulk_update_test.clj
@@ -12,7 +12,7 @@
    [cmr.mock-echo.client.echo-util :as e]
    [cmr.system-int-test.data2.core :as data2-core]
    [cmr.system-int-test.data2.umm-spec-collection :as data-umm-c]
-   [cmr.system-int-test.data2.umm-spec-common :as data-umm-cmn]
+   [cmr.system-int-test.data2.umm-spec-common :as data-umm-cmn]
    [cmr.system-int-test.system :as s]
    [cmr.system-int-test.utils.index-util :as index]
    [cmr.system-int-test.utils.ingest-util :as ingest]
@@ -190,7 +190,7 @@
         bulk-update-options1 {:token (e/login (s/context) "user1") :user-id "user2"}
         bulk-update-options2 {:token (e/login (s/context) "user1")}
         bulk-update-options3 {:user-id "user2"}
-        bulk-update-body {:concept-ids ["all"]
+        bulk-update-body {:concept-ids ["all"]
                           :update-type "ADD_TO_EXISTING"
                           :update-field "SCIENCE_KEYWORDS"
                           :update-value {:Category "EARTH SCIENCE"
@@ -198,7 +198,7 @@
                                          :Term "ENVIRONMENTAL IMPACTS"
                                          :VariableLevel1 "HEAVY METALS CONCENTRATION"}}
         ;; CMR-4570 tests that no duplicate science keywords are created.
-        duplicate-body {:concept-ids ["ALL" ]
+        duplicate-body {:concept-ids ["ALL" ]
                         :update-type "ADD_TO_EXISTING"
                         :update-field "SCIENCE_KEYWORDS"
                         :update-value {:Category "EARTH SCIENCE"
@@ -235,7 +235,7 @@
       (side/eval-form `(ingest-config/set-bulk-update-enabled! true)))

     ;; Kick off bulk update
-    (let [response (ingest/bulk-update-collections
+    (let [response (ingest/bulk-update-collections
                      "PROV1" bulk-update-body bulk-update-options1)]
       (is (= 200 (:status response)))
       ;; Wait for queueing/indexing to catch up
@@ -262,7 +262,7 @@
                  :Term "ENVIRONMENTAL IMPACTS"
                  :Topic "HUMAN DIMENSIONS"}]
                (:ScienceKeywords (:umm concept))))))
-    (let [response (ingest/bulk-update-collections
+    (let [response (ingest/bulk-update-collections
                      "PROV1" bulk-update-body bulk-update-options2)]
       (is (= 200 (:status response)))
       ;; Wait for queueing/indexing to catch up
@@ -277,7 +277,7 @@
         (is (= 4 (:revision-id (:meta concept))))
         (ingest/assert-user-id concept-id 4 "user1")))

-    (let [response (ingest/bulk-update-collections
+    (let [response (ingest/bulk-update-collections
                      "PROV1" bulk-update-body bulk-update-options3)]
       (is (= 200 (:status response)))
       ;; Wait for queueing/indexing to catch up
@@ -495,12 +495,14 @@
                                                                    {:concept-id concept-id})
                                     :results
                                     :items
-                                    first)]]
+                                    first)
+                        platforms (get-in concept [:umm :Platforms])]]
            (is (= 2
                   (:revision-id (:meta concept))))
            (is (= [{:ShortName "a340-600-1"
                     :LongName "airbus a340-600-1"
-                    :Type "Aircraft"}
+                    :Type "Aircraft"
+                    :Instruments []}
                    {:ShortName "a340-600-2"
                     :LongName "airbus a340-600"
                     :Type "Aircraft"
@@ -512,7 +514,7 @@
                     :LongName "airbus a340-600"
                     :Type "Aircraft"
                     :Instruments [{:ShortName "LVIS"}]}]
-                  (:Platforms (:umm concept)))))))))
+                  platforms)))))))

 (deftest nil-platform-long-name-bulk-update
     (let [concept-ids (ingest-collection-in-umm-json-format platforms-instruments-umm)
@@ -590,7 +592,8 @@
                                                               {:Type  "Email"
                                                                :Value "nsidc@nsidc.org"}]}}
                    {:ShortName "New ShortName"}
-                   {:ShortName "New ShortName"}]
+                   {:ShortName "New ShortName"
+                    :ContactInformation {}}]
                   (map #(select-keys % [:ShortName :LongName :ContactInformation])
                        (:DataCenters (:umm concept))))))))))

@@ -830,7 +833,7 @@
                           :update-type "FIND_AND_UPDATE"
                           :update-field "SCIENCE_KEYWORDS"
                           ;; Note: find-value is case-sensitive.
-                          :find-value {:Topic "aTmoSPHERE"}
+                          :find-value {:Topic "aTmoSPHERE"}
                           :update-value {:Category "EARTH SCIENCE"
                                          :Topic "ATMOSPHERE"
                                          :Term "AIR QUALITY"
@@ -860,9 +863,9 @@
         (is (= collection-statuses
                (:collection-statuses collection-response))))

-      ;; Check that each concept was not updated.
+      ;; Check that each concept was not updated.
       ;; revision-id not changed, format not changed, it's identical to the original-concepts.
-      (is (= new-concepts original-concepts))))
+      (is (= new-concepts original-concepts))))

 (deftest bulk-update-update-all-tombstone-test
   (let [coll1 (data2-core/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E1"
@@ -870,7 +873,7 @@
         coll2 (data2-core/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E2"
                                                                                :ShortName "S2"}))
         _ (index/wait-until-indexed)
-        bulk-update-body1 {:concept-ids ["ALL"]
+        bulk-update-body1 {:concept-ids ["ALL"]
                            :update-type "FIND_AND_UPDATE"
                            :update-field "SCIENCE_KEYWORDS"
                            ;; Note: find-value is case-sensitive.
@@ -879,7 +882,7 @@
                                           :Topic "ATMOSPHERE"
                                           :Term "AIR QUALITY"
                                           :VariableLevel1 "EMISSIONS"}}
-        bulk-update-body2 {:concept-ids [(:concept-id coll1) (:concept-id coll2)]
+        bulk-update-body2 {:concept-ids [(:concept-id coll1) (:concept-id coll2)]
                            :update-type "FIND_AND_UPDATE"
                            :update-field "SCIENCE_KEYWORDS"
                            ;; Note: find-value is case-sensitive.
@@ -895,42 +898,42 @@
             collection-response (ingest/bulk-update-task-status "PROV1" (:task-id response))]
         (is (= "COMPLETE" (:task-status collection-response)))
         (is (= "Task completed with 2 SKIPPED out of 2 total collection update(s)." (:status-message collection-response)))))
-
+
     ;; delete the collection
     (is (= 200 (:status (ingest/delete-concept (data2-core/umm-c-collection->concept coll1 :echo10)))))
     (index/wait-until-indexed)
-
-    ;; perform another bulk update, verify that the deleted collection is not included when getting all
-    ;; collections from the provider.
+
+    ;; perform another bulk update, verify that the deleted collection is not included when getting all
+    ;; collections from the provider.
     (testing "Deleted collection is excluded in update all case."
       (let [response (ingest/bulk-update-collections "PROV1" bulk-update-body1)
             _ (index/wait-until-indexed)
-            collection-response (ingest/bulk-update-task-status "PROV1" (:task-id response))]
-        (is (= "Task completed with 1 SKIPPED out of 1 total collection update(s)." (:status-message collection-response)))))
+            collection-response (ingest/bulk-update-task-status "PROV1" (:task-id response))]
+        (is (= "Task completed with 1 SKIPPED out of 1 total collection update(s)." (:status-message collection-response)))))
     ;; perform a bulk update with the deleted collection's concept-id and a non-deleted collection's concept-id
-    ;; The deleted one should fail the update.
+    ;; The deleted one should fail the update.
     (testing "Deleted collection is failed in update concept-id case."
       (let [response (ingest/bulk-update-collections "PROV1" bulk-update-body2)
             _ (index/wait-until-indexed)
             collection-response (ingest/bulk-update-task-status "PROV1" (:task-id response))
             collection-statuses (:collection-statuses collection-response)]
         (is (= "COMPLETE" (:task-status collection-response)))
-        (is (= "Collection with concept-id [C1200000009-PROV1] is deleted. Can not be updated."
+        (is (= "Collection with concept-id [C1200000009-PROV1] is deleted. Can not be updated."
                (get (first collection-statuses) :status-message)))
         (is (= "Task completed with 1 FAILED and 1 SKIPPED out of 2 total collection update(s)." (:status-message collection-response)))))

     ;; delete the second collection
     (is (= 200 (:status (ingest/delete-concept (data2-core/umm-c-collection->concept coll2 :echo10)))))
     (index/wait-until-indexed)
-
+
     ;; perform another bulk update, verify that the deleted collections are not included when getting all
     ;; collections from the provider.
     (testing "All collections are deleted in update all case."
       (let [response (ingest/bulk-update-collections "PROV1" bulk-update-body1)
-            _ (index/wait-until-indexed)]
+            _ (index/wait-until-indexed)]
         (is (= ["There are no collections that have not been deleted for provider [PROV1]."]
                (:errors response)))))))
-
+
 (deftest bulk-update-default-name-test
   (let [concept-ids (ingest-collection-in-each-format find-update-keywords-umm)
         _ (index/wait-until-indexed)
@@ -954,7 +957,7 @@
   (let [concept-ids (ingest-collection-in-each-format find-update-keywords-umm)
         _ (index/wait-until-indexed)
         bulk-update-body {:concept-ids concept-ids
-                          :name "unique"
+                          :name "unique"
                           :update-type "FIND_AND_UPDATE"
                           :update-field "SCIENCE_KEYWORDS"
                           :find-value {:Topic "ATMOSPHERE"}


Test tools.logging using tools.logging.test

--- src/test/clojure/clojure/tools/test_logging.clj
+++ src/test/clojure/clojure/tools/test_logging.clj
@@ -3,31 +3,47 @@
         clojure.tools.logging)
   (:require
     [clojure.set :as set]
-    [clojure.tools.logging.impl :as impl]))
-
-(defn test-factory [enabled-set entries-atom agent-used-atom]
-  (let [main-thread (Thread/currentThread)]
-    (reify impl/LoggerFactory
-      (name [_] "test factory")
-      (get-logger [_ log-ns]
-        (reify impl/Logger
-          (enabled? [_ level] (contains? enabled-set level))
-          (write! [_ lvl ex msg]
-            (reset! entries-atom [(str log-ns) lvl ex msg])
-            (reset! agent-used-atom (not (identical? main-thread (Thread/currentThread))))))))))
-
-(defmacro with-test-logging
-  [[enabled-level-set log-entry-sym agent-used?-sym] & body]
-  (let [enabled-level-set (or enabled-level-set #{:trace :debug :info :warn :error :fatal})
-        log-entry-sym (or log-entry-sym 'log-entry-sym)
-        agent-used?-sym (or agent-used?-sym 'agent-used?-sym)]
-    `(let [~log-entry-sym (atom nil)
-           ~agent-used?-sym (atom nil)]
-       (binding [*logger-factory* (test-factory
-                                    ~enabled-level-set
-                                    ~log-entry-sym
-                                    ~agent-used?-sym)]
-         ~@body))))
+    [clojure.tools.logging.impl :as impl]
+    [clojure.tools.logging.test :as log-test :refer [logged?
+                                                     matches]]))
+
+; TODO: Improve tools.logging.test so that the ability to check the thread is
+;       not so hacky/out-of-band from the normal flow.
+
+
+(defn log-entry-with-thread [logger-ns level throwable message]
+  (assoc (log-test/->LogEntry logger-ns level throwable message)
+         ::thread (Thread/currentThread)))
+
+(defn same-thread? [log-entry]
+  (identical? (::thread log-entry)
+              (Thread/currentThread)))
+
+(defn direct-logged? [logger-ns level throwable message]
+  (->> (log-test/matches logger-ns level throwable message)
+    (filter same-thread?)
+    seq
+    boolean))
+
+(defn agent-logged? [logger-ns level throwable message]
+  (->> (log-test/matches logger-ns level throwable message)
+    (remove same-thread?)
+    seq
+    boolean))
+
+(defmacro with-log [& body]
+  `(let [stateful-log# (log-test/atomic-log log-entry-with-thread)
+         logger-factory# (log-test/logger-factory stateful-log# (constantly true))]
+     (binding [log-test/*stateful-log*   stateful-log#
+               *logger-factory* logger-factory#]
+       ~@body)))
+
+(defmacro with-log-level [level & body]
+  `(let [stateful-log# (log-test/atomic-log log-entry-with-thread)
+         logger-factory# (log-test/logger-factory stateful-log# #(= ~level %2))]
+     (binding [log-test/*stateful-log*   stateful-log#
+               *logger-factory* logger-factory#]
+       ~@body)))

 (deftest log-yields-nil
   (let [enabled-logger  (reify impl/Logger
@@ -44,14 +60,14 @@
       (is (nil? (log* disabled-logger :debug nil :msg))))))

 (deftest log-single-eval
-  (with-test-logging []
+  (with-log
     (let [cnt (atom 0)]
       (log :debug (swap! cnt inc))
       (log :debug (Exception. (str (swap! cnt inc))) (swap! cnt inc))
       (is (== 3 @cnt)))))

 (deftest logp-single-eval
-  (with-test-logging []
+  (with-log
     (let [cnt (atom 0)]
       (logp :debug (str (swap! cnt inc)))
       (logp :debug (str (swap! cnt inc)) :foo)
@@ -60,7 +76,7 @@
       (is (== 6 @cnt)))))

 (deftest logf-single-eval
-  (with-test-logging []
+  (with-log
     (let [cnt (atom 0)]
       (logf :debug (str (swap! cnt inc)))
       (logf :debug (str (swap! cnt inc)) :foo)
@@ -69,33 +85,30 @@
       (is (== 6 @cnt)))))

 (deftest log-msg
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (log :debug "foo")
-    (is (= ["clojure.tools.test-logging"
-            :debug
-            nil
-            "foo"]
-           @log-entry))))
+    (is (logged? "clojure.tools.test-logging"
+                 :debug
+                 nil
+                 "foo"))))

 (deftest log-ex
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (let [e (Exception.)]
       (log :debug e "foo")
-      (is (= ["clojure.tools.test-logging"
-              :debug
-              e
-              "foo"]
-             @log-entry)))))
+      (is (logged? "clojure.tools.test-logging"
+                   :debug
+                   e
+                   "foo")))))

 (deftest log-custom-ns
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (let [e (Exception.)]
       (log "other.ns" :debug e "foo")
-      (is (= ["other.ns"
-              :debug
-              e
-              "foo"]
-             @log-entry)))))
+      (is (logged? "other.ns"
+                   :debug
+                   e
+                   "foo")))))

 (def all-levels #{:trace :debug :info :warn :error :fatal})
 (def default-tx-agent-levels #{:info :warn})
@@ -103,226 +116,196 @@

 (deftest log-tx-agent-default
   (doseq [level default-tx-agent-levels]
-    (with-test-logging [#{level} log-entry agent-used?]
+    (with-log-level level
       (dosync
         (log level "foo"))
       (await *logging-agent*)
-      (is (= ["clojure.tools.test-logging" level nil "foo"] @log-entry))
-      (is @agent-used?))))
+      (is (agent-logged? "clojure.tools.test-logging" level nil "foo")))))

 (deftest log-no-tx-agent-default
   (doseq [level default-no-tx-agent-levels]
-    (with-test-logging [#{level} log-entry agent-used?]
+    (with-log-level level
       (dosync
         (log level "foo"))
       (await *logging-agent*)
-      (is (= ["clojure.tools.test-logging" level nil "foo"] @log-entry))
-      (is (not @agent-used?)))))
+      (is (direct-logged? "clojure.tools.test-logging" level nil "foo")))))

 (deftest log-tx-agent-custom
   (doseq [level default-no-tx-agent-levels]
     (binding [*tx-agent-levels* default-no-tx-agent-levels]
-      (with-test-logging [#{level} log-entry agent-used?]
+      (with-log-level level
         (dosync
           (log level "foo"))
         (await *logging-agent*)
-        (is (= ["clojure.tools.test-logging" level nil "foo"] @log-entry))
-        (is @agent-used?)))))
+        (is (agent-logged? "clojure.tools.test-logging" level nil "foo"))))))

 (deftest log-no-tx-agent-custom
   (doseq [level default-tx-agent-levels]
     (binding [*tx-agent-levels* default-no-tx-agent-levels]
-      (with-test-logging [#{level} log-entry agent-used?]
+      (with-log-level level
         (dosync
           (log level "foo"))
         (await *logging-agent*)
-        (is (= ["clojure.tools.test-logging" level nil "foo"] @log-entry))
-        (is (not @agent-used?))))))
+        (is (direct-logged? "clojure.tools.test-logging" level nil "foo"))))))

 (deftest log-force-agent
   (doseq [level all-levels]
     (binding [*force* :agent]
-      (with-test-logging [#{level} log-entry agent-used?]
+      (with-log-level level
         (dosync
           (log level "foo"))
         (await *logging-agent*)
-        (is (= ["clojure.tools.test-logging" level nil "foo"] @log-entry))
-        (is @agent-used?)))))
+        (is (agent-logged? "clojure.tools.test-logging" level nil "foo"))))))

 (deftest log-force-direct
   (doseq [level all-levels]
     (binding [*force* :direct]
-      (with-test-logging [#{level} log-entry agent-used?]
+      (with-log-level level
         (dosync
           (log level "foo"))
         (await *logging-agent*)
-        (is (= ["clojure.tools.test-logging" level nil "foo"] @log-entry))
-        (is (not @agent-used?))))))
-
-;(comment ; Tests failing on build machine for some unknown reason.
-;         ; See http://groups.google.com/group/clojure-dev/browse_thread/thread/fde32342f3c006bd
-;)
+        (is (direct-logged? "clojure.tools.test-logging" level nil "foo"))))))

 (deftest logp-msg-no-optimize
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (let [a "foo"
           b "bar"]
       (logp :debug a b))
-    (is (= ["clojure.tools.test-logging" :debug nil "foo bar"] @log-entry))))
+    (is (logged? "clojure.tools.test-logging" :debug nil "foo bar"))))

 (deftest logp-msg1
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (logp :debug "hello")
-    (is (= ["clojure.tools.test-logging" :debug nil "hello"] @log-entry))))
+    (is (logged? "clojure.tools.test-logging" :debug nil "hello"))))

 (deftest logp-msg2
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (logp :debug "hello" "world")
-    (is (= ["clojure.tools.test-logging" :debug nil "hello world"]
-           @log-entry))))
+    (is (logged? "clojure.tools.test-logging" :debug nil "hello world"))))

 (deftest logp-ex0
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (let [e (Exception.)]
       (logp :debug e)
-      (is (= ["clojure.tools.test-logging" :debug nil (print-str e)]
-             @log-entry)))))
+      (is (logged? "clojure.tools.test-logging" :debug nil (print-str e))))))

 (deftest logp-ex1
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (let [e (Exception.)]
       (logp :debug e "hello")
-      (is (= ["clojure.tools.test-logging" :debug e "hello"]
-             @log-entry)))))
+      (is (logged? "clojure.tools.test-logging" :debug e "hello")))))

 (deftest logp-ex2
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (let [e (Exception.)]
       (logp :debug e "hello" "world")
-      (is (= ["clojure.tools.test-logging" :debug e "hello world"]
-             @log-entry)))))
+      (is (logged? "clojure.tools.test-logging" :debug e "hello world")))))

 (deftest logf-msg-no-optimize
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (let [a "foo %s"
           b "bar"]
       (logf :debug a b))
-    (is (= ["clojure.tools.test-logging" :debug nil "foo bar"]
-           @log-entry))))
+    (is (logged? "clojure.tools.test-logging" :debug nil "foo bar"))))

 (deftest logf-msg1
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (logf :debug "hello")
-    (is (= ["clojure.tools.test-logging" :debug nil "hello"]
-           @log-entry))))
+    (is (logged? "clojure.tools.test-logging" :debug nil "hello"))))

 (deftest logf-msg3
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (logf :debug "%s %s" "hello" "world")
-    (is (= ["clojure.tools.test-logging" :debug nil "hello world"]
-           @log-entry))))
+    (is (logged? "clojure.tools.test-logging" :debug nil "hello world"))))

 (deftest logf-ex0
   (is (thrown? ClassCastException (logf :debug (Exception.)))))

 (deftest logf-ex3
-  (with-test-logging [#{:debug} log-entry]
+  (with-log
     (let [e (Exception.)]
       (logf :debug e "%s %s" "hello" "world")
-      (is (= ["clojure.tools.test-logging" :debug e "hello world"]
-             @log-entry)))))
+      (is (logged? "clojure.tools.test-logging" :debug e "hello world")))))

 (deftest enabled-true
-  (with-test-logging [#{:fatal}]
+  (with-log-level :fatal
     (is (enabled? :fatal))))

 (deftest enabled-false
-  (with-test-logging [#{:debug}]
+  (with-log-level :debug
     (is (not (enabled? :fatal)))))

 (deftest spy-default
-  (with-test-logging [#{:debug} log-entry]
+  (with-log-level :debug
     (spy (+ 4 5))
-    (is (= ["clojure.tools.test-logging" :debug nil (format "(+ 4 5)%n=> 9")]
-           @log-entry))))
+    (is (logged? "clojure.tools.test-logging" :debug nil (format "(+ 4 5)%n=> 9")))))

 (deftest spy-level
   (doseq [level all-levels]
-    (with-test-logging [#{level} log-entry]
+    (with-log-level level
       (spy level (+ 4 5))
-      (is (= ["clojure.tools.test-logging" level nil (format "(+ 4 5)%n=> 9")]
-             @log-entry)))))
+      (is (logged? "clojure.tools.test-logging" level nil (format "(+ 4 5)%n=> 9"))))))

 (deftest spyf-default
-  (with-test-logging [#{:debug} log-entry]
+  (with-log-level :debug
     (spyf "result: %s" (+ 4 5))
-    (is (= ["clojure.tools.test-logging" :debug nil (format "result: 9")]
-           @log-entry))))
+    (is (logged? "clojure.tools.test-logging" :debug nil (format "result: 9")))))

 (deftest spyf-level
   (doseq [level all-levels]
-    (with-test-logging [#{level} log-entry]
+    (with-log-level level
       (spyf level "result: %s" (+ 4 5))
-      (is (= ["clojure.tools.test-logging" level nil (format "result: 9")]
-             @log-entry)))))
+      (is (logged? "clojure.tools.test-logging" level nil (format "result: 9"))))))

 (deftest capturing
-  (with-test-logging [all-levels log-entry]
+  (with-log
     (log-capture! "foobar")
     (.println System/out "hello world")
-    (is (= ["foobar" :info nil "hello world"]
-           @log-entry))
+    (is (logged? "foobar" :info nil "hello world"))
     (log-uncapture!))

-  (with-test-logging [all-levels log-entry]
+  (with-log
     (log-capture! "foobar")
     (.println System/err "oh noes")
-    (is (= ["foobar" :error nil "oh noes"]
-           @log-entry))
+    (is (logged? "foobar" :error nil "oh noes"))
     (log-uncapture!)))

 (deftest capturing-level
-  (with-test-logging [all-levels log-entry]
+  (with-log
     (log-capture! "foobar" :error :fatal)
     (.println System/out "hello world")
-    (is (= ["foobar" :error nil "hello world"]
-           @log-entry))
+    (is (logged? "foobar" :error nil "hello world"))
     (log-uncapture!))

-  (with-test-logging [all-levels log-entry]
+  (with-log
     (log-capture! "foobar" :error :fatal)
     (.println System/err "oh noes")
-    (is (= ["foobar" :fatal nil "oh noes"]
-           @log-entry))
+    (is (logged? "foobar" :fatal nil "oh noes"))
     (log-uncapture!)))

 (deftest with-logs-default
-  (with-test-logging [all-levels log-entry]
+  (with-log
     (with-logs "foobar"
       (println "hello world"))
-    (is (= ["foobar" :info nil "hello world"]
-           @log-entry))))
+    (is (logged? "foobar" :info nil "hello world"))))

 (deftest with-logs-level
-  (with-test-logging [all-levels log-entry]
+  (with-log
     (with-logs ["foobar" :error :fatal]
       (println "hello world"))
-    (is (= ["foobar" :error nil "hello world"]
-           @log-entry)))
-
-  (with-test-logging [all-levels log-entry]
+    (is (logged? "foobar" :error nil "hello world")))
+
+  (with-log
     (with-logs ["foobar" :error :fatal]
       (binding [*out* *err*]
         (println "hello world")))
-    (is (= ["foobar" :fatal nil "hello world"]
-           @log-entry))))
+    (is (logged? "foobar" :fatal nil "hello world"))))

 (deftest println-style
-  (are [f kw] (with-test-logging [all-levels log-entry]
+  (are [f kw] (with-log
                 (f "hello" "world")
-                (= ["clojure.tools.test-logging" kw nil "hello world"]
-                   @log-entry))
+                (logged? "clojure.tools.test-logging" kw nil "hello world"))
     trace :trace
     debug :debug
     info :info
@@ -332,10 +315,9 @@

 (deftest println-style-ex
   (let [e (Exception.)]
-    (are [f kw] (with-test-logging [all-levels log-entry]
+    (are [f kw] (with-log
                   (f e "hello" "world")
-                  (= ["clojure.tools.test-logging" kw e "hello world"]
-                     @log-entry))
+                  (logged? "clojure.tools.test-logging" kw e "hello world"))
       trace :trace
       debug :debug
       info :info
@@ -344,10 +326,9 @@
       fatal :fatal)))

 (deftest format-style
-  (are [f kw] (with-test-logging [all-levels log-entry]
-                  (f "%s %s" "hello" "world")
-                  (= ["clojure.tools.test-logging" kw nil "hello world"]
-                     @log-entry))
+  (are [f kw] (with-log
+                (f "%s %s" "hello" "world")
+                (logged? "clojure.tools.test-logging" kw nil "hello world"))
     tracef :trace
     debugf :debug
     infof :info
@@ -357,10 +338,9 @@

 (deftest format-style-ex
   (let [e (Exception.)]
-    (are [f kw] (with-test-logging [all-levels log-entry]
+    (are [f kw] (with-log
                   (f e "%s %s" "hello" "world")
-                  (= ["clojure.tools.test-logging" kw e "hello world"]
-                     @log-entry))
+                  (logged? "clojure.tools.test-logging" kw e "hello world"))
       tracef :trace
       debugf :debug
       infof :info


Removed some debug code.

Removed some debug code.

--- src/test/clojure/wunderboss/messaging_tests.clj
+++ src/test/clojure/wunderboss/messaging_tests.clj
@@ -42,7 +42,6 @@
                         (map #(vector (keyword (.name %)) %))
                         (into {}))]
     (fn [opts]
-      (println (str "opts: " opts " avail: " avail-options))
       (reduce (fn [m [k v]]
                 (assoc m
                   (if-let [enum (avail-options k)]


Add missing name persistence on layers sidebar.

--- src/uxbox/main/ui/workspace/sidebar/layers.cljs
+++ src/uxbox/main/ui/workspace/sidebar/layers.cljs
@@ -119,9 +119,13 @@
   [own shape]
   (let [local (:rum/local own)]
     (letfn [(on-blur [event]
-              (let [parent (.-parentNode (.-target event))]
-                (set! (.-draggable parent) true))
-              (swap! local assoc :edition false))
+              (let [target (dom/event->target event)
+                    parent (.-parentNode target)
+                    data {:id (:id shape)
+                          :name (dom/get-value target)}]
+                (set! (.-draggable parent) true)
+                (rs/emit! (uds/update-shape data))
+                (swap! local assoc :edition false)))
             (on-click [event]
               (dom/stop-propagation event)
               (dom/prevent-default event)


Updated spatial search script parameters to allow different shape types.

--- src/cmr/search/data/complex_to_simple_converters/spatial.clj
+++ src/cmr/search/data/complex_to_simple_converters/spatial.clj
@@ -10,8 +10,11 @@

 (defn- shape->script-cond
   [shape]
-  (qm/map->ScriptCondition {:name "spatial"
-                            :params {:ords (str/join "," (:ords (srl/shape->stored-ords shape)))}}))
+  (let [ords-info-map (-> (srl/shapes->ords-info-map [shape])
+                          (update-in [:ords-info] #(str/join "," %))
+                          (update-in [:ords] #(str/join "," %)))]
+    (qm/map->ScriptCondition {:name "spatial"
+                              :params ords-info-map})))

 (defn- br->cond
   [prefix {:keys [west north east south] :as br}]


Update eftest to "0.5.8"

Update eftest to "0.5.8"

--- backend/project.clj
+++ backend/project.clj
@@ -84,7 +84,7 @@
                                     [reloaded.repl "0.2.4"]
                                     [org.clojure/tools.namespace "0.2.11"]
                                     [org.clojure/tools.nrepl "0.2.13"]
-                                    [eftest "0.5.1"]
+                                    [eftest "0.5.8" :exclusions [org.clojure/spec.alpha org.clojure/clojure org.clojure/core.rrb-vector fipp org.clojure/core.specs.alpha]]
                                     [com.gearswithingears/shrubbery "0.4.1"]
                                     [kerodon "0.9.0"]
                                     [com.cognitect/transit-clj "0.8.313"]]


Shorter solution.

Shorter solution.

--- src/main/cljc/clojure_club/x125_gus_quinundrum/mbastian.cljc
+++ src/main/cljc/clojure_club/x125_gus_quinundrum/mbastian.cljc
@@ -1,7 +1,17 @@
 (ns clojure-club.x125-gus-quinundrum.mbastian)

-(fn [] (let [q (quote (fn [] (let [q (quote %s)] (format (str q) (str q)))))] (format (str q) (str q))))
+(def __
+  '(fn []
+     (let [q (str (quote (fn [] (let [q (str (quote %s))] (format q q)))))]
+       (format q q))))

-(=
+(= (str __) ((eval __)))
+
+(=
   (str '(fn [] (let [q (quote (fn [] (let [q (quote %s)] (format (str q) (str q)))))] (format (str q) (str q)))))
-       ((fn [] (let [q (quote (fn [] (let [q (quote %s)] (format (str q) (str q)))))] (format (str q) (str q))))))+  ((fn [] (let [q (quote (fn [] (let [q (quote %s)] (format (str q) (str q)))))] (format (str q) (str q))))))
+
+;;Even shorter!
+(=
+  (str '(fn [] (let [q (str (quote (fn [] (let [q (str (quote %s))] (format q q)))))] (format q q))))
+  ((fn [] (let [q (str (quote (fn [] (let [q (str (quote %s))] (format q q)))))] (format q q)))))


lein: rm srcs of conflict: leiningen, old alembic

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,3 +1,4 @@
+
 ;; Inspired heavily by http://dev.solita.fi/2014/03/18/pimp-my-repl.html
 {:user {:dependencies [
                        [org.clojars.gjahad/debug-repl "0.3.3"]
@@ -8,7 +9,7 @@
                        [nrepl-inspect "0.4.1"]    ; for wrap-inspect, Emacs
                        [ritz/ritz-nrepl-middleware "0.7.0"]
                        ;;[night-vision "0.1.0-SNAPSHOT"] ;; print input/output of each call in a ns; see (night-vision.goggles/introspect-ns! '<your ns>)
-                       [leiningen "2.3.4"] ;; Vinyasa needs this, must match my lein version
+                       ;;[leiningen "2.3.4"] ;; Vinyasa needs this, must match my lein version x see vinyasa/issues/3
                        [alembic "0.2.1"]   ;; reload new deps from project.clj
                        [slamhound "1.5.2"] ;; optimize and add missing requires/imports in .clj files - see aliases below or editor-specific plugins or run from repl
                        [io.aviso/pretty "0.1.10"] ;; nrepl/pretty-middleware for exceptions
@@ -25,7 +26,7 @@
                        '[[clojure.repl doc source]
                          [clojure.pprint pprint pp]
                          [vinyasa.pull pull]
-                         [vinyasa.lein lein]
+                         ;[vinyasa.lein lein]
                          [alex-and-georges.debug-repl debug-repl]
                          [com.georgejahad.difform difform]
                          [clj-ns-browser.sdoc sdoc]
@@ -41,11 +42,12 @@
                   [lein-marginalia "0.7.1"]
                   [lein-ancient "0.5.4"]
                   [lein-try "0.4.1"]
-                  [lein-alembic "0.1.0"]     ; make alembic available -> reload prj deps w/o restarting repl: (alembic.still/load-project)
+                  ;;[lein-alembic "0.1.0"]     ; make alembic available -> reload prj deps w/o restarting repl: (alembic.still/load-project)
                   [lein-clojuredocs "1.0.2"] ; Create clojuredocs-style doc
                   ;;[quickie "0.2.6"] ; autotest for clojure.test
                   [com.jakemccrary/lein-test-refresh "0.3.4"] ;; autotest: lein test-refresh :growl ; weak results reporting :-(
                   [lein-light "0.0.44"] ; LightTable: `lein light` in a prj
+                  [jonase/eastwood "0.1.1"] ; linter: lein eastwood
                   ]
         :aliases {
                   "slamhound" ["run" "-m" "slam.hound"] ;; => lein slamhound <file or dir>


update .lein/profiles.clj

update .lein/profiles.clj

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,7 +1,7 @@
 {:user {
         :plugins [
-                  [cider/cider-nrepl "0.18.0"]
-                  [jonase/eastwood "0.3.3"]
-                  [lein-cljfmt "0.6.2"]
                   [refactor-nrepl "2.4.0"]
+                  [cider/cider-nrepl "0.21.1"]
+                  [jonase/eastwood "0.3.5"]
+                  [lein-cljfmt "0.6.4"]
                   ]}}


Use lein-incise 0.2.1 plugin.

Use lein-incise 0.2.1 plugin.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -10,6 +10,7 @@
                   [lein-exec "0.3.0"]
                   [com.aphyr/prism "0.1.1"]
                   [org.bodil/lein-noderepl "0.1.10"]
+                  [lein-incise "0.2.1"]
                   [quickie "0.2.1"]
                   [lein-kibit "0.0.8"]
                   [lein-clojars "0.9.1"]


Fix CONTRIB-109: proper newline trimming


indent

indent

--- test/bløggr/core_test.clj
+++ test/bløggr/core_test.clj
@@ -3,9 +3,9 @@
   (:require [bløggr.core :refer :all]))

 (fact "get-assets loads assets and modifies path"
-      (get-assets) => (just [{:path "/images/image.jpg"} {:path "/fonts/font.wof"}] :in-any-order)
-      (provided
-       (load-assets "images") => [{:path "/image.jpg"}]
-       (load-assets "fonts") => [{:path "/font.wof"}]))
+  (get-assets) => (just [{:path "/images/image.jpg"} {:path "/fonts/font.wof"}] :in-any-order)
+  (provided
+    (load-assets "images") => [{:path "/image.jpg"}]
+    (load-assets "fonts") => [{:path "/font.wof"}]))


fixed exception

fixed exception

--- src-clj/mappt/server/routes.clj
+++ src-clj/mappt/server/routes.clj
@@ -16,7 +16,7 @@
    :body (pr-str data)
    :session session})

-(defn generate-main-page [data session]
+(defn generate-main-page [session]
   (if (:test-var session)
     {:status 200
      :body (index-page)}


Slight simplification in compiled->line-map

--- src/org/knotation/editor/line_map.cljs
+++ src/org/knotation/editor/line_map.cljs
@@ -32,22 +32,19 @@

 (defn compiled->line-map
   ([line-map compiled input-editors out-key]
-   (let [modified
-         (fn [m ed in out elem]
-           (if (and (or in (zero? in)) (or out (zero? out)))
-             (update-in
-              (update-in m [ed in] #(conj (or % #{}) [out-key out]))
-              [out-key out] #(conj (or % #{}) [ed in]))
-             m))]
-     (reduce
-      (fn [memo [ed lines]]
-        (reduce
-         (fn [m elem]
-           (let [in (::st/line-number (::st/input elem))
-                 out (::st/line-number (::st/output elem))]
-             (modified m ed in out elem)))
-         memo lines))
-      line-map (util/zip input-editors (partition-graphs compiled))))))
+   (reduce
+    (fn [memo [ed lines]]
+      (reduce
+       (fn [m elem]
+         (let [in (::st/line-number (::st/input elem))
+               out (::st/line-number (::st/output elem))]
+           (or (and (or in (zero? in)) (or out (zero? out))
+                    (update-in
+                     (update-in m [ed in] #(conj (or % #{}) [out-key out]))
+                     [out-key out] #(conj (or % #{}) [ed in])))
+               m)))
+       memo lines))
+    line-map (util/zip input-editors (partition-graphs compiled)))))

 (defn update-line-map!
   [atm compiled input-editors output-editor]


Trying to simple things up a bit, per http://tinyurl.com/3xdxgmw

--- support/build-support/src/main/clojure/fnbox/build/tools.clj
+++ support/build-support/src/main/clojure/fnbox/build/tools.clj
@@ -75,79 +75,71 @@
 (defn increase-deployment-timeout [xml]
   xml)

-(defn add-extension [xml name]
-  (let [module-name (str "org.fnbox." name)
-        zip-xml (zip/xml-zip xml)]
-    (if (zfx/xml1-> zip-xml :extensions :extension [(zfx/attr= :module module-name)])
-      xml
-      (zip/root (zip/append-child (zfx/xml1-> zip-xml :extensions) {:tag :extension :attrs {:module module-name}})))))
+;; TODO Is there really a danger of the fnbox exts being there?
+(defn add-extension [loc name]
+  (let [module-name (str "org.fnbox." name)]
+    (zip/append-child loc {:tag :extension :attrs {:module module-name}})))

-(defn add-extensions [xml]
-  (reduce add-extension xml (keys fnbox-modules)))
+(defn add-extensions [loc]
+  (reduce add-extension loc (keys fnbox-modules)))

-(defn add-subsystem [xml name]
+;; TODO Is there really a danger of the fnbox subs being there?
+(defn add-subsystem [loc name]
   (let [module-name (str "urn:jboss:domain:fnbox-" name ":1.0")]
-    (if-let [profile (zfx/xml1-> (zip/xml-zip xml) zf/descendants :profile zip/down zip/rightmost
-                                 [#(not= (zfx/attr % :xmlns) module-name)] zip/up)]
-      (recur (zip/root (zip/append-child profile {:tag :subsystem :attrs {:xmlns module-name}}))
-             name)
-      xml)))
+    (zip/append-child loc {:tag :subsystem :attrs {:xmlns module-name}})))

-(defn add-subsystems [xml]
-  (reduce add-subsystem xml (sort-by #(if (= "core" %) -1 1) (keys fnbox-modules))))
+(defn add-subsystems [loc]
+  (reduce add-subsystem loc (sort-by #(if (= "core" %) -1 1) (keys fnbox-modules))))

-(defn set-welcome-root [xml]
-  (if-let [loc (zfx/xml1-> (zip/xml-zip xml) zf/descendants :virtual-server [#(not= (zfx/attr % :enable-welcome-root) "false")])]
-    (recur (zip/root (zip/edit loc #(update-in % [:attrs :enable-welcome-root] (constantly "false")))))
-    xml))
+(defn add-system-property [loc prop value]
+  (zip/append-child loc {:tag :property :attrs {:name prop :value value}}))

-(defn add-system-properties-tag [xml]
-  (let [xml-zip (zip/xml-zip xml)]
+(defn replace-system-property [loc prop value]
+  (zip/edit loc #(assoc % :attrs {:name prop :value value})))
+
+(defn set-system-property [loc prop value]
+  (if-let [child (zfx/xml1-> loc :property (zfx/attr= :name value))]
+    (zip/up (replace-system-property child prop value))
+    (add-system-property loc prop value)))
+
+(defn unquote-cookie-path [loc]
+  (set-system-property loc "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR" "false"))
+
+(defn set-welcome-root [loc]
+  (if (= "false" (-> loc zip/node :attrs :enable-welcome-root))
+    loc
+    (zip/edit loc #(update-in % [:attrs :enable-welcome-root] (constantly "false")))))
+
+(defn looking-at? [tag loc]
+  (= tag (:tag (zip/node loc))))
+
+(defn prepare-zip [file]
+  "Make sure the doc has a <system-properties> element"
+  (let [xml-zip (zip/xml-zip (xml/parse-trim file))]
     (if (zfx/xml1-> xml-zip zf/descendants :system-properties)
-      xml
-      (zip/root (zip/insert-right (zfx/xml1-> xml-zip :extensions) {:tag :system-properties})))))
+      xml-zip
+      (zip/insert-right (zfx/xml1-> xml-zip :extensions) {:tag :system-properties}))))

-(defn add-system-property [xml prop value]
-  (zip/root (zip/append-child (zfx/xml1-> (zip/xml-zip xml) :system-properties) {:tag :property :attrs {:name prop :value value}})))
-
-(defn replace-system-property [xml prop value]
-  (zip/root (zip/edit (zfx/xml1-> (zip/xml-zip xml) :system-properties :property [(zfx/attr= :name prop)])
-                      #(assoc % :attrs {:name prop :value value}))))
-
-(defn add-or-replace-system-property [xml prop value]
-  (if (zfx/xml1-> (zip/xml-zip xml) :system-properties :property [(zfx/attr= :name value)])
-    (replace-system-property xml prop value)
-    (add-system-property xml prop value)))
-
-(defn set-system-property [xml prop value]
-  (-> xml
-      add-system-properties-tag
-      (add-or-replace-system-property prop value)))
-
-(defn unquote-cookie-path [xml]
-  (set-system-property xml "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR" "false"))
-
-(defn remove-jms-destinations [xml]
-  (if-let [loc (zfx/xml1-> (zip/xml-zip xml) zf/descendants :jms-destinations)]
-    (-> loc zip/remove zip/root)
-    xml))
-
+(defn walk-the-doc [loc]
+  (if (zip/end? loc)
+    (zip/root loc)
+    (recur (zip/next
+            (cond
+             (looking-at? :extensions loc) (add-extensions loc)
+             (looking-at? :profile loc) (add-subsystems loc)
+             (looking-at? :virtual-server loc) (set-welcome-root loc)
+             (looking-at? :system-properties loc) (unquote-cookie-path loc)
+             (looking-at? :jms-destinations loc) (zip/remove loc)
+             :else loc)))))
+
 (defn transform-config [file]
   (let [in-file (io/file jboss-dir file)
-        xml (xml/parse-trim in-file)
         out-file (io/file (.getParentFile in-file) (str "fnbox/" (.getName in-file)))]
-    (print-err (str "transforming " file))
+    (println (str "transforming " file))
     (io/make-parents out-file)
     (backup-current-config in-file)
     (io/copy (with-out-str
                (xml/emit
-                (-> xml
-                    increase-deployment-timeout
-                    add-extensions
-                    add-subsystems
-                    set-welcome-root
-                    unquote-cookie-path
-                    remove-jms-destinations
-                    )
+                (walk-the-doc (prepare-zip in-file))
                 :indent 4))
              out-file)))


linebreaks for cond readability

linebreaks for cond readability

--- src/midje/checking/checkers/collection.clj
+++ src/midje/checking/checkers/collection.clj
@@ -63,20 +63,35 @@

 (defn standardized-arguments
   "Reduce arguments to standard forms so there are fewer combinations to
- consider. Also blow up for some incompatible forms."
+  consider. Also blow up for some incompatible forms."
   [actual expected looseness]
   (compatibility-check actual expected looseness)
   (cond
-   (and (sequential? actual) (set? expected))                  [actual (vec expected) (union looseness #{:in-any-order })]
-   (and (sequential? actual) (right-hand-singleton? expected)) [actual [expected] (union looseness #{:in-any-order })]
-   (sequential? actual)                                        [actual expected looseness]
-   (and (map? actual) (map? expected))  [actual expected looseness]
-   (map? actual)                        [actual (into {} expected) looseness]
-   (set? actual)                        (recur (vec actual) expected looseness-modifiers)
+   (and (sequential? actual) (set? expected))
+   [actual (vec expected) (union looseness #{:in-any-order})]
+
+   (and (sequential? actual) (right-hand-singleton? expected))
+   [actual [expected] (union looseness #{:in-any-order})]
+
+   (sequential? actual)
+   [actual expected looseness]
+
+   (and (map? actual) (map? expected))
+   [actual expected looseness]
+
+   (map? actual)
+   [actual (into {} expected) looseness]
+
+   (set? actual)
+   (recur (vec actual) expected looseness-modifiers)
+
    (and (string? actual)
         (not (string? expected))
-        (not (regex? expected)))        (recur (vec actual) expected looseness-modifiers)
-        :else                                [actual expected looseness]))
+        (not (regex? expected)))
+   (recur (vec actual) expected looseness-modifiers)
+
+   :else
+   [actual expected looseness]))

 (defn match? [actual expected looseness]
   (let [comparison (compare-results actual expected looseness)]


Fixes test

Fixes test

--- test/expound/alpha_test.cljc
+++ test/expound/alpha_test.cljc
@@ -239,8 +239,8 @@

 (s/def :or-spec/str string?)
 (s/def :or-spec/int int?)
-(s/def :or-spec/m-with-str (s/keys :req [:or-specs/str]))
-(s/def :or-spec/m-with-int (s/keys :req [:or-specs/str]))
+(s/def :or-spec/m-with-str (s/keys :req [:or-spec/str]))
+(s/def :or-spec/m-with-int (s/keys :req [:or-spec/int]))
 (s/def :or-spec/m-with-str-or-int (s/or :m-with-str :or-spec/m-with-str
                                         :m-with-int :or-spec/m-with-int))

@@ -327,18 +327,19 @@

   {}

-should contain keys: `:or-specs/str`, `:or-specs/str`
-
-|           key |          spec |
-|---------------+---------------|
-| :or-specs/str | :or-specs/str |
+should contain keys: `:or-spec/int`, `:or-spec/str`
+
+|          key |    spec |
+|--------------+---------|
+| :or-spec/int |    int? |
+| :or-spec/str | string? |

 -- Relevant specs -------

 :or-spec/m-with-int:
-  (clojure.spec.alpha/keys :req [:or-specs/str])
+  (clojure.spec.alpha/keys :req [:or-spec/int])
 :or-spec/m-with-str:
-  (clojure.spec.alpha/keys :req [:or-specs/str])
+  (clojure.spec.alpha/keys :req [:or-spec/str])
 :or-spec/m-with-str-or-int:
   (clojure.spec.alpha/or
    :m-with-str


add ::body to spec of http/post fn

add ::body to spec of http/post fn

--- planck-cljs/src/planck/http.cljs
+++ planck-cljs/src/planck/http.cljs
@@ -216,7 +216,7 @@
 (s/def ::multipart-params seq?)

 (s/fdef post
-  :args (s/cat :url string? :opts (s/? (s/keys :opt-un [::timeout ::debug ::accepts ::content-type ::headers
+  :args (s/cat :url string? :opts (s/? (s/keys :opt-un [::timeout ::debug ::accepts ::content-type ::headers ::body
                                                         ::form-params ::multipart-params])))
   :ret (s/keys :req-un [::body ::headers ::status]))


Fix OS X plan link

Fix OS X plan link

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -180,7 +180,7 @@
                                        "Note: this option only works if the project builds under an OS X plan. "
                                        "Configure that option "
                                        [:a {:href (routes/v1-org-settings-path {:org (:org_name plan)
-                                                                                :vcs_type (:vcs_type plan)
+                                                                                :vcs_type (-> plan :org :vcs_type)
                                                                                :_fragment "osx-pricing"})} "here"]
                                        "."]]
                                      [:p


[#221] MQ: Block to wait for futures on worker stop (@isaacseymour)

When running the `mq/stop`, deref all the worker-loop futures.

This is helpful if, for example, the worker processing depends on other
parts of a component system. At the moment I'm getting errors where the
component system shuts down without being aware of the fact that there
are still some worker threads running, meaning that the workers try to
access closed resources (for example).

--- src/taoensso/carmine/message_queue.clj
+++ src/taoensso/carmine/message_queue.clj
@@ -230,13 +230,15 @@
   (start [this])
   (stop  [this]))

-(defrecord Worker [conn-opts qname running?_ opts]
+(defrecord Worker [conn-opts qname running?_ thread-futures_ opts]

   java.io.Closeable (close [this] (stop this))

   IWorker
   (stop [_]
     (when (compare-and-set! running?_ true false)
+      (timbre/infof "Initiating shutdown of queue worker: %s" qname)
+      (run! deref @thread-futures_)
       (timbre/infof "Message queue worker stopped: %s" qname)
       true))

@@ -284,7 +286,8 @@
                         (Thread/sleep (exp-backoff (inc nerrors)))
                         (recur (inc nerrors))))))))]

-        (dorun (repeatedly nthreads (fn [] (future (start-polling-loop!))))))
+        (reset! thread-futures_
+          (doall (repeatedly nthreads (fn [] (future (start-polling-loop!)))))))

       true)))

@@ -333,7 +336,7 @@
             eoq-backoff-ms exp-backoff
             auto-start     true}}]]

-  (let [w (Worker. conn-opts qname (atom false)
+  (let [w (Worker. conn-opts qname (atom false) (atom [])
             {:handler        handler
              :monitor        monitor
              :lock-ms        lock-ms


Ring stuff: Reorder

Ring stuff: Reorder

--- test/com/nomistech/clojure_the_language/c_800_libraries/s_800_web/ss_020_ring.clj
+++ test/com/nomistech/clojure_the_language/c_800_libraries/s_800_web/ss_020_ring.clj
@@ -19,28 +19,6 @@
    (-> s
        (.getBytes encoding)
        (java.io.ByteArrayInputStream.))))
-
-;;;; ___________________________________________________________________________
-;;;; ---- wrap-json-response ----
-
-(defn handler-with-interesting-response [request]
-  (rur/response {:foo "bar"}))
-
-(def wrapped-handler-with-interesting-response
-  (-> handler-with-interesting-response
-      rmj/wrap-json-response))
-
-(fact "Handler with response whose body is Clojure data"
-  (handler-with-interesting-response {})
-  => {:status 200
-      :headers {}
-      :body {:foo "bar"}})
-
-(fact "Wrapped handler with response whose body is JSON"
-  (wrapped-handler-with-interesting-response {})
-  => {:status 200
-      :headers {"Content-Type" "application/json; charset=utf-8"}
-      :body "{\"foo\":\"bar\"}"})

 ;;;; ___________________________________________________________________________
 ;;;; ---- wrap-json-body ----
@@ -67,3 +45,25 @@
   => {:status 200
       :headers {}
       :body "Uploaded 'Fred'."})
+
+;;;; ___________________________________________________________________________
+;;;; ---- wrap-json-response ----
+
+(defn handler-with-interesting-response [request]
+  (rur/response {:foo "bar"}))
+
+(def wrapped-handler-with-interesting-response
+  (-> handler-with-interesting-response
+      rmj/wrap-json-response))
+
+(fact "Handler with response whose body is Clojure data"
+  (handler-with-interesting-response {})
+  => {:status 200
+      :headers {}
+      :body {:foo "bar"}})
+
+(fact "Wrapped handler with response whose body is JSON"
+  (wrapped-handler-with-interesting-response {})
+  => {:status 200
+      :headers {"Content-Type" "application/json; charset=utf-8"}
+      :body "{\"foo\":\"bar\"}"})


Renamed the function to `recite`

Renamed the function to `recite`

--- exercises/proverb/src/proverb.clj
+++ exercises/proverb/src/proverb.clj
@@ -1,5 +1,5 @@
 (ns proverb)

-(defn proverb [] ;; <- arglist goes here
+(defn recite [] ;; <- arglist goes here
     ;; your code goes here
 )


Moved policy text to its own component and updated footer link(s).

--- src/cljs/org/broadinstitute/firecloud_ui/main.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/main.cljs
@@ -41,6 +41,33 @@
          (if @utils/use-live-data? "off" "on")]]
        [:div {}
         [:a {:href "#status" :style {:textDecoration "none"}} "Status Page"]]]])})
+
+
+(react/defc Policy
+  {:render
+    (fn [{:keys [state]}]
+      [:div {:style {:maxWidth 600 :paddingTop "2em"}}
+        [:p {:style {:fontWeight "bold"}} "WARNING NOTICE"]
+        [:p {}
+          "You are accessing a US Government web site which may contain information that must be "
+          "protected under the US Privacy Act or other sensitive information and is intended for "
+          "Government authorized use only."]
+        [:p {}
+          "Unauthorized attempts to upload information, change information, or use of this web site "
+          "may result in disciplinary action, civil, and/or criminal penalties. Unauthorized users "
+          "of this website should have no expectation of privacy regarding any communications or "
+          "data processed by this website."]
+        [:p {}
+          "Anyone accessing this website expressly consents to monitoring of their actions and all "
+          "communications or data transiting or stored on related to this website and is advised "
+          "that if such monitoring reveals possible evidence of criminal activity, NIH may provide "
+          "that evidence to law enforcement officials."]
+        [:p {:style {:fontWeight "bold"}} "WARNING NOTICE (when accessing controlled data)"]
+        [:p {:style {:fontWeight "bold"}}
+          "You are reminded that when accessing controlled access information you are bound by the "
+          "dbGaP TCGA "
+          [:a {:href "http://cancergenome.nih.gov/pdfs/Data_Use_Certv082014" :target "_blank"}
+            "DATA USE CERTIFICATION AGREEMENT (DUCA)"] "."]])})

 (defn- footer []
@@ -66,11 +93,14 @@
      [:div {:style {:display "block"}}
       (str "\u00A9 " yeartext " Broad Institute")
       spacer
-      [Link {:href "#" :text "Privacy Policy" :target "_self"}]
+      [Link {:href "#policy" :text "Privacy Policy"}]
       spacer
-      [Link {:href "#" :text "Terms of Service" :target "_self"}]
+      [Link {:href (str  "http://gatkforums.broadinstitute.org/firecloud/discussion/6819/"
+                         "firecloud-terms-of-service#latest")
+             :text "Terms of Service" :target "_blank"}]
       spacer
-      [Link {:href "http://gatkforums.broadinstitute.org/firecloud" :text "Support" :target "_blank"}]]]))
+      [Link {:href "http://gatkforums.broadinstitute.org/firecloud" :text "Support"
+             :target "_blank"}]]]))

 (def routes
@@ -81,7 +111,9 @@
     :render #(react/create-element workspaces/Page %)}
    {:key :methods :href "#methods"
     :name "Method Repository"
-    :render #(react/create-element method-repo/Page %)}])
+    :render #(react/create-element method-repo/Page %)}
+   {:key :policy
+    :render #(react/create-element Policy %)}])

 (def top-nav-bar-items
   (filter (fn [r] (contains? #{:workspaces :methods} (:key r))) routes))
@@ -189,27 +221,7 @@
                       (if (clojure.string/blank? hash) "" (str "&path=" hash))))}]]
       [:div {:style {:marginTop "1em"}} [RegisterLink]]
       [:div {:style {:maxWidth 600 :paddingTop "2em" :fontSize "small"}}
-       [:p {:style {:fontWeight "bold"}} "WARNING NOTICE"]
-       [:p {}
-        "You are accessing a US Government web site which may contain information that must be "
-        "protected under the US Privacy Act or other sensitive information and is intended for "
-        "Government authorized use only."]
-       [:p {}
-        "Unauthorized attempts to upload information, change information, or use of this web site "
-        "may result in disciplinary action, civil, and/or criminal penalties. Unauthorized users "
-        "of this website should have no expectation of privacy regarding any communications or "
-        "data processed by this website."]
-       [:p {}
-        "Anyone accessing this website expressly consents to monitoring of their actions and all "
-        "communications or data transiting or stored on related to this website and is advised "
-        "that if such monitoring reveals possible evidence of criminal activity, NIH may provide "
-        "that evidence to law enforcement officials."]
-       [:p {:style {:fontWeight "bold"}} "WARNING NOTICE (when accessing controlled data)"]
-       [:p {:style {:fontWeight "bold"}}
-        "You are reminded that when accessing controlled access information you are bound by the "
-        "dbGaP TCGA "
-        [:a {:href "http://cancergenome.nih.gov/pdfs/Data_Use_Certv082014" :target "_blank"}
-         "DATA USE CERTIFICATION AGREEMENT (DUCA)"] "."]]])})
+        [Policy]]])})

 (react/defc App


Fix test typo.

Fix test typo.

--- test/onyx/windowing/global_window_test.clj
+++ test/onyx/windowing/global_window_test.clj
@@ -122,4 +122,4 @@
       (let [results (take-segments! @out-chan)]
         (is (= (into #{} input) (into #{} (butlast results))))
         (is (= :done (last results)))
-        (is (= expecte-dwindows @test-state))))))
+        (is (= expected-windows @test-state))))))


fix build breaker

fix build breaker

--- test/shuppet/resources/local/localtest.clj
+++ test/shuppet/resources/local/localtest.clj
@@ -40,7 +40,7 @@

  :Role {:RoleName $app-name
-        :Policies  [{:PolicyName "ec2DescribeTags"
+        :Policies  [{:PolicyName "s3ReposReadOnly"
                      :PolicyDocument [{:Effect "Allow"
                                        :Action "EC2:Describe*"
                                        :Resource "*"}