updated docs on client

updated docs on client

--- src/tutorial/untangled_tutorial/F_Untangled_Client.cljs
+++ src/tutorial/untangled_tutorial/F_Untangled_Client.cljs
@@ -32,6 +32,7 @@
       - Complete handling of tempids, merging, attribute conflict resolution, and more!
       - Application locale handling
       - Support VCR viewer recording with internal mutations that can submit support requests
+      - Support for refreshing the entire UI on hot code reload (with your help)
   - It mounts the application UI on the given DOM element (you can pass a real node or string ID)

   Some additional things that are availabe (which we'll cover soon):
@@ -51,10 +52,71 @@

   The primary components of this layout are:

-  - An entry point for production that does nothing *but* mount the app
-  - A core namespace that creates the application and loads things like i18n support
-  - A development namespace file that mounts the app in development mode
   - A project file that is configured for running both the server, client, and tests with hot code reload.
+  - An entry point for production that does nothing *but* mount the app. Nothing but the project build refers to this,
+  so we don't accidentally try to do entry point operations more than once. It can also be used to do things
+  like disable console logging.
+  - A development-only namespace file that mounts the app in development mode. Only the dev build includes this source.
+  - A core namespace that creates the application and loads things like i18n support. This is referred to by the production
+  build and the development-only namespace.
+
+  ## Enabling re-render on hot code reload
+
+  Om and React do their best to prevent unnecessary rendering. During development we'd like to
+  force a refresh that whenever code reloads so we can see our changes.
+  In order to do this:
+
+  - Untangled forces a full UI refresh is mount is called on an already mounted app. If you specify that the
+  development namespace (which always mounts the app) is reloaded every time, then that is sufficient.
+  - The application itself has a (protocol) method named `refresh`. You can configure
+  figwheel to invoke a function that calls thta after each load.
+
+  However, in order to get *React* to actually re-render, you have to cooperate by adding a react
+  key from your app state onto your top-level DOM node, like this:
+
+  ```
+  (defui Root
+     static om/IQuery
+     (query [this] [:ui/react-key ...])
+     Object
+     (render [this]
+        (let [{:keys [ui/react-key ...]} (om/props this)]
+          (dom/div #js { :key react-key } ...))))
+  ```
+
+  The Untangled refresh will automatically set this key in your app state to a new unique value
+  every time, ensuring that the app state has changed (which will cause Om to allow a re-render) and
+  the top-level key change will cause React to force a full DOM diff (ignoring the fact that the
+  rest of the recursive state has not changed).
+
+  ## Using the REPL
+
+  ### Making sure you're connected to the right browser/tab
+
+  If you're running more than one build in Figwheel, the REPL will only be connected to one browser tab
+  at a time. You can run `(fig-status)` to see what builds are running and how many browsers are
+  connected to each.
+
+  If you're trying to look at app state, make sure ONLY one browser is connected to it, otherwise
+  you'll confuse yourself!
+
+  To ensure that you're talking to the tab of the correct build, you should do the following at
+  the REPL:
+
+  ```
+  cljs.user=> *:cljs/quit*
+  Choose focus build for CLJS REPL (tutorial, client, test) or quit > client
+  Launching ClojureScript REPL for build: client
+  ```
+
+  ### Viewing application state
+
+  The sample project `user` namespace includes a helper function called `log-app-state`. By default
+  it will show the entire application state; however, this is often too much (if it gets too big, your
+  REPL will give an error). Instead, you can supply it with a keyword and it will look that up in the
+  app state and show just that bit instead.
+
+
   "
   )


CMR-3253 Added docstring for dif10-collection-progress function

--- umm-spec-lib/src/cmr/umm_spec/test/dif10_expected_conversion.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/dif10_expected_conversion.clj
@@ -55,6 +55,7 @@
       su/convert-empty-record-to-nil))

 (defn- dif10-collection-progress
+  "converts collection progress values to values supported for DIF10 Dataset_Progress."
   [collection-progress-value]
   (when-let [c-progress (when-let [coll-progress collection-progress-value]
                           (str/upper-case coll-progress))]


CMR-3935: Fixes tests in generate-and-parse

--- umm-spec-lib/src/cmr/umm_spec/test/dif10_expected_conversion.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/dif10_expected_conversion.clj
@@ -260,10 +260,15 @@
   "When converting, the creation date and last revision date will be persisted. Both dates are
   required in DIF10, so use a default date if not present."
   [umm-coll]
-  [(conversion-util/create-date-type
-    (date/with-default-date (date/metadata-create-date umm-coll)) "CREATE")
-   (conversion-util/create-date-type
-    (date/with-default-date (date/metadata-update-date umm-coll)) "UPDATE")])
+  (remove nil?
+    [(conversion-util/create-date-type
+     (date/with-default-date (date/metadata-create-date umm-coll)) "CREATE")
+    (conversion-util/create-date-type
+     (date/with-default-date (date/metadata-update-date umm-coll)) "UPDATE")
+    (when (date/metadata-delete-date umm-coll)
+      (conversion-util/create-date-type (date/metadata-delete-date umm-coll) "DELETE"))
+    (when (date/metadata-review-date umm-coll)
+      (conversion-util/create-date-type (date/metadata-review-date umm-coll) "REVIEW"))]))

 (defn- expected-related-url-get-service
   "Returns related-url with the expected values in GetService"


Map linebreak

Map linebreak

--- src/midje/parsing/lexical_maps.clj
+++ src/midje/parsing/lexical_maps.clj
@@ -79,21 +79,18 @@
                          :rhs '~(cons result overrides)}
         override-map `(hash-map ~@overrides)
         line (:line (meta call-form))
-        result `(merge
-                 {
-                  :type :fake
-                  :var ~(fnref/as-var-form fnref)
-                  :value-at-time-of-faking (if (bound? ~(fnref/as-var-form fnref))
-                                             ~(fnref/as-form-to-fetch-var-value fnref))
-                  :arglist-matcher ~(choose-mkfn-for-arglist-matcher args)
-                  :result-supplier (from-fake-maps/mkfn:result-supplier ~arrow ~result)
-                  :times :default  ; Default allows for a more attractive error in the most common case.
+        result `(merge {:type :fake
+                        :var ~(fnref/as-var-form fnref)
+                        :value-at-time-of-faking (if (bound? ~(fnref/as-var-form fnref))
+                                                   ~(fnref/as-form-to-fetch-var-value fnref))
+                        :arglist-matcher ~(choose-mkfn-for-arglist-matcher args)
+                        :result-supplier (from-fake-maps/mkfn:result-supplier ~arrow ~result)
+                        :times :default  ; Default allows for a more attractive error in the most common case.

-                  :position (pointer/line-number-known ~line)
-                  :namespace *ns*
-                  :call-count-atom (atom 0)
-                  :call-text-for-failures (str '~call-form)
-                 }
+                        :position (pointer/line-number-known ~line)
+                        :namespace *ns*
+                        :call-count-atom (atom 0)
+                        :call-text-for-failures (str '~call-form)}
                  ~source-details
                  ~override-map)]
     ;; pprint result
@@ -109,16 +106,14 @@
                          :rhs '~(cons contained overrides)}
         override-map `(hash-map ~@overrides)
         line (:line (meta contained))
-        result `(merge
-                 {
-                  :type :fake
-                  :data-fake true
-                  :var ~(fnref/as-var-form metaconstant)
-                  :contained ~contained
+        result `(merge {:type :fake
+                        :data-fake true
+                        :var ~(fnref/as-var-form metaconstant)
+                        :contained ~contained

-                  :position (pointer/line-number-known ~line)
-                  :call-count-atom (atom 1) ;; kludje
-                 }
+                        :position (pointer/line-number-known ~line)
+                        ;; kludje:
+                        :call-count-atom (atom 1)}
                  ~source-details
                  ~override-map)]
     ;; pprint result


recur on rest of messages when first item is nil.

--- src/uswitch/bifrost/kafka.clj
+++ src/uswitch/bifrost/kafka.clj
@@ -142,20 +142,21 @@
           run? (atom true)]
       (thread
        (loop [msgs (messages c topic)
-                 partition->message-ch {}]
-                (if @run?
-                  (if-let [{:keys [partition] :as msg} (first msgs)]
-                    (let [message-ch (or (partition->message-ch partition)
-                                         (partition-consumer topic partition rotation-interval ch))]
-                      (>!! message-ch msg)
-                      (recur (rest msgs)
-                             (assoc partition->message-ch partition message-ch)))
-                    (do
-                      (<!! (timeout 50))
-                      (recur msgs partition->message-ch)))
-                  ;; if we shouldn't run, close down message-chs
-                  (doseq [[partition message-ch] partition->message-ch]
-                    (close! message-ch)))))
+              partition->message-ch {}]
+         (if @run?
+           (if-let [{:keys [partition] :as msg} (first msgs)]
+             (let [message-ch (or (partition->message-ch partition)
+                                  (partition-consumer topic partition rotation-interval ch))]
+               (>!! message-ch msg)
+               (recur (rest msgs)
+                      (assoc partition->message-ch partition message-ch)))
+             (do
+               (<!! (timeout 50))
+               (recur (rest msgs)
+                      partition->message-ch)))
+           ;; if we shouldn't run, close down message-chs
+           (doseq [[partition message-ch] partition->message-ch]
+             (close! message-ch)))))
       (assoc this
         :consumer c
         :run? run?)))


Fix compilation error

Fix compilation error

--- sre/src/sre/plan/compiler.clj
+++ sre/src/sre/plan/compiler.clj
@@ -16,7 +16,6 @@
              [lookup :as lookup]]
             [taoensso.tufte :as profiler :refer [defnp]])
   (:import [java.io BufferedReader StringReader]
-           sre.plan.compiler.BindingBranchNode
            sre.plan.config.IConfig
            [sre.plan.estimation Cost Weight]
            sre.plan.lookup.ConstraintLookup))


comment

comment

--- src/polismath/components/mongo.clj
+++ src/polismath/components/mongo.clj
@@ -7,6 +7,9 @@
             [cheshire.core :as ch]
             [monger.core :as mg]
             [monger.collection :as mc]))
