CMR-3207: All manual tests passing

CMR-3207: All manual tests passing

--- search-app/src/cmr/search/services/query_execution/facets/links_helper.clj
+++ search-app/src/cmr/search/services/query_execution/facets/links_helper.clj
@@ -13,7 +13,8 @@
   value - the value to apply (or remove) for the given field-name."
   (:require [camel-snake-kebab.core :as csk]
             [ring.util.codec :as codec]
-            [clojure.string :as str]))
+            [clojure.string :as str]
+            [cmr.common.util :as util]))

 (defn- set-and-options-for-param
   "If the provided field has more than one value applied in the query params, add in an options
@@ -221,6 +222,50 @@
                                   (get-potential-matching-query-params query-params field-name))]
      (remove-value-from-query-params-for-hierachical-field query-params potential-qp-matches value))))

+(defn- remove-duplicate-params
+  "Removes any parameters for the provided field which are exact subsets of another index for the
+  same field."
+  [query-params base-field]
+  (let [potential-qps (filter (fn [[k _]]
+                                (re-find (re-pattern base-field) k))
+                              query-params)   ;; Eliminate any params we do not care about
+        ;; Group the remaining params by index
+        param-groups-by-index (group-by (fn [[k _]]
+                                          (second (re-find #"\[\d+\]" k)))
+                                        potential-qps)
+        _ (println "Params grouped by index" param-groups-by-index)
+        ;; Iterate (reduce) through each set of parameters
+        indexes-to-remove
+         (set
+          (flatten
+           (for [[idx qps] param-groups-by-index
+                 :let [qps (util/map-keys #(str/replace % #"\[\d+\]" "")
+                                          (into {} qps))
+                       _ (println "CDD: qps are" qps)]]
+             (keep (fn [[matching-index matching-qps]]
+                     (when (and (not= idx matching-index)
+                                ;; remove the index
+                                (let [matching-qps (util/map-keys #(str/replace % #"\[\d+\]" "")
+                                                                  (into {} matching-qps))
+                                      ;; TODO change matching-qps so that all the keys are compared by ignoring the index
+                                      _ (println "CDD: matching qps are:" matching-qps)
+                                      _ (println "IDX" (type idx) "Matching-index" (type matching-index))]
+                                  ;; another group of params fully contains this group of params
+                                  (and (= qps (select-keys matching-qps (keys qps)))
+                                       (or (not= qps matching-qps)
+                                           (< (Integer/parseInt (format "%s" idx))
+                                              (Integer/parseInt (format "%s" matching-index)))))))
+                       idx))
+                   param-groups-by-index))))
+        query-keys-to-remove (mapcat #(keys (get param-groups-by-index %)) indexes-to-remove)]
+    (if (seq query-keys-to-remove)
+      (do (println "Wow I am in here and need to remove" query-keys-to-remove)
+          (apply dissoc query-params query-keys-to-remove))
+      query-params)))
+
+  ;; if select-keys of another group of parameters contains all of these parameters then this one
+  ;; is no longer needed.
+
 (defn create-remove-link-for-hierarchical-field
   "Create a link that will modify the current search to no longer filter on the given hierarchical
   field-name and value. Looks for matches case insensitively.
@@ -235,105 +280,10 @@
    (let [[base-field subfield] (str/split field-name #"\[0\]")
          updated-params (reduce (partial process-removal-for-field-value-tuple base-field potential-qp-matches)
                                 query-params
-                                (conj applied-children-tuples [subfield value]))]
+                                (conj applied-children-tuples [subfield value]))
+         ;; TODO Remove any extraneous parameters
+         updated-params (remove-duplicate-params updated-params base-field)]
      {:remove (generate-query-string base-url updated-params)})))
-
-; (defn create-link-for-hierarchical-field
-;   "Creates either a remove or an apply link based on whether this particular value is already
-;   selected within a query. Returns a map with the key being the type of link created and value is
-;   the link itself. The Field-name must be a hierarchical field which has the form
-;   <string>[<int>][<string>].
-;
-;   applied-children-tuples - Tuples of [subfield term] for any applied children terms that should
-;                             also be removed if a remove link is being generated."
-;   [base-url query-params field-name ancestors-map parent-indexes value has-siblings? applied-children-tuples]
-;   ;; TODO - I'm thinking that I need to pass the parent index into the sub-facets function
-;   ;; For apply links - if none of the siblings for this parent are applied apply the
-;   ;; same index as the parent index. Else increment the max index by one and use that.
-;   ;; For remove links - if there is exactly one other sibling - Nevermind this seems bad.
-;   ;; TODO - new solution for apply links... if none of the siblings are applied use the
-;   ;; same index as the parent, otherwise increment the max index by one and duplicate all
-;   ;; the parent parameters with the new index and add this field with the new index.
-;   (let [potential-query-params
-;         (if (and has-siblings? (not (nil? parent-indexes)))
-;           (let [exact-query-param (str/replace-first field-name "[0]"
-;                                                      (format "[%d]" parent-indexes))]
-;             (println "Exact query-param is: " exact-query-param "and value is" value "and found existing query-param"
-;                      (get query-params exact-query-param))
-;             ; (throw "Failed")
-;             (filter (fn [[k _]] (= exact-query-param k)) query-params))
-;           (get-potential-matching-query-params query-params field-name))
-;         value-exists? (or (seq (get-keys-to-remove potential-query-params value))
-;                           (seq (get-keys-to-update potential-query-params value)))]
-;
-;     (when has-siblings? (println "Value exists is " value-exists?))
-;     (if value-exists?
-;       (create-remove-link-for-hierarchical-field
-;        base-url query-params field-name ancestors-map parent-indexes value has-siblings?
-;        applied-children-tuples)
-;       (create-apply-link-for-hierarchical-field
-;        base-url query-params field-name ancestors-map parent-indexes value has-siblings?
-;        applied-children-tuples))))
-
-
-; (defn create-link-for-hierarchical-field
-;   "Creates either a remove or an apply link based on whether this particular value is already
-;   selected within a query. Returns a map with the key being the type of link created and value is
-;   the link itself. The Field-name must be a hierarchical field which has the form
-;   <string>[<int>][<string>].
-;
-;   applied-children-tuples - Tuples of [subfield term] for any applied children terms that should
-;                             also be removed if a remove link is being generated."
-;   [base-url query-params field-name ancestors-map parent-indexes value has-siblings? applied-children-tuples]
-;   ;; TODO - I'm thinking that I need to pass the parent index into the sub-facets function
-;   ;; For apply links - if none of the siblings for this parent are applied apply the
-;   ;; same index as the parent index. Else increment the max index by one and use that.
-;   ;; For remove links - if there is exactly one other sibling - Nevermind this seems bad.
-;   ;; TODO - new solution for apply links... if none of the siblings are applied use the
-;   ;; same index as the parent, otherwise increment the max index by one and duplicate all
-;   ;; the parent parameters with the new index and add this field with the new index.
-;   (if (keys (dissoc ancestors-map "category"))
-;     ;; Check if all ancestors are in the query-params with the parent index
-;     (let [[base-field subfield] (str/split field-name #"\[\d+\]")
-;           ancestors-to-match (into {} (map (fn [[k v]]
-;                                              [(format "%s[%s][%s]" base-field parent-indexes k) v])
-;                                            (dissoc ancestors-map "category")))
-;           ancestors-found (into {} (for [[k v] ancestors-to-match
-;                                          :when (= (str/lower-case v)
-;                                                   (some-> (get query-params k) str/lower-case))]
-;                                      [k v]))
-;           ancestors-found? (= (count ancestors-to-match) (count ancestors-found))
-;           exact-query-param (str/replace-first field-name "[0]" (format "[%s]" parent-indexes))
-;           potential-query-params (filter (fn [[k _]] (= exact-query-param k)) query-params)
-;           value-exists? (or (seq (get-keys-to-remove potential-query-params value))
-;                             (seq (get-keys-to-update potential-query-params value)))]
-;           ;                                                      (format "[%d]" parent-indexes))]
-;           ;             (println "Exact query-param is: " exact-query-param "and value is" value "and found existing query-param"
-;           ;                      (get query-params exact-query-param))
-;           ;             ; (throw "Failed")
-;           ;             (filter (fn [[k _]] (= exact-query-param k)) query-params))
-;       (if ancestors-found?
-;         (println "Found all ancestors!! for" field-name "and" value)
-;         (println "Did not find ancestors" ancestors-to-match ancestors-found))
-;       ; (when has-siblings? (println "Value exists is " value-exists?))
-;       ;; If all ancestors are found
-;       (if (and ancestors-found? value-exists?)
-;         (create-remove-link-for-hierarchical-field
-;          base-url query-params field-name ancestors-map parent-indexes value has-siblings?
-;          applied-children-tuples)
-;         (create-apply-link-for-hierarchical-field
-;          base-url query-params field-name ancestors-map parent-indexes value has-siblings?
-;          applied-children-tuples)))
-;     (let [potential-query-params (get-potential-matching-query-params query-params field-name)
-;           value-exists? (or (seq (get-keys-to-remove potential-query-params value))
-;                             (seq (get-keys-to-update potential-query-params value)))]
-;       (if value-exists?
-;         (create-remove-link-for-hierarchical-field
-;          base-url query-params field-name ancestors-map parent-indexes value has-siblings?
-;          applied-children-tuples)
-;         (create-apply-link-for-hierarchical-field
-;          base-url query-params field-name ancestors-map parent-indexes value has-siblings?
-;          applied-children-tuples)))))

 (defn create-link-for-hierarchical-field
   "Creates either a remove or an apply link based on whether this particular value is already
@@ -370,17 +320,6 @@
                                                        (dissoc ancestors-map "category")
                                                        subfield value))
                                   parent-indexes)
