CMR-3701: Saved granule_validation_test.clj

--- system-int-test/test/cmr/system_int_test/ingest/granule_validation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_validation_test.clj
@@ -1,23 +1,25 @@
 (ns cmr.system-int-test.ingest.granule-validation-test
   "CMR Ingest granule validation integration tests"
-  (:require [clojure.test :refer :all]
-            [cmr.system-int-test.utils.ingest-util :as ingest]
-            [cmr.system-int-test.data2.collection :as dc]
-            [cmr.system-int-test.data2.granule :as dg]
-            [cmr.system-int-test.data2.core :as d]
-            [cmr.umm.umm-spatial :as umm-s]
-            [cmr.umm.umm-granule :as umm-g]
-            [cmr.spatial.polygon :as poly]
-            [cmr.spatial.point :as p]
-            [cmr.spatial.line-string :as l]
-            [cmr.spatial.mbr :as m]
-            [cmr.system-int-test.utils.url-helper :as url]
-            [cmr.ingest.services.messages :as msg]
-            [cmr.system-int-test.utils.dev-system-util :as dev-sys-util]
-            [cmr.common.time-keeper :as tk]
-            [cmr.common.util :refer [are2]]
-            [clj-time.format :as tf]
-            [clj-time.core :as t]))
+  (:require
+    [clj-time.core :as t]
+    [clj-time.format :as tf ]
+    [clojure.test :refer :all]
+    [cmr.common.time-keeper :as tk]
+    [cmr.common.util :refer [are2]]
+    [cmr.ingest.services.messages :as msg]
+    [cmr.spatial.line-string :as l]
+    [cmr.spatial.mbr :as m]
+    [cmr.spatial.point :as p]
+    [cmr.spatial.polygon :as poly]
+    [cmr.system-int-test.data2.collection :as dc]
+    [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.utils.dev-system-util :as dev-sys-util]
+    [cmr.system-int-test.utils.ingest-util :as ingest]
+    [cmr.system-int-test.utils.url-helper :as url]
+    [cmr.umm.umm-granule :as umm-g]
+    [cmr.umm.umm-spatial :as umm-s]))

 (use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1" "provguid2" "PROV2"}))

@@ -26,9 +28,10 @@
     (dev-sys-util/reset)
     (ingest/create-provider {:provider-guid "provguid1" :provider-id "PROV1"}))

-  (d/ingest "PROV1" (dc/collection {:product-specific-attributes
-                                    [(dc/psa {:name "bool" :data-type :boolean :value true})
-                                     (dc/psa {:name "bool" :data-type :boolean :value true})]})))
+  (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection
+                      {:AdditionalAttributes
+                       [(data-umm-c/additional-attribute {:Name "bool" :DataType :boolean :value true})
+                        (data-umm-c/additional-attribute {:Name "bool" :DataType :boolean :Value true})]})))