+
+
+;; I think we're no longer using this namespace so we should be able to remove it.

 (defn collection-name


serve /index.html

serve /index.html

--- support/src/figwheel/core.clj
+++ support/src/figwheel/core.clj
@@ -1,8 +1,9 @@
 (ns figwheel.core
   (:require
+   [cljs.compiler]
    [compojure.route :as route]
-   [cljs.compiler]
    [compojure.core :refer [routes GET]]
+   [ring.util.response :refer [resource-response]]
    [org.httpkit.server :refer [run-server with-channel on-close on-receive send! open?]]
    [watchtower.core :as wt :refer [watcher compile-watcher watcher* ignore-dotfiles file-filter extensions]]
    [clojure.core.async :refer [go-loop <!! <! chan put! sliding-buffer timeout]]
@@ -263,7 +264,11 @@

 (defn start-static-server [{:keys [js-dirs http-server-root] :as opts}]
   (let [http-s-root (or http-server-root "public")]
-    (start-server (merge opts {:ring-handler (route/resources "/" :root http-s-root)
+    (start-server (merge opts {:ring-handler
+                               (routes
+                                (GET "/" [] (resource-response "index.html" {:root http-s-root}))
+                                (route/resources "/" :root http-s-root)
+                                (route/not-found "
Page not found
"))
                                :http-server-root http-s-root}))))

 (defn stop-server [{:keys [http-server]}]


Extract common code into separated function

--- test/app/test/interactive.clj
+++ test/app/test/interactive.clj
@@ -50,10 +50,13 @@
 ;; For this reason, we can use any compilation units and any threshold (for
 ;; the operations that require one).

-(deftest can-execute-mc-operation
+;; All the operations can be tested in the same way.
+(defn- test-operation [op-command operation threshold]
   (let [javaparser-cus {:cus (take 2 (cus javaparser-cus-path))}
-        mc-op-threshold 3
-        command-sequence [(str "mc th " mc-op-threshold) "quit"]
+        first-command (if threshold
+                        (str op-command " th " threshold)
+                        (str op-command))
+        command-sequence [first-command "quit"]
         input-string (command-sequence->input-str command-sequence)]
     (with-in-str
       input-string
@@ -61,53 +64,16 @@
                (interactive javaparser-cus)
                (verify-call-times-for printOperation 1)
                (verify-first-call-args-for
-                printOperation
-                classesWithManyConstructorsOp
-                (:cus javaparser-cus)
-                mc-op-threshold)))))
+                 printOperation operation (:cus javaparser-cus) threshold)))))
+
+(deftest can-execute-mc-operation
+  (test-operation "mc" classesWithManyConstructorsOp 2))

 (deftest can-execute-mcp-operation
-  (let [javaparser-cus {:cus (take 2 (cus javaparser-cus-path))}
-        mcp-op-threshold 3
-        command-sequence [(str "mcp th " mcp-op-threshold) "quit"]
-        input-string (command-sequence->input-str command-sequence)]
-    (with-in-str
-      input-string
-      (mocking [println print flush printOperation]
-               (interactive javaparser-cus)
-               (verify-call-times-for printOperation 1)
-               (verify-first-call-args-for
-                 printOperation
-                 constructorsWithManyParametersOp
-                 (:cus javaparser-cus)
-                 mcp-op-threshold)))))
+  (test-operation "mcp" constructorsWithManyParametersOp 3))
+
+(deftest can-execute-f-operation
+  (test-operation "f" finalizersOp nil))

 (deftest can-execute-st-operation
-  (let [javaparser-cus {:cus (take 2 (cus javaparser-cus-path))}
-        command-sequence ["st" "quit"]
-        input-string (command-sequence->input-str command-sequence)]
-    (with-in-str
-      input-string
-      (mocking [println print flush printOperation]
-               (interactive javaparser-cus)
-               (verify-call-times-for printOperation 1)
-               (verify-first-call-args-for
-                 printOperation
-                 classesAndSingletonTypeOp
-                 (:cus javaparser-cus)
-                 nil)))))
-
-(deftest can-execute-f-operation
-  (let [javaparser-cus {:cus (take 2 (cus javaparser-cus-path))}
-        command-sequence ["f" "quit"]
-        input-string (command-sequence->input-str command-sequence)]
-    (with-in-str
-      input-string
-      (mocking [println print flush printOperation]
-               (interactive javaparser-cus)
-               (verify-call-times-for printOperation 1)
-               (verify-first-call-args-for
-                 printOperation
-                 finalizersOp
-                 (:cus javaparser-cus)
-                 nil)))))
+  (test-operation "st" classesAndSingletonTypeOp nil))


Reformat permutation test for clarity

Reformat permutation test for clarity

--- test/caesium/binding_test.clj
+++ test/caesium/binding_test.clj
@@ -14,42 +14,25 @@
   (is (= '[[^long ^{size_t {}} crypto_secretbox_keybytes []]]
          (#'b/permuted-byte-types
           '[^long ^{size_t {}} crypto_secretbox_keybytes []])))
-  (is (= '[[bytes bytes long bytes bytes]
-           [bytes bytes long bytes java.nio.ByteBuffer]
-           [bytes bytes long java.nio.ByteBuffer bytes]
-           [bytes bytes long java.nio.ByteBuffer java.nio.ByteBuffer]
-           [bytes java.nio.ByteBuffer long bytes bytes]
-           [bytes java.nio.ByteBuffer long bytes java.nio.ByteBuffer]
-           [bytes java.nio.ByteBuffer long java.nio.ByteBuffer bytes]
-           [bytes
-            java.nio.ByteBuffer
-            long
-            java.nio.ByteBuffer
-            java.nio.ByteBuffer]
-           [java.nio.ByteBuffer bytes long bytes bytes]
-           [java.nio.ByteBuffer bytes long bytes java.nio.ByteBuffer]
-           [java.nio.ByteBuffer bytes long java.nio.ByteBuffer bytes]
-           [java.nio.ByteBuffer
-            bytes
-            long
-            java.nio.ByteBuffer
-            java.nio.ByteBuffer]
-           [java.nio.ByteBuffer java.nio.ByteBuffer long bytes bytes]
-           [java.nio.ByteBuffer
-            java.nio.ByteBuffer
-            long
-            bytes
-            java.nio.ByteBuffer]
-           [java.nio.ByteBuffer
-            java.nio.ByteBuffer
-            long
-            java.nio.ByteBuffer
-            bytes]
-           [java.nio.ByteBuffer
-            java.nio.ByteBuffer
-            long
-            java.nio.ByteBuffer
-            java.nio.ByteBuffer]]
+  (is (= (let [b 'bytes
+               l 'long
+               B 'java.nio.ByteBuffer]
+           [[b b l b b]
+            [b b l b B]
+            [b b l B b]
+            [b b l B B]
+            [b B l b b]
+            [b B l b B]
+            [b B l B b]
+            [b B l B B]
+            [B b l b b]
+            [B b l b B]
+            [B b l B b]
+            [B b l B B]
+            [B B l b b]
+            [B B l b B]
+            [B B l B b]
+            [B B l B B]])
          (mapv (fn [[_ args]] (mapv (comp :tag meta) args))
                (#'b/permuted-byte-types
                 '[^int crypto_secretbox_easy


finished cljs tests in system-test

finished cljs tests in system-test

--- test/deferst/system_test.cljc
+++ test/deferst/system_test.cljc
@@ -346,23 +346,35 @@
                                           :c-b [:b :b-arg]}]])
         sys (s/start-system! sb2 {:foo 10})
         sysmap (s/system-map sys)
-        stop-sys (s/stop-system! sys)]
+        stop-sys (s/stop-system! sys)
+        x-sysmap {:foo 10 :a {:a-arg 10} :b {:b-arg 10} :c {:c-a 10 :c-b 10}}
+        x-dvals [{:c-a 10 :c-b 10} {:a-arg 10}]]

     (testing "items are created"
       #?(:clj
-         (is (= @(s/system-map sys)
-                {:foo 10
-                 :a {:a-arg 10}
-                 :b {:b-arg 10}
-                 :c {:c-a 10 :c-b 10}}))))
+         (is (= @sysmap x-sysmap))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           sysmap
+           (fn [v] (is (= v x-sysmap))
+             (done))))))

     (testing "items were destroyed"
       #?(:clj
          (do
            @stop-sys
-           (is (= @destructor-vals
-                  [{:c-a 10 :c-b 10}
-                   {:a-arg 10}])))))))
+           (is (= @destructor-vals x-dvals)))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           stop-sys
+           (fn [_] (is (= @destructor-vals x-dvals))
+             (done))))))))

 (deftest unwind-on-builder-error
   (let [destructor-vals (atom [])
@@ -389,4 +401,4 @@
                 sys
                 (fn [e]
                   (is (= @destructor-vals x-dvals))
-                  (prn r)))))))))
+                  (done)))))))))


Move some tests into a deftest form

Move some tests into a deftest form


Dependencyjen päivitykset wer-projektiin

--- mtg-pairings-wer/project.clj
+++ mtg-pairings-wer/project.clj
@@ -1,13 +1,13 @@
 (defproject mtg-pairings "0.2.0"
   :license {:name "MIT License"
             :url "http://www.opensource.org/licenses/mit-license.php"}
-  :dependencies [[org.clojure/clojure "1.5.1"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
                  [clojess "0.3"]
                  [seesaw "1.4.4"]
                  [watchtower "0.1.1"]
-                 [http-kit "2.1.16"]
-                 [org.clojure/tools.reader "0.8.3"]
-                 [cheshire "5.3.1"]
-                 [clj-time "0.6.0"]]
+                 [http-kit "2.1.18"]
+                 [org.clojure/tools.reader "1.0.0-alpha3"]
+                 [cheshire "5.5.0"]
+                 [clj-time "0.11.0"]]
   :profiles {:uberjar {:main mtg-pairings.core
                        :aot [mtg-pairings.core]}})


(MAINT) PR Feedback

(MAINT) PR Feedback

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_proxy_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_proxy_test.clj
@@ -740,9 +740,8 @@
   "Increments counter if the endpoint is /goodbye"
   [counter req]
   (condp = (:uri req)
-    "/hello/" {:status 200 :body (str "Hello, World!"
-                                        ((:headers req) "x-fancy-proxy-header")
-                                        ((:headers req) "cookie"))}
+    "/hello/world/" {:status 200 :body (str "Hello, World!")}
+    "/hello/" {:status 200 :body (str "Hello, You!")}
     "/goodbye/" {:status 200 :body (str "Goodbye! Count: " (swap! counter inc))}
     {:status 404 :body "count-ring-handler couldn't find the route"}))

@@ -775,6 +774,13 @@
                         :port 9001
                         :path "/hello"}
          :ring-handler hello-goodbye-count-ring-handler}