-          ; ancestors-to-match (into {} (map (fn [[k v]]
-          ;                                    [(format "%s[%s][%s]"
-          ;                                             base-field
-          ;                                             (first parent-indexes)
-          ;                                             k)
-          ;                                     v])
-          ;                                  (dissoc ancestors-map "category")))
-          ; ancestors-found (into {} (for [[k v] ancestors-to-match
-          ;                                :when (= (str/lower-case v)
-          ;                                         (some-> (get query-params k) str/lower-case))]
-          ;                            [k v]))
           ancestors-found (map (fn [ancestor]
                                  (into {} (for [[k v] ancestor
                                                 :when (= (str/lower-case v)
@@ -399,41 +338,35 @@
                                     (map (fn [qp]
                                            (str/replace-first qp #"\]\[.*\]"
                                                               (format "][%s]" subfield))))
-                                    (select-keys query-params))]
-          ; matching-indexes (map keys matching-indexes)
-          ; matching-indexes (map (fn [ancestor])
-
-                                ; matching-indexes)
-                              ;  (map #(first (keys %))))
-          ; potential-qp-matches nil]
-          ; potential-qp-matches (when ancestors-found?
-          ;                        (->> ancestors-found
-          ;                             (filter #(= (count (first ancestors-to-match)) (count %)))))]
-
-                                      ; (map #(select-keys % [subfield]))
-                                      ; (into {})))]
-          ; potential-qp-matches (into {}
-          ;                            (map #(for [[k v] %
-          ;                                        :when (re-find (re-pattern subfield) k)]
-          ;                                    [k v])
-          ;                                 potential-qp-matches))]
-
-        ; (println "matching indexes are" matching-indexes)
+                                    (select-keys query-params))
+
+          ;; TODO change to multiple indexes
+          ; idx (some->> potential-qp-matches
+          ;              keys
+          ;              first
+          ;              (re-find #"\[\d+\]")
+          ;              second)
+          ; _ (println "IDX=" idx)
+          ; child-matches (when idx
+          ;                 (concat (for [[k v] applied-children-tuples]
+          ;                           [(format "%s[%s][%s]" base-field idx (csk/->snake_case_string k))
+          ;                            v])))
+          indexes (some->> potential-qp-matches
+                           keys
+                           (map #(re-find #"\[\d+\]" %))
+                           (map second)
+                           set)
+          _ (println "IDX=" indexes)
+          child-matches (mapcat
+                          (fn [idx]
+                            (concat (for [[k v] applied-children-tuples]
+                                      [(format "%s[%s][%s]" base-field idx (csk/->snake_case_string k))
+                                       v])))
+                          indexes)]
+        (println "Child matches are" child-matches)
+
         (println "potential-qp-matches are" potential-qp-matches)
-          ; exact-query-params (map #(str/replace-first field-name "[0]" (format "[%s]" %)) parent-indexes)
-          ; _ (println "Exact query params are" exact-query-params)]
-          ; potential-query-params (into {} (filter (fn [[k _]]
-          ;                                           (seq (filter #(= % k) exact-query-params)))
-          ;                                         query-params))
-          ; _ (when (= value "Level2-2") (println "Potential query params for" value ":" potential-query-params))
-          ; value-exists? (or (seq (get-keys-to-remove potential-query-params value))
-          ;                   (seq (get-keys-to-update potential-query-params value)))]
-      ; (println "Value exists is" value-exists?)
-          ;                                                      (format "[%d]" parent-indexes))]
-          ;             (println "Exact query-param is: " exact-query-param "and value is" value "and found existing query-param"
-          ;                      (get query-params exact-query-param))
-          ;             ; (throw "Failed")
-          ;             (filter (fn [[k _]] (= exact-query-param k)) query-params))
+
       (if ancestors-found?
         (println "Found all ancestors!! for" field-name "and" value)
         (println "Did not find ancestors" ancestors-to-match ancestors-found))
@@ -442,7 +375,7 @@
       (if ancestors-found?
         (create-remove-link-for-hierarchical-field
          base-url query-params field-name ancestors-map parent-indexes value has-siblings?
-         applied-children-tuples potential-qp-matches)
+         applied-children-tuples (concat child-matches potential-qp-matches))
         (create-apply-link-for-hierarchical-field
          base-url query-params field-name ancestors-map parent-indexes value has-siblings?
          applied-children-tuples)))


whitespace

whitespace

--- src/angelic/search/implicit/dash_astar_opt_simple.clj
+++ src/angelic/search/implicit/dash_astar_opt_simple.clj
@@ -1,4 +1,4 @@
-(ns angelic.search.implicit.dash-astar-opt-simpler
+(ns angelic.search.implicit.dash-astar-opt-simple
   (:require [angelic.util :as util]
 	    [angelic.util.channel :as channel]
             [angelic.search.summary :as summary]
@@ -25,15 +25,6 @@

 ;; TODO: can we factor out ri equality check?

-;; Further idea -- traits aren't really helping.
-;; Can instead go one or two steps towards simple at some expense.
-;; One step: switch to multimethods or javascript-style objects, but keep mutability.
-;; Two steps: Above, plus go immutable.  use global hash table.
-;;   That can double as decomposition -- just choide of keys.
-;;   mutation just replaces entry in table.
-;; Or intermediate -- e.g., cache can probably stay mutable, other things less so.
-;; If we have mutable state, options are to make it explicit or close over.
-;; Depends on what makes sense, either way trait thing should be fresh every time.

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       Options      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -121,9 +112,11 @@
 (defn sp-ts [sp]
   (let [ts-atom (:ts-atom sp)]
     (or @ts-atom (reset! ts-atom (make-tree-summarizer sp)))))
+
 ;; Canonical SPs are Atomic and Pair; wrappers use TS of inner SP.
 (defn- canonicalize [sp] (:ts-sp (sp-ts sp)))
 (defn- canonical? [sp] (identical? sp (canonicalize sp)))
+

 (defn publish-child! [sp child-sp]
   (when child-sp
@@ -134,10 +127,14 @@
       (sg/connect! (sp-ts sp) (sp-ts child-sp))
       (schedule-increase! (sp-ts sp)))
     (channel/publish! (:child-channel sp) child-sp)))
+
 (defn list-children        [s] (channel/publications (:child-channel s)))
+
 (defn subscribe-children!  [s w] (channel/subscribe! (:child-channel s) w))

+
 (defn subsuming-sps        [s] (keys (:subsuming-sp-set s)))
+
 (defn add-subsuming-sp! [s subsuming-sp]
   (util/assert-is (canonical? s))
   (util/assert-is (canonical? subsuming-sp))
@@ -155,19 +152,16 @@
               (fn [subsuming-child]
                 (let [can-subsuming-child (canonicalize subsuming-child)]
                   (when (= (:name can-child) (:name can-subsuming-child))
-                    (add-subsuming-sp! can-child can-subsuming-child)))))))))))
-  )
+                    (add-subsuming-sp! can-child can-subsuming-child))))))))))))
+
+
 (defn refine-input    [s ni]
   (when-let [ret ((:ri-fn s) s ni)]
     (util/assert-is (= (:name s) (:name ret)))
     (when (canonical? s) (add-subsuming-sp! ret s))
     ret))
-
-(defmethod print-method ::Subproblem [sp o]
-  (print-method (format "#<SP$%8h %s>" (System/identityHashCode sp) (:name sp)) o))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Auxillary fns  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+
 (defn- terminal? [sp]
   (and (empty? (list-children sp))
        (not (summary/live? (sg/summary sp)))))
@@ -185,12 +179,12 @@
   (sg/connect! p (sp-ts c)))

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Constructors  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
+(defmethod print-method ::Subproblem [sp o]
+  (print-method (format "#<SP$%8h %s>" (System/identityHashCode sp) (:name sp)) o))

 ;; Multimethod to get a subproblem by name, or nil for dead.
 (defmulti get-subproblem (fn get-subproblem-dispatch [nm inp] (first nm)))
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


pass program fn

pass program fn