@@ -56,18 +59,18 @@

     (testing "granule with end date slightly in the future and collection with
              EndsAtPresentFlag=true and end date in the far future (see CMR-1351)"
-             (let [collection (dc/collection {:entry-title "correct"
-                                              :short-name "S1"
-                                              :version-id "V1"
-                                              :temporal (dc/temporal
+             (let [collection (data-umm-c/collection {:EntryTitle "correct"
+                                              :ShortName "S1"
+                                              :Version "V1"
+                                              :TemporalExtents [(data-umm-c/temporal-extent
                                                           {:beginning-date-time "2009-03-08T00:00:00Z"
                                                            :ending-date-time "2121-11-04T00:00:00Z"
-                                                           :ends-at-present? true})})
-                   coll-concept (d/item->concept collection)
+                                                           :ends-at-present? true})]})
+                   coll-concept (d/umm-c-collection->concept collection)
                    future-date-time (t/plus (tk/now) (t/hours 1))
                    time-formatter (tf/formatters :date-time-no-ms)
                    future-date-time-str (tf/unparse time-formatter future-date-time)
-                   granule (assoc (dg/granule collection)
+                   granule (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                                   :temporal (dg/temporal {:beginning-date-time "2010-11-04T00:00:00Z"
                                                           :ending-date-time future-date-time-str}))]
                (assert-validation-success
@@ -75,30 +78,29 @@
                  coll-concept)))

     (testing "with collection as additional parameter"
-      (let [collection (dc/collection-dif {})
-            coll-concept (d/item->concept collection :echo10)]
+      (let [collection (data-umm-c/collection {})
+            coll-concept (d/umm-c-collection->concept collection :echo10)]
         (testing "success"
-          (let [concept (d/item->concept (dg/granule collection))]
+          (let [concept (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))]
             (assert-validation-success concept coll-concept)))
         (testing "collection in different format than granule"
-          (let [concept (d/item->concept (dg/granule collection))]
-            (assert-validation-success concept (d/item->concept collection :iso19115))
-            (assert-validation-success concept (d/item->concept collection :dif))))
+          (let [concept (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))]
+            (assert-validation-success concept (d/umm-c-collection->concept collection :iso19115))
+            (assert-validation-success concept (d/umm-c-collection->concept collection :dif))))

         (testing "invalid collection xml"
           (assert-validation-errors
             400
             [(msg/invalid-parent-collection-for-validation
                "Line 1 - cvc-elt.1: Cannot find the declaration of element 'Granule'.")]
-            (d/item->concept (dg/granule collection))
+            (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))
             (assoc coll-concept :metadata invalid-granule-xml)))

         (testing "invalid granule xml"
           (assert-validation-errors
             400
             expected-errors
-            (-> collection
-                dg/granule
+            (-> (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                 d/item->concept
                 (assoc :metadata invalid-granule-xml))
             coll-concept))
@@ -117,7 +119,7 @@
           (assert-validation-errors
             415
             ["Invalid content-type: application/xml. Valid content-types: application/echo10+xml, application/iso:smap+xml."]
-            (-> (d/item->concept (dg/granule collection))
+            (-> (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))
                 (assoc :format "application/xml"))
             coll-concept))

@@ -127,14 +129,14 @@
             [(msg/invalid-parent-collection-for-validation
                (str "Invalid content-type: application/xml. Valid content-types: "
                     "application/echo10+xml, application/vnd.nasa.cmr.umm+json, application/iso:smap+xml, application/iso19115+xml, application/dif+xml, application/dif10+xml."))]
-            (d/item->concept (dg/granule collection))
+            (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))
             (assoc coll-concept :format "application/xml")))

         (testing "granule collection ref does not match collection"
           (testing "entry-title"
-            (let [collection (dc/collection {:entry-title "correct"})
-                  coll-concept (d/item->concept collection :echo10)
-                  granule (assoc (dg/granule collection)
+            (let [collection (data-umm-c/collection {:EntryTitle "correct"})
+                  coll-concept (d/umm-c-collection->concept collection :echo10)
+                  granule (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                                  :collection-ref
                                  (umm-g/map->CollectionRef {:entry-title "wrong"}))]
               (assert-validation-errors
@@ -145,26 +147,26 @@
                 coll-concept)))

           (testing "entry-id"
-            (let [collection (dc/collection-dif {:short-name "correct"})
-                  coll-concept (d/item->concept collection :dif)
-                  granule (assoc (dg/granule collection)
+            (let [collection (data-umm-c/collection {:ShortName "correct"})
+                  coll-concept (d/umm-c-collection->concept collection :dif)
+                  granule (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                                  :collection-ref
                                  (umm-g/map->CollectionRef {:entry-id "wrong"}))]
               (assert-validation-errors
                 422
                 [{:path ["CollectionRef"],
-                  :errors ["Collection Reference Entry Id [wrong] does not match the Entry Id of the parent collection [correct]"]}]
+                  :errors ["Collection Reference Entry Id [wrong] does not match the Entry Id of the parent collection [correct_V1]"]}]
                 (d/item->concept granule)
                 coll-concept)))

-          (let [collection (dc/collection {:short-name "S1" :version-id "V1"})
-                coll-concept (d/item->concept collection :echo10)]
+          (let [collection (data-umm-c/collection {:ShortName "S1" :Version "V1"})
+                coll-concept (d/umm-c-collection->concept collection :echo10)]
             (testing "shortname"
               (assert-validation-errors
                 422
                 [{:path ["CollectionRef"],
                   :errors ["Collection Reference Short Name [S2] does not match the Short Name of the parent collection [S1]"]}]
-                (d/item->concept (assoc (dg/granule collection)
+                (d/item->concept (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                                         :collection-ref
                                         (umm-g/map->CollectionRef {:short-name "S2"
                                                                    :version-id "V1"})))
@@ -174,27 +176,30 @@
                 422
                 [{:path ["CollectionRef"],
                   :errors ["Collection Reference Version Id [V2] does not match the Version Id of the parent collection [V1]"]}]
-                (d/item->concept (assoc (dg/granule collection)
+                (d/item->concept (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                                         :collection-ref
                                         (umm-g/map->CollectionRef {:short-name "S1"
                                                                    :version-id "V2"})))
                 coll-concept)))

           (testing "granule collection-refs with all entry-title, short-name and version-id"
-            (let [collection-ref-attrs {:entry-title "correct"
+            (let [collection-attrs {:EntryTitle "correct"
+                                    :ShortName "S1"
+                                    :Version "V1"}
+                  collection-ref-attrs {:entry-title "correct"
                                         :short-name "S1"
                                         :version-id "V1"}
-                  collection (dc/collection collection-ref-attrs)
-                  coll-concept (d/item->concept collection :iso-smap)]
+                  collection (data-umm-c/collection collection-attrs)
+                  coll-concept (d/umm-c-collection->concept collection :iso-smap)]
               (testing "valid SMAP ISO granule"
-                (let [granule (assoc (dg/granule collection)
+                (let [granule (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                                      :collection-ref
                                      (umm-g/map->CollectionRef collection-ref-attrs))]
                   (assert-validation-success (d/item->concept granule :iso-smap)
                                              coll-concept)))
               (testing "invalid SMAP ISO granule"
                 (are [attrs errors]
-                     (let [granule (assoc (dg/granule collection)
+                     (let [granule (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                                           :collection-ref
                                           (umm-g/map->CollectionRef (merge collection-ref-attrs attrs)))]
                        (assert-validation-errors
@@ -218,11 +223,11 @@

           (testing "granule collection-refs missing field"
-            (let [collection (dc/collection {:entry-title "correct"
-                                             :short-name "S1"
-                                             :version-id "V1"})
-                  coll-concept (d/item->concept collection)
-                  granule (assoc (dg/granule collection)
+            (let [collection (data-umm-c/collection {:EntryTitle "correct"
+                                             :ShortName "S1"
+                                             :Version "V1"})
+                  coll-concept (d/umm-c-collection->concept collection)
+                  granule (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                                  :collection-ref
                                  (umm-g/map->CollectionRef {:entry-title nil
                                                             :short-name nil
@@ -235,19 +240,18 @@
                 coll-concept))))))

     (testing "with ingested collection"
-      (let [collection (d/ingest "PROV1" (dc/collection {}))]
+      (let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {}))]
         (testing "successful validation of granule"
-          (let [granule-concept (d/item->concept (dg/granule collection))]
+          (let [granule-concept (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))]
             (assert-validation-success granule-concept)

             (testing "with ingested parent collection"
-              (assert-validation-success granule-concept (d/item->concept collection)))))
+              (assert-validation-success granule-concept (d/umm-c-collection->concept collection)))))
         (testing "invalid granule xml"
           (assert-validation-errors
             400
             expected-errors
-            (-> collection
-                dg/granule
+            (-> (dg/granule-with-umm-spec-collection collection (:concept-id collection))
                 d/item->concept
                 (assoc :metadata invalid-granule-xml))))))))

@@ -261,9 +265,9 @@
    (assert-invalid coll-attributes gran-attributes field-path errors :echo10))
   ([coll-attributes gran-attributes field-path errors metadata-format]
    (testing "through validation api"
-     (let [coll (dc/collection coll-attributes)
-           coll-concept (d/item->concept coll metadata-format)
-           granule (dg/granule coll gran-attributes)
+     (let [coll (data-umm-c/collection coll-attributes)
+           coll-concept (d/umm-c-collection->concept coll metadata-format)
+           granule (dg/granule-with-umm-spec-collection coll (:concept-id coll) gran-attributes)
            gran-concept (d/item->concept granule)
            response (ingest/validate-granule gran-concept coll-concept)]
        (is (= {:status 422
@@ -272,9 +276,9 @@
               (select-keys response [:status :errors])))))

    (testing "through ingest API"
-     (let [coll (d/ingest "PROV1" (dc/collection coll-attributes) {:format metadata-format})
-           response (d/ingest "PROV1" (dg/granule coll gran-attributes) {:format metadata-format
-                                                                         :allow-failure? true})]
+     (let [coll (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection coll-attributes) {:format metadata-format})
+           response (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll (:concept-id coll) gran-attributes)
+                                      {:format metadata-format :allow-failure? true})]
        (is (= {:status 422
                :errors [{:path field-path
                          :errors errors}]}
@@ -283,9 +287,9 @@
 (defn assert-valid
   [coll-attributes gran-attributes]
   (testing "through validation api"
-    (let [coll (dc/collection coll-attributes)
-          coll-concept (d/item->concept coll)
-          granule (dg/granule coll gran-attributes)
+    (let [coll (data-umm-c/collection coll-attributes)
+          coll-concept (d/umm-c-collection->concept coll)
+          granule (dg/granule-with-umm-spec-collection coll (:concept-id coll) gran-attributes)
           gran-concept (d/item->concept granule)
           response (ingest/validate-granule gran-concept coll-concept)]
       (is (= {:status 200}
@@ -293,31 +297,31 @@

   (testing "through ingest API"
     (let [provider-id (get gran-attributes :provider-id "PROV1")
-          coll (d/ingest provider-id (dc/collection coll-attributes))
-          response (d/ingest provider-id (dg/granule coll gran-attributes))]
+          coll (d/ingest-umm-spec-collection provider-id (data-umm-c/collection coll-attributes))
+          response (d/ingest provider-id (dg/granule-with-umm-spec-collection coll (:concept-id coll) gran-attributes))]
       (is (#{{:status 201} {:status 200}} (select-keys response [:status :errors]))))))

 (defn assert-invalid-spatial
-  ([coord-sys shapes errors]
-   (assert-invalid-spatial coord-sys shapes errors :echo10))
-  ([coord-sys shapes errors metadata-format]
+  ([coord-sys umm-c-coord-sys shapes errors]
+   (assert-invalid-spatial coord-sys umm-c-coord-sys shapes errors :echo10))
+  ([coord-sys umm-c-coord-sys shapes errors metadata-format]
    (let [shapes (map (partial umm-s/set-coordinate-system coord-sys) shapes)]
-     (assert-invalid {:spatial-coverage (dc/spatial {:gsr coord-sys})}
+     (assert-invalid {:SpatialExtent (data-umm-c/spatial {:gsr umm-c-coord-sys})}
                      {:spatial-coverage (apply dg/spatial shapes)}
                      ["SpatialCoverage" "Geometries" 0]
                      errors
                      metadata-format))))

 (defn assert-valid-spatial
-  [coord-sys shapes]
+  [coord-sys umm-c-coord-sys shapes]
   (let [shapes (map (partial umm-s/set-coordinate-system coord-sys) shapes)]
-    (assert-valid {:spatial-coverage (dc/spatial {:gsr coord-sys})}
+    (assert-valid {:SpatialExtent (data-umm-c/spatial {:gsr umm-c-coord-sys})}
                   {:spatial-coverage (apply dg/spatial shapes)})))

 (defn assert-conflict
   [gran-attributes errors]
-  (let [collection (d/ingest "PROV1" (dc/collection))
-        response (d/ingest "PROV1" (dg/granule collection gran-attributes) {:allow-failure? true})]
+  (let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection))
+        response (d/ingest "PROV1" (dg/granule-with-umm-spec-collection collection (:concept-id collection) gran-attributes) {:allow-failure? true})]
     (is (= {:status 409
             :errors errors}
            (select-keys response [:status :errors])))))
@@ -330,7 +334,8 @@
     (testing "geodetic polygon"
       ;; Invalid points are caught in the schema validation
       (assert-invalid-spatial
-        :geodetic
+        :geodetic
+        "GEODETIC"
         [(polygon 180 90, -180 90, -180 -90, 180 -90, 180 90)]
         ["Spatial validation error: The shape contained duplicate points. Points 1 [lon=180 lat=90] and 2 [lon=-180 lat=90] were considered equivalent or very close."
          "Spatial validation error: The shape contained duplicate points. Points 3 [lon=-180 lat=-90] and 4 [lon=180 lat=-90] were considered equivalent or very close."
@@ -341,17 +346,19 @@
       ;; Holes are ignored during validation for now.
       (assert-valid-spatial
         :geodetic
+        "GEODETIC"
         [(poly/polygon [(umm-s/ords->ring 1 1, -1 1, -1 -1, 1 -1, 1 1)
                         (umm-s/ords->ring 0,0, 0.00004,0, 0.00006,0.00005, 0.00002,0.00005, 0,0)])]))
     (testing "cartesian polygon"
       ;; The same shape from geodetic is valid as a cartesian.
       ;; Cartesian validation is not supported yet. See CMR-1172
-      (assert-valid-spatial :cartesian
+      (assert-valid-spatial :cartesian "CARTESIAN"
                             [(polygon 180 90, -180 90, -180 -90, 180 -90, 180 90)]))

     (testing "geodetic line"
       (assert-invalid-spatial
         :geodetic
+        "GEODETIC"
         [(l/ords->line-string :geodetic [0,0,1,1,2,2,1,1])]
         ["Spatial validation error: The shape contained duplicate points. Points 2 [lon=1 lat=1] and 4 [lon=1 lat=1] were considered equivalent or very close."]))

@@ -359,11 +366,13 @@
       ;; Cartesian line validation isn't supported yet. See CMR-1172
       (assert-valid-spatial
         :cartesian
+        "CARTESIAN"
         [(l/ords->line-string :cartesian [180 0, -180 0])]))

     (testing "bounding box"
       (assert-invalid-spatial
         :geodetic
+        "GEODETIC"
         [(m/mbr -180 45 180 46)]
         ["Spatial validation error: The bounding rectangle north value [45] was less than the south value [46]"]))))

@@ -371,7 +380,7 @@
   (testing "granule with spatial but parent collection does not"
     (are2 [coll-gsr]
           (assert-invalid
-            {:spatial-coverage (when coll-gsr (dc/spatial {:gsr coll-gsr}))}
+            {:SpatialExtent (when coll-gsr (data-umm-c/spatial {:gsr coll-gsr}))}
             {:spatial-coverage
              (dg/spatial
                (umm-s/set-coordinate-system
@@ -382,14 +391,16 @@
             ["SpatialCoverage" "Geometries"]
             ["[Geometries] cannot be set when the parent collection's GranuleSpatialRepresentation is NO_SPATIAL"])

-          "parent collection has no spatial info"
-          nil
+         ;; in umm-spec the default GranuleSpatialRepresentation is "CARTESIAN" not "NO_SPATIAL"
+         ;; so the following test doesn't work anymore.
+         ;; "parent collection has no spatial info"
+         ;; nil

           "parent collection GranuleSpatialRepresentation is NO_SPATIAL"
           "NO_SPATIAL")))

 (deftest missing-spatial-coverage-test
-  (let [collection-attrs {:spatial-coverage {:granule-spatial-representation :geodetic}}
+  (let [collection-attrs {:SpatialExtent (data-umm-c/spatial {:gsr "GEODETIC"})}
         granule-attrs {:format "application/echo10+xml; charset=utf-8"}]
     (assert-invalid collection-attrs
                     granule-attrs


Hack to reconnect on each handler.

Hack to reconnect on each handler.

Seems the connection dies sometimes and causes blocking behaviour.

--- src/uuuurrrrllll/core.clj
+++ src/uuuurrrrllll/core.clj
@@ -42,6 +42,7 @@
     [k (map :url v)]))

 (defn get-all-entries []
+  (wc/connect!)
   (let [keys (wb/keys-in bucket)]
     (->> "all"
          (kv/index-query bucket :all)
@@ -50,6 +51,7 @@
          (merge-urls))))

 (defn handle-post [request]
+  (wc/connect!)
   (let [body    (:body request)
         url     (body "url")
         channel (body "channel")
@@ -62,6 +64,7 @@
       {:status 400})))

 (defn handle-get [request]
+  (wc/connect!)
   (if-let [url (-> request
                    (get-in [:params :url])
                    (get-entry)
@@ -70,6 +73,7 @@
     {:status 404}))

 (defn list-all [request]
+  (wc/connect!)
   {:status 200
    :body (html [:body
                 [:ul


Disallow spaces in method configuration names

--- src/cljs/main/broadfcui/page/workspace/method_configs/method_config_editor.cljs
+++ src/cljs/main/broadfcui/page/workspace/method_configs/method_config_editor.cljs
@@ -200,9 +200,12 @@
         (create-section-header "Method Configuration Name")
         (create-section
          (if editing?
-           (style/create-text-field {:ref "confname" :style {:maxWidth 500}
-                                     :data-test-id "edit-method-config-name-input"
-                                     :defaultValue (:name config)})
+           [:div {}
+            (style/create-text-field {:ref "confname" :style {:width 500}
+                                      :data-test-id "edit-method-config-name-input"
+                                      :defaultValue (:name config)
+                                      :onKeyDown (common/create-key-handler [:space] #(.preventDefault %))})
+            (style/create-textfield-hint "foo")]
            [:div {:style {:padding "0.5em 0 1em 0"}
                   :data-test-id "method-config-name"} (:name config)]))
         (create-section-header "Referenced Method")


Add streaming timeout to test instance watches (#1392)

* add streaming timeout to watch due to slow integration tests taking over 20 seconds

* more reasonable streaming timeout to 120 seconds

--- waiter/integration/waiter/instance_tracker_integration_test.clj
+++ waiter/integration/waiter/instance_tracker_integration_test.clj
@@ -89,7 +89,8 @@
                     (is (t/before? start-time (du/str-to-date last-error-time)))))))))))))

 (defn- start-watch
-  [router-url cookies & {:keys [query-params] :or {query-params {"watch" "true"}}}]
+  [router-url cookies & {:keys [query-params] :or {query-params {"streaming-timeout" "120000"
+                                                                 "watch" "true"}}}]
   (let [{:keys [body error headers] :as response}
         (make-request router-url "/apps/instances" :async? true :cookies cookies :query-params query-params)
         _ (assert-response-status response 200)


Remove web server start in init since it is now an adapter

--- src/yetibot/core/init.clj
+++ src/yetibot/core/init.clj
@@ -44,7 +44,6 @@
 (defn -main [& args]
   (do
     (welcome-message!)
-    (web/start-web-server)
     (start-nrepl!)
     (db/start)
     (logging/start)


Improve initialization logging around starting chat adapters

--- src/yetibot/core/init.clj
+++ src/yetibot/core/init.clj
@@ -1,8 +1,9 @@
 (ns yetibot.core.init
   (:require
+    [clojure.stacktrace :refer [print-stack-trace]]
     [yetibot.core.config :as config]
     [yetibot.core.db :as db]
-    [taoensso.timbre :refer [warn]]
+    [taoensso.timbre :refer [info warn]]
     [yetibot.core.logging :as log]
     [yetibot.core.loader :refer [load-commands-and-observers]]
     [yetibot.core.handler :refer [handle-unparsed-expr]]
@@ -16,9 +17,10 @@

 (defn report-ex [f n]
   (future (try
+            (info "Trying to start adapter" n)
             (f)
             (catch Exception e
-              (warn "Error starting adapter" n e)))))
+              (warn "Error starting adapter" n (with-out-str (print-stack-trace e)))))))

 (defn -main [& args]
   (welcome-message)


Removed unnecessary special case for SMAP ISO granule.

--- system-int-test/src/cmr/system_int_test/data2/granule.clj
+++ system-int-test/src/cmr/system_int_test/data2/granule.clj
@@ -114,11 +114,7 @@
   ([collection attribs]
    (let [timestamps {:data-provider-timestamps (dc/data-provider-timestamps attribs)}
          {:keys [format-key entry-title short-name version-id]} collection
-         ;; Here we infer the granule format based on collection format
-         ;; Added the special case for SMAP ISO granule to cover CMR-956.
-         coll-ref (if (= :iso-smap format-key)
-                    (g/collection-ref entry-title short-name version-id)
-                    (g/collection-ref entry-title))
+         coll-ref (g/collection-ref entry-title short-name version-id)
          minimal-gran {:granule-ur (d/unique-str "ur")
                        :collection-ref coll-ref
                        ;; Including the parent collection concept id so it's available later.


Fix for type-type|pattern2 such that the pattern passed to type-type|pattern at the end always really is a string

--- damp.ekeko.aspectj.plugin/src/damp/ekeko/aspectj/annotations.clj
+++ damp.ekeko.aspectj.plugin/src/damp/ekeko/aspectj/annotations.clj
@@ -151,6 +151,6 @@
  (l/all (v+ ?pattern)
         (type-type|pattern ?type ?pattern)
         (fails
-          (l/all
+          (l/project [?pattern]
             (l/!= ?pattern (clojure.string/replace ?pattern #"\+" ""))
             (type-type|pattern ?type (clojure.string/replace ?pattern #"\+" ""))))))


[clojure][image] add draw-bounding-box interop (#14533)

* [clojure][image] add draw-bounding-box interop

* [clojure][image] add more specs and type conversion

--- contrib/clojure-package/src/org/apache/clojure_mxnet/image.clj
+++ contrib/clojure-package/src/org/apache/clojure_mxnet/image.clj
@@ -23,6 +23,7 @@
             [org.apache.clojure-mxnet.util :as util]
             [clojure.spec.alpha :as s])
   (:import (org.apache.mxnet Image NDArray)
+           (java.awt.image BufferedImage)
            (java.io InputStream)))

 ;; Flags for conversion of images
@@ -199,3 +200,68 @@
   [input]
   (util/validate! ::to-image-ndarray input "Invalid input array")
   (Image/toImage input))
+
+(s/def ::buffered-image #(instance? BufferedImage %))
+(s/def ::xmin integer?)
+(s/def ::xmax integer?)
+(s/def ::ymin integer?)
+(s/def ::ymax integer?)
+(s/def ::coordinate (s/keys :req-un [::xmin ::xmax ::ymin ::ymax]))
+(s/def ::coordinates (s/coll-of ::coordinate))
+(s/def ::names (s/nilable (s/coll-of string?)))
+(s/def ::stroke (s/and integer? pos?))
+(s/def ::font-size-mult (s/and float? pos?))
+(s/def ::transparency (s/and float? #(<= 0.0 % 1.0)))
+(s/def ::coordinates-names
+  (fn [[coordinates names]] (= (count coordinates) (count names))))
+
+(defn- convert-coordinate
+  "Convert bounding box coordinate to Scala correct types."
+  [{:keys [xmin xmax ymin ymax]}]
+  {:xmin (int xmin)
+   :xmax (int xmax)
+   :ymin (int ymin)
+   :ymax (int ymax)})
+
+(defn draw-bounding-box!
+  "Draw bounding boxes on `buffered-image` and Mutate the input image.
+  `buffered-image`: BufferedImage
+  `coordinates`: collection of {:xmin int :xmax int :ymin int :ymax int}
+  `font-size-mult`: positive float - Font size multiplier
+  `names`: collection of strings - List of names for the bounding boxes
+  `stroke`: positive integer - thickness of the bounding box
+  `transparency`: float in (0.0, 1.0) - Transparency of the bounding box
+  returns: Modified `buffered-image`
+  Ex:
+    (draw-bounding-box! img [{:xmin 0 :xmax 100 :ymin 0 :ymax 100}])
+    (draw-bounding-box! [{:xmin 190 :xmax 850 :ymin 50 :ymax 450}
+                         {:xmin 200 :xmax 350 :ymin 440 :ymax 530}]
+                        {:stroke 2
+                         :names [\"pug\" \"cookie\"]
+                         :transparency 0.8
+                         :font-size-mult 2.0})"
+  ([buffered-image coordinates]
+   (draw-bounding-box! buffered-image coordinates {}))
+  ([buffered-image coordinates
+    {:keys [names stroke font-size-mult transparency]
+     :or {stroke 3 font-size-mult 1.0 transparency 1.0}
+     :as opts}]
+  (util/validate! ::buffered-image buffered-image "Invalid input image")
+  (util/validate! ::coordinates coordinates "Invalid input coordinates")
+  (util/validate! ::names names "Invalid input names")
+  (util/validate! ::stroke stroke "Invalid input stroke")
+  (util/validate! ::font-size-mult font-size-mult "Invalid input font-size-mult")
+  (util/validate! ::transparency transparency "Invalid input transparency")
+  (when (pos? (count names))
+    (util/validate!  ::coordinates-names [coordinates names] "Invalid number of names"))
+  (Image/drawBoundingBox
+    buffered-image
+    (->> coordinates
+         (map convert-coordinate)
+         (map util/convert-map)
+         (into-array))
+    (util/->option (into-array names))
+    (util/->option (int stroke))
+    (util/->option (float font-size-mult))
+    (util/->option (float transparency)))
+  buffered-image))


[CIRCLE-2649] Cleaning up debug statements for amplitude session-id (#1673)

* Cleaning up debug statements for session-id

* Add expiry delay for cookie to work around idle user edge case

--- src-cljs/frontend/analytics/amplitude.cljs
+++ src-cljs/frontend/analytics/amplitude.cljs
@@ -3,6 +3,8 @@
             [frontend.utils :as utils :refer-macros [swallow-errors]]))

 (def session-cookie-name "amplitude-session-id")
+
+(def session-expiry-delay (* 30 60))

 (defn session-id []
   (swallow-errors
@@ -12,13 +14,7 @@
   "Cookies the user with their amplitude session-id. Set the cookie
   path to be root so that it is available anywhere under the circleci domain.

-  Set the opt_maxAge to -1 as it is a session cookie:
-    https://google.github.io/closure-library/api/goog.net.Cookies.html"
+  Using an expiry delay of 30 minutes to mimic Amplitude's default session length:
+  https://amplitude.zendesk.com/hc/en-us/articles/231275508-Amplitude-2-0-User-Sessions"
   []
-  (let [sid (session-id)]
-    (println "setting cookie with sid" sid)
-    (cookies/set session-cookie-name sid -1 "/")
-    (println "set" (cookies/get session-cookie-name))
-    (when (not (cookies/get session-cookie-name))
-      (println js/amplitude)
-      (println js/window.amplitude))))
+  (cookies/set session-cookie-name (session-id) session-expiry-delay "/"))


lose another inconsistant test

lose another inconsistant test

--- dada-core/src/test/clojure/org/dada/core/test_clojure.clj
+++ dada-core/src/test/clojure/org/dada/core/test_clojure.clj
@@ -59,9 +59,9 @@

 ;; doseq nearly twice as fast

-(if (not (ibm?))
-  (deftest doseq-vs-dorun-map
-    (is (faster 1 (doseq [n (range 10000000)] (identity n)) (dorun (map identity (range 10000000)))))))
+;; (if (not (ibm?))
+;;   (deftest doseq-vs-dorun-map
+;;     (is (faster 1 (doseq [n (range 10000000)] (identity n)) (dorun (map identity (range 10000000)))))))

 ;; seems to be true - but so close I can't rely on it not to fail build


another test that behaves differentlt on IBM Java6

--- dada-core/src/test/clojure/org/dada/core/test_clojure.clj
+++ dada-core/src/test/clojure/org/dada/core/test_clojure.clj
@@ -21,9 +21,17 @@

 (defrecord Value [v])

-(deftest test-get
-  (if (not (.contains (.toLowerCase (System/getProperty "java.vm.vendor")) "ibm")) ;TODO - this assumption does not hold true on IBM - maybe we should generate code accordingly ?
-    (let [^Value v (Value. 0)] (is (faster 100000000 (.v v)(:v v))))))
+(if (not (.contains (.toLowerCase (System/getProperty "java.vm.vendor")) "ibm")) ;TODO - these assumptions do not hold true on IBM - maybe we should generate code accordingly ?
+
+  (deftest test-get
+    (let [^Value v (Value. 0)] (is (faster 100000000 (.v v)(:v v)))))
+
+  (deftest int-arithmetic
+    (is (faster 10000000
+		((fn [^Integer lhs ^Integer rhs](< (int lhs)(int rhs))) 1 2)
+		((fn [^Integer lhs ^Integer rhs](< lhs rhs)) 1 2)))) ;; on IBM Java6 - this approach seems [very] slightly faster
+
+  )

 (import java.lang.reflect.Constructor)
 (deftest test-construction
@@ -38,7 +46,3 @@
 	^String p ""]
     (faster 100000000 (.v r)(.length p))))

-(deftest int-arithmetic
-  (is (faster 10000000
-	      ((fn [^Integer lhs ^Integer rhs](< (int lhs)(int rhs))) 1 2)
-	      ((fn [^Integer lhs ^Integer rhs](< lhs rhs)) 1 2))))


we seem to  right and left handed joins going - although I haven't yet made my mind up about how they will be stored, so the test does not yet check them

--- dada2-core/src/test/clojure/org/dada2/test_join_model.clj
+++ dada2-core/src/test/clojure/org/dada2/test_join_model.clj
@@ -21,6 +21,24 @@
 ;;--------------------------------------------------------------------------------
 ;; impl

+;;; calculate all permutations for a given list of sets...
+;;; e.g.
+;;; (permute [[]] [[:a1 :a2][:b1 :b2 :b3][:c1]]) ->
+;;; ([:a1 :b1 :c1] [:a1 :b2 :c1] [:a1 :b3 :c1] [:a2 :b1 :c1] [:a2 :b2 :c1] [:a2 :b3 :c1])
+
+;;; TODO: should use recurse
+(defn- permute [state [head & tail]]
+  (if (empty? head)
+    state
+    (permute (mapcat (fn [i] (map (fn [j] (conj i j)) head)) state) tail)))
+
+;;; consider outer joins
+;; (defn- permute2 [inner state [head & tail]]
+;;   (if (empty? tail)
+;;     state
+;;     (if-let [head (if (and (empty? head) inner) nil [nil])]
+;; 	(permute (mapcat (fn [i] (map (fn [j] (conj i j)) head)) state) tail))))
+
 ;; TODO: return a pair - first is notification fn, second is new-indeces - use swap*! to apply

 (defn- derive-joins [v rhs-indeces ks join-fn]
@@ -31,50 +49,59 @@
 (defn- lhs-upsert [[old-index & rhs-indeces] ks v join-fn]
   (let [new-index (mapv (fn [index key] (group index (key v) v)) old-index ks)
 	new-indeces (apply vector new-index rhs-indeces)]
-    (println "JOINS: " (derive-joins v rhs-indeces ks)		;TODO: what should we do with this ?
+    (println "LHS JOINS: " (derive-joins v rhs-indeces ks join-fn)) ;TODO: what should we do with this ?
     new-indeces))

 ;;; TODO
-(defn- lhs-delete [old-indeces i k v])
-(defn- lhs-upserts [old-indeces i k vs])
-(defn- lhs-deletes [old-indeces i k vs])
+(defn- lhs-delete [old-indeces i ks v join-fn])
+(defn- lhs-upserts [old-indeces i ks vs join-fn])
+(defn- lhs-deletes [old-indeces i ks vs join-fn])

 (defn- lhs-view [indeces i keys join-fn]
   (reify
    View
    ;; singleton changes
    (on-upsert [_ upsertion] (swap! indeces lhs-upsert keys upsertion join-fn) nil)
-   (on-delete [_ deletion]  (swap! indeces lhs-delete i keys deletion) nil)
+   (on-delete [_ deletion]  (swap! indeces lhs-delete keys deletion join-fn) nil)
    ;; batch changes
-   (on-upserts [_ upsertions] (swap! indeces lhs-upserts i keys upsertions) nil)
-   (on-deletes [_ deletions]  (swap! indeces lhs-deletes i keys deletions) nil)))
+   (on-upserts [_ upsertions] (swap! indeces lhs-upserts keys upsertions join-fn) nil)
+   (on-deletes [_ deletions]  (swap! indeces lhs-deletes keys deletions join-fn) nil)))

 ;; TODO: return a pair - first is notification fn, second is new-indeces - use swap*! to apply

-(defn- rhs-upsert [old-indeces i k v]
-  (let [old-index (nth old-indeces i)
-	key (k v)
+(defn- rhs-upsert [old-indeces i lhs-key rhs-ks v join-fn]
+  (println "rhs-upsert: " old-indeces i rhs-ks v join-fn)
+  (let [
+	old-index (nth old-indeces i)
+	key (lhs-key v)
 	old-value (or (old-index key) [])
 	new-value (conj old-value v)
 	new-index (assoc old-index key new-value)
-	new-indeces (assoc old-indeces i new-index)]
+	new-indeces (assoc old-indeces i new-index)
+	lhs-indeces (first old-indeces)
+	lhs-index (nth lhs-indeces (dec i))
+	lhses (key lhs-index)
+	rhs-indeces (rest new-indeces)
+	joins (mapcat (fn [lhs] (derive-joins lhs rhs-indeces rhs-ks join-fn)) lhses)
+	]
+    (println "RHS JOINS: " joins)
     new-indeces
     ))

 ;;; TODO
-(defn- rhs-delete [old-indeces i ks v])
-(defn- rhs-upserts [old-indeces i ks vs])
-(defn- rhs-deletes [old-indeces i ks vs])
-
-(defn- rhs-view [indeces i keys]
+(defn- rhs-delete [old-indeces i ks v join-fn])
+(defn- rhs-upserts [old-indeces i ks vs join-fn])
+(defn- rhs-deletes [old-indeces i ks vs join-fn])
+
+(defn- rhs-view [indeces i key keys join-fn]
   (reify
    View
    ;; singleton changes
-   (on-upsert [_ upsertion] (swap! indeces rhs-upsert i keys upsertion) nil)
-   (on-delete [_ deletion]  (swap! indeces rhs-delete i keys deletion) nil)
+   (on-upsert [_ upsertion] (swap! indeces rhs-upsert i key keys upsertion join-fn) nil)
+   (on-delete [_ deletion]  (swap! indeces rhs-delete i keys deletion join-fn) nil)
    ;; batch changes
-   (on-upserts [_ upsertions] (swap! indeces rhs-upserts i keys upsertions) nil)
-   (on-deletes [_ deletions]  (swap! indeces rhs-deletes i keys deletions) nil)))
+   (on-upserts [_ upsertions] (swap! indeces rhs-upserts i keys upsertions join-fn) nil)
+   (on-deletes [_ deletions]  (swap! indeces rhs-deletes i keys deletions join-fn) nil)))

 ;;; attach lhs to all rhses such that any change to an rhs initiates an
 ;;; attempt to [re]join it to the lhs and vice versa.
@@ -89,7 +116,7 @@
 	  (log2 :info (str " rhs: " model ", " i ", " key))
 	  (swap! indeces conj {})	; add index for this model
 	  ;; view rhs model
-	  (attach model (rhs-view indeces i key))))
+	  (attach model (rhs-view indeces i key lhs-keys join-fn))))
     indeces))

 (deftype JoinModel [^String name ^Atom state ^Atom views]
@@ -108,49 +135,35 @@
 ;;--------------------------------------------------------------------------------
 ;; tests

-(defrecord D [name ^int version e]
-  Object
-  (^String toString [_] (str name)))
-
-(defrecord B [name ^int version c]
-  Object
-  (^String toString [_] (str name)))
-
-(defrecord A [name ^int version ^B b ^D d]
-  Object
-  (^String toString [_] (str name)))
-
-(defrecord ACE [a ^int version c e]
-  Object
-  (^String toString [_] (str a)))
+(defrecord A [name ^int version fk-b fk-c]
+  Object
+  (^String toString [_] (str name)))
+
+(defrecord B [name ^int version b data]
+  Object
+  (^String toString [_] (str name)))
+
+(defrecord C [name ^int version c data]
+  Object
+  (^String toString [_] (str name)))
+
+(defrecord ABC [name ^int version b-data c-data]
+  Object
+  (^String toString [_] (str name)))

 ;; an example of an aggressive join-fn
 ;; a "lazy" join fn would define the same interface, but hold references to the A,B and C...
 ;; a really clever impl might start lazy and become agressive during serialisation..
-(defn- ^ACE join-ace [^A a ^B b ^D d]
-  (->ACE (:name a) (+ (:version a) (:version b) (:version d)) (:c b) (:e d)))
-
-(deftest test-join-ace
-  (is (= (->ACE :a 0 :c :e)
-	 (join-ace (->A :a 0 :b :d)(->B :b 0 :c)(->D :d 0 :e)))))
-
-;;; calculate all permutations for a given list of sets...
-;;; e.g.
-;;; (permute [[]] [[:a1 :a2][:b1 :b2 :b3][:c1]]) ->
-;;; ([:a1 :b1 :c1] [:a1 :b2 :c1] [:a1 :b3 :c1] [:a2 :b1 :c1] [:a2 :b2 :c1] [:a2 :b3 :c1])
-
-;;; TODO: should use recurse
-(defn- permute [state [head & tail]]
-  (if (empty? head)
-    state
-    (permute (mapcat (fn [i] (map (fn [j] (conj i j)) head)) state) tail)))
-
-;;; consider outer joins
-;; (defn- permute2 [inner state [head & tail]]
-;;   (if (empty? tail)
-;;     state
-;;     (if-let [head (if (and (empty? head) inner) nil [nil])]
-;; 	(permute (mapcat (fn [i] (map (fn [j] (conj i j)) head)) state) tail))))
+(defn- ^ABC join-abc [^A a ^B b ^C c]
+  (->ABC
+   (keyword (apply str (interpose "-" (list (name (:name a)) (name (:name b)) (name (:name c))))))
+   (+ (* 1000 (:version a)) (* 100 (:version b)) (* 10 (:version c)))
+   (:data b)
+   (:data c)))
+
+(deftest test-join-abc
+  (is (= (->ABC :a1-b1-c1 0 "b-data" "c-data")
+	 (join-abc (->A :a1 0 :b :c)(->B :b1 0 :b "b-data")(->C :c1 0 :c "c-data")))))

 (deftest test-permute
   (is (=
@@ -160,28 +173,44 @@
 (deftest test-join-model
   (let [as (versioned-optimistic-map-model (str :as) :name :version >)
 	bs (versioned-optimistic-map-model (str :bs) :name :version >)
-	ds (versioned-optimistic-map-model (str :ds) :name :version >)
-	join (join-model "join-model" [[as :b :d][bs :name][ds :name]] join-ace)
+	cs (versioned-optimistic-map-model (str :cs) :name :version >)
+	join (join-model "join-model" [[as :fk-b :fk-c][bs :b][cs :c]] join-abc)
 	view (test-view "test")
-	a (->A :a 0 :b :d)
-	b (->B :b 0 :c)
-	d (->D :d 0 :e)]
+	a1 (->A :a1 0 :b :c)
+	a2 (->A :a2 0 :b :c)
+	b1 (->B :b1 0 :b "b1-data")
+	b2 (->B :b2 0 :b "b2-data")
+	c1 (->C :c1 0 :c "c1-data")
+	c2 (->C :c2 0 :c "c2-data")]
     (is (= [[{}{}]{}{}] (data join)))

     (attach join view)
     (is (= nil (data view)))

-    (on-upsert bs b)
-    (is (= [[{}{}]{:b [b]} {}] (data join)))
-
-    (on-upsert ds d)
-    (is (= [[{}{}]{:b [b]} {:d [d]}] (data join)))
-
-    (on-upsert as a)
-    (is (= [[{:b [a]}{:d [a]}]{:b [b]} {:d [d]}] (data join)))
-
-    ;; (on-delete join james)
-    ;; (on-upserts join [john steve])
-    ;; (on-deletes join [john steve])
+    ;; initial data
+    (on-upsert bs b1)
+    (is (= [[{}{}]{:b [b1]} {}] (data join)))
+
+    (on-upsert cs c1)
+    (is (= [[{}{}]{:b [b1]} {:c [c1]}] (data join)))
+
+    ;; join - lhs - a1
+    (on-upsert as a1)
+    (is (= [[{:b [a1]}{:c [a1]}]{:b [b1]} {:c [c1]}] (data join)))
+
+    ;; join - new rhs - b2
+    (on-upsert bs b2)
+    (is (= [[{:b [a1]}{:c [a1]}]{:b [b1 b2]} {:c [c1]}] (data join)))
+
+    ;; join - new rhs - c2
+    (on-upsert cs c2)
+    (is (= [[{:b [a1]}{:c [a1]}]{:b [b1 b2]} {:c [c1 c2]}] (data join)))
+
+    ;; join - new lhs - a2
+    (on-upsert as a2)
+    (is (= [[{:b [a1 a2]}{:c [a1 a2]}]{:b [b1 b2]} {:c [c1 c2]}] (data join)))
+
+    ;; what about amend-in/out ?
+    ;; what about delete ?

     ))


Tweak final hue section.

Tweak final hue section.

The controller pads hue assignment was not looking right beyond blue;
this solves it.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -118,7 +118,11 @@
           ;; a single hue, starting with the lightened version, then
           ;; the bright, medium, and dim versions.
           :else
-          (let [hue-section (+ 4 (* 4 (math/floor (* 13 (/ (colors/hue color) 360)))))]
+          (let [base-hue (colors/hue color)
+                adjusted-hue (if (> base-hue 240)
+                               (min 360 (* base-hue 1.2))
+                               base-hue)
+                hue-section (+ 4 (* 4 (math/floor (* 13 (/ adjusted-hue 360)))))]
             (int (+ hue-section brightness-shift))))))

 (defonce ^{:doc "The color of buttons that are completely off."}


Implement beat adjust, tempo flash.

Implement beat adjust, tempo flash.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -278,8 +278,11 @@
     ;; TODO: Loop over the most recent four active cues, rendering information
     ;;       about them.

-    (let [metronome-button (:metronome control-buttons)
+    (let [metronome (:metronome (:show controller))
+          metronome-button (:metronome control-buttons)
+          tap-tempo-button (:tap-tempo control-buttons)
           metronome-mode @(:metronome-mode controller)]
+      ;; Should the first cell display metronome information?
       (if (seq metronome-mode)
         (let [metronome (:metronome (:show controller))
               marker (rhythm/metro-marker metronome)
@@ -295,7 +298,13 @@
           (when (:adjusting-bpm metronome-mode)
             (aset (get (:next-display controller) 2) 16 (byte 1))))
         (swap! (:next-text-buttons controller)
-               assoc metronome-button (button-state metronome-button :dim))))
+               assoc metronome-button (button-state metronome-button :dim)))
+      ;; Regardless, flash the tap tempo button on beats
+      (swap! (:next-text-buttons controller)
+             assoc tap-tempo-button
+             (button-state tap-tempo-button
+                           (if (< (rhythm/metro-beat-phase metronome) 0.15)
+                             :bright :dim))))

     (update-text controller)
     (update-text-buttons controller)
@@ -428,6 +437,12 @@
                                              (dissoc % :showing)
                                              (assoc % :showing :true))))

+    14 ; Beat encoder
+    (let [delta (sign-velocity (:velocity message))
+          snapshot (rhythm/metro-snapshot (:metronome (:show controller)))]
+      (rhythm/metro-start (:metronome (:show controller)) (+ (:beat snapshot) delta))
+      (rhythm/metro-beat-phase (:metronome (:show controller) (:beat-phase snapshot))))
+
     15 ; BPM encoder
     (let [delta (/ (sign-velocity (:velocity message)) 10)
           bpm (rhythm/metro-bpm (:metronome (:show controller)))]


make ui match backend data structure| fs / cb | #3

--- src/cljs/conference_rating/conference.cljs
+++ src/cljs/conference_rating/conference.cljs
@@ -59,7 +59,7 @@

 (defn create-rating [form-data]
   (let [conference @displayed-conference]
-  (ajax/POST (str "/api/conferences/" (:id conference) "/ratings") {:params @form-data
+  (ajax/POST (str "/api/conferences/" (:_id conference) "/ratings") {:params @form-data
                                                                     :format :json
                                                                     :handler #(js/alert "success")
                                                                     :error-handler #(js/alert (str "could not create rating" %1))}))
@@ -70,8 +70,8 @@
         doc (atom {})]
   [:div {:class "container"}
    [:div {:class "jumbotron"}
-    [:h1(:conference-name conference)]
-    [:p (:conference-description conference)]]
+    [:h1(:name conference)]
+    [:p (:description conference)]]
    [:div {:class "panel panel-default"}
     [:div {:class "panel-heading"} "rate this conference now!"]
     [:div {:class "panel-body"}
@@ -86,8 +86,8 @@
       (display-loading))))

 (defn display-conference-list-item [conference-list-entry]
-  [:li {:key (:id conference-list-entry)}
-   [:a {:href (str "#/conferences/" (:id conference-list-entry))} (:conference-name conference-list-entry)]])
+  [:li {:key (:_id conference-list-entry)}
+   [:a {:href (str "#/conferences/" (:_id conference-list-entry))} (:name conference-list-entry)]])

 (defn display-conference-list [conference-list]
   [:div {:class "container"}


Fix invalid id's generation.

Fix invalid id's generation.

--- src/cljs/hatnik/web/client/components.cljs
+++ src/cljs/hatnik/web/client/components.cljs
@@ -103,6 +103,6 @@
           (accordion-panel
            :header (project-header prj)
            :body (actions-table (get prj "id") (get prj "actions"))
-           :body-id (str "__" (get prj "name"))))
+           :body-id (str "__PrjList" (get prj "id"))))
         (:projects data))))))


fix error message when progbar layer does not exist

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -7,7 +7,8 @@
             [infinitelives.utils.resources :as resources]
             [infinitelives.utils.console :refer [log]]
             [cljs.core.async :refer [chan put! <! >! timeout close!]])
-  (:require-macros [cljs.core.async.macros :refer [go]]))
+  (:require-macros [cljs.core.async.macros :refer [go]]
+                   [infinitelives.pixi.macros :as m]))

 ;; where we store all the loaded full textures keyed by name
 ;; The textures stored here are the full loaded image. Sub textures
@@ -143,7 +144,7 @@
 (defn load-resources [canvas layer urls & {:keys [fade-in fade-out]
                       :or {fade-in 0.5 fade-out 0.5}
                       :as options}]
-  (let [b (add-prog-bar (-> canvas :layer layer) options)]
+  (let [b (add-prog-bar (m/get-layer canvas layer) options)]
     (go
       ;; fade in
       (<! (fadein b :duration fade-in))


Remove superfluous whitespace.

Remove superfluous whitespace.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -8,7 +8,7 @@

 (ns
   ^{:author "Ruediger Gad",
-    :doc "Tests for cli4clj"}
+    :doc "Tests for cli4clj"}
   cli4clj.test.cli
   (:use clojure.test
         cli4clj.cli


Use GUIUpdater here

Use GUIUpdater here

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

--- plugins/SlideExplorer2/src/slide_explorer/display.clj
+++ plugins/SlideExplorer2/src/slide_explorer/display.clj
@@ -46,11 +46,11 @@

 (def angle (atom 0))

-(defn grab-tagged-image
+(def grab-tagged-image
   "Grab a single image from camera."
-  []
-  (core snapImage)
-  (core getTaggedImage))
+  (memoize (fn []
+             (core snapImage)
+             (core getTaggedImage))))

 (def pixel-size (core getPixelSizeUm true))

@@ -305,10 +305,12 @@
   (bind-window-key window "ADD" #(swap! zoom-atom update-in [:zoom] inc))
   (bind-window-key window "SUBTRACT" #(swap! zoom-atom update-in [:zoom] dec)))

+(def updater (GUIUpdater.))
+
 (defn display-follow [panel reference]
   (add-watch reference "display"
     (fn [_ _ _ _]
-      (.repaint panel))))
+      (.post updater #(.repaint panel)))))

 (defn main-panel [screen-state available-tiles]
   (doto
@@ -361,7 +363,7 @@
 (defn test-tiles [nx ny]
   (.start (Thread.
             #(doseq [i (range (- nx) (inc nx)) j (range (- ny) (inc ny))]
-               (Thread/sleep 1000)
+               ;(Thread/sleep 1000)
                (test-tile i j)))))

 (defn test-rotate []


Забыл событие по селекту

Забыл событие по селекту

--- radiolamp-6P3S/src/r6p3s/cpt/input_date_interval.cljs
+++ radiolamp-6P3S/src/r6p3s/cpt/input_date_interval.cljs
@@ -28,7 +28,7 @@
 (defn component [app own
                  {:keys [selected-fn
                          class-name style]
-                  :as opts}]
+                  :as   opts}]
   (reify
     om/IInitState
     (init-state [_]
@@ -64,12 +64,14 @@
                                         :style     #js {:paddingRight 0 :paddingLeft 0}}
                                    (om/build input-date/component-form-group (app :from-date)
                                              {:opts {:label       "с даты"
-                                                     :label-style #js {:textAlign "right"}}}))
+                                                     :label-style #js {:textAlign "right"}
+                                                     :spec-input  {:onChange-updated-valid-fn selected-fn}}}))
                           (dom/div #js {:className "col-xs-12 col-sm-6 col-md-6 col-lg-6"
                                         :style     #js {:paddingRight 0 :paddingLeft 0}}
                                    (om/build input-date/component-form-group (app :to-date)
                                              {:opts {:label       "по дату"
-                                                     :label-style #js {:textAlign "right"}}})))
+                                                     :label-style #js {:textAlign "right"}
+                                                     :spec-input  {:onChange-updated-valid-fn selected-fn}}})))

                  (when (or
                         (get-in app-v [:from-date :text-warning])


Updating the indexer so that it will refresh the acl cache instead of clearing it before reindexing collections.

--- src/cmr/indexer/services/index_service.clj
+++ src/cmr/indexer/services/index_service.clj
@@ -44,9 +44,9 @@
   "Reindexes all the collections in a provider."
   [context provider-id]

-  ;; Clear the ACL cache.
+  ;; Refresh the ACL cache.
   ;; We want the latest permitted groups to be indexed with the collections
-  (acl-cache/reset context)
+  (acl-cache/refresh-acl-cache context)

   (let [collections (meta-db/find-collections context {:provider-id provider-id})]
     (bulk-index context [collections])))


Add timestamp to export-metadata

Add timestamp to export-metadata

Nick's export tool included a timestamp in the metadata, which
seems like a good idea.  This commit adds that to the clojure
export tool.

--- src/com/puppetlabs/puppetdb/cli/export.clj
+++ src/com/puppetlabs/puppetdb/cli/export.clj
@@ -8,7 +8,9 @@
 ;; database.

 (ns com.puppetlabs.puppetdb.cli.export
-  (:use [com.puppetlabs.utils :only (cli!)])
+  (:use [com.puppetlabs.utils :only (cli!)]
+        [clj-time.core :only [now]]
+        [clj-time.coerce :only [to-string]])
   (:require [cheshire.core :as json]
             [fs.core :as fs]
             [clojure.java.io :as io]
@@ -50,7 +52,8 @@

 (def export-metadata
   "Metadata about this export; used during import to ensure version compatibility."
-  {:command-versions
+  {:timestamp (to-string (now))
+   :command-versions
     ;; This is not ideal that we are hard-coding the command version here, but
     ;;  in our current architecture I don't believe there is any way to introspect
     ;;  on which version of the `replace catalog` matches up with the current


bug #3911 - fixed balance in asset field when value too long

Signed-off-by: Goran Jovic <fc686822162e6f379ea05b6f92d78d206147085c@gmail.com>

--- src/status_im/ui/screens/wallet/components/styles.cljs
+++ src/status_im/ui/screens/wallet/components/styles.cljs
@@ -138,11 +138,13 @@
   {:flex            1
    :flex-direction  :row
    :justify-content :space-between
-   :align-items     :center})
+   :align-items     :center
+   :flex-wrap       :wrap
+   :margin-left     10})

 (def asset-label-content
-  {:flex-direction    :row
-   :margin-horizontal 10})
+  {:flex-direction :row
+   :margin-right   10})

 (def asset-label
   {:margin-right 10})


CMR-1387: More refactoring

CMR-1387: More refactoring

--- search-app/src/cmr/search/services/query_execution/facets_results_feature.clj
+++ search-app/src/cmr/search/services/query_execution/facets_results_feature.clj
@@ -8,8 +8,8 @@
 (defn- terms-facet
   [field]
   ;; We shouldn't try to handle this many different values.
-  ;; We should have a limit and if that's exceeded in the elastic response we should note that in the values returned.
-  ;; This can be handled as a part of CMR-1101
+  ;; We should have a limit and if that's exceeded in the elastic response we should note that in
+  ;; the values returned. This can be handled as a part of CMR-1101.
   {:terms {:field field :size 10000}})

 (def ^:private collection-count-aggregation
@@ -81,7 +81,8 @@
   (assoc query :aggregations (facet-aggregations (:nested-science-keywords? query))))

 (defn- buckets->value-count-pairs
-  "Processes an elasticsearch aggregation response of buckets to a sequence of value and count tuples"
+  "Processes an elasticsearch aggregation response of buckets to a sequence of value and count
+  tuples"
   [bucket-map]
   (->> bucket-map
        :buckets
@@ -104,8 +105,7 @@
     (let [remaining-fields (rest field-hierarchy)
           next-field (first remaining-fields)
           buckets (get aggregations-for-field :buckets)
-          response (r/map->HierarchicalFacet {:field field
-                                              :value-count-maps []})]
+          response (r/map->HierarchicalFacet {:field field})]
       (->> (for [bucket buckets
                  :let [field-key (get bucket :key)
                        coll-count (get-in bucket [:coll-count :doc_count])
@@ -121,7 +121,6 @@
                (r/map->ValueCountMaps
                  {:value field-key
                   :count coll-count})))
-           (into [])
            (assoc response :value-count-maps)))))

 (defn- science-keywords-bucket->facets
@@ -168,31 +167,39 @@
     (symbol (str prefix ":" (name k)))
     k))

+;; Forward declaration to handle circular dependency within value-count-maps->xml-element and
+;; facet->xml-element functions
+(declare facet->xml-element)
+
 (defn- value-count-maps->xml-element
   "Converts a list of value-count-maps into an XML element."
-  [ns-prefix with-prefix value-count-maps]
-  (for [value-count-map value-count-maps
-        :let [xml-element (x/element (with-prefix :value-count-maps) {}
-                                     (x/element (with-prefix :value) {:count (:count value-count-map)} (:value value-count-map)))]]
-    (do
+  [ns-prefix value-count-maps]
+  (let [with-prefix (partial key-with-prefix ns-prefix)]
+    (for [value-count-map value-count-maps
+          :let [xml-element (x/element (with-prefix :value-count-maps) {}
+                                       (x/element (with-prefix :value)
+                                                  {:count (:count value-count-map)}
+                                                  (:value value-count-map)))]]
       (when-let [facets (:facets value-count-map)]
-        (let [child-facets (x/element (key-with-prefix ns-prefix :facets) {} (facet->xml-element ns-prefix facets))]
+        (let [child-facets (x/element (with-prefix :facets) {}
+                                      (facet->xml-element ns-prefix facets))]
           (x/element (with-prefix :value-count-maps) {}
-                     [(x/element (with-prefix :value) {:count (:count value-count-map)} (:value value-count-map))
+                     [(x/element (with-prefix :value)
+                                 {:count (:count value-count-map)}
+                                 (:value value-count-map))
                       child-facets]))))))

 (defn- facet->xml-element
   [ns-prefix {:keys [field value-counts value-count-maps facets]}]
   (let [with-prefix (partial key-with-prefix ns-prefix)
         xml-element-content
-        (cond value-count-maps (value-count-maps->xml-element ns-prefix with-prefix value-count-maps)
-              facets (x/element (key-with-prefix ns-prefix :facets) {}
+        (cond value-count-maps (value-count-maps->xml-element ns-prefix value-count-maps)
+              facets (x/element (with-prefix :facets) {}
                                 (facet->xml-element ns-prefix facets))
               :else
               (for [[value value-count] value-counts]
                 (x/element (with-prefix :value) {:count value-count} value)))]
     (x/element (with-prefix :facet) {:field (name field)} xml-element-content)))
-

 (defn facets->xml-element
   "Helper function for converting a facet result into an XML element"


CMR-630: Refactored to address pull request comments.

--- test/cmr/system_int_test/bootstrap/bulk_index_test.clj
+++ test/cmr/system_int_test/bootstrap/bulk_index_test.clj
@@ -14,39 +14,51 @@

 (use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1"}))

+;; This test performs the follwing steps:
+;; 1. Saves ten collections in metadata db.
+;; 2. Saves three granules for each of those collections in metadata db.
+;; 3. Ingests ten granules five times each in a separate thread.
+;; 4. Concurrently executes a bulk index operation for the provider.
+;; 5. Waits for the bulk indexing and granule ingest to complete.
+;; 6. Searches for all of the saved/ingested concepts by concept-id.
+;; 7. Verifies that the concepts returned by searh have the expected revision ids.
 (deftest bulk-index-after-ingest
   ;; only run this test with the external db
   (when (= (type (get-in user/system [:apps :metadata-db :db]))
            cmr.oracle.connection.OracleStore)
     (let [collections (for [x (range 1 11)]
-                        (let [concept-map {:concept-type :collection
+                        (let [cmap {:short-name (str "short-name" x)
+                                    :entry-title (str "ttl" x)}
+                              umm (dc/collection cmap)
+                              xml (echo10/umm->echo10-xml umm)
+                              concept-map {:concept-type :collection
+                                           :format "application/echo10+xml"
+                                           :metadata xml
                                            :extra-fields {:short-name (str "short-name" x)
                                                           :entry-title (str "title" x)
                                                           :version-id "v1"}
                                            :provider-id "PROV1"
                                            :native-id (str "coll" x)
-                                           :short-name (str "short-name" x)}
-                              umm (dc/collection concept-map)
-                              xml (echo10/umm->echo10-xml umm)
-                              concept-map (merge concept-map {:format "application/echo10+xml"
-                                                              :metadata xml})]
+                                           :short-name (str "short-name" x)}]
                           (ingest/save-concept concept-map)))
-          granules1 (flatten
-                      (mapcat (fn [collection]
+          granules1 (mapcat (fn [collection]
                                 (doall
                                   (for [x (range 1 4)]
                                     (let [pid (:concept-id collection)
+                                          cmap {:native-id (str "gran-" pid "-" x)}
+                                          umm (dg/granule cmap)
+                                          xml (echo10/umm->echo10-xml umm)
                                           concept-map {:concept-type :granule
                                                        :provider-id "PROV1"
                                                        :native-id (str "gran-" pid "-" x)
-                                                       :extra-fields {:parent-collection-id pid}}
-                                          umm (dg/granule concept-map)
-                                          xml (echo10/umm->echo10-xml umm)
-                                          concept-map (merge concept-map
-                                                             {:format "application/echo10+xml"
-                                                              :metadata xml})]
+                                                       :extra-fields {:parent-collection-id pid}
+                                                       :format "application/echo10+xml"
+                                                       :metadata xml}]
                                       (ingest/save-concept concept-map)))))
-                              collections))
+                              collections)
+          ;; granules2 and f (the future) are used to ingest ten granules five times each in
+          ;; a separate thread to verify that bulk indexing with concurrent ingest does the right
+          ;; thing.
           granules2 (let [collection (first collections)
                           pid (:concept-id (first collections))]
                       (for [x (range 1 11)]
@@ -66,6 +78,7 @@
           (let [{:keys [concept-id revision-id]} collection
                 response (search/find-refs :collection {:concept-id concept-id})
                 es-revision-id (:revision-id (first (:refs response)))]
+            ;; the latest revision should be indexed
             (is (= es-revision-id revision-id))))
         (doseq [granule granules1]
           (let [{:keys [concept-id revision-id]} granule


Refactor: duplication

Refactor: duplication

--- test/layzee/integration/storage/simple_db_examples.clj
+++ test/layzee/integration/storage/simple_db_examples.clj
@@ -10,16 +10,17 @@
 (defn- client-for[amazon-credential] (sdb/create-client (-> amazon-credential :access-key-id) (-> amazon-credential :secret-access-key)))
 (defn- config-for[amazon-credential] (assoc enc/keyword-strings :client (client-for amazon-credential)))

+(defn- ex[amazon-credential fn] (apply fn (config-for amazon-credential) []))
+
 (defn- set[amazon-credential domain key value] ;; https://console.aws.amazon.com/iam/home?region=us-west-2#security_credential
-  (let [config (config-for amazon-credential)]
-    (sdb/put-attrs config domain {::sdb/id key :name "value" :key value})))
+  (ex amazon-credential #(sdb/put-attrs % domain {::sdb/id key :name "value" :key value})))

 (defn- get[amazon-credential domain key]
-  (let [config (config-for amazon-credential)]
-    (-> (sdb/get-attrs config domain key) :key)))
+  (ex amazon-credential #(-> (sdb/get-attrs % domain key) :key)))

 (facts "Basic proof that we can connect"
        (let [domain "test-layzee-web"]
+
          (sdb/create-domain (config-for settings/amazon-credential) domain)

          (fact "can write an entry and read it back"


(MAINT) Silence log output during test

(MAINT) Silence log output during test

--- test/puppetlabs/puppetserver/ruby/http_client_test.clj
+++ test/puppetlabs/puppetserver/ruby/http_client_test.clj
@@ -161,46 +161,44 @@
          (is (= "hi" (.runScriptlet sc "response.body")))))))

 (deftest https-sslv3
-  (with-webserver-with-protocols ["SSLv3"] nil
-    (testing "Cannot connect via SSLv3 by default"
-      (let [sc (create-scripting-container-with-ssl-client 10080)]
-        (logutils/with-test-logging
+  (logutils/with-test-logging
+    (with-webserver-with-protocols ["SSLv3"] nil
+      (testing "Cannot connect via SSLv3 by default"
+        (let [sc (create-scripting-container-with-ssl-client 10080)]
           (try
             (.runScriptlet sc "response = c.get('/', {})")
             (is (true? false) "Expected HTTP connection to HTTPS port to fail")
             (catch EvalFailedException e
               (is (instance? HttpClientException (.. e getCause)))
-              (is (instance? SSLHandshakeException (.. e getCause getCause))))))))
-
-    (testing "Can connect via SSLv3 when specified"
-       (let [sc (create-scripting-container-with-ssl-client
+              (is (instance? SSLHandshakeException (.. e getCause getCause)))))))
+
+      (testing "Can connect via SSLv3 when specified"
+        (let [sc (create-scripting-container-with-ssl-client
                   10080
                   {:ssl-protocols ["SSLv3" "TLSv1"]})]
-         (.runScriptlet sc "response = c.get('/', {})")
-         (is (= "200" (.runScriptlet sc "response.code")))
-         (is (= "hi" (.runScriptlet sc "response.body")))))))
+          (.runScriptlet sc "response = c.get('/', {})")
+          (is (= "200" (.runScriptlet sc "response.code")))
+          (is (= "hi" (.runScriptlet sc "response.body"))))))))

 (deftest https-cipher-suites
-  (with-webserver-with-protocols ["SSLv3"] ["SSL_RSA_WITH_RC4_128_SHA"]
-    (testing "Should not be able to connect if no matching ciphers"
-      (let [sc (create-scripting-container-with-ssl-client
-                 10080
-                 {:ssl-protocols ["SSLv3"]
-                  :cipher-suites ["SSL_RSA_WITH_RC4_128_MD5"]})]
-         (logutils/with-test-logging
-           (try
-             (.runScriptlet sc "response = c.get('/', {})")
-             (is (true? false) "Expected HTTP connection to HTTPS port to fail")
-             (catch EvalFailedException e
-               (is (instance? HttpClientException (.. e getCause)))
-               (is (instance? ConnectionClosedException (.. e getCause getCause))))))))
-    (testing "Should be able to connect if explicit matching ciphers are configured"
-      (let [sc (create-scripting-container-with-ssl-client
-                 10080
-                 {:ssl-protocols ["SSLv3"]
-                  :cipher-suites ["SSL_RSA_WITH_RC4_128_SHA"]})]
-        (.runScriptlet sc "response = c.get('/', {})")
-        (is (= "200" (.runScriptlet sc "response.code")))
-        (is (= "hi" (.runScriptlet sc "response.body")))))))
-
-
+  (logutils/with-test-logging
+    (with-webserver-with-protocols ["SSLv3"] ["SSL_RSA_WITH_RC4_128_SHA"]
+      (testing "Should not be able to connect if no matching ciphers"
+        (let [sc (create-scripting-container-with-ssl-client
+                  10080
+                  {:ssl-protocols ["SSLv3"]
+                   :cipher-suites ["SSL_RSA_WITH_RC4_128_MD5"]})]
+          (try
+            (.runScriptlet sc "response = c.get('/', {})")
+            (is (true? false) "Expected HTTP connection to HTTPS port to fail")
+            (catch EvalFailedException e
+              (is (instance? HttpClientException (.. e getCause)))
+              (is (instance? ConnectionClosedException (.. e getCause getCause)))))))
+      (testing "Should be able to connect if explicit matching ciphers are configured"
+        (let [sc (create-scripting-container-with-ssl-client
+                  10080
+                  {:ssl-protocols ["SSLv3"]
+                   :cipher-suites ["SSL_RSA_WITH_RC4_128_SHA"]})]
+          (.runScriptlet sc "response = c.get('/', {})")
+          (is (= "200" (.runScriptlet sc "response.code")))
+          (is (= "hi" (.runScriptlet sc "response.body"))))))))


fixed test

fixed test

--- test/selmer/core_test.clj
+++ test/selmer/core_test.clj
@@ -12,7 +12,7 @@
     (= "start a\n{% block a %}\nstart b\n{% block b %}{% endblock %}\nstop b\n{% endblock %}stop a\n\n{% block content %}content{% endblock %}\nHello, {{name}}!\n"
        (preprocess-template "templates/inheritance/inherit-b.html")))
   (is
-    (= "\"start a\\n{% block a %}\\nstart b\\n{% block b %}\\nstart c\\nstop c\\n{% endblock %}stop b\\n{% endblock %}stop a\\n\\n{% block content %}content{% endblock %}\\nHello, {{name}}!\\n\""
+    (= "start a\n{% block a %}\nstart b\n{% block b %}\nstart c\nstop c\n{% endblock %}stop b\n{% endblock %}stop a\n\n{% block content %}content{% endblock %}\nHello, {{name}}!\n"
       (preprocess-template "templates/inheritance/inherit-c.html"))))

 (deftest custom-tags


gentlemen, I found a bug.

gentlemen, I found a bug.

--- test/selmer/core_test.clj
+++ test/selmer/core_test.clj
@@ -3,6 +3,19 @@
   (:import java.io.File))

 (def path (str "test" File/separator "templates" File/separator))
+
+(deftest passthrough
+  (let [s "a b c d"]
+    (is (= s (render-string s {}))))
+  (let [s "{{blah}} a b c d"]
+    (is (= " a b c d" (render-string s {}))))
+  (let [s "{{blah}} a b c d"]
+    (is (= "blah a b c d" (render-string s {:blah "blah"}))))
+  ;; expected: (= s (render-string s {}))
+  ;; actual: java.lang.OutOfMemoryError: Java heap space
+  ;; lol.
+  (let [s "{a b c} \nd"]
+    (is (= s (render-string s {})))))

 (deftest inheritance
   (is
@@ -172,7 +185,8 @@
 (deftest filter-upper
   (is (= "FOO" (render-string "{{f|upper}}" {:f "foo"}))))

-;;; How do we handle nils ?
+;; How do we handle nils ?
+;; nils should return empty strings at the point of injection in a DTL library. - cma
 (deftest filter-no-value
   (is (= "" (render-string "{{f|upper}}" {}))))

@@ -203,6 +217,10 @@

 ;; switched commas + doublequotes for colons
 ;; TODO - maybe remain consistent with django's only 1 argument allowed.
+;; I like being able to accept multiple arguments.
+;; Alternatively, we could have curried filters and just chain
+;; it into a val and apply it Haskell-style.
+;; I think that could surprise users. (which is bad)
 (deftest filter-pluralize
   (is (= "s" (render-string "{{f|pluralize}}" {:f []})))
   (is (= "" (render-string "{{f|pluralize}}" {:f [1]})))
@@ -239,9 +257,11 @@
   ;; safe only works at the end
   #_(is (= "{\"foo\":27,\"dan\":\"awesome\"}"
          (render-string "{{f|safe|json}}" {:f {:foo 27 :dan "awesome"}})))
+  ;; Do we really want to nil-pun the empty map?
+  ;; Is that going to surprise the user?
   (is (= "null" (render-string "{{f|json}}" {}))))

-;;TODO
+;; TODO
 (deftest filter-chaining
   (is (= "ACBD18DB4CC2F85CEDEF654FCCC4A4D8"
          (render-string "{{f|hash:\"md5\"|upper}}" {:f "foo"}))))
@@ -253,8 +273,8 @@
   (is (= "&"'<>"
          (render-string "{{f}}" {:f "&\"'<>"}))))

-;;TODO - safe only works at the end atm.
-;;; Don't think it should work anywhere else :-) - cbp
+;; Safe only works at the end.
+;; Don't think it should work anywhere else :-) - cbp (agreed, - cma)
 (deftest test-safe-filter
   (is (= "<foo>"
          (render-string "{{f}}" {:f "<foo>"})))


fix several cards to account for hosting

Added `(all-installed state :runner)` to Origami, Wraparound, Calling in Favors, Sacrificial Clone.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -302,7 +302,7 @@

    "Calling in Favors"
    {:effect (effect (gain :credit (count (filter (fn [c] (has? c :subtype "Connection"))
-                                                 (get-in runner [:rig :resource])))))}
+                                                 (all-installed state :runner)))))}

    "Capital Investors"
    {:abilities [{:cost [:click 1] :effect (effect (gain :credit 2)) :msg "gain 2 [Credits]"}]}
@@ -1813,10 +1813,10 @@
    "Origami"
    {:effect (effect (gain :max-hand-size
                           (dec (* 2 (count (filter #(= (:title %) "Origami")
-                                                   (get-in runner [:rig :program])))))))
+                                                   (all-installed state :runner)))))))
     :leave-play (effect (lose :max-hand-size
                               (dec (* 2 (count (filter #(= (:title %) "Origami")
-                                                       (get-in runner [:rig :program])))))))}
+                                                       (all-installed state :runner)))))))}

    "Oversight AI"
    {:choices {:req #(and (= (:type %) "ICE") (not (:rezzed %)))}
@@ -2258,7 +2258,7 @@
    {:prevent {:damage [:meat :net :brain]}
     :abilities [{:effect (req (doseq [c (concat (get-in runner [:rig :hardware])
                                                 (filter #(not (has? % :subtype "Virtual"))
-                                                        (get-in runner [:rig :resource]))
+                                                        (all-installed state :runner))
                                                 (:hand runner))]
                                 (trash state side c {:cause :ability-cost}))
                               (lose state side :credit :all :tag :all)
@@ -3839,7 +3839,7 @@

    "Wraparound"
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]
-    :strength-bonus (req (if (some #(has? % :subtype "Fracter") (get-in runner [:rig :program]))
+    :strength-bonus (req (if (some #(has? % :subtype "Fracter") (all-installed state :runner))
                            0 7))
     :events (let [wr {:req (req (and (not= (:cid target) (:cid card)) (has? target :subtype "Fracter")))
                       :effect (effect (update-ice-strength card))}]


only valid voices now

only valid voices now

--- src/codemash/voice.clj
+++ src/codemash/voice.clj
@@ -1,7 +1,7 @@
 (ns codemash.voice
   (:use [overtone.live]))

-(def voices [:agnes :albert :alex "bad news" :bahh  :bells :boing :bruce :bubbles :cellos :deranged :fred "good news" :hysterical :junior :kathy "pipe organ"
+(def voices [:agnes :albert :alex :bad-news :bahh  :bells :boing :bruce :bubbles :cellos :deranged :fred :good-news :hysterical :junior :kathy :pipe-organ
              :princess :ralph :trinoids :vicki :victoria :whisper :zarvox])

 (def waves-b (speech-buffer "waves" :voice (rand-nth voices)))


limit results on cause page

limit results on cause page

--- src/demogorgon/web.clj
+++ src/demogorgon/web.clj
@@ -180,7 +180,7 @@
   (sql/with-connection (:db @config)
     (sql/with-query-results
       rs
-      ["select * from xlogfile where death_uniq = ? order by points desc" (url-decode cause-str)]
+      ["select * from xlogfile where death_uniq = ? order by points desc limit 100" (url-decode cause-str)]
       (layout
        (rs-to-table rs)))))


Fix issue where checkpoint metric was used for two purposes.

--- src/onyx/monitoring/metrics_monitoring.clj
+++ src/onyx/monitoring/metrics_monitoring.clj
@@ -338,7 +338,7 @@
               :checkpoint-serialization-latency checkpoint-serialization-latency
               :checkpoint-store-latency checkpoint-store-latency
               :checkpoint-size checkpoint-size
-              :checkpoint-written-bytes checkpoint-size
+              :checkpoint-written-bytes checkpoint-written-bytes
               :read-offset read-offset
               :lag-gauge lag-gauge
               :recover-latency recover-latency


Tidy, including getting rid of the map keys in melody.


original doesn't need type hints

original doesn't need type hints

--- src/random/learning/plumbing/typeHints.clj
+++ src/random/learning/plumbing/typeHints.clj
@@ -15,12 +15,15 @@
         m  (/ (sum identity xs) n)
         m2 (/ (sum #(* % %) xs) n)
         v  (- m2 (* m m))
-        ^{:tag java.io.File} ffull (.getAbsoluteFile (clojure.java.io/as-file "flat-file"))
+;        ^{:tag java.io.File} ;hmm this doesn't need a type hint but the graph one does
+        ff (clojure.java.io/as-file "flat-file")
+        ffull (.getAbsoluteFile ff)
         ]
     {:n n   ; count
      :m m   ; mean
      :m2 m2 ; mean-square
-     :v v   ; variance
+     :v v   ; variance
+     :ffull ffull
      }))

 (def stats-graph
@@ -55,6 +58,7 @@

 ;(println (.getAbsoluteFile ff))
 (println (:ffull (stats-eager {:xs [1 2 3 6]})))
+(println (:ffull (stats {:xs [1 2]})))

 (def extended-stats
   (graph/eager-compile


Updated labeling used in comments for ccp extension concepts

--- resources/rules/post_identifier_merge/temp/goa/goa.clj
+++ resources/rules/post_identifier_merge/temp/goa/goa.clj
@@ -20,23 +20,23 @@
          ;; provenance: connect the record to the process subclass
          (?/record obo/IAO_0000219 ?/process_sc)) ; IAO:denotes

-  :body ((?/go_ice_id rdfs/subClassOf ccp/IAO_EXT_0000103) ; ccp:GO_BP_concept_identifier
+  :body ((?/go_ice_id rdfs/subClassOf ccp/IAO_EXT_0000103) ; ccp:Gene_Ontology_concept_identifier_GO_BP_concept_identifier
          (?/go_ice_id obo/IAO_0000219 ?/process) ; IAO:denotes
          (?/id_field_value rdf/type ?/go_ice_id)
-         (?/id_field_value rdf/type ccp/IAO_EXT_0000014) ; ccp:GAF_ontology_identifier_field_value
+         (?/id_field_value rdf/type ccp/IAO_EXT_0000014) ; ccp:GOA_GAF_v2.0_Annotation_record_ontology_term_identifier_field_value
          (?/record obo/BFO_0000051 ?/id_field_value) ; BFO:has_part
-         (?/record rdf/type ccp/IAO_EXT_0000007) ; ccp:GAF_record_v2.0
+         (?/record rdf/type ccp/IAO_EXT_0000007) ; ccp:GOA_GAF_v2.0_Annotation_record

          ;; retrieve the process participant identifier
          (?/record obo/BFO_0000051 ?/bioentity_field_value) ; BFO:has_part
-         (?/bioentity_field_value rdf/type ccp/IAO_EXT_0000010) ; ccp:database_object_identifier_field_value
+         (?/bioentity_field_value rdf/type ccp/IAO_EXT_0000010) ; ccp:GOA_GAF_v2.0_Annotation_record_database_object_identifier_field_value
          (?/bioentity_field_value rdf/type ?/bioentity_ice_id)
          (?/bioentity_ice_id obo/IAO_0000219 ?/participating_bioentity) ; IAO:denotes

          ;; filter out the negations
           (:optional
            ((?/record obo/BFO_0000051 ?/qualifier_fv) ; BFO:has_part
-            (?/qualifier_fv rdf/type ccp/IAO_EXT_0000013) ; ccp:GAF_qualifier_field_value
+            (?/qualifier_fv rdf/type ccp/IAO_EXT_0000013) ; ccp:GOA_GAF_v2.0_Annotation_record_qualifier_field_value
             (?/qualifier_fv rdfs/label ?/qualifier)))
           (:or (:not (:bound ?/qualifier))
                (:not (:regex ?/qualifier "^NOT" "i")))
@@ -80,16 +80,16 @@
          ;; provenance: connect the record to the localization subclass
          (?/record obo/IAO_0000219 ?/localization_sc)) ; IAO:denotes

-  :body ((?/go_ice_id [rdfs/subClassOf *] ccp/IAO_EXT_0000200) ; ccp:GO_CC_concept_identifier
-         (?/go_ice_id obo/IAO_0000219 ?/go) ; IAO:denotes
+  :body ((?/go_ice_id [rdfs/subClassOf *] ccp/IAO_EXT_0000200) ; ccp:Gene_Ontology_concept_identifier_GO_CC_concept_identifier
+         (?/go_ice_id obo/IAO_0000219 ?/process) ; IAO:denotes
          (?/id_field_value rdf/type ?/go_ice_id)
-         (?/id_field_value rdf/type ccp/IAO_EXT_0000014) ; ccp:GAF_ontology_identifier_field_value
+         (?/id_field_value rdf/type ccp/IAO_EXT_0000014) ; ccp:GOA_GAF_v2.0_Annotation_record_ontology_term_identifier_field_value
          (?/record obo/BFO_0000051 ?/id_field_value) ; BFO:has_part
-         (?/record rdf/type ccp/IAO_EXT_0000007) ; ccp:GAF_record_v2.0
+         (?/record rdf/type ccp/IAO_EXT_0000007) ; ccp:GOA_GAF_v2.0_Annotation_record

          ;; retrieve the process participant identifier
          (?/record obo/BFO_0000051 ?/bioentity_field_value) ; BFO:has_part
-         (?/bioentity_field_value rdf/type ccp/IAO_EXT_0000010) ; ccp:database_object_identifier_field_value
+         (?/bioentity_field_value rdf/type ccp/IAO_EXT_0000010) ; ccp:GOA_GAF_v2.0_Annotation_record_database_object_identifier_field_value
          (?/bioentity_field_value rdf/type ?/bioentity_ice_id)
          (?/bioentity_ice_id obo/IAO_0000219 ?/participating_bioentity) ; IAO:denotes


unknown users don't break sign-on

unknown users don't break sign-on

--- webapp/src/webapp/core.clj
+++ webapp/src/webapp/core.clj
@@ -53,9 +53,12 @@
 		[{:keys [username password]}]
 		(let [{:keys [roles hashed-password]} (get_roles_from_redis username)]
 			(if
-				(BCrypt/checkpw password hashed-password)
-				{:username username :roles roles}
-				nil)))
+				(nil? hashed-password)
+				nil
+					(if
+					(BCrypt/checkpw password hashed-password)
+					{:username username :roles roles}
+					nil))))

 (def secured-app (friend/authenticate
 	router*


Make destination creation more idempotentery

--- modules/messaging/src/main/clojure/immutant/messaging/core.clj
+++ modules/messaging/src/main/clojure/immutant/messaging/core.clj
@@ -157,14 +157,14 @@

 (defn start-queue [name & {:keys [durable selector] :or {durable true selector ""}}]
   (if-let [manager (lookup/fetch "jboss.messaging.default.jms.manager")]
-    (do (.createQueue manager false name selector durable (into-array String []))
-        (at-exit #(stop-destination name)))
+    (if (.createQueue manager false name selector durable (into-array String []))
+      (at-exit #(stop-destination name)))
     (throw (Exception. (str "Unable to start queue, " name)))))

 (defn start-topic [name & opts]
   (if-let [manager (lookup/fetch "jboss.messaging.default.jms.manager")]
-    (do (.createTopic manager false name (into-array String []))
-        (at-exit #(stop-destination name)))
+    (if (.createTopic manager false name (into-array String []))
+      (at-exit #(stop-destination name)))
     (throw (Exception. (str "Unable to start topic, " name)))))

 (defn create-session [^javax.jms.XAConnection connection]


identity

identity

--- pigpen-cascading/src/main/clojure/pigpen/cascading/runtime.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading/runtime.clj
@@ -50,8 +50,7 @@

 (defmethod pigpen.runtime/post-process [:cascading :native]
   [_ _]
-  (fn [args]
-    args))
+  identity)

 (defmethod pigpen.runtime/post-process [:cascading :frozen]
   [_ _]


:sparkles: Update page indices on change notifications.

--- frontend/src/uxbox/main/data/workspace/notifications.cljs
+++ frontend/src/uxbox/main/data/workspace/notifications.cljs
@@ -18,6 +18,7 @@
    [uxbox.main.repo :as rp]
    [uxbox.main.store :as st]
    [uxbox.main.streams :as ms]
+   [uxbox.main.data.workspace.common :as dwc]
    [uxbox.main.data.workspace.persistence :as dwp]
    [uxbox.util.avatars :as avatars]
    [uxbox.util.geom.point :as gpt]
@@ -169,6 +170,7 @@
   (ptk/reify ::handle-page-change
     ptk/WatchEvent
     (watch [_ state stream]
-      (rx/of (dwp/shapes-changes-persisted msg)))))
+      (rx/of (dwp/shapes-changes-persisted msg)
+             (dwc/update-page-indices (:page-id msg))))))


Removed interstitial row

Removed interstitial row

--- streamable.clj
+++ streamable.clj
@@ -65,11 +65,6 @@
                         [site streaming-sites]
                         (str " | " site))
                      "\n")
-        interstitial-row (list
-                           (for
-                             [site streaming-sites]
-                             (str " | **" site "**"))
-                           "\n")
         body-rows (for [ep eps]
                     (list
                       (:episode_title ep)