+        (testing "proxy is up and running"
+          (let [response (http-get "https://localhost:10001/hello-proxy/" default-options-for-https-client)]
+            (is (= 200 (:status response)))
+            (is (= "Hello, You!" (:body response))))
+          (let [response (http-get "https://localhost:10001/hello-proxy/world/" default-options-for-https-client)]
+            (is (= 200 (:status response)))
+            (is (= "Hello, World!" (:body response)))))
         (testing "non-proxied endpoint doesn't see any traffic"
           (doall (for [bad-request bad-proxy-requests]
                    (let [response (http-get bad-request default-options-for-https-client)]


Clean up single-project insights

Clean up single-project insights

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -354,11 +354,10 @@
         (#(assoc % :sort-category (project-sort-category %)))
         (#(assoc % :latest-build-time (project-latest-build-time %))))))

-(defrender cards [{:keys [plans projects selected-filter selected-sorting]} owner]
-  (let [decorated-projects (map (partial decorate-project plans) projects)
-        categories (group-by :sort-category decorated-projects)
+(defrender cards [{:keys [projects selected-filter selected-sorting]} owner]
+  (let [categories (group-by :sort-category projects)
         filtered-projects (if (= selected-filter :all)
-                            decorated-projects
+                            projects
                             (selected-filter categories))
         sorted-projects (case selected-sorting
                           :alphabetical (->> filtered-projects
@@ -378,7 +377,7 @@
                  :checked (= selected-filter :all)
                  :on-change #(raise! owner [:insights-filter-changed {:new-filter :all}])}]
         [:label {:for "insights-filter-all"}
-         (gstring/format"All (%s)" (count decorated-projects))]
+         (gstring/format"All (%s)" (count projects))]
         [:input {:id "insights-filter-success"
                  :type "radio"
                  :name "selected-filter"
@@ -403,30 +402,37 @@
       [:div.blocks-container
        (om/build-all project-insights sorted-projects)]])))

-(defrender project-insight [data owner]
+(defrender single-project-insights [project owner]
   (html
    [:div
-    [:div.content
-    (let [project (first (filter (fn [project]
-                    (and
-                      (= (:reponame project)
-                        (get-in data [:navigation-data :repo])))
-                      (= (:username project)
-                        (get-in data [:navigation-data :org])))
-                    (get-in data state/projects-path)
-                    ))]
-        (om/build project-insights (decorate-project
-                                    (get-in data state/user-plans-path) project)))]]))
+    [:div.content (om/build project-insights project)]]))

 (defrender build-insights [state owner]
-  (let [projects (get-in state state/projects-path)]
+  (let [projects (get-in state state/projects-path)
+        plans (get-in state state/user-plans-path)
+        navigation-data (state :navigation-data)
+        decorate (partial decorate-project plans)]
     (html
-     [:div#build-insights {}
+     [:div#build-insights
       (cond
-        (nil? projects)    [:div.loading-spinner-big common/spinner]
-        (empty? projects)  (om/build no-projects state)
-        (some? ((state :navigation-data) :repo)) (om/build project-insight state)
-        :else              (om/build cards {:plans (get-in state state/user-plans-path)
-                                            :projects (get-in state state/projects-path)
-                                            :selected-filter (get-in state state/insights-filter-path)
-                                            :selected-sorting (get-in state state/insights-sorting-path)}))])))
+        ;; Still loading projects
+        (nil? projects)
+        [:div.loading-spinner-big common/spinner]
+
+        ;; User has no projects
+        (empty? projects)
+        (om/build no-projects state)
+
+        ;; User is looking at a single project
+        (some? (:repo navigation-data))
+        (om/build single-project-insights (->> projects
+                                               (filter #(and (= (:reponame %) (:repo navigation-data))
+                                                             (= (:username %) (:org navigation-data))))
+                                               first
+                                               decorate))
+
+        ;; User is looking at all projects
+        :else
+        (om/build cards {:projects (map decorate projects)
+                         :selected-filter (get-in state state/insights-filter-path)
+                         :selected-sorting (get-in state state/insights-sorting-path)}))])))


Detect and reflect show stoppage.

Detect and reflect show stoppage.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -763,6 +763,8 @@
         (write-display-cell controller 2 1 "       No effects")
         (write-display-cell controller 2 2 "are active.")))))

+(declare enter-stop-mode)
+
 (defn- update-interface
   "Determine the desired current state of the interface, and send any
   changes needed to get it to that state."
@@ -776,6 +778,10 @@

     (update-effect-list controller)
     (update-metronome-section controller)
+
+    ;; If the show has stopped without us noticing, enter stop mode
+    (when (and (nil? @(:task (:show controller))) (not @(:stop-mode controller)))
+      (enter-stop-mode controller))

     ;; Reflect the shift button state
     (swap! (:next-text-buttons controller)
@@ -1091,11 +1097,11 @@
   and black it out until the stop button is pressed again."
   [controller]

+  (reset! (:stop-mode controller) true)
   (with-show (:show controller)
     (show/stop!)
     (Thread/sleep (:refresh-interval (:show controller)))
     (show/blackout-show))
-  (clear-interface controller)

   (add-overlay controller
                (reify IOverlay
@@ -1119,6 +1125,7 @@
                      ;; End stop mode
                      (with-show (:show controller)
                        (show/start!))
+                     (reset! (:stop-mode controller) false)
                      :done))
                  (handle-note-on [this controller message]
                    false)
@@ -1457,6 +1464,7 @@
          :next-grid-pads (int-array 64)
          :metronome-mode (atom {})
          :shift-mode (atom false)
+         :stop-mode (atom false)
          :midi-handler (atom nil)
          :tap-tempo-handler (amidi/create-tempo-tap-handler (:metronome show))
          :overlays (atom (sorted-map-by >))


Fix crash when showing effect with no cue.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -772,7 +772,7 @@
                   end-label   (if ending " Ending  " "  End    ")
                   scroll-vars (> (count (:variables cue)) 2)
                   more-label  (when scroll-vars (concat " More " [(:right-arrow special-symbols)]))
-                  cur-vals    (cues/snapshot-cue-variables cue (:id info) :show (:show controller))
+                  cur-vals    (when cue (cues/snapshot-cue-variables cue (:id info) :show (:show controller)))
                   saved-vals  (controllers/cue-vars-saved-at (:cue-grid (:show controller)) (:x info) (:y info))
                   save-action (when (seq cur-vals)
                                 (if (seq saved-vals)


Thourougly broken summary cmoputation

Thourougly broken summary cmoputation

--- src/angelic/search/implicit/dash_astar.clj
+++ src/angelic/search/implicit/dash_astar.clj
@@ -75,10 +75,48 @@
 ;;  --> Make sure no updates see an inconsistent state.
 ;; (made more challenging by fact that outputs can trigger children,
 ;;  children can trigger updates, updates can trigger more children (from pair), ...).
+;; However, nothing can trigger outputs except outputs and evaluation.
+;;  -- and children which create pair children that get outputs. . .. .
 ;; IF we just remove latter dependency, can do all tree modifications, then all updates.
 ;; We try to manage this now, but potentially fail.
 ;;  Alternative is old way, with summary-changed-local!
 ;; Or, a combination -- although not clear how S-C-L helps then...
+
+;; Clearly, problem is with solved.
+;; Can we propagate solved first, or something?
+;; Can clearly propagate just solved info.  Doing it with summaries seems awkward.
+;; If we do this right, could lead to solution to lazy problem as well ...?
+;; Nah, summary is just too closely tied to status. (i.e., OC is solved if MAX-REWARD child is SOLVED)
+;; This makes any sort of separate "solved-signal" painful -- including fresh outputs
+
+;; Without the pair thing, we could do all our propagation.
+;; Then, do subsumption connections, then update things with new children (incr),
+;;  and finally update the evaluated leaf and anyone who gave up children (dec).
+;; (where, exactly, should evaluated leaf go in this???).
+;; (subsumption may be do more than we want, though).
+
+;; Then, only problem is pair thing.
+;; That will always happen in "increase" phase.
+;; Problem: pair cannot return a correct status until it shifts and
+;; potentially spits out new outputs.
+;; Solution(?) -- we can still defer the decreases.
+;; I.e., do al the increases first?
+;; This is always guaranteed to be safe...?
+;; This means that we always have to leave tree in consistent state-- Ugh.
+
+;; Another idea: just try to make sure each operation is consistent, instead of batching everything.
+;; I.e., release a child or output, wait for it to be fully "absorbed", do updates, then release next, etc.
+
+;; Or, we can try to break dependence of pair on summary, e.g., by pushing solved as output.
+
+;; Or, we can prevent further tree modifications by pair switch.
+;; For instance, iff right has outputs already, it becomes live, must be evaluated to switch directions.
+
+;; We can even take this one step further & do it automatically.
+
+;; Forget about OC and
+
+;; Or, we can

 (set! *warn-on-reflection* true)


Removed support for Clojure versions prior to 1.4.

--- src/appengine_magic/services/datastore.clj
+++ src/appengine_magic/services/datastore.clj
@@ -375,12 +375,7 @@
                  :or {kind (unqualified-name (.getName entity-record-type))}}]
   (try
     (retrieve-helper entity-record-type key-value-or-values :parent parent :kind kind)
-    ;; XXX: Clojure 1.2.x only:
-    (catch EntityNotFoundException _ nil)
-    ;; XXX: Clojure 1.3.x:
-    (catch Exception ex (if (isa? (class (.getCause ex)) EntityNotFoundException)
-                            nil
-                            (throw ex)))))
+    (catch EntityNotFoundException _ nil)))

 (defn exists? [entity-record-type key-value-or-values &
@@ -400,24 +395,9 @@
                       :or {kind (unqualified-name name)
                            before-save identity
                            after-load identity}}]