--- src/gamma_driver/api.cljs
+++ src/gamma_driver/api.cljs
@@ -106,7 +106,8 @@
     (gdp/bind this program spec)
     (bind/bind
       ;; need to pass these in to avoid cyclic dependency
-      {:array-buffer array-buffer
+      {:program program
+       :array-buffer array-buffer
        :element-array-buffer element-array-buffer
        :texture texture
        :bind-attribute       bind-attribute


fix order of logging statement

fix order of logging statement

--- ring-container/src/sixsq/slipstream/server/ring_container.clj
+++ ring-container/src/sixsq/slipstream/server/ring_container.clj
@@ -97,12 +97,13 @@
    by calling 'close' on the object."
   [handler ^long port]
   (log/info "starting aleph application container on port" port)
-  (let [start-server (dyn-resolve 'aleph.http/start-server)]
+  (let [start-server (dyn-resolve 'aleph.http/start-server)
+        server (->> port
+                    (InetSocketAddress. "127.0.0.1")
+                    (hash-map :socket-address)
+                    (start-server handler))]
     (log/info "started aleph application container on port" port)
-    (->> port
-         (InetSocketAddress. "127.0.0.1")
-         (hash-map :socket-address)
-         (start-server handler))))
+    server))

 (defn- parse-port
   "Parses the given value (string or int) as an integer and returns the value


Increase maximum file size limit.

Increase maximum file size limit.

Now big enough that your web-browser will break first. Fixes #186.

--- src/gorilla_repl/core.clj
+++ src/gorilla_repl/core.clj
@@ -98,7 +98,7 @@
     ;; first startup nREPL
     (nrepl/start-and-connect nrepl-requested-port)
     ;; and then the webserver
-    (let [s (server/run-server #'app-routes {:port webapp-requested-port :join? false :ip ip})
+    (let [s (server/run-server #'app-routes {:port webapp-requested-port :join? false :ip ip :max-body 500000000})
           webapp-port (:local-port (meta s))]
       (spit (doto (io/file ".gorilla-port") .deleteOnExit) webapp-port)
       (println (str "Running at http://" ip ":" webapp-port "/worksheet.html ."))


updated syntax

updated syntax

--- src/cljs/wombats_web_client/components/game_ranking.cljs
+++ src/cljs/wombats_web_client/components/game_ranking.cljs
@@ -7,14 +7,14 @@
    (<= 1 hp 29) "dying"
    :else "none"))

-(defn get-adjusted-hp [isStarting?]
-  (if isStarting? 100 0))
+(defn get-adjusted-hp [is-starting?]
+  (if is-starting? 100 0))

 (defn ranking-box
   [game-id stats info]
   (fn []
     (let [game-status (:status @info)
-          isStarting? (or (= game-status :pending-open) (= game-status :pending-closed))]
+          is-starting? (or (= game-status :pending-open) (= game-status :pending-closed))]
       [:div {:class-name "game-ranking-box"}
        [:ul.list-wombat-status
         (for [{:keys [wombat-name
@@ -22,8 +22,8 @@
                       score
                       hp
                       color]} @stats]
-          (let [hpNil? (nil? hp)
-                adjusted-hp-value (if hpNil? (get-adjusted-hp isStarting?) hp)]
+          (let [hp-nil? (nil? hp)
+                adjusted-hp-value (if hp-nil? (get-adjusted-hp is-starting?) hp)]
             ^{:key username} [:li.wombat-status {:class (when (= adjusted-hp-value 0) "disabled")}
                               [:div.health-bar
                                [:span.filling {:class (get-health-color adjusted-hp-value)


remember sorted column

remember sorted column

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

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -15,7 +15,7 @@
 (ns org.micromanager.browser.core
   (:import [javax.swing BorderFactory JButton JComboBox JFrame JLabel JOptionPane
                         JList JPanel JScrollPane JSplitPane SortOrder
-                        JTable JTextField RowFilter SpringLayout]
+                        JTable JTextField RowFilter RowSorter$SortKey SpringLayout]
            [javax.swing.table AbstractTableModel DefaultTableModel
                               TableColumn TableRowSorter]
            [javax.swing.event DocumentListener TableModelListener]
@@ -435,10 +435,9 @@
      :locations @current-locations
      :sorted-column
        (when-let [sort-key (->> table .getRowSorter .getSortKeys seq first)]
-         {:order ({SortOrder/ASCENDING 1 SortOrder/DESCENDING -1}
+         {:order ({SortOrder/ASCENDING 0 SortOrder/DESCENDING 1 SortOrder/UNSORTED 2}
                    (.getSortOrder sort-key))
           :model-column (.getColumnName model (.getColumn sort-key))})}))
-

 (defn apply-data-and-settings [collection-name settings]
   (clear-queues)
@@ -460,6 +459,11 @@
       (doseq [col display-columns]
         (doto (add-browser-column (:title col))
           (.setPreferredWidth (* total-width (:width col))))))
+    (println "sorted-column" sorted-column :model-column)
+    (.. table getRowSorter
+        (setSortKeys (list (RowSorter$SortKey.
+                             (.indexOf tags (sorted-column :model-column))
+                             (nth (SortOrder/values) (sorted-column :order))))))
     (-> @settings-window :columns :table
                          .getModel .fireTableDataChanged)))


Adapt previous component function to work with latest rum version.

--- src/uxbox/util/mixins.cljs
+++ src/uxbox/util/mixins.cljs
@@ -5,42 +5,21 @@
             [lentes.core :as l]
             [goog.dom.forms :as gforms]))

+(extend-type cljs.core.UUID
+  INamed
+  (-name [this] (str this))
+  (-namespace [_] ""))
+
 (defn component
-  [spec]
-  (let [name (or (:name spec)
-                 (str (gensym "rum-")))
-        mixins (or (:mixins spec)
-                   [])
-        spec (merge (dissoc spec :name :mixins)
-                    (when-let [rfn (:render spec)]
-                      {:render (fn [state]
-                                 [(apply rfn state (:rum/props state)) state])}))
-        cls (rum/build-class (conj mixins spec) name)
-        ctr (fn self
-              ([] (self {}))
-              ([& props]
-               (let [state {:rum/props props}]
-                 (rum/element cls state nil))))]
-    (with-meta ctr {:rum/class cls})))
-
-(defn ref-html
-  [own ref]
-  (let [component (-> own :rum/react-component)
-        node (aget (.-refs component) ref)]
-    (.-innerHTML node)))
-
-(defn ref-value
-  [own ref]
-  (let [component (-> own :rum/react-component)
-        ref-node (aget (.-refs component) ref)
-        dom-node  (.findDOMNode js/ReactDOM ref-node)]
-    (.-value dom-node)))
-
-(defn get-ref-dom
-  [own ref]
-  (let [component (-> own :rum/react-component)
-        ref-node (aget (.-refs component) ref)]
-    (.findDOMNode js/ReactDOM ref-node)))
+  [{:keys [render] :as spec}]
+  {:pre [(ifn? render)]}
+  (let [name (or (:name spec) (str (gensym "rum-")))
+        mixins (or (:mixins spec) [])
+        spec (dissoc spec :name :mixins :render)
+        render' (fn [state]
+                  [(apply render state (:rum/args state)) state])
+        mixins (conj mixins spec)]
+    (rum/build-ctor render' mixins name)))

 (defn concat
   [& elements]


Login validation message updated

Login validation message updated

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -131,9 +131,9 @@

 (defn login-validator [data-set]
   (first (b/validate data-set
-                     :username [[v/required :message "Filed is required"]
+                     :username [[v/required :message "Field is required"]
                                 [v/email :message "Enter valid email-id"]]
-                     :password [[v/required :message "Filed is required"]
+                     :password [[v/required :message "Field is required"]
                                 [v/string  :message "Enter valid password"]])))

 (defn input-element [id ttype data-set placeholder in-focus]


cleanup

cleanup

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/state/search.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/state/search.cljs
@@ -1,11 +1,6 @@
 (ns birdwatch.state.search
   (:require [birdwatch.util :as util]
             [cljs.core.async :as async :refer [put!]]))
-
-(defn append-search-text
-  "Appends string s to search-text in app, separated by space."
-  [app s]
-  (swap! app assoc :search-text (str (:search-text @app) " " s)))

 (defn- load-prev
   "Loads previous tweets matching the current search. Search is contructed


Testing extension filtering with API function

--- test/puppetlabs/master/certificate_authority_test.clj
+++ test/puppetlabs/master/certificate_authority_test.clj
@@ -95,6 +95,11 @@
     false
     (catch map? actual-map#
       (= actual-map# ~expected-map))))
+
+(defn contains-ext?
+  "Does the provided extension list contain an extensions with the given OID."
+  [ext-list oid]
+  (> (count (filter #(= oid (:oid %)) ext-list)) 0))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Tests
@@ -599,7 +604,8 @@
         issuer-pub   (utils/get-public-key issuer-keys)
         subject-keys (utils/generate-key-pair 512)
         subject-pub  (utils/get-public-key subject-keys)
-        subject-dn   (utils/cn "subject")]
+        subject      "subject"
+        subject-dn   (utils/cn subject)]
     (testing "basic extensions are created"
       (let [csr  (utils/generate-certificate-request subject-keys subject-dn)
             exts (create-agent-extensions csr issuer-pub)
@@ -658,31 +664,21 @@
         (is (= exts exts-expected))))

     (testing "only puppet extensions are extracted from CSR and DNS alt names is ignored."
-      (let [csr-exts [(utils/subject-dns-alt-names ["onefish"] false)
-                      (utils/puppet-node-uid "AAAA-BBBB-CCCC-DDDD" false)]
-            csr      (utils/generate-certificate-request
-                       subject-keys subject-dn csr-exts)
-            exts (create-agent-extensions csr issuer-pub)
-            exts-expected [{:oid "2.16.840.1.113730.1.13"
-                            :critical false
-                            :value "Puppet JVM Internal Certificate"}
-                           {:oid "2.5.29.35"
-                            :critical false
-                            :value issuer-pub}
-                           {:oid "2.5.29.19"
-                            :critical true
-                            :value {:is-ca false
-                                    :path-len-constraint nil}}
-                           {:oid "2.5.29.37"
-                            :critical true
-                            :value [ssl-server-cert ssl-client-cert]}
-                           {:oid "2.5.29.15"
-                            :critical true
-                            :value #{:digital-signature :key-encipherment}}
-                           {:oid "2.5.29.14"
-                            :critical false
-                            :value subject-pub}
-                           {:critical false
-                            :oid      "1.3.6.1.4.1.34380.1.1.1"
-                            :value    "AAAA-BBBB-CCCC-DDDD"}]]
-        (is (= exts exts-expected))))))
+      (let [csr-exts           [(utils/subject-dns-alt-names
+                                  ["onefish"] false)
+                                (utils/puppet-node-uid
+                                  "AAAA-BBBB-CCCC-DDDD" false)]
+            csr                (utils/generate-certificate-request
+                                 subject-keys subject-dn csr-exts)
+            csr-path           (path-to-cert-request csrdir subject)
+            _                  (utils/obj->pem! csr csr-path)
+            csr-fn             #(identity csr-path)
+            expected-cert-path (path-to-cert signeddir subject)
+            _                  (autosign-certificate-request!
+                                 subject csr-fn (ca-test-settings))
+            exts               (utils/get-extensions
+                                 (utils/pem->cert expected-cert-path))]
+        (is (not (contains-ext? exts "2.5.29.17")))
+        (is (contains-ext? exts "1.3.6.1.4.1.34380.1.1.1"))
+        (fs/delete expected-cert-path)
+        (fs/delete csr-path)))))


Ensure examples have the right deps.

Ensure examples have the right deps.

--- examples/todomvc/project.clj
+++ examples/todomvc/project.clj
@@ -2,7 +2,7 @@
   :dependencies [[org.clojure/clojure        "1.8.0"]
                  [org.clojure/clojurescript  "1.9.89"]
                  [reagent "0.6.0-rc"]
-                 [re-frame "0.8.0-SNAPSHOT"]
+                 [re-frame "0.8.0"]
                  [binaryage/devtools "0.8.1"]
                  [secretary "1.2.3"]]


hopefully wait long enough for finite inputs to finish

--- src/test/clojure/clojure/test/generative/runner_test.clj
+++ src/test/clojure/clojure/test/generative/runner_test.clj
@@ -20,7 +20,7 @@
       :fn (fn [n] (swap! adder + n))
       :inputs (fn [] [[1] [2] [3]])}
      1
-     100)
+     Integer/MAX_VALUE)
     (is (= @adder (apply + (map first inputs))))))

 (defmethod runner/var-tests ::custom-type


Forgot to remove a TODO after I to-did it.

--- src/midje/unprocessed.clj
+++ src/midje/unprocessed.clj
@@ -11,13 +11,6 @@
 (immigrate 'midje.checkers)

-;; TODO: I'm not wild about signalling failure in two ways: by report() and by
-;; return value. Fix this when (a) we move away from clojure.test.report and
-;; (b) we figure out how to make fact() some meaningful unit of reporting.
-;;
-;; Later note: this doesn't actually work well anyway when facts are nested within
-;; larger structures. Probably fact should return true/false based on interior failure
-;; counts.
 (defmulti check-result (fn [actual call]
                          (:desired-check call)))


Defer DOM load until files are downloaded

--- src/modal_synth/core.cljs
+++ src/modal_synth/core.cljs
@@ -143,132 +143,139 @@
 ;;;;;;; Make the channels
 ;;;;;;;;;;;;;;;;;;;;;;;;;

-(defonce channel1-audio (make-channel-audio))
-(defonce channel1-state (init-channel-state 0.3 0 0 1
-                                             channel1-audio))
-(def channel1 (channel-dom/create (:gain channel1-state)
-                                  (:delay channel1-state)
-                                  (:highpass-cutoff channel1-state)
-                                  (:lowpass-cutoff channel1-state)
-                                  "channel1"))
-(def divider1 (channel-dom/create-divider "divider1"))
-(channel-dom/add-to (sel1 :body) divider1)
-
-
-(defonce channel2-audio (make-channel-audio))
-(defonce channel2-state (init-channel-state 0.3 0 0 1
-                                             channel2-audio))
-(def channel2 (channel-dom/create (:gain channel2-state)
-                                  (:delay channel2-state)
-                                  (:highpass-cutoff channel2-state)
-                                  (:lowpass-cutoff channel2-state)
-                                  "channel2"))
-(def divider2 (channel-dom/create-divider "divider2"))
-(channel-dom/add-to (sel1 :body) divider2)
-
-
-(defonce channel3-audio (make-channel-audio))
-(defonce channel3-state (init-channel-state 0.3 0 0 1
-                                             channel3-audio))
-(def channel3 (channel-dom/create (:gain channel3-state)
-                                  (:delay channel3-state)
-                                  (:highpass-cutoff channel3-state)
-                                  (:lowpass-cutoff channel3-state)
-                                  "channel3"))
-(def divider3 (channel-dom/create-divider "divider3"))
-(channel-dom/add-to (sel1 :body) divider3)
-
-
-(defonce channel4-audio (make-channel-audio))
-(defonce channel4-state (init-channel-state 0.3 0 0 1
-                                             channel4-audio))
-(def channel4 (channel-dom/create (:gain channel4-state)
-                                  (:delay channel4-state)
-                                  (:highpass-cutoff channel4-state)
-                                  (:lowpass-cutoff channel4-state)
-                                  "channel4"))
-
-(def divider-master1 (channel-dom/create-divider "divider-master1"))
-(channel-dom/add-to (sel1 :body) divider-master1)
-(def divider-master2 (channel-dom/create-divider "divider-master2"))
-(channel-dom/add-to (sel1 :body) divider-master2)
-
-
-(defonce channel-master-audio (make-channel-audio))
-(defonce channel-master-state (init-channel-state 0.3 0 0 1
-                                                   channel-master-audio))
-(def channel-master (channel-dom/create (:gain channel-master-state)
-                                        (:delay channel-master-state)
-                                        (:highpass-cutoff channel-master-state)
-                                        (:lowpass-cutoff channel-master-state)
-                                        "channel-master"))
-
-
-; Connect everything up
-
-(defonce master-fanin (webaudio/fanin (:graph channel-master-audio)))
-(defonce master-fanout (webaudio/fanout (:graph channel-master-audio)))
-(webaudio/connect [(:graph channel1-audio) (:graph channel2-audio) (:graph channel3-audio) (:graph channel4-audio)]
-                   master-fanin)
-(webaudio/connect master-fanout
-                   [(:graph channel1-audio) (:graph channel2-audio) (:graph channel3-audio) (:graph channel4-audio)])
-(webaudio/connect master-fanout
-                   (webaudio/destination audio-context))
-
-
-; Make the noise osc for pingning the resonator
-
-(defonce noise-osc
-  (let [osc-node (webaudio/make-noise-osc audio-context
-                                          :highpass-cutoff 30
-                                          :lowpass-cutoff 1800)]
-    (webaudio/loop-noise-osc osc-node)
-    (webaudio/osc-start osc-node (webaudio/get-now audio-context))
-    osc-node))
-(defonce noise-gain (webaudio/make-gain 0 audio-context))
-(-> noise-osc
-     (webaudio/connect noise-gain)
-     webaudio/fanout
-     (webaudio/connect [(:graph channel1-audio) (:graph channel2-audio) (:graph channel3-audio) (:graph channel4-audio)]))
-(defonce noise-gain-state (atom 0))
-(add-watch noise-gain-state
-           :noise-gain-watcher
-           (make-watcher noise-osc
-                         webaudio/set-gain!
-                         identity))
-
-
-; Make the saw osc for bowing the resonator
-
-(defonce bow-osc
-  (let [osc-node (webaudio/make-osc
-                   40
-                   audio-context
-                   :osc-type "sawtooth")]
-    (webaudio/osc-start osc-node (webaudio/get-now audio-context))
-    osc-node))
-(defonce bow-gain (webaudio/make-gain 0 audio-context))
-(-> bow-osc
-     (webaudio/connect bow-gain)
-     webaudio/fanout
-     (webaudio/connect [(:graph channel1-audio) (:graph channel2-audio) (:graph channel3-audio) (:graph channel4-audio)]))
-(defonce bow-gain-state (atom 0))
-(add-watch bow-gain-state
-           :bow-gain-watcher
-           (make-watcher bow-osc
-                         webaudio/set-gain!
-                         identity))
-
-
-; Kick off the keyboard control
-
-(keyboard-control/init {:channel-states {:1 channel1-state
-                                         :2 channel2-state
-                                         :3 channel3-state
-                                         :4 channel4-state
-                                         :master channel-master-state}
-                        :noise-gain-state noise-gain-state
-                        :noise-gain noise-gain
-                        :bow-gain-state bow-gain-state
-                        :bow-gain bow-gain
-                        :audio-context audio-context})
+(defn main []
+  (defonce channel1-audio (make-channel-audio))
+  (defonce channel1-state (init-channel-state 0.3 0 0 1
+                                              channel1-audio))
+  (def channel1 (channel-dom/create (:gain channel1-state)
+                                    (:delay channel1-state)
+                                    (:highpass-cutoff channel1-state)
+                                    (:lowpass-cutoff channel1-state)
+                                    "channel1"))
+  (def divider1 (channel-dom/create-divider "divider1"))
+  (channel-dom/add-to (sel1 :body) divider1)
+
+
+  (defonce channel2-audio (make-channel-audio))
+  (defonce channel2-state (init-channel-state 0.3 0 0 1
+                                              channel2-audio))
+  (def channel2 (channel-dom/create (:gain channel2-state)
+                                    (:delay channel2-state)
+                                    (:highpass-cutoff channel2-state)
+                                    (:lowpass-cutoff channel2-state)
+                                    "channel2"))
+  (def divider2 (channel-dom/create-divider "divider2"))
+  (channel-dom/add-to (sel1 :body) divider2)
+
+
+  (defonce channel3-audio (make-channel-audio))
+  (defonce channel3-state (init-channel-state 0.3 0 0 1
+                                              channel3-audio))
+  (def channel3 (channel-dom/create (:gain channel3-state)
+                                    (:delay channel3-state)
+                                    (:highpass-cutoff channel3-state)
+                                    (:lowpass-cutoff channel3-state)
+                                    "channel3"))
+  (def divider3 (channel-dom/create-divider "divider3"))
+  (channel-dom/add-to (sel1 :body) divider3)
+
+
+  (defonce channel4-audio (make-channel-audio))
+  (defonce channel4-state (init-channel-state 0.3 0 0 1
+                                              channel4-audio))
+  (def channel4 (channel-dom/create (:gain channel4-state)
+                                    (:delay channel4-state)
+                                    (:highpass-cutoff channel4-state)
+                                    (:lowpass-cutoff channel4-state)
+                                    "channel4"))
+
+  (def divider-master1 (channel-dom/create-divider "divider-master1"))
+  (channel-dom/add-to (sel1 :body) divider-master1)
+  (def divider-master2 (channel-dom/create-divider "divider-master2"))
+  (channel-dom/add-to (sel1 :body) divider-master2)
+
+
+  (defonce channel-master-audio (make-channel-audio))
+  (defonce channel-master-state (init-channel-state 0.3 0 0 1
+                                                    channel-master-audio))
+  (def channel-master (channel-dom/create (:gain channel-master-state)
+                                          (:delay channel-master-state)
+                                          (:highpass-cutoff channel-master-state)
+                                          (:lowpass-cutoff channel-master-state)
+                                          "channel-master"))
+
+
+  ; Connect everything up
+
+  (defonce master-fanin (webaudio/fanin (:graph channel-master-audio)))
+  (defonce master-fanout (webaudio/fanout (:graph channel-master-audio)))
+  (webaudio/connect [(:graph channel1-audio) (:graph channel2-audio) (:graph channel3-audio) (:graph channel4-audio)]
+                    master-fanin)
+  (webaudio/connect master-fanout
+                    [(:graph channel1-audio) (:graph channel2-audio) (:graph channel3-audio) (:graph channel4-audio)])
+  (webaudio/connect master-fanout
+                    (webaudio/destination audio-context))
+
+
+  ; Make the noise osc for pingning the resonator
+
+  (defonce noise-osc
+    (let [osc-node (webaudio/make-noise-osc audio-context
+                                            :highpass-cutoff 30
+                                            :lowpass-cutoff 1800)]
+      (webaudio/loop-noise-osc osc-node)
+      (webaudio/osc-start osc-node (webaudio/get-now audio-context))
+      osc-node))
+  (defonce noise-gain (webaudio/make-gain 0 audio-context))
+  (-> noise-osc
+      (webaudio/connect noise-gain)
+      webaudio/fanout
+      (webaudio/connect [(:graph channel1-audio) (:graph channel2-audio) (:graph channel3-audio) (:graph channel4-audio)]))
+  (defonce noise-gain-state (atom 0))
+  (add-watch noise-gain-state
+             :noise-gain-watcher
+             (make-watcher noise-osc
+                           webaudio/set-gain!
+                           identity))
+
+
+  ; Make the saw osc for bowing the resonator
+
+  (defonce bow-osc
+    (let [osc-node (webaudio/make-osc
+                     40
+                     audio-context
+                     :osc-type "sawtooth")]
+      (webaudio/osc-start osc-node (webaudio/get-now audio-context))
+      osc-node))
+  (defonce bow-gain (webaudio/make-gain 0 audio-context))
+  (-> bow-osc
+      (webaudio/connect bow-gain)
+      webaudio/fanout
+      (webaudio/connect [(:graph channel1-audio) (:graph channel2-audio) (:graph channel3-audio) (:graph channel4-audio)]))
+  (defonce bow-gain-state (atom 0))
+  (add-watch bow-gain-state
+             :bow-gain-watcher
+             (make-watcher bow-osc
+                           webaudio/set-gain!
+                           identity))
+
+
+  ; Kick off the keyboard control
+
+  (keyboard-control/init {:channel-states {:1 channel1-state
+                                           :2 channel2-state
+                                           :3 channel3-state
+                                           :4 channel4-state
+                                           :master channel-master-state}
+                          :noise-gain-state noise-gain-state
+                          :noise-gain noise-gain
+                          :bow-gain-state bow-gain-state
+                          :bow-gain bow-gain
+                          :audio-context audio-context}))
+
+
+(.addEventListener
+  js/window
+  "DOMContentLoaded"
+  main)


Stringify keys in metadata.

Stringify keys in metadata.

--- dev/migrate.clj
+++ dev/migrate.clj
@@ -17,7 +17,7 @@
   [m]
   (let [metadata (:metadata m)]
     (if metadata
-      (read-string metadata)
+      (clojure.walk/stringify-keys (read-string metadata))
       nil)))

 (defn migrate-reading-metadata
@@ -29,13 +29,15 @@
     (let [sensors (db/execute session (hayt/select :sensors))]
       (doseq [s sensors]
         (let [measurements (measurements/all-measurements store s)]
-          (do-map #(db/execute session
-                               (hayt/update :measurements
-                                            (hayt/set-columns :reading_metadata (convert-metadata %))
-                                            (hayt/where [[= :device_id (:device_id %)]
-                                                         [= :type (:type %)]
-                                                         [= :month (:month %)]
-                                                         [= :timestamp (:timestamp %)]]))) measurements)))))
+          (when measurements
+            (doseq [m measurements]
+               (db/execute session
+                           (hayt/update :measurements
+                                        (hayt/set-columns :reading_metadata (convert-metadata m))
+                                        (hayt/where [[= :device_id (:device_id m)]
+                                                     [= :type (:type m)]
+                                                     [= :month (:month m)]
+                                                     [= :timestamp (:timestamp m)]])))))))))
   (log/info "Finished migrating reading metadata."))

 (defn fill-sensor-bounds


saving the student details.

saving the student details.

--- src/application_management/server/controllers/applications.clj
+++ src/application_management/server/controllers/applications.clj
@@ -35,13 +35,14 @@
    (redis/saveSet (get application :emailId ) (get-struct application)))
   {:success true})))

-;;saving the ddetails of the user into redis
+;;saving the details of the user into redis
  (defn save-details
   [details]
+  (prn details)
   (if (invalid-json details)
       {:error "Error" :message ""}
   (do (redis/saveSet (get details :emailId) (get-struct details))
-      {:success true})))
+      {:success "true"})))

 (defn getApplications
   []


CMR-3195: Added more int tests.

CMR-3195: Added more int tests.

--- system-int-test/test/cmr/system_int_test/ingest/collection_validation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_validation_test.clj
@@ -346,7 +346,7 @@
     (assert-valid {:product-specific-attributes [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                  (dc/psa {:name "bool2" :data-type :boolean :value true})]}))

-  (testing "Enabling UMM-C JSON-Schema validation through Cmr-Validate-Umm-C header"
+  (testing "Enabling UMM-C JSON-Schema validation through Cmr-Validate-Umm-C header being true"
     ;; create collection valid against echo10 but invalid against schema
     (let [response (d/ingest "PROV1" (dc/collection {:product-specific-attributes
                                                      [(dc/psa {:name "bool1" :data-type :boolean :value true})
@@ -357,21 +357,71 @@
              (select-keys response [:status :errors]))))
     (assert-valid {:product-specific-attributes [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                  (dc/psa {:name "bool2" :data-type :boolean :value true})]}))
-  (testing "Enabling UMM-Spec validation through Cmr-Validate-Umm-C header"
+  (testing "Enabling UMM-C JSON-Schema validation through Cmr-Validate-Umm-C header being false"
+    ;; create collection valid against echo10 but invalid against schema
+    (let [response (d/ingest "PROV1" (dc/collection {:product-specific-attributes
+                                                     [(dc/psa {:name "bool1" :data-type :boolean :value true})
+                                                      (dc/psa {:name "bool2" :data-type :boolean :value true})]})
+                             {:allow-failure? true :validate-umm-c false})]
+      (is (= {:status 200}
+             (select-keys response [:status :errors]))))
+    (assert-valid {:product-specific-attributes [(dc/psa {:name "bool1" :data-type :boolean :value true})
+                                                 (dc/psa {:name "bool2" :data-type :boolean :value true})]}))
+  (testing "Enabling UMM-C JSON-Schema validation through Cmr-Validate-Umm-C header being absent"
+    ;; create collection valid against echo10 but invalid against schema
+    (let [response (d/ingest "PROV1" (dc/collection {:product-specific-attributes
+                                                     [(dc/psa {:name "bool1" :data-type :boolean :value true})
+                                                      (dc/psa {:name "bool2" :data-type :boolean :value true})]})
+                             {:allow-failure? true})]
+      (is (= {:status 200}
+             (select-keys response [:status :errors]))))
+    (assert-valid {:product-specific-attributes [(dc/psa {:name "bool1" :data-type :boolean :value true})
+                                                 (dc/psa {:name "bool2" :data-type :boolean :value true})]}))
+
+  (testing "Enabling UMM-Spec validation through Cmr-Validate-Umm-C header being true"
     ;; create a collection that's  valid against schema validation, but invalid against umm-spec validation
     (assert-invalid
       {:processing-level-id "1"
        :science-keywords [(dc/science-keyword {:category "upcase"
-                                            :topic "Cool"
-                                            :term "Mild"})]
+                                               :topic "Cool"
+                                               :term "Mild"})]
        :spatial-coverage (dc/spatial {:gsr :cartesian})
-       :related-urls [(dc/related-url {:type "type" :url "htt://www.foo.com"})]
+       :related-urls [(dc/related-url {:type "type" :url "http://www.foo.com"})]
        :product-specific-attributes
        [(dc/psa {:name "bool" :data-type :boolean :value true})
         (dc/psa {:name "bool" :data-type :boolean :value true})]}
       ["AdditionalAttributes"]
       ["Additional Attributes must be unique. This contains duplicates named [bool]."]
       {:validate-umm-c true}))
+  (testing "Enabling UMM-Spec validation through Cmr-Validate-Umm-C header being false"
+    ;; create a collection that's  valid against schema validation, but invalid against umm-spec validation
+    (assert-invalid
+      {:processing-level-id "1"
+       :science-keywords [(dc/science-keyword {:category "upcase"
+                                               :topic "Cool"
+                                               :term "Mild"})]
+       :spatial-coverage (dc/spatial {:gsr :cartesian})
+       :related-urls [(dc/related-url {:type "type" :url "http://www.foo.com"})]
+       :product-specific-attributes
+       [(dc/psa {:name "bool" :data-type :boolean :value true})
+        (dc/psa {:name "bool" :data-type :boolean :value true})]}
+      ["ProductSpecificAttributes"]
+      ["Product Specific Attributes must be unique. This contains duplicates named [bool]."]
+      {:validate-umm-c false}))
+  (testing "Enabling UMM-Spec validation through Cmr-Validate-Umm-C header being absent"
+    ;; create a collection that's  valid against schema validation, but invalid against umm-spec validation
+    (assert-invalid
+      {:processing-level-id "1"
+       :science-keywords [(dc/science-keyword {:category "upcase"
+                                               :topic "Cool"
+                                               :term "Mild"})]
+       :spatial-coverage (dc/spatial {:gsr :cartesian})
+       :related-urls [(dc/related-url {:type "type" :url "http://www.foo.com"})]
+       :product-specific-attributes
+       [(dc/psa {:name "bool" :data-type :boolean :value true})
+        (dc/psa {:name "bool" :data-type :boolean :value true})]}
+      ["ProductSpecificAttributes"]
+      ["Product Specific Attributes must be unique. This contains duplicates named [bool]."]))

   (side/eval-form `(icfg/set-return-umm-spec-validation-errors! true))


CMR-1325: Add test to manually test race conditions with ingesting the same concept-id

--- system-int-test/test/cmr/system_int_test/ingest/collection_validation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_validation_test.clj
@@ -160,3 +160,20 @@
       (is (= {:status 400
               :errors [(msg/invalid-revision-id "NaN")]}
              response)))))
+
+(comment
+  (ingest/delete-provider "PROV1")
+  ;; Attempt to create race conditions by ingesting the same concept-id simultaneously. We expect
+  ;; some requests to succeed while others return a 409.
+  ;; If the race condition is reproduced you will see a message like:
+  ;; 409 returned, Errors: [Conflict with existing concept-id [C1-PROV1] and revision-id [23]]
+  (do
+    (ingest/create-provider "provguid1" "PROV1")
+    (cmr.system-int-test.utils.echo-util/grant-all-ingest "PROV1")
+
+    (doseq [_ (range 150)]
+      (future (do (let [response (ingest/ingest-concept
+                                   (dc/collection-concept {:concept-id "C1-PROV1"
+                                                           :native-id "Same Native ID"}))]
+                    (when (= 409 (:status response))
+                      (println "409 returned, Errors:" (:errors response)))))))))


(maint) Fix puppetserver-metrics test for dynamic ports

--- test/puppetlabs/puppetdb/integration/puppetserver_metrics.clj
+++ test/puppetlabs/puppetdb/integration/puppetserver_metrics.clj
@@ -20,14 +20,15 @@

     (testing "Puppet Server status endpoint contains expected puppetdb metrics"

-      (let [all-svcs-status (svc-utils/get-ssl "https://localhost:8140/status/v1/services")]
+      (let [status-endpoint (str "https://localhost:" (-> ps int/server-info :port) "/status/v1")
+            all-svcs-status (svc-utils/get-ssl (str status-endpoint "/services"))]
         (is (= 200 (:status all-svcs-status)))
         ;; in older versions of Puppet Server (pre-5.0), the `master` status
         ;; didn't exist. Since these tests are run against multiple versions
         ;; of Puppet Server, this ensures that we're only testing that the
         ;; `master` status has appropriate content on the right versions.
         (when (some? (get-in all-svcs-status [:body :master]))
-          (let [resp (svc-utils/get-ssl "https://localhost:8140/status/v1/services/master?level=debug")]
+          (let [resp (svc-utils/get-ssl (str status-endpoint "/services/master?level=debug"))]
             (is (= 200 (:status resp)))

             (let [metrics (get-in resp [:body :status :experimental :http-client-metrics])]


Cleanup in lein profiles

Cleanup in lein profiles

--- clojure/lein.symlink/profiles.clj
+++ clojure/lein.symlink/profiles.clj
@@ -2,6 +2,4 @@
         :dependencies [[pjstadig/humane-test-output "0.6.0"]]
         :injections [(require 'pjstadig.humane-test-output)
                      (pjstadig.humane-test-output/activate!)]
-        :plugins [[lein-droid "0.2.0"]
-                  [cider/cider-nrepl "0.7.0"]]
-        :android {:sdk-path "/home/nicolas/tools/android/sdk"}}}
+        :plugins [[cider/cider-nrepl "0.8.2"]]}}


typo turning off "removedfile" event

typo turning off "removedfile" event

--- src/om_dropzone/core.cljs
+++ src/om_dropzone/core.cljs
@@ -99,7 +99,7 @@
     om/IWillUnmount
       (will-unmount [_]
         (doto (om/get-state owner :dropzone)
-          (.off"removedfile")
+          (.off "removedfile")
           (.destroy)))

     om/IDidMount


Fix timeline position on events

Fix timeline position on events

--- src/teach_by_friends/shared/components/timeline_and_table.cljs
+++ src/teach_by_friends/shared/components/timeline_and_table.cljs
@@ -7,7 +7,7 @@
 (def TIMELINE_LINES_COUNT 70)

 (defn update-positions [tPosition table-margin-top fullHeight visibleHeight event _]
-  (let [timeline-y (aget event "nativeEvent" "pageY")
+  (let [timeline-y (.. event -nativeEvent -locationY)
         y-ratio (/ timeline-y @visibleHeight)
         words-list-y-temp (* @fullHeight y-ratio)
         words-list-y (if (> words-list-y-temp (- @fullHeight @visibleHeight))
@@ -39,7 +39,8 @@
     (fn timeline-and-table-comp [{:keys [style render-row]}]
       [ui/view {:style style}
        [table-view {:ref        "wordsList"
-                    :on-layout  (fn [event _] (swap! visibleHeight (fn [_] (.. event -nativeEvent -layout -height))))
+                    :on-layout  (fn [event _] (swap! visibleHeight (fn [_] (.. event -nativeEvent -layout -height)))
+                                  (print (.. event -nativeEvent -layout -height)))
                     :on-scroll  update-timeline-position-compiled
                     :margin-top table-margin-top
                     :num-rows   (count chapter)


make even even even even more compatible with clojure 1.3

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

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -297,8 +297,8 @@
                         (doseq [data-set (find-data-sets location)]
                           ; (println "data-set:" data-set)
                           (.put pending-data-sets [data-set location]))
-                        (recur))))
-                  (catch Exception e nil))))
+                        (recur)))))
+                  (catch Exception e nil)))
           "data browser scanning thread") .start))


Add seq to treat empty suggestions as falsy.

--- src/re_com/typeahead.cljs
+++ src/re_com/typeahead.cljs
@@ -115,13 +115,13 @@
 (defn- activate-suggestion-next
   [{:as state :keys [suggestions suggestion-active-index]}]
   (cond-> state
-    suggestions
+    (seq suggestions)
     (activate-suggestion-by-index (-> suggestion-active-index (or -1) inc (wrap (count suggestions))))))

 (defn- activate-suggestion-prev
   [{:as state :keys [suggestions suggestion-active-index]}]
   (cond-> state
-    suggestions
+    (seq suggestions)
     (activate-suggestion-by-index (-> suggestion-active-index (or 0) dec (wrap (count suggestions))))))

 (defn- reset-typeahead


Add unit tests for collection deletion

Add unit tests for collection deletion

--- test/fcms/unit/resources/collection/collection_delete.clj
+++ test/fcms/unit/resources/collection/collection_delete.clj
@@ -0,0 +1,29 @@
+(ns fcms.unit.resources.collection.collection-delete
+  (:require [midje.sweet :refer :all]
+            [fcms.lib.resources :refer :all]
+            [fcms.lib.check :refer (about-now?)]
+            [fcms.resources.collection :refer :all]
+            [fcms.resources.common :as common]))
+
+;; ----- Tests -----
+
+(with-state-changes [(before :facts (do
+                                      (delete-collection c)
+                                      (create-collection c {:custom foo})))
+                      (after :facts (delete-collection c))]
+
+  (facts "about collection deletion failures"
+
+    (fact "when the specified collection doesn't exist"
+      (doseq [coll-slug (conj bad-strings "not-here")]
+        (delete-collection coll-slug) => :bad-collection)))
+
+  (facts "about deleting collections"
+
+    (fact "the collection can no longer be retrieved"
+      (delete-collection c)
+      (get-collection c) => nil)
+
+    (fact "the collection is no longer listed"
+      (delete-collection c)
+      (all-collections) => [])))


test fix

test fix

--- test/metabase/driver/generic_sql/query_processor_test.clj
+++ test/metabase/driver/generic_sql/query_processor_test.clj
@@ -4,6 +4,17 @@
             [metabase.driver.generic-sql.query-processor :refer :all]
             [metabase.test-data :refer [db-id table->id field->id]]
             metabase.test-setup))
+
+(def venues-columns
+  (delay ["ID" "CATEGORY_ID" "PRICE" "LONGITUDE" "LATITUDE" "NAME"]))
+
+(def venues-cols
+  (delay [{:special_type "id", :base_type "BigIntegerField", :description nil, :name "ID", :table_id (table->id :venues), :id (field->id :venues :id)}
+          {:special_type "fk", :base_type "IntegerField", :description nil, :name "CATEGORY_ID", :table_id (table->id :venues), :id (field->id :venues :category_id)}
+          {:special_type "category" :base_type "IntegerField", :description nil, :name "PRICE", :table_id (table->id :venues), :id (field->id :venues :price)}
+          {:special_type "longitude", :base_type "FloatField", :description nil, :name "LONGITUDE", :table_id (table->id :venues), :id (field->id :venues :longitude)}
+          {:special_type "latitude", :base_type "FloatField", :description nil, :name "LATITUDE", :table_id (table->id :venues), :id (field->id :venues :latitude)}
+          {:special_type nil, :base_type "TextField", :description nil, :name "NAME", :table_id (table->id :venues), :id (field->id :venues :name)}]))

 ;; ## "COUNT" AGGREGATION
 (expect {:status :completed
@@ -30,7 +41,7 @@
          :data {:rows [[203]]
                 :columns ["sum"]
                 :cols [{:base_type "IntegerField"
-                        :special_type nil
+                        :special_type "category"
                         :name "sum"
                         :id nil
                         :table_id nil
@@ -118,13 +129,8 @@
                  [8 11 2 -118.342 34.1015 "25°"]
                  [9 71 1 -118.301 34.1018 "Krua Siri"]
                  [10 20 2 -118.292 34.1046 "Fred 62"]],
-          :columns ["ID" "CATEGORY_ID" "PRICE" "LONGITUDE" "LATITUDE" "NAME"],
-          :cols [{:special_type "id", :base_type "BigIntegerField", :description nil, :name "ID", :table_id (table->id :venues), :id (field->id :venues :id)}
-                 {:special_type "fk", :base_type "IntegerField", :description nil, :name "CATEGORY_ID", :table_id (table->id :venues), :id (field->id :venues :category_id)}
-                 {:special_type nil, :base_type "IntegerField", :description nil, :name "PRICE", :table_id (table->id :venues), :id (field->id :venues :price)}
-                 {:special_type "longitude", :base_type "FloatField", :description nil, :name "LONGITUDE", :table_id (table->id :venues), :id (field->id :venues :longitude)}
-                 {:special_type "latitude", :base_type "FloatField", :description nil, :name "LATITUDE", :table_id (table->id :venues), :id (field->id :venues :latitude)}
-                 {:special_type nil, :base_type "TextField", :description nil, :name "NAME", :table_id (table->id :venues), :id (field->id :venues :name)}]}}
+          :columns @venues-columns
+          :cols @venues-cols}}
         (process-and-run {:type :query
                           :database @db-id
                           :query {:source_table (table->id :venues)
@@ -226,17 +232,6 @@

 ;; ## "FILTER" CLAUSE

-(def venues-columns
-  (delay ["ID" "CATEGORY_ID" "PRICE" "LONGITUDE" "LATITUDE" "NAME"]))
-
-(def venues-cols
-  (delay [{:special_type "id", :base_type "BigIntegerField", :description nil, :name "ID", :table_id (table->id :venues), :id (field->id :venues :id)}
-          {:special_type "fk", :base_type "IntegerField", :description nil, :name "CATEGORY_ID", :table_id (table->id :venues), :id (field->id :venues :category_id)}
-          {:special_type nil, :base_type "IntegerField", :description nil, :name "PRICE", :table_id (table->id :venues), :id (field->id :venues :price)}
-          {:special_type "longitude", :base_type "FloatField", :description nil, :name "LONGITUDE", :table_id (table->id :venues), :id (field->id :venues :longitude)}
-          {:special_type "latitude", :base_type "FloatField", :description nil, :name "LATITUDE", :table_id (table->id :venues), :id (field->id :venues :latitude)}
-          {:special_type nil, :base_type "TextField", :description nil, :name "NAME", :table_id (table->id :venues), :id (field->id :venues :name)}]))
-
 ;; ### FILTER -- "AND", ">", ">="
 (expect {:status :completed,
          :row_count 5,
@@ -320,8 +315,8 @@
 ;; ### FILTER -- "INSIDE"
 ;; TODO - add "NEAR"
 (expect
-  {:status :completed,
-   :row_count 1,
+  {:status :completed
+   :row_count 1
    :data {:rows [[1 4 3 -165.374 10.0646 "Red Medicine"]]
           :columns @venues-columns
           :cols @venues-cols}}


CMR-2118 Cleans up :require statement.

CMR-2118 Cleans up :require statement.

--- ingest-app/src/cmr/ingest/services/business_rule_validation.clj
+++ ingest-app/src/cmr/ingest/services/business_rule_validation.clj
@@ -3,7 +3,6 @@
   (:require [clj-time.core :as t]
             [cmr.common.time-keeper :as tk]
             [cmr.common.date-time-parser :as p]
-            [cmr.common.mime-types :as mt]
             [cmr.transmit.metadata-db :as mdb]
             [cmr.transmit.search :as search]
             [cmr.ingest.services.helper :as h]


GAWB-80: Include timestamp in error viewer component

--- src/cljs/org/broadinstitute/firecloud_ui/common/components.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/components.cljs
@@ -235,8 +235,8 @@
   {:render
    (fn [{:keys [props]}]
      (when-let [error (:error props)]
-       (let [[source status-code code causes stack-trace message]
-             (map error ["source" "statusCode" "code" "causes" "stackTrace" "message"])
+       (let [[source timestamp status-code code causes stack-trace message]
+             (map error ["source" "timestamp" "statusCode" "code" "causes" "stackTrace" "message"])
              ;; method redact is responding with "code" for 401.  TODO: standardize and remove this extra logic
              status-code (or status-code code)]
          (if-let [expected-msg (get-in props [:expect status-code])]
@@ -251,6 +251,7 @@
               (icons/font-icon {:style {:color (:exception-red style/colors)}}
                 :status-warning-triangle)]
              (str "Error " status-code ": " message)]
+            (when timestamp [:div {} "Occurred: " (-> timestamp js/moment (.format "LLL Z"))])
             (when source [:div {} "Source: " source])
             (when (seq causes)
               [:div {}


[Add] test sigmoid

[Add] test sigmoid

--- test/clj_elm/core_test.clj
+++ test/clj_elm/core_test.clj
@@ -40,7 +40,9 @@

 (facts "test-standard-sigmoid"
   (fact "(standard-sigmoid x)"
-    (standard-sigmoid 0) => 0.5))
+    (standard-sigmoid 0) => 0.5
+    (filter #(> % 1.0) (map standard-sigmoid (take 10 (repeatedly #(rand 100)))))
+    => []))

 (fact "test-a-hidden-layer-output"
   (fact "(a-hidden-layer-output as_i b_i xs)"


improved error handling

improved error handling

--- src/clj/game/main.clj
+++ src/clj/game/main.clj
@@ -60,8 +60,10 @@
           (.send socket (generate-string (assoc @(@game-states gameid) :action action)))
           (.send socket (generate-string "ok")))
         (catch Exception e
-          (println "Error in Thread " action command (get-in args [:card :title]) e)
-          (.send socket (generate-string (assoc @(@game-states gameid) :action action))))))))
+          (println "Error " action command (get-in args [:card :title]) e)
+          (if (and (= action "do") state)
+            (.send socket (generate-string state))
+            (.send socket (generate-string "error"))))))))

 (defn dev []
   (println "[Dev] Listening on port 1043 for incoming commands...")


More conversation update test refactoring, and some simple moderation sanity check tests

--- test/conversation_test.clj
+++ test/conversation_test.clj
@@ -16,7 +16,20 @@
                      {:created 700 :pid :a, :tid :y, :vote 1}]
       several-votes (concat single-vote wonky-votes)
       full-votes    (for [pid [:a :b :c] tid [:x :y :z]]
-                     {:created 100 :pid pid :tid tid :vote (rand)})]
+                     {:created 100 :pid pid :tid tid :vote (rand)})
+
+      big-conv {:rating-mat
+                  (named-matrix
+                    [:p1 :p2 :p3 :p4 :p5]
+                    [:c1 :c2 :c3 :c4]
+                    [[ 0  1  0 -1  1]
+                     [-1  0 -1 -1  0]
+                     [ 1  0  1  0  1]
+                     [ 1 -1  0 -1  0]
+                     [-1 -1  0  1  0]])
+                :pca {:center [0.0 -0.2 -0.0  0.4] ;actually calculated this...
+                      :comps [[0.4  0.2 -0.3  0.7] ;this is faked...
+                              [0.1 -0.5  0.2  0.2]]}}]

   (deftest init-conv-update-test
     (testing "empty matrix and one vote"
@@ -44,34 +57,29 @@
       (is (conv-update small-conv wonky-votes))))

   ; Test that iterating on previous pca/clustering results makes sense
-  (deftest small-conv-iterative-test
-    (let [fleshed-conv (conv-update small-conv single-vote)]
+  (let [fleshed-conv (conv-update small-conv single-vote)]
+    (deftest small-conv-iterative-test
       (testing "fleshed conv and full matrix"
         (is (conv-update fleshed-conv full-votes)))
       (testing "fleshed conv and wonky vote"
-        (is (conv-update fleshed-conv [{:created 999 :pid :j :tid :k :vote -1}]))))))
+        (is (conv-update fleshed-conv [{:created 999 :pid :j :tid :k :vote -1}]))))
+
+    (deftest moderation-test
+      (testing "from scratch with fleshed out conv"
+        (is (:mod-out (mod-update fleshed-conv [{:tid :x}]))))
+      (testing "based on previous moderations"
+        (is (= (:mod-out (mod-update (assoc big-conv :mod-out [:x])
+                                     [{:tid :y}]))
+               (set [:x :y]))))))
+
+  (deftest large-conv-update-test
+      (testing "should work with votes for only existing ptpts/cmts"
+        (is (large-conv-update {:conv big-conv :opts {}
+                                :votes [{:created 100 :pid :p1 :tid :c1 :vote  1}
+                                        {:created 200 :pid :p3 :tid :c3 :vote -1}]})))
+      (testing "should work with votes for new cmts"
+        (is (large-conv-update {:conv big-conv :opts {}
+                                :votes [{:created 100 :pid :p3 :tid :c5 :vote  1}
+                                        {:created 200 :pid :p5 :tid :c5 :vote -1}]})))))

-(deftest large-conv-update-test
-  (let [data (named-matrix
-               [:p1 :p2 :p3 :p4 :p5]
-               [:c1 :c2 :c3 :c4]
-               [[ 0  1  0 -1  1]
-                [-1  0 -1 -1  0]
-                [ 1  0  1  0  1]
-                [ 1 -1  0 -1  0]
-                [-1 -1  0  1  0]])
-        conv {:rating-mat data
-              :pca {:center [0.0 -0.2 -0.0  0.4] ;actually calculated this...
-                    :comps [[0.4  0.2 -0.3  0.7] ;this is faked...
-                            [0.1 -0.5  0.2  0.2]]}}]
-    (testing "should work with votes for only existing ptpts/cmts"
-      (is (large-conv-update {:conv conv :opts {}
-                              :votes [{:created 100 :pid :p1 :tid :c1 :vote  1}
-                                      {:created 200 :pid :p3 :tid :c3 :vote -1}]})))
-    (testing "should work with votes for new cmts"
-      (is (large-conv-update {:conv conv :opts {}
-                              :votes [{:created 100 :pid :p3 :tid :c5 :vote  1}
-                                      {:created 200 :pid :p5 :tid :c5 :vote -1}]})))))
-
-


Avoid effects of cljs.main temp dir

Avoid effects of cljs.main temp dir

--- Clojure/src/ambly/core.clj
+++ Clojure/src/ambly/core.clj
@@ -533,8 +533,7 @@
           (let [core-js (closure/compile core
                           (assoc opts
                             :output-dir webdav-mount-point
-                            :output-file
-                            (closure/src-file->target-file core)))
+                            :output-file (io/file "cljs" "core.js")))
                 deps (closure/add-dependencies opts core-js)]
             ;; output unoptimized code and the deps file
             ;; for all compiled namespaces


Bump ndvi def above the rain def since rain depends on ndvi.


Fix sample config to reflect new recipes API

--- satellite-master/config/riemann-config.clj
+++ satellite-master/config/riemann-config.clj
@@ -24,26 +24,30 @@
  indx
  (where (service #"satellite.*")
         prn)
-
- ;; if we stop receiving a test from a host, remove
- ;; that host from the whitelist
  (where (service #"mesos/slave.*")
         prn
+        ;; if a host/service pair changes state, update global state
+        (changed-state
+         (where (state "ok")
+                delete-event
+                (else
+                 persist-event)))
+        ;; If we stop receiving any test from a host, remove that host
+        ;; from the whitelist. We don't want to send tasks to a host
+        ;; that is (a) experiencing a network partition or (b) whose
+        ;; tests are timing-out. If it is (c) that the satellite-slave
+        ;; process is down, this at least warrants investigation.
         (where* expired?
-                #(off-host (:host %))
+                (fn [event]
+                  (warn "Removing host due to expired event" (:host event))
+                  (off-host (:host event)))
+                ;; Otherwise make sure all tests pass on each host
                 (else
-                 (ensure-all-tests-on-whitelisted-host-pass))))
+                 (coalesce 60
+                           ensure-all-tests-pass))))

  ;; if less than 70% of hosts registered with mesos are
  ;; on the whitelist, alert with an email
  (where (and (service #"mesos/prop-available-hosts")
              (< metric 0.7))
-        (email "foo@example.com"))
-
- ;; if more than 10 hosts (net) have gone down in the last
- ;; five minutes, alert with an email
- (where (service #"satellite host count")
-        (coalesce (* 60 5)
-                  prn
-                  (where* (fn [es] (< (:metric (folds/sum es)) 10)
-                          (email "foo@example.com"))))))
+        (email "foo@example.com")))


CMR-3203 Additional logging

CMR-3203 Additional logging

--- search-app/src/cmr/search/services/humanizers_service.clj
+++ search-app/src/cmr/search/services/humanizers_service.clj
@@ -86,20 +86,20 @@
   [context n]
   (let [[t1 collection-batches] (u/time-execution
                                  (get-all-collections context n))
-        string-writer (StringWriter.)]
+        string-writer (StringWriter.)
+        idx-atom (atom 0)]
     (debug "get-all-collections:" t1
            "processing " (count collection-batches) " batches of size" n)
     (csv/write-csv string-writer [CSV_HEADER])
     (doseq [batch collection-batches]
-     (debug "processing batch of size " (count batch))
+     (debug "processing batch " (swap! idx-atom inc) " of size " (count batch))
      (let [[t2 humanized-rows] (u/time-execution
                                    (pmap (fn [coll]
                                            (->> coll
                                                 humanizer/umm-collection->umm-collection+humanizers
                                                 humanized-collection->reported-rows))
                                          batch))]
-       (debug "get humanized rows" t2
-              (count humanized-rows) " humanized rows")
+       (debug "get humanized rows" t2)
        (let [[t3 rows] (u/time-execution
                          (apply concat humanized-rows))]
           (debug "write " (count rows) "rows to csv")
@@ -109,4 +109,5 @@
                "get-all-collections:" t1
                "get humanized rows:" t2
                "concat humanized rows:" t3))))
+    (debug "Finished processing batches")
     (str string-writer)))


Minor change on tests.

Minor change on tests.

--- test/octet/tests/core.cljc
+++ test/octet/tests/core.cljc
@@ -78,6 +78,7 @@
      (let [buffer (buf/allocate 16 {:type :direct :impl :netty})]
        (t/is (.isDirect buffer))
        (t/is (instance? ByteBuf buffer)))))
+
 #?(:clj
    (t/deftest indexed-specs-write-with-offset
      (let [spec (buf/spec (buf/int32))


fix ns

fix ns

--- src/thinking/records.cljc
+++ src/thinking/records.cljc
@@ -1,4 +1,4 @@
-(ns thinking.objects)
+(ns thinking.records)

 ;; Cljc doesn't support traditional OOP programming; however at its
 ;; heart, OO foundations exist: Interfaces, Polymorphism, and light-weight 'records'


Tests: update for DynamoDB APIv2

Tests: update for DynamoDB APIv2

--- test/test_faraday/main.clj
+++ test/test_faraday/main.clj
@@ -2,7 +2,7 @@
   (:use     [clojure.test]
             [taoensso.faraday])
   (:require [taoensso.faraday :as far]) ; TODO
-  (:import com.amazonaws.services.dynamodb.model.ConditionalCheckFailedException))
+  (:import com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException))

 (def creds {:access-key (get (System/getenv) "AWS_DYNAMODB_ACCESS_KEY")
             :secret-key (get (System/getenv) "AWS_DYNAMODB_SECRET_KEY")})
@@ -32,21 +32,28 @@
 (deftest test-batch-simple
   (setup-table)

-  (let [result (batch-get-item cred table '("1" "2" "3" "4"))
-        consis (batch-get-item creds {
-                 table {
-                   :consistent true
-                   :keys ["1" "2" "3" "4"]}})
-        attrs  (batch-get-item creds {
-                 table {
-                   :consistent true
-                   :attrs [attr]
-                   :keys ["1" "2" "3" "4"]}})
-        items  (get-in result [:responses table :items])
-        item-1 (get-item creds table "1")
-        item-2 (get-item creds table "2")
-        item-3 (get-item creds table "3")
-        item-4 (get-item creds table "4")]
+  (let [result
+        (batch-get-item
+         creds {table {:key-name "test-id"
+                       :keys ["1" "2" "3" "4"]
+                       :consistent true}})
+        consis
+        (batch-get-item
+         creds {table {:key-name "test-id"
+                       :keys ["1" "2" "3" "4"]
+                       :consistent true}})
+        attrs
+        (batch-get-item
+         creds {table {:key-name "test-id"
+                       :keys ["1" "2" "3" "4"]
+                       :consistent true
+                       :attrs [attr]}})
+
+        items  (get-in result [:responses table])
+        item-1 (get-item creds table {id "1"})
+        item-2 (get-item creds table {id "2"})
+        item-3 (get-item creds table {id "3"})
+        item-4 (get-item creds table {id "4"})]

     (is (= "foo" (item-1 attr)) "batch-write-item :put failed")
     (is (= "bar" (item-2 attr)) "batch-write-item :put failed")
@@ -54,44 +61,48 @@
     (is (= "foobar" (item-4 attr)) "batch-write-item :put failed")

     (is (= true (some #(= (% attr) "foo") items)))
-    (is (= true (some #(= (% attr) "bar") (get-in consis [:responses table :items]))))
-    (is (= true (some #(= (% attr) "baz") (get-in attrs [:responses table :items]))))
+    (is (= true (some #(= (% attr) "bar") (get-in consis [:responses table]))))
+    (is (= true (some #(= (% attr) "baz") (get-in attrs [:responses table]))))
     (is (= true (some #(= (% attr) "foobar") items)))

     (batch-write-item creds
-      [:delete table {:hash-key "1"}]
-      [:delete table {:hash-key "2"}]
-      [:delete table {:hash-key "3"}]
-      [:delete table {:hash-key "4"}])
+      [:delete table {id "1"}]
+      [:delete table {id "2"}]
+      [:delete table {id "3"}]
+      [:delete table {id "4"}])

-    (is (= nil (get-item creds table "1")) "batch-write-item :delete failed")
-    (is (= nil (get-item creds table "2")) "batch-write-item :delete failed")
-    (is (= nil (get-item creds table "3")) "batch-write-item :delete failed")
-    (is (= nil (get-item creds table "4")) "batch-write-item :delete failed")))
+    (is (= nil (get-item creds table {id "1"})) "batch-write-item :delete failed")
+    (is (= nil (get-item creds table {id "2"})) "batch-write-item :delete failed")
+    (is (= nil (get-item creds table {id "3"})) "batch-write-item :delete failed")
+    (is (= nil (get-item creds table {id "4"})) "batch-write-item :delete failed")))

 (deftest conditional-put
-  (batch-write-item creds
-                    [:delete table {:hash-key "42"}]
-                    [:delete table {:hash-key "9"}]
-                    [:delete table {:hash-key "6"}]
-                    [:delete table {:hash-key "23"}])
-  (batch-write-item creds
-                    [:put table {id "42" attr "foo"}]
-                    [:put table {id "6" attr "foobar"}]
-                    [:put table {id "9" attr "foobaz"}])
+  (batch-write-item
+   creds
+   [:delete table {id "42"}]
+   [:delete table {id "9"}]
+   [:delete table {id "6"}]
+   [:delete table {id "23"}])

-  ;; Should update item 42 to have attr bar
+  (batch-write-item
+   creds
+   [:put table {id "42" attr "foo"}]
+   [:put table {id "6" attr "foobar"}]
+   [:put table {id "9" attr "foobaz"}])
+
+  ;; ;; Should update item 42 to have attr bar
   (put-item creds table {id "42" attr "bar"} :expected {attr "foo"})
-  (is (= "bar" ((get-item creds table "42") attr)))
+  (is (= "bar" ((get-item creds table {id "42"}) attr)))

   ;; Should fail to update item 6
-  (is (thrown? ConditionalCheckFailedException (put-item creds table {id "6" attr "baz"} :expected {id false})))
-  (is (not (= "baz" ((get-item creds table "6") attr))))
+  (is (thrown? ConditionalCheckFailedException
+               (put-item creds table {id "6" attr "baz"} :expected {id false})))
+  (is (not (= "baz" ((get-item creds table {id "6"}) attr))))

   ;; Should upate item 9 to have attr baz
   (put-item creds table {id "9" attr "baz"} :expected {attr "foobaz"})
-  (is (= "baz" ((get-item creds table "9") attr)))
+  (is (= "baz" ((get-item creds table {id "9"}) attr)))

   ;; Should add item 23
   (put-item creds table {id "23" attr "bar"} :expected {id false})
-  (is (not (= nil (get-item creds table "23")))))
+  (is (not (= nil (get-item creds table {id "23"})))))