-  ;; TODO: Clojure 1.3: Remove the ugly Clojure version check.
-  (let [clj13? (fn [] (and (= 1 (:major *clojure-version*))
-                           (= 3 (:minor *clojure-version*))))
-        key-property-name (if (clj13?)
-                              (first (filter #(contains? (meta %) :key) properties))
-                              (first (filter #(= (:tag (meta %)) :key) properties)))
-        ;; TODO: Clojure 1.3: Remove unnecessary call to str.
-        key-property (if key-property-name (keyword (str key-property-name)) nil)
-        ;; XXX: The keyword and str composition below works
-        ;; around a weird Clojure bug (see
-        ;; http://groups.google.com/group/clojure-dev/browse_thread/thread/655f6e7d1b312f17).
-        ;; TODO: This bug is fixed in Clojure 1.3 after alpha4 came out (see
-        ;; http://dev.clojure.org/jira/browse/CLJ-693).
-        clj-properties (if (clj13?)
-                           (set (map (comp keyword str)
-                                     (filter #(contains? (meta %) :clj) properties)))
-                           (set (map (comp keyword str)
-                                     (filter #(= (:tag (meta %)) :clj) properties))))]
+  (let [key-property-name (first (filter #(contains? (meta %) :key) properties))
+        key-property (if key-property-name (keyword key-property-name) nil)
+        clj-properties (set (map keyword (filter #(contains? (meta %) :clj) properties)))]
     `(defrecord ~name ~properties
        EntityProtocol
        (get-clj-properties [this#]


Record creator functions in websocket component renamed.

According to pedestal component naming schema which should be
the default one from now on.

--- src/clj/hellhound/components/websocket.clj
+++ src/clj/hellhound/components/websocket.clj
@@ -58,7 +58,7 @@
                             :adapter (get-sch-adapter)}))))

-(defn make-websocket
+(defn new-websocket
   "Creates a websocket component instance."
   ([router]
    (new-channel-socket-server (router-builder router) (get-sch-adapter) {}))
@@ -66,10 +66,10 @@
    (new-channel-socket-server (router-builder router) (get-sch-adapter) options)))

-(defn websocket-server
+(defn make-websocket-component
   "Create an instance from websocket component. This function is meant
   to be used with `hellhound.system.defsystem` macro."
   ([system-map]
-   (websocket-server system-map {}))
+   (make-websocket-component system-map {}))
   ([system-map options]
-   (update-in system-map [:components :websocket] (make-websocket options))))
+   (update-in system-map [:components :websocket] (new-websocket options))))


refactor routes

refactor routes

--- src/clj/salava/extra/socialuser/routes.clj
+++ src/clj/salava/extra/socialuser/routes.clj
@@ -15,7 +15,7 @@
 (defn route-def [ctx]
   (routes
     (context "/connections" []
-             (layout/main ctx "/connections"))
+             (layout/main ctx "/user"))

     (context "/obpv1/socialuser" []
              :tags ["socialuser"]


Added namespace that the specification uses when the composed specification is returned to the frontend.

--- src/clj_formal_specifications_app/core.clj
+++ src/clj_formal_specifications_app/core.clj
@@ -67,7 +67,9 @@

 (defn ns-spec
   [ns]
-  (reduce assoc-to-spec {:actions #{} :data #{}} (ns-publics (symbol ns))))
+  (reduce assoc-to-spec
+          {:namespace ns :actions #{} :data #{}}
+          (ns-publics (symbol ns))))

 (defn compose
   [spec]


Return 400 error when delete time is before now.

--- src/cmr/indexer/services/index_service.clj
+++ src/cmr/indexer/services/index_service.clj
@@ -36,10 +36,14 @@
         ttl (when delete-time (t/in-millis (t/interval (t/now) delete-time)))
         concept-index (idx-set/get-concept-index-name context concept-id revision-id concept)
         es-doc (concept->elastic-doc context concept umm-concept)]
-    (es/save-document-in-elastic
-      context
-      concept-index
-      (concept-mapping-types concept-type) es-doc (Integer. revision-id) ttl ignore-conflict)))
+    (if (and ttl (<= ttl 0))
+      (errors/throw-service-error
+        :bad-request
+        (format "DeleteTime %s is before the current time." (str delete-time)))
+      (es/save-document-in-elastic
+        context
+        concept-index
+        (concept-mapping-types concept-type) es-doc (Integer. revision-id) ttl ignore-conflict))))

 (deftracefn delete-concept


formatting

formatting

--- src/overtone/sc/machinery/server/comms.clj
+++ src/overtone/sc/machinery/server/comms.clj
@@ -18,8 +18,8 @@
                ::osc-receiver)

 (defn- massage-numerical-args
-  "Massage numerical args to the form SC would like them. Currently
-  this just casts all Longs to Integers and Doubles to Floats."
+  "Massage numerical args to the form SC would like them. Currently this
+  just casts all Longs to Integers and Doubles to Floats."
   [args]
   (map (fn [arg]
          (cond (instance? Long arg)
@@ -51,7 +51,7 @@
    generated by executing the action-fn have completed. Returns result
    of action-fn."
   [action-fn handler-fn]
-  (let [id (next-id ::server-sync-id)
+  (let [id  (next-id ::server-sync-id)
         key (uuid)]
     (on-event "/synced"
               (fn [msg] (when (= id (first (:args msg)))
@@ -65,24 +65,24 @@
       res)))

 (defn server-sync
-  "Send a sync message to the server with the specified id. Server
-  will reply with a synced message when all incoming messages up to
-  the sync message have been handled. See with-server-sync and
-  on-server-sync for more typical usage."
+  "Send a sync message to the server with the specified id. Server will
+  reply with a synced message when all incoming messages up to the sync
+  message have been handled. See with-server-sync and on-server-sync for
+  more typical usage."
   [id]
   (server-snd "/sync" id))

 (defn with-server-self-sync
   "Blocks the current thread until the action-fn explicitly sends a
-  server sync.  The action-fn is assumed to have one argument which
-  will be the unique sync id.  This is useful when the action-fn is
-  itself asynchronous yet you wish to synchronise with its
-  completion. The action-fn can sync using the fn server-sync.
-  Returns the result of action-fn."
+  server sync.  The action-fn is assumed to have one argument which will
+  be the unique sync id.  This is useful when the action-fn is itself
+  asynchronous yet you wish to synchronise with its completion. The
+  action-fn can sync using the fn server-sync.  Returns the result of
+  action-fn."
   [action-fn]
-  (let [id (next-id ::server-sync-id)
+  (let [id   (next-id ::server-sync-id)
         prom (promise)
-        key (uuid)]
+        key  (uuid)]
     (oneshot-event "/synced"
                    (fn [msg] (when (= id (first (:args msg)))
                               (deliver prom true)))
@@ -95,9 +95,9 @@
   "Blocks current thread until all osc messages in action-fn have
   completed. Returns result of action-fn."
   [action-fn]
-  (let [id (next-id ::server-sync-id)
+  (let [id   (next-id ::server-sync-id)
         prom (promise)
-        key (uuid)]
+        key  (uuid)]
     (on-event "/synced"
               (fn [msg] (when (= id (first (:args msg)))
                          (do
@@ -110,18 +110,18 @@
       res)))

 (defn server-recv
-  "Register your intent to wait for a message associated with given
-  path to be received from the server. Returns a promise that will
-  contain the message once it has been received. Does not block
-  current thread (this only happens once you try and look inside the
-  promise and the reply has not yet been received).
+  "Register your intent to wait for a message associated with given path
+  to be received from the server. Returns a promise that will contain
+  the message once it has been received. Does not block current
+  thread (this only happens once you try and look inside the promise and
+  the reply has not yet been received).

-  If an optional matcher-fn is specified, will only deliver the
-  promise when the matcher-fn returns true. The matcher-fn should
-  accept one arg which is the incoming event info."
+  If an optional matcher-fn is specified, will only deliver the promise
+  when the matcher-fn returns true. The matcher-fn should accept one arg
+  which is the incoming event info."
   ([path] (server-recv path nil))
   ([path matcher-fn]
-     (let [p (promise)
+     (let [p   (promise)
            key (uuid)]
        (on-sync-event path
                       (fn [info]


run the longs->refs migration on startup

--- src/pc/datomic/migrations.clj
+++ src/pc/datomic/migrations.clj
@@ -112,7 +112,8 @@
    4 #'archive/make-existing-documents-public
    5 #'archive/migrate-fake-documents
    6 #'archive/fix-bounding-boxes
-   7 #'archive/add-frontend-ids))
+   7 #'archive/add-frontend-ids
+   8 #'longs->refs))

 (defn necessary-migrations
   "Returns tuples of migrations that need to be run, e.g. [[0 #'migration-one]]"


Put docstring in the proper place.

Put docstring in the proper place.

--- core/src/immutant/internal/util.clj
+++ core/src/immutant/internal/util.clj
@@ -117,8 +117,9 @@
        (finally
          (.setContextClassLoader thread# curr-cl#)))))

-(defn uuid []
+(defn uuid
   "Generates a random uuid string."
+  []
   (str (java.util.UUID/randomUUID)))

 (defn ^org.slf4j.Logger logger


fixing what looks lik a mistake in a fact

--- test/midje/t_sweet.clj
+++ test/midje/t_sweet.clj
@@ -77,7 +77,7 @@
 ; Metaconstants
 (fact (always-one ...anything...) => 1)
 (fact (g-caller ...something...) => ...g-value...
-  (provided (g-caller ...something...) => ...g-value...))
+  (provided (g ...something...) => ...g-value...))

 (fact "key-value pairs can be passed to override normal behavior"
   (always-one 3) => 3 :expected-result 1)


test(model.connection): should save new connection

--- test/busa_server/model/connection_test.clj
+++ test/busa_server/model/connection_test.clj
@@ -20,4 +20,7 @@
        :duration "00:50"
        :from-place (c/make-connection-place {:time "2016-04-10T05:55:00+03:00" :name "Nummela"})
        :to-place (c/make-connection-place {:time "2016-04-10T06:40:00+03:00" :name "Helsinki"})}) => connection)
+
+  (fact "should save new connection"
+    (c/save [connection]) => (contains {:inserted 1}))
 )


Fix tests

Fix tests

--- test/caesium/magicnonce/secretbox_test.clj
+++ test/caesium/magicnonce/secretbox_test.clj
@@ -38,8 +38,8 @@

     (is (u/array-eq st/ptext (ms/decrypt st/secret-key ctext)))

-    (let [forgery (r/randombytes (alength ^bytes out))]
-      (is (thrown-with-msg
+    (let [forgery (r/randombytes (alength ^bytes ctext))]
+      (is (thrown-with-msg?
            RuntimeException #"Ciphertext verification failed"
            (ms/decrypt st/secret-key forgery))))

@@ -55,7 +55,7 @@

     (is (u/array-eq st/ptext (ms/open ctext st/secret-key)))

-    (let [forgery (r/randombytes (alength ^bytes out))]
-      (is (thrown-with-msg
+    (let [forgery (r/randombytes (alength ^bytes ctext))]
+      (is (thrown-with-msg?
            RuntimeException #"Ciphertext verification failed"
            (ms/open forgery st/secret-key))))))


New test: test-format-time-3

New test: test-format-time-3

--- test/clj_calendar/format_datetime_test.clj
+++ test/clj_calendar/format_datetime_test.clj
@@ -125,6 +125,32 @@
               "2 months and one year ago"     (format-time- 2 1 "month" "year")
               "2 months and 2 years ago"      (format-time- 2 2 "month" "year"))))

+(deftest test-format-time-3
+    "Check the function clj-calendar.format-datetime/format-time-."
+    (testing "the function clj-calendar.format-datetime/format-time-."
+        (are [x y] (= x y)
+              "99 minutes ago"                 (format-time- 99 0 "minute" "second")
+              "99 minutes and one second ago"  (format-time- 99 1 "minute" "second")
+              "99 minutes and 2 seconds ago"   (format-time- 99 2 "minute" "second")
+              "99 minutes and 3 seconds ago"   (format-time- 99 3 "minute" "second")
+              "99 minutes and 4 seconds ago"   (format-time- 99 4 "minute" "second")
+              "99 minutes and 59 seconds ago"  (format-time- 99 59 "minute" "second")
+              "99 minutes and 60 seconds ago"  (format-time- 99 60 "minute" "second")
+              "99 minutes and 61 seconds ago"  (format-time- 99 61 "minute" "second")
+              "99 minutes and 99 seconds ago"  (format-time- 99 99 "minute" "second")
+              "99 days ago"                    (format-time- 99 0 "day" "hour")
+              "99 days and one hour ago"       (format-time- 99 1 "day" "hour")
+              "99 days and 2 hours ago"        (format-time- 99 2 "day" "hour")
+              "99 days and 3 hours ago"        (format-time- 99 3 "day" "hour")
+              "99 days and 4 hours ago"        (format-time- 99 4 "day" "hour")
+              "99 days and 59 hours ago"       (format-time- 99 59 "day" "hour")
+              "99 days and 60 hours ago"       (format-time- 99 60 "day" "hour")
+              "99 days and 61 hours ago"       (format-time- 99 61 "day" "hour")
+              "99 days and 99 hours ago"       (format-time- 99 99 "day" "hour")
+              "99 months ago"                  (format-time- 99 0 "month" "year")
+              "99 months and one year ago"     (format-time- 99 1 "month" "year")
+              "99 months and 2 years ago"      (format-time- 99 2 "month" "year"))))
+
 (deftest test-format-time
     "Check the function clj-calendar.format-datetime/format-time."
     (testing "the function clj-calendar.format-datetime/format-time."


Fixes typo in test_fixtures.clj

Fixes typo in test_fixtures.clj

--- test/clj_spotify/test_fixtures.clj
+++ test/clj_spotify/test_fixtures.clj
@@ -24,9 +24,7 @@
 (def test-album-cover "./test/clj_spotify/test-data/test-album-cover.png")

 (def test-base64-encoded-image-hex-string
-  (slurp "./test/clj_spotify/test-data/test-album-cover-png.hex"))
-
-()
+  (slurp "./test/clj_spotify/test-data/test-album-cover.png.hex"))

 (def correct-map {:test-key 0, :test-map 0, :test-vector 0, :test-null 0})


figwheel.repl: fix calling setlevel on wrong types of logger

--- figwheel-repl/src/figwheel/server/jetty_websocket.clj
+++ figwheel-repl/src/figwheel/server/jetty_websocket.clj
@@ -85,10 +85,13 @@
                     :off     StdErrLog/LEVEL_OFF
                     :warn    StdErrLog/LEVEL_WARN } log-lvl)
                   StdErrLog/LEVEL_WARN)]
-    (doto (Log/getRootLogger)
-      (.setLevel level))
-    (doseq [[k v] (Log/getLoggers)]
-      (.setLevel v level))))
+    ;; this only works for the jetty StdErrLog
+    (let [l (Log/getRootLogger)]
+      (when (instance? StdErrLog l)
+        (.setLevel l level)))
+    (doseq [[k l] (Log/getLoggers)]
+      (when (instance? StdErrLog l)
+        (.setLevel l level)))))

 (defn async-websocket-configurator [{:keys [websockets async-handlers]}]
   (fn [server]


Fixed generation of polygon json.

Fixed generation of polygon json.

--- src/cmr/search/results_handlers/json_spatial_results_handler.clj
+++ src/cmr/search/results_handlers/json_spatial_results_handler.clj
@@ -9,7 +9,7 @@
     "Converts a spatial shape into the string of ordinates"))

 (defn ring->string
-  "Converts a ring _for a polygon with holes_ to a string."
+  "Converts a ring to a string."
   [ring]
   (atom-spatial/points-map->points-str ring))

@@ -19,10 +19,10 @@
   (shape->string
     [{:keys [rings]}]
     (if (= (count rings) 1)
-      (atom-spatial/points-map->points-str (first rings))
+      [(atom-spatial/points-map->points-str (first rings))]
       (let [boundary (first rings)
             holes (rest rings)]
-        (concat (ring->string boundary) (map ring->string holes)))))
+        (concat [(ring->string boundary)] (map ring->string holes)))))

   cmr.spatial.point.Point
   (shape->string
@@ -45,7 +45,7 @@
   (let [shapes-by-type (group-by type shapes)
         points (map shape->string (get shapes-by-type cmr.spatial.point.Point))
         boxes (map shape->string (get shapes-by-type cmr.spatial.mbr.Mbr))
-        polygons (get shapes-by-type cmr.spatial.polygon.Polygon)
+        polygons (map shape->string (get shapes-by-type cmr.spatial.polygon.Polygon))
         lines (map shape->string (get shapes-by-type cmr.spatial.line.Line))
         spatial {:points points
                  :boxes boxes


Make toolbar scrollable

Make toolbar scrollable

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/gui/editors/context_editor/context_editor.clj
+++ src/conexp/contrib/gui/editors/context_editor/context_editor.clj
@@ -240,9 +240,9 @@
           ectx           (ref (make-editable-context ctx)),
           bar            (toolbar :orientation :horizontal
                                   :floatable? false)
-          root           (top-bottom-split bar
+          root           (top-bottom-split (scrollable bar)
                                            (get-widget table)
-                                           :divider-location 43)
+                                           :divider-location 65)
           e-ctx          @ectx,
           widget         (context-editor-widget. root table ectx),
           keystroke-fill (KeyStroke/getKeyStroke KeyEvent/VK_SPACE


(maint) Update get-certname-list to use sequential? instead of seq?

seq? will be true for a list and false for a vec, which is what hocon
will be passing in, so this commit updates the conditional to use
sequential?, which will be true for both lists and vectors.

--- src/puppetlabs/trapperkeeper/services/authorization/authorization_core.clj
+++ src/puppetlabs/trapperkeeper/services/authorization/authorization_core.clj
@@ -146,7 +146,7 @@
                             (cond
                               (string? rule) (list rule)
                               (map? rule) (list (get rule :certname ""))
-                              (seq? rule) (for [x rule]
+                              (sequential? rule) (for [x rule]
                                                  (if (map? x) (get x :certname "") x))
                               :else (list "")))
         largest-br (fn [match]


Add test for chaining on more than one route.

--- test/catacumba/core_tests.clj
+++ test/catacumba/core_tests.clj
@@ -97,7 +97,7 @@
           (is (= (:body response) "hello world from test.txt\n"))
           (is (= (:status response) 200))))))

-  (testing "Chaining handlers."
+  (testing "Chaining handlers in one route."
     (let [handler1 (fn [ctx]
                      (ct/delegate ctx {:foo "bar"}))
           handler2 (fn [ctx]
@@ -106,6 +106,20 @@
           router (ct/routes [[:get "" handler1 handler2]])]
       (with-server router
         (let [response (client/get (str base-url ""))]
+          (is (= (:body response) "hello bar"))
+          (is (= (:status response) 200))))))
+
+  (testing "Chaining handlers in more than one route."
+    (let [handler1 (fn [ctx]
+                     (ct/delegate ctx {:foo "bar"}))
+          handler2 (fn [ctx]
+                     (let [params (ct/context-params ctx)]
+                       (str "hello " (:foo params))))
+          router (ct/routes [[:prefix "foo"
+                              [:all handler1]
+                              [:get handler2]]])]
+      (with-server router
+        (let [response (client/get (str base-url "/foo"))]
           (is (= (:body response) "hello bar"))
           (is (= (:status response) 200))))))


test `component?`

test `component?`

--- test/cellophane/next_test.clj
+++ test/cellophane/next_test.clj
@@ -32,6 +32,13 @@
       (is (cellophane/component? c))
       (is (not (cellophane/renderable? c))))))

+(deftest test-component?-predicate
+  (let [simple-c-factory (cellophane/factory SimpleComponent)
+        c (simple-c-factory)]
+    (is (cellophane/component? c))
+    (is (not (cellophane/component? simple-c-factory)))
+    (is (not (cellophane/component? SimpleComponent)))))
+
 (deftest test-factory
   (let [simple-component-factory (cellophane/factory SimpleComponent)
         c (simple-component-factory)]


clean up the impl a bit

clean up the impl a bit

--- clojure_liberator/src/clojure_liberator/core.clj
+++ clojure_liberator/src/clojure_liberator/core.clj
@@ -19,10 +19,10 @@
   (-write [date out]
     (json/-write (fmt/unparse formatter date) out)))

-(defn transform-type [type-name value]
-  {:id (str (:id value)) :type type-name :attributes (dissoc value :id)})
-
-(def client-transform (partial transform-type "clients"))
+(defn make-json-api-item [type-name value]
+  {:id         (str (:id value))
+   :type       type-name
+   :attributes (dissoc value :id)})

 (defresource hello-world
              :available-media-types ["text/plain"]
@@ -30,7 +30,10 @@

 (defresource all-clients
              :available-media-types ["application/json"]
-             :handle-ok {:data (map client-transform (data-access/all_clients))})
+             :handle-ok (let [all_clients (data-access/all_clients)
+                              client-transform #(make-json-api-item "clients" %1)
+                              data (map client-transform all_clients)]
+                          {:data data}))

 (defroutes app
            (ANY "/api/test" [] hello-world)


CMR-1862 Work around empty generated tiling system names

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/iso19115_2.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/iso19115_2.clj
@@ -120,7 +120,7 @@
     (let [code-string (value-of tiling-system-el "gmd:code/gco:CharacterString")
           description-string (value-of tiling-system-el "gmd:description/gco:CharacterString")]
       (merge
-       {:TilingIdentificationSystemName description-string}
+       {:TilingIdentificationSystemName (or description-string "")}
        (iso/parse-tiling-system-coordinates code-string)))))

 (defn- parse-iso19115-xml


Correctly check for z-stack sequenceability.

The bug was that Z-stacks would fail with "Unsupported device command"
error, due to calling core.loadStageSequence() without correctly
checking core.isStageSequenceable(). This would only happen when more
than one Z slice is to be acquired, only one channel is to be acquired
(or channels are disabled), and the acquisition order is
slices-before-channels. When channels were disabled altogether, the
error would occur only if slices-before-channels was selected when
channels were previously enabled.

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@12015 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/sequence_generator.clj
+++ acqEngine/src/org/micromanager/sequence_generator.clj
@@ -406,6 +406,7 @@
         have-multiple-slices (< 1 (count slices))
         have-multiple-channels (< 1 (count channels))
         channel-properties-sequenceable (channels-sequenceable property-sequences channels)
+        slices-sequenceable (. mmc isStageSequenceable (. mmc getFocusDevice))
         no-channel-skips-frames (all-equal? 0 (map :skip-frames channels))
         all-channels-do-z-stack (all-equal? true (map :use-z-stack channels))]
     (println slices-first)
@@ -418,15 +419,23 @@
         (or
           time-first ; time points at each position
           (not have-multiple-positions))
-        (or
-          (and
-            (not have-multiple-slices)
-            (not have-multiple-channels))
-          (and
-            channel-properties-sequenceable
-            no-channel-skips-frames
-            all-channels-do-z-stack
-            (not slices-first))) ; channels at each slice
+        (not (and
+               have-multiple-slices
+               (not slices-sequenceable)))
+        (not (and
+               have-multiple-channels
+               (not channel-properties-sequenceable)))
+        (not (and
+               have-multiple-channels
+               (not no-channel-skips-frames)))
+        (not (and
+               have-multiple-slices
+               have-multiple-channels
+               (not all-channels-do-z-stack)))
+        (not (and
+               have-multiple-slices
+               have-multiple-channels
+               slices-first))
         (or
           (not use-autofocus)
           (>= autofocus-skip (dec numFrames)))


Three tests: parse-int-zero, parse-int-positive-int, and parse-int-negative-int

--- test/hurvinek/config_test.clj
+++ test/hurvinek/config_test.clj
@@ -11,8 +11,8 @@
 ;

 (ns hurvinek.config-test
-  (:require [clojure.test :refer :all]
-            [hurvinek.core :refer :all]))
+  (:require [clojure.test    :refer :all]
+            [hurvinek.config :refer :all]))

 ;
 ; Common functions used by tests.
@@ -55,7 +55,7 @@
 ;

 (deftest test-parse-boolean
-    "Check the behaviour of function emender-jenkins.config/parse-boolean."
+    "Check the behaviour of function hurvinek.config/parse-boolean."
     (are [x y] (= x y)
         true (parse-boolean "true")
         true (parse-boolean "True")
@@ -65,3 +65,33 @@
         false (parse-boolean "unknown")
         false (parse-boolean nil)))

+(deftest test-parse-int-zero
+    "Check the behaviour of function hurvinek.config/parse-int."
+    (are [x y] (== x y)
+        0 (parse-int "0")
+        0 (parse-int "00")
+        0 (parse-int "000")
+        0 (parse-int "-0")
+        0 (parse-int "-00")
+        0 (parse-int "-000")))
+
+(deftest test-parse-int-positive-int
+    "Check the behaviour of function hurvinek.config/parse-int."
+    (are [x y] (== x y)
+        1          (parse-int "1")
+        2          (parse-int "2")
+        42         (parse-int "42")
+        65535      (parse-int "65535")
+        65536      (parse-int "65536")
+        2147483646 (parse-int "2147483646")))
+
+(deftest test-parse-int-negative-int
+    "Check the behaviour of function hurvinek.config/parse-int."
+    (are [x y] (== x y)
+        -1          (parse-int "-1")
+        -2          (parse-int "-2")
+        -42         (parse-int "-42")
+        -65535      (parse-int "-65535")
+        -65536      (parse-int "-65536")
+        -2147483647 (parse-int "-2147483647")))
+


mark flakey test as explicit (#1628)

mark flakey test as explicit (#1628)

--- waiter/integration/waiter/metrics_sync_integration_test.clj
+++ waiter/integration/waiter/metrics_sync_integration_test.clj
@@ -493,7 +493,8 @@
             routers))
         :interval 1 :timeout 5)))

-(deftest ^:parallel ^:integration-slow ^:resource-heavy test-bypass-services-use-external-metrics-for-outstanding-requests
+;; Test is marked explicit because it is known to be flaky
+(deftest ^:explicit ^:parallel ^:integration-slow ^:resource-heavy test-bypass-services-use-external-metrics-for-outstanding-requests
   (testing-using-waiter-url
     (let [cluster-name (retrieve-cluster-name waiter-url)
           routers (routers waiter-url)]


Fix common test

Fix common test

--- test/robinson/common_test.clj
+++ test/robinson/common_test.clj
@@ -1,6 +1,7 @@
 (ns robinson.common-test
   (:use clojure.test
-        robinson.common))
+        robinson.common
+        robinson.world))

 (deftest test-adjacent-to-player-0
   (is (false? (adjacent-to-player? {:world {:player {:pos {:x 26, :y 9}}}}


try stashing mutable within immutable state - less overhead and less code - must be a good idea

--- dada-core/src/main/clojure/org/dada/core/SessionImpl.clj
+++ dada-core/src/main/clojure/org/dada/core/SessionImpl.clj
@@ -6,7 +6,7 @@
  (:require
   [org.dada.core RemoteSession])
  (:import
-  [clojure.lang IFn]
+  [clojure.lang Atom IFn]
   [java.util Map]
   [org.dada.core Data Model RemoteSession View]
   )
@@ -18,23 +18,21 @@
   )
  )

-(defrecord ImmutableState [^Model metamodel ^IFn close-hook])
 (defrecord MutableState [^Long lastPing ^Map views])
+(defrecord ImmutableState [^Model metamodel ^IFn close-hook ^Atom mutable])

 (defn -init [^Model metamodel ^IFn close-hook]
   (debug "init")
   [ ;; super ctor args
    []
    ;; instance state
-   (let [mutable (MutableState. (System/currentTimeMillis) {})
-	 immutable (ImmutableState. metamodel close-hook)]
-     [immutable (atom mutable)])])
+   (ImmutableState. metamodel close-hook (atom (MutableState. (System/currentTimeMillis) {})))])

 (defn ^ImmutableState immutable [^org.dada.core.SessionImpl this]
-  (first (.state this)))
+   (.state this))

-(defn mutable [^org.dada.core.SessionImpl this]
-  (second (.state this)))
+(defn ^Atom mutable [^org.dada.core.SessionImpl this]
+  (.mutable (immutable this)))

 (defn -ping [^org.dada.core.SessionImpl this]
   (trace "ping")
@@ -45,47 +43,43 @@
   (with-record ^MutableState @(mutable this) [lastPing] lastPing))

 (defn -close [^org.dada.core.SessionImpl this]
-  (let [[^ImmutableState immutable mutable] (.state this)]
-    (with-record
-     immutable
-     [close-hook]
-     (close-hook this)
-     (debug "close")
-     (doseq [[^View view models] (:views @mutable)]
-	 (doseq [^Model model models] (.deregisterView model view))))))
+  (with-record
+   (immutable this)
+   [close-hook mutable]
+   (close-hook this)
+   (debug "close")
+   (doseq [[^View view models] (:views @mutable)]
+       (doseq [^Model model models] (.deregisterView model view)))))

 (defn ^Data -registerView [^org.dada.core.SessionImpl this ^Model model ^View view]
   (debug "registerView")
-  (let [[^ImmutableState immutable mutable] (.state this)]
-    (with-record
-     immutable
-     [^Model metamodel]
-     (let [model-name (.getName model)
-	   ^Model model (.find metamodel model-name)]
-       (if (nil? model)
-	 (throw (IllegalArgumentException. (str "no Model for name: " model-name)))
-	 (let [data (.registerView model view)]
-	   (swap! mutable (fn [state] (assoc (assoc2m state :views view model) :lastPing (System/currentTimeMillis))))
-	   data))))))
+  (with-record
+   (immutable this)
+   [^Model metamodel mutable]
+   (let [model-name (.getName model)
+	 ^Model model (.find metamodel model-name)]
+     (if (nil? model)
+       (throw (IllegalArgumentException. (str "no Model for name: " model-name)))
+       (let [data (.registerView model view)]
+	 (swap! mutable (fn [state] (assoc (assoc2m state :views view model) :lastPing (System/currentTimeMillis))))
+	 data)))))

 (defn ^Data -deregisterView [^org.dada.core.SessionImpl this ^Model model ^View view]
   (debug "deregisterView")
-  (let [[^ImmutableState immutable mutable] (.state this)]
-    (with-record
-     immutable
-     [^Model metamodel]
-     (let [model-name (.getName model)
-	   ^Model model (.find metamodel model-name)]
-       (if (nil? model)
-	 (throw (IllegalArgumentException. (str "no Model for name: " model-name)))
-	 (let [data (.deregisterView model view)]
-	   (swap! mutable (fn [state] (assoc (dissoc2m state :views view model) :lastPing (System/currentTimeMillis))))
-	   data))))))
+  (with-record
+   (immutable this)
+   [^Model metamodel mutable]
+   (let [model-name (.getName model)
+	 ^Model model (.find metamodel model-name)]
+     (if (nil? model)
+       (throw (IllegalArgumentException. (str "no Model for name: " model-name)))
+       (let [data (.deregisterView model view)]
+	 (swap! mutable (fn [state] (assoc (dissoc2m state :views view model) :lastPing (System/currentTimeMillis))))
+	 data)))))

 (defn ^Data -find [^org.dada.core.SessionImpl this ^Model model key]
-  (let [[^ImmutableState immutable mutable] (.state this)]
-    (with-record
-     immutable
-     [^Model metamodel]
-     (swap! mutable assoc :lastPing (System/currentTimeMillis))
-     (.find ^Model (.find metamodel (.getName model)) key))))
+  (with-record
+   (immutable this)
+   [^Model metamodel mutable]
+   (swap! mutable assoc :lastPing (System/currentTimeMillis))
+   (.find ^Model (.find metamodel (.getName model)) key)))


Write a compress test

Write a compress test

--- test/useful/compress_test.clj
+++ test/useful/compress_test.clj
@@ -2,3 +2,8 @@
   (:use clojure.test useful.compress))

+(deftest round-trip
+  (let [s "f3509ruwqerfwoa reo1u30`1 ewf dfgjdsf sfc saf65sad+ f5df3
+g2 sd35g4szdf sdf4 as89faw76fwfwf210
+"]
+    (is (= s (unsmash (smash s))))))


CMR-3282 refactors acl search test

CMR-3282 refactors acl search test

--- access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
@@ -1071,17 +1071,25 @@
                                   :access-value 1
                                   :temporal-range {:BeginningDateTime (t/date-time 2009)
                                                    :EndingDateTime (t/date-time 2010)}})
+
+        ;; Needs to exist to create FOO entry title ACL
         coll2 (u/save-collection {:entry-title "FOO"
                                   :short-name "coll5"
                                   :native-id "coll5"
                                   :provider-id "PROV1"})

+        ;; Needs to exist to create PROV2 ACL with "coll1 entry title"
+        coll3 (u/save-collection {:entry-title "coll1 entry title"
+                                  :short-name "coll1-prov2"
+                                  :native-id "coll1-prov2"
+                                  :provider-id "PROV2"})
+
         gran1 (u/save-granule coll1 {:access-value nil
                                      :provider-id "PROV1"
                                      :temporal {:range-date-time {:beginning-date-time (t/date-time 2009)
                                                                   :ending-date-time (t/date-time 2010)}}})

-        ;; Tests combination of granule and collection identifier for granule and its parent collection
+        ;; Tests combination of granule and collection identifier for granule and its parent collection, should match
         acl1 (ingest-acl token (assoc (u/catalog-item-acl "Combined granule collection identifier")
                                       :catalog_item_identity {:name "Combined granule collection identifier"
                                                               :collection_applicable true
@@ -1096,65 +1104,111 @@
                                                                                :entry_titles ["coll1 entry title"]
                                                                                :access_value {:min_value 1 :max_value 1}}
                                                               :provider_id "PROV1"}))
-        ;; Tests parent collection against temporal contains
-        acl2 (ingest-acl token (assoc (u/catalog-item-acl "Temporal contains")
-                                      :catalog_item_identity {:name "Temporal contains"
-                                                              :collection_applicable true
-                                                              :granule_applicable true
+
+        ;; Tests combination of granule and collection identifier for granule and its parent collection, shouldn't match
+        ;; granule temporal
+        acl2 (ingest-acl token (assoc (u/catalog-item-acl "Combined granule collection identifier2")
+                                      :catalog_item_identity {:name "Combined granule collection identifier2"
+                                                              :collection_applicable true
+                                                              :granule_applicable true
+                                                              :granule_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "disjoint"}
+                                                                                :access_value {:include_undefined_value true}}
                                                               :collection_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
                                                                                :stop_date "2010-01-01T00:00:00Z"
-                                                                                :mask "contains"}}
-                                                              :provider_id "PROV1"}))
-        ;; Tests parent collection against temporal intersect, should not match
-        acl3 (ingest-acl token (assoc (u/catalog-item-acl "Temporal intersect")
-                                      :catalog_item_identity {:name "Temporal intersect"
-                                                              :granule_applicable true
-                                                              :collection_identifier {:temporal {:start_date "2014-01-01T00:00:00Z"
-                                                                                :stop_date "2015-01-01T00:00:00Z"
-                                                                                :mask "intersect"}}
-                                                              :provider_id "PROV1"}))
-        ;; Tests parent collection against temporal disjoint, should not match
-        acl4 (ingest-acl token (assoc (u/catalog-item-acl "Temporal disjoint")
-                                      :catalog_item_identity {:name "Temporal disjoint"
-                                                              :collection_applicable true
-                                                              :granule_applicable true
-                                                              :collection_identifier {:temporal {:start_date "1970-01-01T00:00:00Z"
-                                                                                :stop_date "2017-01-01T00:00:00Z"
-                                                                                :mask "disjoint"}}
-                                                              :provider_id "PROV1"}))
-        ;; Tests parent collection against entry title
-        acl5 (ingest-acl token (assoc (u/catalog-item-acl "PROV1 coll1 entry title")
-                                      :catalog_item_identity {:name "Entry title coll1 entry title"
-                                                              :granule_applicable true
-                                                              :collection_identifier {:entry_titles ["coll1 entry title"]}
-                                                              :provider_id "PROV1"}))
-        ;; Tests parent collection against disjoint, should not match
-        acl6 (ingest-acl token (assoc (u/catalog-item-acl "Entry titles FOO")
-                                      :catalog_item_identity {:name "Entry titles FOO"
-                                                              :granule_applicable true
-                                                              :collection_identifier {:entry_titles ["FOO"]}
-                                                              :provider_id "PROV1"}))
-        ;; Tests parent collection against access value
-        acl7 (ingest-acl token (assoc (u/catalog-item-acl "Access value 1")
-                                      :catalog_item_identity {:name "Access value 1"
-                                                              :collection_applicable true
-                                                              :granule_applicable true
-                                                              :collection_identifier {:access_value {:min_value 1 :max_value 1}}
-                                                              :provider_id "PROV1"}))
-        ;; Tests parent collection against access value, should not match
-        acl8 (ingest-acl token (assoc (u/catalog-item-acl "Access value 4")
-                                      :catalog_item_identity {:name "Access value 4"
-                                                              :collection_applicable true
-                                                              :granule_applicable true
-                                                              :collection_identifier {:access_value {:min_value 4 :max_value 4}}
-                                                              :provider_id "PROV1"}))
-        ;; Tests parent collection against access value, should not match
-        acl9 (ingest-acl token (assoc (u/catalog-item-acl "Access value undefined")
-                                      :catalog_item_identity {:name "include undefined value"
-                                                              :granule_applicable true
-                                                              :collection_identifier {:access_value {:include_undefined_value true}}
-                                                              :provider_id "PROV1"}))
-        expected-acls [acl1 acl2 acl5 acl7]]
+                                                                                :mask "contains"}
+                                                                                :entry_titles ["coll1 entry title"]
+                                                                                :access_value {:min_value 1 :max_value 1}}
+                                                              :provider_id "PROV1"}))
+
+        ;; Tests combination of granule and collection identifier for granule and its parent collection, shouldn't match
+        ;; granule access value
+        acl3 (ingest-acl token (assoc (u/catalog-item-acl "Combined granule collection identifier3")
+                                      :catalog_item_identity {:name "Combined granule collection identifier3"
+                                                              :collection_applicable true
+                                                              :granule_applicable true
+                                                              :granule_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :access_value {:min_value 1 :max_value 1}}
+                                                              :collection_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :entry_titles ["coll1 entry title"]
+                                                                                :access_value {:min_value 1 :max_value 1}}
+                                                              :provider_id "PROV1"}))
+
+        ;; Tests combination of granule and collection identifier for granule and its parent collection, shouldn't match
+        ;; parent collection temporal
+        acl4 (ingest-acl token (assoc (u/catalog-item-acl "Combined granule collection identifier4")
+                                      :catalog_item_identity {:name "Combined granule collection identifier4"
+                                                              :collection_applicable true
+                                                              :granule_applicable true
+                                                              :granule_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :access_value {:include_undefined_value true}}
+                                                              :collection_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "disjoint"}
+                                                                                :entry_titles ["coll1 entry title"]
+                                                                                :access_value {:min_value 1 :max_value 1}}
+                                                              :provider_id "PROV1"}))
+
+        ;; Tests combination of granule and collection identifier for granule and its parent collection, shouldn't match
+        ;; parent collection access value
+        acl5 (ingest-acl token (assoc (u/catalog-item-acl "Combined granule collection identifier5")
+                                      :catalog_item_identity {:name "Combined granule collection identifier5"
+                                                              :collection_applicable true
+                                                              :granule_applicable true
+                                                              :granule_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :access_value {:include_undefined_value true}}
+                                                              :collection_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :entry_titles ["coll1 entry title"]
+                                                                                :access_value {:min_value 2 :max_value 2}}
+                                                              :provider_id "PROV1"}))
+
+        ;; Tests combination of granule and collection identifier for granule and its parent collection, shouldn't match
+        ;; parent collection entry-title
+        acl6 (ingest-acl token (assoc (u/catalog-item-acl "Combined granule collection identifier6")
+                                      :catalog_item_identity {:name "Combined granule collection identifier6"
+                                                              :collection_applicable true
+                                                              :granule_applicable true
+                                                              :granule_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :access_value {:include_undefined_value true}}
+                                                              :collection_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :entry_titles ["FOO"]
+                                                                                :access_value {:min_value 1 :max_value 1}}
+                                                              :provider_id "PROV1"}))
+
+        ;; Tests combination of granule and collection identifier for granule and its parent collection, shouldn't match
+        ;; provider
+        acl7 (ingest-acl token (assoc (u/catalog-item-acl "Combined granule collection identifier7")
+                                      :catalog_item_identity {:name "Combined granule collection identifier7"
+                                                              :collection_applicable true
+                                                              :granule_applicable true
+                                                              :granule_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :access_value {:include_undefined_value true}}
+                                                              :collection_identifier {:temporal {:start_date "2009-01-01T00:00:00Z"
+                                                                                :stop_date "2010-01-01T00:00:00Z"
+                                                                                :mask "contains"}
+                                                                                :entry_titles ["coll1 entry title"]
+                                                                                :access_value {:min_value 1 :max_value 1}}
+                                                              :provider_id "PROV2"}))
+
+
+        expected-acls [acl1]]
    (u/wait-until-indexed)
    (testing "collection concept id search parent collection"
      (let [response (ac/search-for-acls (u/conn-context) {:permitted-concept-id gran1})]


Fixed object error in reify entry

Fixed object error in reify entry

--- resources/rules/post_identifier_merge/temp/goa/goa_biological_process_ice_to_bio.clj
+++ resources/rules/post_identifier_merge/temp/goa/goa_biological_process_ice_to_bio.clj
@@ -42,7 +42,7 @@
                (:not (:regex ?/qualifier "^NOT" "i")))
          )

-  :reify ([?/process_sc {:ln (:sha-1 ?/process ?/participation_restriction)
+  :reify ([?/process_sc {:ln (:sha-1 ?/process ?/participating_bioentity)
                  :ns "ccp" :prefix "BP_"}]
           [?/bioentity_sc {:ln (:sha-1 ?/process ?/participating_bioentity)
                     :ns "ccp" :prefix "B_"}]


Log message when unlistening [IMMUTANT-409]

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -192,7 +192,7 @@
         (.setMessageListener (consumer-fn session)
           (create-listener handler))))
     (.start connection)
-    connection
+    [connection (destination-name dest)]
     (catch Throwable e
       (close-connection connection)
       (throw e))))
@@ -202,9 +202,10 @@
                      {:keys [izer connection listener-name setup-fn]}
                      {:keys [concurrency] :as opts}]
   (log/info "Creating in-vm listener for:" dest)
-  (let [group (.createGroup
+  (let [dest-name (destination-name dest)
+        group (.createGroup
                 izer
-                (destination-name dest)
+                dest-name
                 false ;; TODO: singleton
                 concurrency
                 (not (nil? (:client-id opts)))
@@ -213,7 +214,7 @@
                     (str (:client-id opts) listener-fn)))
                 connection
                 setup-fn)]
-    (waiting-derefable #(.hasStartedAtLeastOnce group) group)))
+    (waiting-derefable #(.hasStartedAtLeastOnce group) [group dest-name])))

 (defn- remote-listen? [dest {:keys [izer connection]} {:keys [host]}]
   (or (not izer)
@@ -351,7 +352,8 @@
    call. The deref will resolve to a boolean that is true if there was
    actually something to unlisten, false otherwise."
   [listener]
-  (when-let [group (maybe-deref listener)]
+  (when-let [[group dest-name] (maybe-deref listener)]
+    (log/info "Removing listener for:" dest-name)
     (future
       (if (or (instance? java.io.Closeable group)
               (instance? javax.jms.Connection group))


CMR-5848 Adds test for umm-json granule ingest with virtual product.

--- system-int-test/test/cmr/system_int_test/ingest/provider_cmr_only_client_id_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/provider_cmr_only_client_id_test.clj
@@ -5,6 +5,7 @@
     [cmr.system-int-test.data2.core :as d]
     [cmr.system-int-test.data2.granule :as dg]
     [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.utils.index-util :as index]
     [cmr.system-int-test.utils.ingest-util :as ingest]
     [cmr.system-int-test.utils.search-util :as search]
@@ -122,4 +123,30 @@
       (assert-ingest-success #'ingest/delete-concept concept "Virtual-Product-Service")
       (index/wait-until-indexed)
       (is (= 0 (:hits (search/find-refs :granule {:granule-ur (:granule-ur granule)
+                                                  :page-size 50}))))))
+  (testing "ingest with Virtual-Product-Service with a umm-json granule"
+    (let [psa1 (data-umm-cmn/additional-attribute {:Name "source_granule_ur" :DataType "STRING" :Description "Test"})
+          collection (d/ingest-umm-spec-collection "GES_DISC" (data-umm-c/collection
+                                                                {:EntryTitle "OMI/Aura Surface UVB Irradiance and Erythemal Dose Daily L3 Global 1.0x1.0 deg Grid V003 (OMUVBd) at GES DISC"
+                                                                 :ShortName "OMUVBd_ErythemalUV"
+                                                                 :AdditionalAttributes [psa1]
+                                                                 :Version "003"}))
+          concept (-> (dg/granule-with-umm-spec-collection
+                       collection
+                       (:concept-id collection)
+                       {:granule-ur "Gran1"
+                        :provider-id "GES_DISC"
+                        :collection-ref (umm-g/map->CollectionRef {:entry-title "OMI/Aura Surface UVB Irradiance and Erythemal Dose Daily L3 Global 1.0x1.0 deg Grid V003 (OMUVBd) at GES DISC"})})
+                      (d/item->concept {:format :umm-json
+                                        :version "1.4"}))]
+      (ingest/clear-caches)
+      (assert-ingest-success #'ingest/validate-concept concept "Virtual-Product-Service")
+      (assert-ingest-success #'ingest/ingest-concept concept "Virtual-Product-Service")
+      (index/wait-until-indexed)
+      (is (= 1 (:hits (search/find-refs :granule {:granule-ur (:granule-ur "Gran1")
                                                   :page-size 50})))))))
+
+      ; (assert-ingest-success #'ingest/delete-concept concept "Virtual-Product-Service")
+      ; (index/wait-until-indexed)
+      ; (is (= 0 (:hits (search/find-refs :granule {:granule-ur (:granule-ur "Gran1")
+      ;                                             :page-size 50})))))))


cleanup

cleanup

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/ui/tweets.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/ui/tweets.cljs
@@ -1,5 +1,4 @@
 (ns birdwatch.ui.tweets
-  (:require-macros [cljs.core.async.macros :refer [go-loop]])
   (:require [birdwatch.ui.util :as util]
             [reagent.core :as r :refer [atom]]
             [matthiasn.systems-toolbox.component :as comp]))


Add arg cardinality map to accommodate new multi tnseq capability

--- services/tnseq-aggregate.clj
+++ services/tnseq-aggregate.clj
@@ -13,19 +13,23 @@
                 (when (seq grp)
                   (let [pairs (butlast grp)
                         allins (mapv second pairs)
-                        allcsv (last grp)
-                        strain (-> pairs ffirst fs/basename
-                                   (str/split #"-") first)
-                        refnm  ((cmn/get-exp-info eid :ncbi-sample-xref) strain)
+                        [refnm allcsv] (last grp)
                         gtf (fs/join refdir (str refnm ".gbk"))
-                        norm   (fs/join refdir "NormGenes" (str refnm ".txt"))]
+                        norm (fs/join refdir "NormGenes" (str refnm ".txt"))
+                        main ["-m" norm "-w" "1" "-x" "10"
+                              "-l" "50" "-b" "0" "-c" gtf]
+                        argcard ((get-toolinfo "tnseq-aggregate" eid) :argcard)
+                        cmdargs ((cmn/get-exp-info eid :cmdsargs) "aggregate")
+                        theargs (pg/merge-arg-sets argcard main cmdargs)
+                        theargs (conj theargs "-o")]
                     (coll/vfold
                      (fn[oiv]
+                       (infof "TNSEQ-AGGREGATE: %s"
+                              (vec (concat theargs oiv)))
                        (let [ret (apply
                                   pg/perl script
-                                  (concat ["-m" norm "-w" "1" "-x" "10"
-                                           "-l" "50" "-b" "0" "-c" gtf "-o"]
-                                          oiv [{:verbose true :throw false}]))
+                                  (vec (concat theargs oiv
+                                               [{:verbose true :throw false}])))
                              exit-code @(ret :exit-code)
                              exit (if (= 0 exit-code) :success exit-code)
                              err (-> (ret :stderr) (str/split #"\n") last)]
@@ -36,5 +40,12 @@
                      (conj pairs (coll/concatv [allcsv] allins))))))
               grps))))

- :description "Function wrapping calc_fitness.py taking cmp-quads [t1 t2 csv ef]."
+ ;; Cardinalities of arguments
+ ;;
+ :argcard {"-m" 1, "-w" 1, "-x" 1
+           "-l" 1, "-b" 1, "-c" 1
+           "-o" 1}
+
+ :description
+ "Function wrapping aggregate.pl."
 }


Add exception logging to debug "Pop without matching push exception" (#74)

* -- add exception logging to debug "Pop without matching push exception"

* -- feedback from @dposada

--- waiter/src/waiter/state.clj
+++ waiter/src/waiter/state.clj
@@ -310,7 +310,7 @@

 (defn handle-kill-instance-request
   "Handles a kill request."
-  [{:keys [id->instance instance-id->state] :as current-state} service-id update-status-tag-fn
+  [{:keys [id->instance instance-id->state] :as current-state} update-status-tag-fn
    [{:keys [request-id] :as reason-map} resp-chan exclude-ids-set _]]
   (let [{instance-id :id :as instance-to-offer}
         (find-killable-instance id->instance instance-id->state #(not (contains? exclude-ids-set %)))]
@@ -376,7 +376,7 @@

 (defn handle-blacklist-request
   "Handle a request to blacklist an instance."
-  [{:keys [instance-id->request-id->use-reason-map instance-id->state] :as current-state} service-id
+  [{:keys [instance-id->request-id->use-reason-map instance-id->state] :as current-state}
    update-status-tag-fn update-state-by-blacklisting-instance-fn [{:keys [instance-id blacklist-period-ms cid]} response-chan]]
   (cid/with-correlation-id cid
     (log/info "attempt to blacklist" instance-id "which has"
@@ -506,7 +506,6 @@
                       initial-state)]
           (if-let [new-state
                    (let [slots-available? (some slots-available? (vals instance-id->state))
-                         idle-instances-available? (some killable? (vals instance-id->state))
                          ;; `reserve-instance-chan` must be highest priority channel as we want reserve calls
                          ; to be handled before release calls. This allows instances from work-stealing offers
                          ; to be used preferentially. `exit-chan` and `query-state-chan` must be lowest priority
@@ -538,7 +537,7 @@

                          kill-instance-chan
                          (let [{:keys [current-state' response-chan response]}
-                               (handle-kill-instance-request current-state service-id update-status-tag-fn data)]
+                               (handle-kill-instance-request current-state update-status-tag-fn data)]
                            (async/>! response-chan response)
                            current-state')

@@ -561,8 +560,7 @@

                          blacklist-instance-chan
                          (let [{:keys [current-state' response-chan response]}
-                               (handle-blacklist-request current-state service-id update-status-tag-fn
-                                                         update-state-by-blacklisting-instance-fn data)]
+                               (handle-blacklist-request current-state update-status-tag-fn update-state-by-blacklisting-instance-fn data)]
                            (async/put! response-chan response)
                            current-state')

@@ -587,9 +585,13 @@
   "Launches a go-block that sends a message to unblacklist-instance-chan to unblacklist instance-id after blacklist-period-ms have elapsed."
   [correlation-id instance-id blacklist-period-ms unblacklist-instance-chan]
   (async/go
-    (async/<! (async/timeout blacklist-period-ms))
-    (cid/cinfo correlation-id "requesting instance" instance-id "to be unblacklisted")
-    (async/>! unblacklist-instance-chan {:instance-id instance-id})))
+    (try
+      (async/<! (async/timeout blacklist-period-ms))
+      (cid/cinfo correlation-id "requesting instance" instance-id "to be unblacklisted")
+      (async/>! unblacklist-instance-chan {:instance-id instance-id})
+      (catch Throwable th
+        (log/error th "unexpected error inside trigger-unblacklist-process"
+                   {:blacklist-period-ms blacklist-period-ms :cid correlation-id :instance-id instance-id})))))

 (defn prepare-and-start-service-chan-responder
   "Starts the service channel responder."


stub object serialisation

stub object serialisation

--- worker/src/worker/worker.cljs
+++ worker/src/worker/worker.cljs
@@ -20,6 +20,13 @@
     (first (scripts-src))))

 (def *cljs-output-file* (cljs-output-file))
+
+(defn serialize [obj]
+  (->> obj
+    (map (fn [[key val]] (str (name key) ":" val)))
+    (interpose ",")
+    (#(str "{" (apply str %) "}"))))
+
 (defn worker-body [[ns* fn*]]
   (let [
     multi-loader (str


Add test for remote receive timeouts.

Add test for remote receive timeouts.

--- messaging/test/immutant/messaging_test.clj
+++ messaging/test/immutant/messaging_test.clj
@@ -192,6 +192,18 @@
           (publish q :hi :session s)
           (= :hi (receive q :session s :timeout 100 :timeout-val :failure)))))))

+(deftest remote-receive-should-properly-timeout
+  (queue "remote" :durable false)
+  (let [extra-connect-opts
+        (when (u/in-container?)
+          [:username "testuser" :password "testuser" :remote-type :hornetq-wildfly])]
+    (with-open [c (apply connection :host "localhost" :port (u/messaging-remoting-port)
+                    extra-connect-opts)]
+      (let [start (System/currentTimeMillis)
+            q (queue "remote" :connection c)]
+        (is (= :success (receive q :timeout 100 :timeout-val :success)))
+        (is (< (- (System/currentTimeMillis) start) 200))))))
+
 (deftest publish-from-a-listener-should-work
   (let [q (random-queue)
         q2 (random-queue)


Enhance curl helper

Enhance curl helper

--- ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/resources/simu_usage_test.clj
+++ ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/resources/simu_usage_test.clj
@@ -1,6 +1,7 @@
 (ns com.sixsq.slipstream.ssclj.resources.simu-usage-test
   (:require
     [clojure.test                                       :refer :all]
+    [clojure.java.shell                                 :only [sh] :as sh]
     [com.sixsq.slipstream.ssclj.resources.usage-record  :refer :all]
     [com.sixsq.slipstream.ssclj.usage.record-keeper     :as rc]
     [korma.core                                         :as kc]
@@ -82,7 +83,7 @@
 ;; public
 ;;

-(defn delete-all
+(defn delete-everything
   []
   (acl/-init)
   (rc/-init)
@@ -94,8 +95,9 @@
 (defn populate-usage-records
   []
   (rc/-init)
-  (doseq [day (some-days) i (range nb-records-per-day)]
-    (do
+  (doseq [day (some-days)]
+    (println "Populating " day)
+    (doseq [i (range nb-records-per-day)]
       (kc/insert rc/usage_records (kc/values (rand-usage-record day))))))

@@ -106,15 +108,17 @@
   []
   (compute-summaries (some-days)))

-(defn compute-weekly-summaries
-  []
-  (->> (some-days)
-       (drop 3) ;; so that first day is monday
-       (take-nth 7)
-       compute-summaries))
+;;
+;; user-1 for the day january 21st 2015:
+;;
+;; ?$filter=user='user-3' and start_timestamp='2010-02-10T00:00:00.000Z' and end_timestamp='2010-02-11T00:00:00.000Z'
+;;
+;; cloud-2
+;;
+;; ?$filter=cloud='cloud-2' and start_timestamp='2010-02-10T00:00:00.000Z' and end_timestamp='2010-02-11T00:00:00.000Z'

 (defn curl
   [qs]
-  (println
-    (str "curl -H \"slipstream-authn-info: super ADMIN\" -X GET \"http://localhost:8201/ssclj/Usage"
+  (print
+    (str "time curl -H \"slipstream-authn-info: super ADMIN\" -X GET \"http://localhost:8201/api/Usage"
        (tu/urlencode-params qs) "\"")))