Refactor

Refactor

--- backend/test/akvo/lumen/lib/transformation_test.clj
+++ backend/test/akvo/lumen/lib/transformation_test.clj
@@ -35,10 +35,12 @@

 (alias 'import.column.text.s                   'akvo.lumen.specs.import.column.text)
 (alias 'import.column.multiple.s               'akvo.lumen.specs.import.column.multiple)
-
 (alias 'transformation.engine.s                'akvo.lumen.specs.transformation.engine)
+(alias 'transformation.combine.s               'akvo.lumen.specs.transformation.combine)
+(alias 'transformation.filter-column.s         'akvo.lumen.specs.transformation.filter-column)
 (alias 'transformation.split-column.s          'akvo.lumen.specs.transformation.split-column)
 (alias 'transformation.derive.s                'akvo.lumen.specs.transformation.derive)
+(alias 'transformation.change-datatype.s       'akvo.lumen.specs.transformation.change-datatype)
 (alias 'transformation.sort-column.s           'akvo.lumen.specs.transformation.sort-column)
 (alias 'transformation.remove-sort.s           'akvo.lumen.specs.transformation.remove-sort)
 (alias 'transformation.generate-geopoints.s    'akvo.lumen.specs.transformation.generate-geopoints)
@@ -53,6 +55,11 @@
 (hugsql/def-db-fns "akvo/lumen/lib/job-execution.sql")
 (hugsql/def-db-fns "akvo/lumen/lib/transformation_test.sql")
 (hugsql/def-db-fns "akvo/lumen/lib/transformation.sql")
+
+(defn latest-data [dataset-id]
+  (let [table-name (:table-name
+                    (latest-dataset-version-by-dataset-id *tenant-conn* {:dataset-id dataset-id}))]
+    (get-data *tenant-conn* {:table-name table-name})))

 (def ops (vec (json/parse-string (slurp (io/resource "ops.json")))))

@@ -85,7 +92,7 @@
                args)

         op-name (str (namespace t-type) "/" (name t-type))]
-    (conform :akvo.lumen.specs.transformation.engine/op-spec (assoc s :op (keyword op-name) :args args))
+    (conform ::transformation.engine.s/op-spec (assoc s :op (keyword op-name) :args args))

     (tu/clj>json>clj (assoc s :op op-name :args args))))

@@ -104,35 +111,35 @@

 (deftest ^:functional test-import-and-transform
   (testing "Import CSV and transform"
-    (let [t-log [(gen-transformation :core/trim {:akvo.lumen.specs.db.dataset-version.column/columnName "c5"
-                                                 :akvo.lumen.specs.transformation.engine/onError "fail"})
-                 (gen-transformation :core/change-datatype {:akvo.lumen.specs.db.dataset-version.column/columnName "c5"
-                                                        :akvo.lumen.specs.transformation.change-datatype/defaultValue 0
-                                                        :akvo.lumen.specs.transformation.change-datatype/newType "number"
-                                                        :akvo.lumen.specs.transformation.engine/onError "default-value"})
-                 (gen-transformation :core/filter-column {:akvo.lumen.specs.db.dataset-version.column/columnName "c4"
-                                                      :akvo.lumen.specs.transformation.filter-column/expression {"contains" "broken"}
-                                                      :akvo.lumen.specs.transformation.engine/onError "fail"})]
-          dataset-id (import-file *tenant-conn* *error-tracker* {:name "GDP Test"
+    (let [t-log      [(gen-transformation :core/trim {::db.dataset-version.column.s/columnName "c5"
+                                                      ::transformation.engine.s/onError        "fail"})
+                      (gen-transformation :core/change-datatype {::db.dataset-version.column.s/columnName        "c5"
+                                                                 ::transformation.change-datatype.s/defaultValue 0
+                                                                 ::transformation.change-datatype.s/newType      "number"
+                                                                 ::transformation.engine.s/onError               "default-value"})
+                      (gen-transformation :core/filter-column {::db.dataset-version.column.s/columnName    "c4"
+                                                               ::transformation.filter-column.s/expression {"contains" "broken"}
+                                                               ::transformation.engine.s/onError           "fail"})]
+          dataset-id (import-file *tenant-conn* *error-tracker* {:name                "GDP Test"
                                                                  :has-column-headers? false
-                                                                 :file "GDP.csv"})]
+                                                                 :file                "GDP.csv"})]
       (let [[tag {:strs [datasetId]}] (last (for [transformation t-log]
                                               (transformation/apply {:tenant-conn *tenant-conn*}
-                                                        dataset-id
-                                                        {:type :transformation
-                                                         :transformation transformation})))]
+                                                                    dataset-id
+                                                                    {:type           :transformation
+                                                                     :transformation transformation})))]

         (is (= ::lib/ok tag))

         (let [table-name (:table-name (latest-dataset-version-by-dataset-id *tenant-conn*
                                                                             {:dataset-id datasetId}))]
           (is (zero? (:c5 (get-val-from-table *tenant-conn*
-                                              {:rnum 196
+                                              {:rnum        196
                                                :column-name "c5"
-                                               :table-name table-name}))))
-          (is (= "[Broken]" (:c4 (get-val-from-table *tenant-conn* {:rnum 196
+                                               :table-name  table-name}))))
+          (is (= "[Broken]" (:c4 (get-val-from-table *tenant-conn* {:rnum        196
                                                                     :column-name "c4"
-                                                                    :table-name table-name}))))
+                                                                    :table-name  table-name}))))
           (is (= 1 (:total (get-row-count *tenant-conn* {:table-name table-name})))))))))

 (deftest ^:functional test-undo
@@ -143,17 +150,15 @@
         apply-transformation (partial transformation/apply {:tenant-conn *tenant-conn*} dataset-id)]
     (is (= ::lib/ok (first (apply-transformation {:type :undo}))))
     (let [[tag _] (do (apply-transformation {:type :transformation
-                                             :transformation
-                                             (gen-transformation :core/to-lowercase
-                                                                 {:akvo.lumen.specs.db.dataset-version.column/columnName "c1"
-                                                                  :akvo.lumen.specs.transformation.engine/onError "fail"})})
+                                             :transformation (gen-transformation :core/to-lowercase
+                                                                                {::db.dataset-version.column.s/columnName "c1"
+                                                                                ::transformation.engine.s/onError "fail"})})
                       (apply-transformation {:type :transformation
-                                             :transformation
-                                             (gen-transformation :core/change-datatype
-                                                                 {:akvo.lumen.specs.db.dataset-version.column/columnName "c5"
-                                                                  :akvo.lumen.specs.transformation.engine/onError "default-value"
-                                                                  :akvo.lumen.specs.transformation.change-datatype/newType "number"
-                                                                  :akvo.lumen.specs.transformation.change-datatype/defaultValue 0})})
+                                             :transformation (gen-transformation :core/change-datatype
+                                                                                {::db.dataset-version.column.s/columnName "c5"
+                                                                                ::transformation.engine.s/onError "default-value"
+                                                                                ::transformation.change-datatype.s/newType "number"
+                                                                                ::transformation.change-datatype.s/defaultValue 0})})
                       (apply-transformation {:type :undo}))]
       (is (= ::lib/ok tag))
       (is (not (:exists (table-exists *tenant-conn* {:table-name previous-table-name}))))
@@ -182,29 +187,29 @@
 (deftest ^:functional combine-transformation-test
   (let [dataset-id (import-file *tenant-conn* *error-tracker* {:has-column-headers? true
                                                                :file "name.csv"})
-        apply-transformation (partial transformation/apply {:tenant-conn *tenant-conn*} dataset-id)]
-    (let [[tag _] (apply-transformation {:type :transformation
-                                         :transformation
-                                         (gen-transformation :core/combine
-                                                             {:akvo.lumen.specs.transformation.combine/columnNames ["c1" "c2"]                                                                          :akvo.lumen.specs.transformation.engine/onError "fail"
-                                                              :akvo.lumen.specs.transformation.combine/newColumnTitle "full name"
-                                                              :akvo.lumen.specs.transformation.combine/separator " "})})]
-      (is (= ::lib/ok tag))
-      (let [table-name (:table-name
-                        (latest-dataset-version-by-dataset-id *tenant-conn*
-                                                              {:dataset-id dataset-id}))]
-        (is (= "bob hope"
-               (:d1 (get-val-from-table *tenant-conn*
-                                        {:rnum 1
-                                         :column-name "d1"
-                                         :table-name table-name}))))))
+        apply-transformation (partial transformation/apply {:tenant-conn *tenant-conn*} dataset-id)
+        [tag _] (apply-transformation {:type :transformation
+                                       :transformation (gen-transformation :core/combine
+                                                                           {::transformation.combine.s/columnNames ["c1" "c2"]
+                                                                            ::transformation.engine.s/onError "fail"
+                                                                            ::transformation.combine.s/newColumnTitle "full name"
+                                                                            ::transformation.combine.s/separator " "})})]
+    (is (= ::lib/ok tag))
+    (let [table-name (:table-name
+                      (latest-dataset-version-by-dataset-id *tenant-conn*
+                                                            {:dataset-id dataset-id}))]
+      (is (= "bob hope"
+             (:d1 (get-val-from-table *tenant-conn*
+                                      {:rnum 1
+                                       :column-name "d1"
+                                       :table-name table-name})))))

     ;;https://github.com/akvo/akvo-lumen/issues/1517
     (testing "Combining columns where one of the columns has empty values"
       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                          (gen-transformation :core/combine
-                                                             {:akvo.lumen.specs.transformation.combine/columnNames ["c2" "c3"]                                                                          :akvo.lumen.specs.transformation.engine/onError "fail"
+                                                             {:akvo.lumen.specs.transformation.combine/columnNames ["c2" "c3"]                                                                          ::transformation.engine.s/onError "fail"
                                                               :akvo.lumen.specs.transformation.combine/newColumnTitle "issue1517"
                                                               :akvo.lumen.specs.transformation.combine/separator " "})})]
         (is (= ::lib/ok tag))
@@ -226,7 +231,7 @@
                                                        :akvo.lumen.specs.transformation.change-datatype/defaultValue 0
                                                        :akvo.lumen.specs.transformation.change-datatype/newType "date"
                                                        :akvo.lumen.specs.transformation.change-datatype/parseFormat format*
-                                                       :akvo.lumen.specs.transformation.engine/onError "fail"})})
+                                                       ::transformation.engine.s/onError "fail"})})
         data                (import.s/sample-imported-dataset [:text
                                                           [:text {::import.column.text.s/value (fn [] (import.column.s/date-format-gen
                                                                                (fn [[y _ _ :as date]]
@@ -261,24 +266,16 @@
         (is (= years-slash (map (comp tcc/from-long :c3) table-data)))
         (is (= years-hiphen (map (comp tcc/from-long :c4) table-data)))))))

-
-(defn change-datatype-transformation [column-name]
-  {:type :transformation
-   :transformation
-   (-> (gen-transformation
-        :core/change-datatype {:akvo.lumen.specs.db.dataset-version.column/columnName "column-name"
-                               :akvo.lumen.specs.transformation.change-datatype/newType "number"
-                               :akvo.lumen.specs.transformation.engine/onError "default-value"})
-       (assoc-in ["args" "defaultValue"] nil) ;; we can generate nil values ... spec related
-       )})
-
-(defn latest-data [dataset-id]
-  (let [table-name (:table-name
-                    (latest-dataset-version-by-dataset-id *tenant-conn* {:dataset-id dataset-id}))]
-    (get-data *tenant-conn* {:table-name table-name})))
-
 (deftest ^:functional derived-column-test
-  (let [dataset-id (import-file *tenant-conn* *error-tracker* {:has-column-headers? true
+  (let [change-datatype-transformation (fn [column-name]
+                                         {:type :transformation
+                                          :transformation
+                                          (-> (gen-transformation
+                                               :core/change-datatype {::db.dataset-version.column.s/columnName "column-name"
+                                                                      ::transformation.change-datatype.s/newType "number"
+                                                                      ::transformation.engine.s/onError "default-value"})
+                                              (assoc-in ["args" "defaultValue"] nil))})
+        dataset-id (import-file *tenant-conn* *error-tracker* {:has-column-headers? true
                                                                :file "derived-column.csv"})
         apply-transformation (partial transformation/apply {:tenant-conn *tenant-conn*} dataset-id)]
     (do (apply-transformation (change-datatype-transformation "c2"))
@@ -294,20 +291,20 @@
       (apply-transformation {:type :transformation
                              :transformation
                              (gen-transformation :core/derive
-                                                 {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 1"
-                                                  :akvo.lumen.specs.transformation.derive/code "row['foo'].toUpperCase()"
-                                                  :akvo.lumen.specs.transformation.derive/newColumnType "text"
-                                                  :akvo.lumen.specs.transformation.engine/onError "leave-empty"})})
+                                                 {::transformation.derive.s/newColumnTitle "Derived 1"
+                                                  ::transformation.derive.s/code "row['foo'].toUpperCase()"
+                                                  ::transformation.derive.s/newColumnType "text"
+                                                  ::transformation.engine.s/onError "leave-empty"})})
       (is (= ["A" "B" nil] (map :d1 (latest-data dataset-id)))))

     (testing "Basic text transform with drop row on error"
       (apply-transformation {:type :transformation
                              :transformation
                              (gen-transformation :core/derive
-                                                 {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 3"
-                                                  :akvo.lumen.specs.transformation.derive/code "row['foo'].replace('a', 'b')"
-                                                  :akvo.lumen.specs.transformation.derive/newColumnType "text"
-                                                  :akvo.lumen.specs.transformation.engine/onError "delete-row"})})
+                                                 {::transformation.derive.s/newColumnTitle "Derived 3"
+                                                  ::transformation.derive.s/code "row['foo'].replace('a', 'b')"
+                                                  ::transformation.derive.s/newColumnType "text"
+                                                  ::transformation.engine.s/onError "delete-row"})})
       (is (= ["b" "b"] (map :d2 (latest-data dataset-id))))
       ;; Undo this so we have all the rows in the remaining tests
       (apply-transformation {:type :undo}))
@@ -316,10 +313,10 @@
       (apply-transformation {:type :transformation
                              :transformation
                              (gen-transformation :core/derive
-                                                 {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 2"
-                                                  :akvo.lumen.specs.transformation.derive/code "row['foo'].length"
-                                                  :akvo.lumen.specs.transformation.derive/newColumnType "number"
-                                                  :akvo.lumen.specs.transformation.engine/onError "fail"})})
+                                                 {::transformation.derive.s/newColumnTitle "Derived 2"
+                                                  ::transformation.derive.s/code "row['foo'].length"
+                                                  ::transformation.derive.s/newColumnType "number"
+                                                  ::transformation.engine.s/onError "fail"})})
       (is (-> (latest-data dataset-id)
               first
               keys
@@ -331,29 +328,29 @@
       (apply-transformation {:type :transformation
                              :transformation
                              (gen-transformation :core/derive
-                                                 {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 4"
-                                                  :akvo.lumen.specs.transformation.derive/code "row['foo'].toUpperCase()"
-                                                  :akvo.lumen.specs.transformation.derive/newColumnType "text"
-                                                  :akvo.lumen.specs.transformation.engine/onError "leave-empty"})})
+                                                 {::transformation.derive.s/newColumnTitle "Derived 4"
+                                                  ::transformation.derive.s/code "row['foo'].toUpperCase()"
+                                                  ::transformation.derive.s/newColumnType "text"
+                                                  ::transformation.engine.s/onError "leave-empty"})})
       (is (= ["A" "B" nil] (map :d2 (latest-data dataset-id))))

       (apply-transformation {:type :transformation
                              :transformation
                              (gen-transformation :core/derive
-                                                 {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 5"
-                                                  :akvo.lumen.specs.transformation.derive/code "row['Derived 4'].toLowerCase()"
-                                                  :akvo.lumen.specs.transformation.derive/newColumnType "text"
-                                                  :akvo.lumen.specs.transformation.engine/onError "leave-empty"})})
+                                                 {::transformation.derive.s/newColumnTitle "Derived 5"
+                                                  ::transformation.derive.s/code "row['Derived 4'].toLowerCase()"
+                                                  ::transformation.derive.s/newColumnType "text"
+                                                  ::transformation.engine.s/onError "leave-empty"})})
       (is (= ["a" "b" nil] (map :d3 (latest-data dataset-id)))))

     (testing "Date transform"
       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                            (gen-transformation :core/derive
-                                                               {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 5"
-                                                                :akvo.lumen.specs.transformation.derive/code "new Date()"
-                                                                :akvo.lumen.specs.transformation.derive/newColumnType "date"
-                                                                :akvo.lumen.specs.transformation.engine/onError "fail"})})]
+                                                               {::transformation.derive.s/newColumnTitle "Derived 5"
+                                                                ::transformation.derive.s/code "new Date()"
+                                                                ::transformation.derive.s/newColumnType "date"
+                                                                ::transformation.engine.s/onError "fail"})})]
         (is (= tag ::lib/ok))
         (is (every? number? (map :d4 (latest-data dataset-id))))))

@@ -361,50 +358,50 @@
       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                            (gen-transformation :core/derive
-                                                               {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 6"
-                                                                :akvo.lumen.specs.transformation.derive/code "new Date()"
-                                                                :akvo.lumen.specs.transformation.derive/newColumnType "number"
-                                                                :akvo.lumen.specs.transformation.engine/onError "fail"})})]
+                                                               {::transformation.derive.s/newColumnTitle "Derived 6"
+                                                                ::transformation.derive.s/code "new Date()"
+                                                                ::transformation.derive.s/newColumnType "number"
+                                                                ::transformation.engine.s/onError "fail"})})]
         (is (= tag ::lib/conflict))))

     (testing "Sandboxing java interop"
       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                            (gen-transformation :core/derive
-                                                               {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 7"
-                                                                :akvo.lumen.specs.transformation.derive/code "new java.util.Date()"
-                                                                :akvo.lumen.specs.transformation.derive/newColumnType "number"
-                                                                :akvo.lumen.specs.transformation.engine/onError "fail"})})]
+                                                               {::transformation.derive.s/newColumnTitle "Derived 7"
+                                                                ::transformation.derive.s/code "new java.util.Date()"
+                                                                ::transformation.derive.s/newColumnType "number"
+                                                                ::transformation.engine.s/onError "fail"})})]
         (is (= tag ::lib/conflict))))

     (testing "Sandboxing dangerous js functions"
       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                            (gen-transformation :core/derive
-                                                               {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 7"
-                                                                :akvo.lumen.specs.transformation.derive/code "quit()"
-                                                                :akvo.lumen.specs.transformation.derive/newColumnType "number"
-                                                                :akvo.lumen.specs.transformation.engine/onError "fail"})})]
+                                                               {::transformation.derive.s/newColumnTitle "Derived 7"
+                                                                ::transformation.derive.s/code "quit()"
+                                                                ::transformation.derive.s/newColumnType "number"
+                                                                ::transformation.engine.s/onError "fail"})})]
         (is (= tag ::lib/conflict))))

     (testing "Fail early on syntax error"
       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                            (gen-transformation :core/derive
-                                                               {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 8"
-                                                                :akvo.lumen.specs.transformation.derive/code ")"
-                                                                :akvo.lumen.specs.transformation.derive/newColumnType "text"
-                                                                :akvo.lumen.specs.transformation.engine/onError "fail"})})]
+                                                               {::transformation.derive.s/newColumnTitle "Derived 8"
+                                                                ::transformation.derive.s/code ")"
+                                                                ::transformation.derive.s/newColumnType "text"
+                                                                ::transformation.engine.s/onError "fail"})})]
         (is (= tag ::lib/bad-request))))

     (testing "Fail infinite loop"
       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                            (gen-transformation :core/derive
-                                                               {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 9"
-                                                                :akvo.lumen.specs.transformation.derive/code "while(true) {}"
-                                                                :akvo.lumen.specs.transformation.derive/newColumnType "text"
-                                                                :akvo.lumen.specs.transformation.engine/onError "fail"})})]
+                                                               {::transformation.derive.s/newColumnTitle "Derived 9"
+                                                                ::transformation.derive.s/code "while(true) {}"
+                                                                ::transformation.derive.s/newColumnType "text"
+                                                                ::transformation.engine.s/onError "fail"})})]
         (is (= tag ::lib/bad-request))))

@@ -412,19 +409,19 @@
       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                            (gen-transformation :core/derive
-                                                               {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 10"
-                                                                :akvo.lumen.specs.transformation.derive/code "(function() {})()"
-                                                                :akvo.lumen.specs.transformation.derive/newColumnType "text"
-                                                                :akvo.lumen.specs.transformation.engine/onError "fail"})})]
+                                                               {::transformation.derive.s/newColumnTitle "Derived 10"
+                                                                ::transformation.derive.s/code "(function() {})()"
+                                                                ::transformation.derive.s/newColumnType "text"
+                                                                ::transformation.engine.s/onError "fail"})})]
         (is (= tag ::lib/bad-request)))

       (let [[tag _] (apply-transformation {:type :transformation
                                            :transformation
                                            (gen-transformation :core/derive
-                                                               {:akvo.lumen.specs.transformation.derive/newColumnTitle "Derived 11"
-                                                                :akvo.lumen.specs.transformation.derive/code "(() => 'foo')()"
-                                                                :akvo.lumen.specs.transformation.derive/newColumnType "text"
-                                                                :akvo.lumen.specs.transformation.engine/onError "fail"})})]
+                                                               {::transformation.derive.s/newColumnTitle "Derived 11"
+                                                                ::transformation.derive.s/code "(() => 'foo')()"
+                                                                ::transformation.derive.s/newColumnType "text"
+                                                                ::transformation.engine.s/onError "fail"})})]
         (is (= tag ::lib/bad-request))))))

 (deftest ^:functional split-column-test


[#2254] Allow remove columns with isolated txs applied

--- backend/test/akvo/lumen/lib/transformation_test.clj
+++ backend/test/akvo/lumen/lib/transformation_test.clj
@@ -306,20 +306,37 @@
                                       :data (import.s/sample-imported-dataset [:text :number :text :number :text :number :text :number] 2)
                                       :with-job? true})
           dataset-id (:dataset_id dataset)
+          apply-transformation (partial async-tx-apply {:tenant-conn *tenant-conn*} dataset-id)
           dataset (dataset-version-by-dataset-id *tenant-conn* {:dataset-id dataset-id
                                                                 :version 1})
           stored-data (->> (latest-dataset-version-by-dataset-id *tenant-conn*
                                                                  {:dataset-id dataset-id})
                            (get-data *tenant-conn*))]
       (testing "Testing columns are removed without tx"
-        (log/error :job job)
-       (let [updated-res (update-file *tenant-conn* *error-tracker* (:dataset-id job) (:data-source-id job)
-                                      {:kind "clj"
-                                       :with-job? true
-                                       :data (import.s/sample-imported-dataset [:text :number :text :number :text :number] 2)})]
-         (log/error :updated-res updated-res)
-         (is (some? updated-res))))
-      )))
+        (let [updated-res (update-file *tenant-conn* *error-tracker* (:dataset-id job) (:data-source-id job)
+                                       {:kind "clj"
+                                        :with-job? true
+                                        :data (import.s/sample-imported-dataset [:text :number :text :number :text :number] 2)})]
+          (is (some? updated-res))))
+
+      (testing "Removing column with change-datatype tx"
+        (let [_ (apply-transformation (change-datatype-tx "c6" "text"))
+              updated-res (update-file *tenant-conn* *error-tracker* (:dataset-id job) (:data-source-id job)
+                                       {:kind "clj"
+                                        :with-job? true
+                                        :data (import.s/sample-imported-dataset [:text :number :text :number :text] 2)})]
+          (is (some? updated-res))))
+      (testing "Removing column with delete-column tx"
+        (let [_ (apply-transformation {:type :transformation
+                                       :transformation
+                                       (gen-transformation "core/delete-column"
+                                                           {::db.dataset-version.column.s/columnName "c5"
+})})
+              updated-res (update-file *tenant-conn* *error-tracker* (:dataset-id job) (:data-source-id job)
+                                       {:kind "clj"
+                                        :with-job? true
+                                        :data (import.s/sample-imported-dataset [:text :number :text :number] 2)})]
+          (is (some? updated-res)))))))

 (deftest ^:functional derived-column-test
   (let [dataset-id (import-file *tenant-conn* *error-tracker* {:has-column-headers? true


hotfix to get create workspace button to show up

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspaces_list.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspaces_list.cljs
@@ -239,9 +239,7 @@
           :width 500
           :content (render-modal state refs nav-context)}]
         [:div {:style {:padding "2em"}}
-         [:div {:style {:float "right" :display (when (or
-                                                        (not (:workspaces-loaded? @state))
-                                                        (:name selected-ws-id)) "none")}}
+         [:div {:style {:float "right" :display (when (:name selected-ws-id) "none")}}
           [comps/Button
            {:text "Create New Workspace" :style :add
             :onClick #(swap! state assoc :overlay-shown? true)}]]


:bug: Add missing interactions to viewer

--- frontend/src/uxbox/view/ui/viewer/interactions.cljs
+++ frontend/src/uxbox/view/ui/viewer/interactions.cljs
@@ -81,6 +81,7 @@
                      :strokeOpacity "1"
                      :easing (translate-ease easing)
                      :delay delay
+                     :class "itx-displayed"
                      :duration duration}))))

 (defn- run-hide-interaction
@@ -93,7 +94,16 @@
                      :strokeOpacity "0"
                      :easing (translate-ease easing)
                      :delay delay
-                     :duration duration}))))
+                     :class "itx-hidden"
+                     :duration duration}))))
+
+(defn- run-toggle-interaction
+  [{:keys [element easing delay duration
+           animation direction] :as itx}]
+  (let [dom (dom/get-element (str "shape-" element))]
+    (if (= (:class dom) "itx-hidden")
+      (run-show-interaction itx)
+      (run-hide-interaction itx))))

 (defn- run-opacity-interaction
   [{:keys [element opacity easing delay
@@ -129,6 +139,24 @@
                      :duration duration
                      :width resize-width
                      :height resize-height}))))
+
+(defn- run-size-interaction-circle
+  [{:keys [x1 y1 rotation] :as shape}
+   {:keys [resize-width resize-height easing
+           element delay duration direction] :as opts}]
+  (let [{:keys [width height]} (geom/size shape)
+        dom (dom/get-element (str "shape-" element))]
+    (if (= direction :reverse)
+      (animate* dom {:easing (translate-ease easing)
+                     :delay delay
+                     :duration duration
+                     :rx width
+                     :ry height})
+      (animate* dom {:easing (translate-ease easing)
+                     :delay delay
+                     :duration duration
+                     :rx resize-width
+                     :ry resize-height}))))

 (defn- run-size-interaction
   [{:keys [element] :as opts}]
@@ -136,7 +164,8 @@
     (case (:type shape)
       :icon (run-size-interaction-rect shape opts)
       :image (run-size-interaction-rect shape opts)
-      :rect (run-size-interaction-rect shape opts))))
+      :rect (run-size-interaction-rect shape opts)
+      :circle (run-size-interaction-circle shape opts))))

 (defn- run-gotourl-interaction
   [{:keys [url]}]
@@ -188,6 +217,7 @@
     :moveby (run-moveby-interaction itx)
     :show (run-show-interaction itx)
     :hide (run-hide-interaction itx)
+    :toggle (run-toggle-interaction itx)
     :size (run-size-interaction itx)
     :opacity (run-opacity-interaction itx)
     :color (run-color-interaction itx)


Fixed imports in db-spec-test

Fixed imports in db-spec-test

--- test/hurvinek/db_spec_test.clj
+++ test/hurvinek/db_spec_test.clj
@@ -12,7 +12,7 @@

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

 ;
 ; Common functions used by tests.


Add roundtrip test to mem-store

Add roundtrip test to mem-store

--- test/icecap/store/mem_test.clj
+++ test/icecap/store/mem_test.clj
@@ -2,10 +2,13 @@
   (:require [caesium.crypto.util :refer [array-eq]]
             [icecap.store.api :refer :all]
             [icecap.store.mem :refer :all]
-            [icecap.store.test-props :refer [store-roundtrip-prop]]
+            [icecap.store.test-props :refer :all]
             [clojure.test :refer :all]
             [clojure.core.async :as a :refer [<!!]]
             [clojure.test.check.clojure-test :refer [defspec]]))

 (defspec mem-store-roundtrip
   (store-roundtrip-prop (mem-store)))
+
+(defspec mem-store-delete
+  (store-delete-prop (mem-store)))


Lean Map meta operation tests

Lean Map meta operation tests

--- test/clojure/lean_map/test.clj
+++ test/clojure/lean_map/test.clj
@@ -1,6 +1,10 @@
 (ns clojure.lean-map.test
   (:require [clojure.lean-map.util :as lmu]
             [clojure.test :as t]))
+
+(t/deftest meta-operations
+  (t/is (= {:foo :bar} (-> lmu/empty (with-meta {:foo :bar}) meta)))
+  (t/is (= {:foo :bar} (-> lmu/empty (with-meta {:foo :bar}) (assoc :foo :bar) meta))))

 (t/deftest assoc-operations
   (t/is (= :bar (-> lmu/empty (assoc :foo :bar) (get :foo))))


CMR-1405: Moved comment

CMR-1405: Moved comment

--- search-app/src/cmr/search/api/routes.clj
+++ search-app/src/cmr/search/api/routes.clj
@@ -259,9 +259,10 @@
         ;; In this case, the Echo-Token header is used in the GET request.
         (OPTIONS "/" req options-response)
         (GET "/" {params :params headers :headers context :request-context}
-          ;; According to the CMR-1405, a '.native' extension with direct retrieval should behave
-          ;; the same as no extension, so we just strip off '.native' here
           (find-concept-by-cmr-concept-id context
+                                          ;; According to CMR-1405, a '.native' extension with
+                                          ;; direct retrieval should behave the same as no
+                                          ;; extension, so we just strip off '.native' here
                                           (str/replace path-w-extension #"\.native" "")
                                           params
                                           headers)))


Story ID: 0.4.5 ported support viewer to work with changed to 0.4.5

--- src/untangled/support_viewer.cljs
+++ src/untangled/support_viewer.cljs
@@ -63,21 +63,7 @@
                                                          :started-callback
                                                          (fn [{:keys [reconciler]}]
                                                            (load-singleton reconciler `[(:support-request {:id ~(core/get-url-param "id")})]
-                                                             :callback (fn [state]
-                                                                         (swap! state
-                                                                           (fn [s]
-                                                                             (let [req (:support-request @state)
-                                                                                comments (:comment req)
-                                                                                history (:history req)
-                                                                                frames (-> history :steps count)
-                                                                                last-idx (dec frames)]
-                                                                               (core/reset-state! @app (history-entry history last-idx))
-                                                                               (-> s
-                                                                                (dissoc :support-request)
-                                                                                (assoc :comments comments)
-                                                                                (assoc :frames frames)
-                                                                                (assoc :history history)
-                                                                                (assoc :current-position last-idx))))))))))})]
+                                                             :post-mutation 'support-viewer/initialize-history))))})]
     (core/mount viewer SupportViewerRoot support-dom-id)))

 (defn history-step [state delta-fn]
@@ -92,6 +78,25 @@
                            (assoc :client-time tm))))
     (core/reset-state! @application entry)))

+(defmethod m/mutate 'support-viewer/initialize-history [{:keys [state]} k params]
+  {:action
+   (fn []
+     (swap! state
+       (fn [s]
+         (let [req (:support-request @state)
+               app (:application @state)
+               comments (:comment req)
+               history (:history req)
+               frames (-> history :steps count)
+               last-idx (dec frames)]
+           (core/reset-state! @app (history-entry history last-idx))
+           (-> s
+             (dissoc :support-request)
+             (assoc :comments comments)
+             (assoc :frames frames)
+             (assoc :history history)
+             (assoc :current-position last-idx))))))})
+
 (defmethod m/mutate 'support-viewer/step-forward [{:keys [state]} k params] {:action #(history-step state inc)})

 (defmethod m/mutate 'support-viewer/step-back [{:keys [state]} k params] {:action #(history-step state dec)})


Moved stdout redirection into stdout->file macro.

--- src/validation_benchmark/core.clj
+++ src/validation_benchmark/core.clj
@@ -15,6 +15,12 @@

 (def bench-out-path "target/criterium.output")
 (def quick? true)
+
+
+(defmacro stdout->file [fname & body]
+  `(with-open [out# (writer ~fname :append true)]
+      (binding [*out* out#]
+        ~@body)))

 (defn check-results [alternatives inputs results]
@@ -74,9 +80,8 @@
                 criterium/quick-benchmark*
                 criterium/benchmark*)
         opts nil]
-    (with-open [bench-out (writer bench-out-path :append true)]
-      (binding [*out* bench-out]
-        (bench (fn [] (doall (map test-fn test-data))) opts)))))
+    (stdout->file bench-out-path
+      (bench (fn [] (doall (map test-fn test-data))) opts))))

 (defn save-results [results path]


unit test to validate that fk_target_field_id is unset when special_type is set to something other than :fk

--- test/metabase/api/field_test.clj
+++ test/metabase/api/field_test.clj
@@ -95,6 +95,41 @@
               :fk_target_field_id nil})
   ((user->client :crowberto) :put 200 (format "field/%d" (id :venues :latitude)) {:special_type :fk}))

+
+;; when we set the special-type from :fk to something else, make sure fk_target_field_id is set to nil
+(expect
+  [true
+   nil]
+  (tu/with-temp Database [{database-id :id} {:name      "Field Test"
+                                             :engine    :yeehaw
+                                             :details   {}
+                                             :is_sample false}]
+    (tu/with-temp Table [{table-id :id} {:name   "Field Test"
+                                         :db_id  database-id
+                                         :active true}]
+      (tu/with-temp Field [{field-id1 :id} {:table_id    table-id
+                                            :name        "Target Field"
+                                            :base_type   :TextField
+                                            :field_type  :info
+                                            :special_type :id
+                                            :active      true
+                                            :preview_display true
+                                            :position    1}]
+        (tu/with-temp Field [{field-id :id} {:table_id    table-id
+                                             :name        "Field Test"
+                                             :base_type   :TextField
+                                             :field_type  :info
+                                             :special_type :fk
+                                             :fk_target_field_id field-id1
+                                             :active      true
+                                             :preview_display true
+                                             :position    1}]
+          (let [original-val (boolean (db/sel :one :field [Field :fk_target_field_id] :id field-id))]
+            ;; unset the :fk special-type
+            ((user->client :crowberto) :put 200 (format "field/%d" field-id) {:special_type :name})
+            [original-val
+             (db/sel :one :field [Field :fk_target_field_id] :id field-id)]))))))
+
 (expect
   ["Invalid Request."
    nil]


Rabbit tests should not run appropriately when not integrating.

--- test/monocle/rabbitmq_test.clj
+++ test/monocle/rabbitmq_test.clj
@@ -10,17 +10,19 @@

 (def queue "test.foo")

-(def key "foo")
+(def _key "foo")

-(use-fixtures :each (fn [t]
-                      (bind-queue uri exch queue key)
-                      (t)
-                      (delete-queue uri exch queue)
-                      (delete-exchange uri exch)))
+(defmacro with-rabbit [body]
+  `(do
+     (bind-queue uri ~exch ~queue ~_key)
+     ~body
+     (delete-queue ~uri ~exch ~queue)
+     (delete-exchange ~uri ~exch))  )

 (deftest ^{:integration true}
   t-publish
   (testing "make sure we have a connection"
-    (is (= 2 (write-rabbitmq [uri exch key]
-                             (io/reader
-                              (StringReader. "foo\nbar")) 1)))))
+    (with-rabbit
+      (is (= 2 (write-rabbitmq [uri exch _key]
+                               (io/reader
+                                (StringReader. "foo\nbar")) 1))))))


Add point-conversion unit tests for InfluxDB.

--- test/riemann/influxdb_test.clj
+++ test/riemann/influxdb_test.clj
@@ -1,7 +1,7 @@
 (ns riemann.influxdb-test
   (:require
     [clojure.test :refer :all]
-    [riemann.influxdb :refer [influxdb]]
+    [riemann.influxdb :as influxdb]
     [riemann.logging :as logging]
     [riemann.time :refer [unix-time]]))

@@ -9,7 +9,7 @@

 (deftest ^:influxdb-8 ^:integration influxdb-test-8
-  (let [k (influxdb {:block-start true})]
+  (let [k (influxdb/influxdb {:block-start true})]
     (k {:host "riemann.local"
         :service "influxdb test"
         :state "ok"
@@ -17,14 +17,14 @@
         :metric -2
         :time (unix-time)}))

-  (let [k (influxdb {:block-start true})]
+  (let [k (influxdb/influxdb {:block-start true})]
     (k {:service "influxdb test"
         :state "ok"
         :description "all clear, uh, situation normal"
         :metric 3.14159
         :time (unix-time)}))

-  (let [k (influxdb {:block-start true})]
+  (let [k (influxdb/influxdb {:block-start true})]
     (k {:host "no-service.riemann.local"
         :state "ok"
         :description "Missing service, not transmitted"
@@ -33,9 +33,10 @@

 (deftest ^:influxdb-9 ^:integration influxdb-test-9
-  (let [k (influxdb {:version :0.9
-                     :host (System/getenv "INFLUXDB_HOST")
-                     :db "riemann_test"})]
+  (let [k (influxdb/influxdb
+            {:version :0.9
+             :host (System/getenv "INFLUXDB_HOST")
+             :db "riemann_test"})]
     (k {:host "riemann.local"
         :service "influxdb test"
         :state "ok"
@@ -52,3 +53,48 @@
         :description "Missing service, not transmitted"
         :metric 4
         :time (unix-time)})))
+
+
+(deftest point-conversion
+  (is (nil? (influxdb/event->point-9 #{} {:service "foo test", :time 1}))
+      "Event with no metric is converted to nil")
+  (is (= {"name" "test service"
+          "time" "2015-04-07T00:32:45.000Z"
+          "tags" {"host" "host-01"}
+          "fields" {"value" 42.08}}
+         (influxdb/event->point-9
+           #{:host}
+           {:host "host-01"
+            :service "test service"
+            :time 1428366765
+            :metric 42.08}))
+      "Minimal event is converted to point fields")
+  (is (= {"name" "service_api_req_latency"
+          "time" "2015-04-06T21:15:41.000Z"
+          "tags" {"host" "www-dev-app-01.sfo1.example.com"
+                  "sys" "www"
+                  "env" "dev"
+                  "role" "app"
+                  "loc" "sfo1"}
+          "fields" {"value" 0.8025
+                    "description" "A text description!"
+                    "state" "ok"
+                    "foo" "frobble"}}
+         (influxdb/event->point-9
+           #{:host :sys :env :role :loc}
+           {:host "www-dev-app-01.sfo1.example.com"
+            :service "service_api_req_latency"
+            :time 1428354941
+            :metric 0.8025
+            :state "ok"
+            :description "A text description!"
+            :ttl 60
+            :tags ["one" "two" "red"]
+            :sys "www"
+            :env "dev"
+            :role "app"
+            :loc "sfo1"
+            :foo "frobble"}))
+      "Full event is converted to point fields")
+  (is (empty? (influxdb/events->points-9 #{} [{:service "foo test"}]))
+      "Nil points are filtered from result"))


Make sure repo exists

Make sure repo exists

--- test/runbld/test/main_test.clj
+++ test/runbld/test/main_test.clj
@@ -1,8 +1,10 @@
 (ns runbld.test.main-test
   (:require [clojure.test :refer :all]
             [runbld.env :as env]
+            [runbld.opts :as opts]
             [runbld.process :as proc]
             [runbld.publish :as publish]
+            [runbld.vcs.git :as git]
             [runbld.version :as version])
   (:require [runbld.main :as main] :reload-all))

@@ -33,10 +35,15 @@
       (with-redefs [proc/run (fn [& args] (throw
                                            (Exception.
                                             "boy that was unexpected")))]
-        (is (.startsWith (main/-main "-c" "test/runbld.yaml"
-                                     "--job-name" "elastic,proj1,master"
-                                     "/path/to/script.bash")
-                         "#error {\n :cause boy that was "))))))
+        (let [args ["-c" "test/runbld.yaml"
+                    "--job-name" "elastic,proj1,master"
+                    "/path/to/script.bash"]
+              opts (opts/parse-args args)
+              repo (git/init-test-repo (get-in opts [:profiles
+                                                     :elastic-proj1-master
+                                                     :git :remote]))
+              res (apply main/-main args)]
+          (is (.startsWith res "#error {\n :cause boy that was ")))))))

 (deftest execution
   (testing "real execution all the way through"


add tests for merge of stripe-params in create-transfer

--- test/clj/stripe/transfer_test.clj
+++ test/clj/stripe/transfer_test.clj
@@ -56,4 +56,29 @@

           (is (:error (cancel-transfer (:id to-us)))
               "You can't cancel a transaction that's already been
-              submitted."))))))
+              submitted.")
+
+          (let [transfer-a (create-transfer {:amount amt-to-transfer
+                                             :currency "usd"
+                                             :recipient (:id r)
+                                             :expand [:balance_transaction]})
+                transfer-b (create-transfer {:amount amt-to-transfer
+                                             :currency "usd"
+                                             :recipient (:id r)}
+                                            {:stripe-params
+                                             {:expand [:balance_transaction]}})
+                transfer-c (create-transfer {:amount 1000
+                                             :currency "usd"
+                                             :recipient (:id r)}
+                                            {:stripe-params
+                                             {:amount 2000}})
+                remove-id-and-time #(dissoc % :created :source :id :available_on)]
+            (is (= (remove-id-and-time (:balance_transaction transfer-a))
+                   (remove-id-and-time (:balance_transaction transfer-b)))
+                "You can specify the expand parameter in the first or
+                second argument to create-transfer; they're
+                equivalent.")
+            (is (= (:amount transfer-c) 1000)
+                "If you specify the same keyword in the first arg map
+                and the second arg map's stripe params, the value in
+                the first arg map wins.")))))))


Add block comparison test case

Add block comparison test case

--- test/clojure_fabric/core_test.clj
+++ test/clojure_fabric/core_test.clj
@@ -262,6 +262,15 @@
                     (concat (channel/join-channel (user/get-channel org1-admin channel-name) org1-peers genesis-block)
                             (channel/join-channel (user/get-channel org2-admin channel-name) org2-peers genesis-block))))))

+(expect (let [org1-admin (core/get-user "Org1MSP" "admin")]
+          (-> (channel/get-genesis-block (get-in org1-admin [:channels "mychannel"]))
+              (proto/proto->clj (proto/parse-trees :block-transaction))
+              (dissoc :metadata)))
+        (let [org1-admin (core/get-user "Org1MSP" "admin")
+              mychannel (user/get-channel org1-admin "mychannel")]
+          (-> (channel/query-block-by-number mychannel 0)
+              (first)
+              (dissoc :metadata))))
 #_
 (expect true
         (let [admin (core/get-user "Org2MSP" "admin")


fix assertion test for cljs

fix assertion test for cljs

--- test/zombie_run/game_test.cljc
+++ test/zombie_run/game_test.cljc
@@ -31,7 +31,9 @@
   (last (take (inc n) (iterate run-zombie-actions game))))

 (deftest test-action->coords-only-allows-directions
-  (is (thrown? AssertionError (action->coords :foo))))
+  (is (thrown? #?(:clj AssertionError
+                  :cljs js/Error)
+               (action->coords :foo))))

 (deftest test-action->coords-returns-an-action-for-movement
   (is (= [0 1] (action->coords :down))))


WIP: Fixing tests: Renamed to right keyword name

--- test/freecoin/journey/sign_in.clj
+++ test/freecoin/journey/sign_in.clj
@@ -74,7 +74,7 @@
                  (kc/check-page-is :sign-in [ks/auth-form-problems])))

        (fact "Activate account using link"
-             (let [activation-url (-> @emails (first) :activation-url)
+             (let [activation-url (-> @emails (first) :activation-link)
                    activation-id (-> activation-url (clojure.string/split #"/") (last))]
                (-> (k/session test-app)
                    (k/visit (routes/absolute-path :activate-account


Get-tokens test passes.

Get-tokens test passes.

--- test/loudmoauth/authflow_test.clj
+++ test/loudmoauth/authflow_test.clj
@@ -41,13 +41,16 @@
   (testing "Create query data map from provider data."
     (deliver (:code tf/provider-data) "abcdefghijklmn123456789")
     (deliver (:code tf/final-provider-data) "abcdefghijklmn123456789")
-                                            (is (=  tf/test-query-data-auth (create-query-data tf/provider-data)))
+    (is (=  tf/test-query-data-auth (create-query-data tf/provider-data)))
     (is (=  tf/test-query-data-refresh (create-query-data tf/final-provider-data)))))

 ;(deftest test-get-tokens)
 (deftest test-get-tokens
- (testing "Retrieve tokens from authentication server, parse the reply and add the token information to our provider-data,"
-  (with-redefs [http-post-for-tokens (fn [provider-data] tf/test-token-response)]
-   (is (= tf/final-provider-data (get-tokens tf/provider-data))))))
+  (testing "Retrieve tokens from authentication server, parse the reply and add the token information to our provider-data,"
+    (with-redefs [http-post-for-tokens (fn [provider-data] tf/test-token-response)]
+      (get-tokens tf/provider-data)
+   (is (= @(:access_token tf/final-provider-data) @(:access_token tf/provider-data)))
+   (is  (= @(:refresh_token tf/final-provider-data) @(:refresh_token tf/provider-data)))
+   (is (= @(:expires_in tf/final-provider-data) @(:expires_in tf/provider-data))))))

 ;(deftest test-init-and-add-provider)


simplified field base type function declaration

--- test/metabase/test/data/crate.clj
+++ test/metabase/test/data/crate.clj
@@ -59,8 +59,7 @@
   generic/IGenericSQLDatasetLoader
   (merge generic/DefaultsMixin
          {:execute-sql!              generic/sequentially-execute-sql!
-          :field-base-type->sql-type (fn [_ base-type]
-                                       (field-base-type->sql-type base-type))
+          :field-base-type->sql-type (u/drop-first-arg field-base-type->sql-type)
           :pk-sql-type               (constantly "integer")
           :create-db-sql             (constantly nil)
           :add-fk-sql                (constantly nil)


modify formatter test to make clear that we are parsing test cases from the markdown file

--- test/parinfer/formatter-test.cljs
+++ test/parinfer/formatter-test.cljs
@@ -7,11 +7,14 @@

 (def fs (js/require "fs"))

+;; All test cases are parsed from this markdown file.
+(def test-filepath "formatter-test.md")
+
 (defn error-msg
   [line-no msg]
   (str "error at test-case line #" line-no ": " msg))

-(defmulti parse-line
+(defmulti parse-test-line
   (fn [state [line-no line]]
     (cond
       (= "```" line)          :end-block
@@ -19,7 +22,7 @@
       (:block-key state)      :in-block
       :else                   :default)))

-(defmethod parse-line :end-block
+(defmethod parse-test-line :end-block
   [{:keys [block-key test-case test-cases] :as state} [line-no line]]
   (if-not block-key
     (throw (error-msg line-no "opening block must have a name: 'in' or 'out'"))
@@ -35,7 +38,7 @@
         ;; close test block
         (assoc state :block-key nil)))))

-(defmethod parse-line :start-block
+(defmethod parse-test-line :start-block
   [{:keys [block-key test-case test-cases] :as state} [line-no line]]
   (if block-key
     (throw (error-msg line-no "must close previous block before starting new one"))
@@ -57,7 +60,7 @@
             (assoc :block-key block-key)
             (assoc-in [:test-case block-key] {:line-no line-no :text ""}))))))

-(defmethod parse-line :in-block
+(defmethod parse-test-line :in-block
   [{:keys [block-key test-case test-cases] :as state} [line-no line]]
   (let [cursor-x (.indexOf line "|")
         cursor-line (when (and (= :in block-key)
@@ -68,7 +71,7 @@
         (update-in [:test-case block-key :text] str "\n" line)
         (update-in [:test-case block-key :cursor-line] #(or % cursor-line)))))

-(defmethod parse-line :default
+(defmethod parse-test-line :default
   [state [line-no line]]
   state)

@@ -78,7 +81,7 @@
                        :block-key nil ;; :in or :out
                        :test-case {:in nil, :out nil}}
         numbered-lines (map-indexed (fn [line-no line] [(inc line-no) line]) lines)
-        state (reduce parse-line initial-state numbered-lines)]
+        state (reduce parse-test-line initial-state numbered-lines)]

     (when (:block-key state)
       (throw (error-msg "EOF" "code block not closed")))
@@ -89,7 +92,7 @@
     (:test-cases state)))

 (deftest run-test-cases
-  (let [text (.readFileSync fs "formatter-test.md")
+  (let [text (.readFileSync fs test-filepath)
         test-cases (parse-test-cases text)]
     (doseq [{:keys [in out]} test-cases]
       (let [cursor-line (:cursor-line in)]


Fix the unit tests.

Fix the unit tests.

--- test/vignette/storage/s3_test.clj
+++ test/vignette/storage/s3_test.clj
@@ -14,8 +14,7 @@
   (provided
     (safe-get-object ..creds.. "bucket" "a/ab/image.jpg") => {:content ..stream..
                                                               :metadata {:content-length ..length.. :content-type ..content-type..}}
-    (read-byte-stream ..stream.. ..length..) => ..bytes..
-    (sc/create-storage-object ..bytes.. ..content-type.. ..length..) => ..object..)
+    (sc/create-storage-object ..stream.. ..content-type.. ..length..) => ..object..)

   (get-object (create-s3-object-storage ..creds..) "bucket" "a/ab/image.jpg") => falsey
   (provided


create-dots

create-dots

--- examples/lesson-carousel-starter-kit/src/carousel/core.cljs
+++ examples/lesson-carousel-starter-kit/src/carousel/core.cljs
@@ -18,11 +18,18 @@
                (setProperty "textHighlight" "none")
                (setProperty "zIndex" "2")))

+(defn create-dots [root-node]
+  (let [root-dot (.. root-node addChild)]
+    (doseq [i (range 5)]
+      (.. root-dot addChild)))
+  root-dot)
+
 (defn Carousel [selector data]
   (let [context (.. FamousEngine (createScene selector))
         root (.. context addChild)
         back-node (.. root addChild)
         next-node (.. root addChild)
+        dots (create-dots root)

         back (decorate-arrow-node back-node "<")
         next (decorate-arrow-node next-node ">")


update timestamp on timeout

update timestamp on timeout

--- kafka-clj/src/kafka_clj/consumer/work_organiser.clj
+++ kafka-clj/src/kafka_clj/consumer/work_organiser.clj
@@ -106,7 +106,7 @@
         (car/lpush work-queue w-unit))
       (car/wcar redis-conn                  ;we remove the work-unit and push to the working-queue with :tm-count 1
         (car/lrem working-queue -1 w-unit)
-        (car/lpush working-queue -1 (assoc w-unit :tm-count 1))))))
+        (car/lpush working-queue -1 (assoc w-unit :tm-count 1 :ts (System/currentTimeMillis)))))))

 (defn- get-queue-len [redis-conn queue]
   (car/wcar redis-conn (car/llen queue)))


Make recent build results visible again

Make recent build results visible again

Reverts a small change (I don't know why it was made) from the new
signup page which made recent results in the branch list invisible.

--- src-cljs/frontend/components/common.cljs
+++ src-cljs/frontend/components/common.cljs
@@ -112,8 +112,9 @@
 (defn ico [ico-name]
   (let [template (get ico-templates ico-name)]
     (html
-     [:i {:class (str "ico "(name ico-name))}
-      [:svg {:xmlns "http://www.w3.org/2000/svg" :viewBox "0 0 100 100"}
+     [:i {:class "ico"}
+      [:svg {:xmlns "http://www.w3.org/2000/svg" :viewBox "0 0 100 100"
+             :class (name ico-name)}
        (for [path (:paths template)]
          (html [:path {:class (name path) :d (get ico-paths path)}]))]])))


Fix recent colors on shape color picker.

--- frontend/src/uxbox/main/ui/workspace/recent_colors.cljs
+++ frontend/src/uxbox/main/ui/workspace/recent_colors.cljs
@@ -6,17 +6,15 @@
 ;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>

 (ns uxbox.main.ui.workspace.recent-colors
-  (:require [sablono.core :as html :refer-macros [html]]
-            [rum.core :as rum]
-            [lentes.core :as l]
-            [uxbox.util.i18n :refer (tr)]
+  (:require [lentes.core :as l]
             [potok.core :as ptk]
             [uxbox.store :as st]
             [uxbox.main.data.workspace :as dw]
+            [uxbox.main.ui.workspace.base :as wb]
             [uxbox.main.ui.icons :as i]
             [uxbox.util.mixins :as mx :include-macros true]
             [uxbox.util.dom :as dom]
-            [uxbox.main.ui.workspace.base :as wb]))
+            [uxbox.util.i18n :refer (tr)]))

 ;; --- Helpers

@@ -30,35 +28,29 @@
 (defn- calculate-colors
   [shapes]
   (as-> {} $
-    (reduce #(count-color %1 %2 :fill) $ shapes)
-    (reduce #(count-color %1 %2 :stroke) $ shapes)
+    (reduce #(count-color %1 %2 :fill-color) $ shapes)
+    (reduce #(count-color %1 %2 :stroke-color) $ shapes)
     (remove nil? $)
     (sort-by second (into [] $))
     (take 5 (map first $))))

 ;; --- Component

-(defn- recent-colors-render
-  [own {:keys [page id] :as shape} callback]
+(mx/defc recent-colors
+  {:mixins [mx/static mx/reactive]}
+  [{:keys [page id] :as shape} callback]
   (let [shapes-by-id (mx/react wb/shapes-by-id-ref)
         shapes (->> (vals shapes-by-id)
                     (filter #(= (:page %) page)))
         colors (calculate-colors shapes)]
-    (html
-     [:div
-      [:span (tr "ds.recent-colors")]
-      [:div.row-flex
-       (for [color colors]
-         [:span.color-th {:style {:background-color color}
-                          :key color
-                          :on-click (partial callback color)}])
-       (for [i (range (- 5 (count colors)))]
-         [:span.color-th {:key (str "empty" i)}])
-       [:span.color-th.palette-th i/picker]]])))
+    [:div
+     [:span (tr "ds.recent-colors")]
+     [:div.row-flex
+      (for [color colors]
+        [:span.color-th {:style {:background-color color}
+                         :key color
+                         :on-click (partial callback color)}])
+      (for [i (range (- 5 (count colors)))]
+        [:span.color-th {:key (str "empty" i)}])
+      [:span.color-th.palette-th i/picker]]]))

-(def recent-colors
-  (mx/component
-   {:render recent-colors-render
-    :name "recent-colors"
-    :mixins [mx/static mx/reactive]}))
-


pass permissions to submit task (#758)

pass permissions to submit task (#758)

--- src/cljs/main/broadfcui/page/workspace/summary/catalog/wizard.cljs
+++ src/cljs/main/broadfcui/page/workspace/summary/catalog/wizard.cljs
@@ -215,7 +215,7 @@
           (let [save-permissions (or editable? can-share?)
                 last-page (> page-num (-> library-schema :wizard count))]
             [comps/Button {:text (if published? "Republish" "Submit")
-                           :onClick #(react/call :submit this)
+                           :onClick #(react/call :submit this editable? set-discoverable?)
                            :disabled? (not (and save-permissions last-page))
                            :style {:width 80}}]))]]))
    :component-did-mount


revert change 8073

revert change 8073

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -139,7 +139,7 @@
   (TaggedImage. (:pix annotated-img) (JSONObject. (:tags annotated-img))))

 ;; hardware error handling
-"
+
 (defmacro successful? [& body]
   `(try (do ~@body true)
      (catch Exception e#
@@ -236,14 +236,12 @@

 (defn load-slice-sequence [slice-sequence relative-z]
   (when slice-sequence
-    (println slice-sequence relative-z)
     (let [z (core getFocusDevice)
           ref (@state :reference-z)
           adjusted-slices (vec (if relative-z
                                  (map #(+ ref %) slice-sequence)
                                  slice-sequence))
           new-seq (not= [z adjusted-slices] @active-slice-sequence)]
-      (println "adjusted-slices: " adjusted-slices ";" "reference-z" (@state :reference-z))
       (when new-seq
         (core loadStageSequence z (double-vector adjusted-slices)))
       (reset! active-slice-sequence [z adjusted-slices])
@@ -261,7 +259,6 @@

 (defn init-burst [length trigger-sequence relative-z]
   (core setAutoShutter (@state :init-auto-shutter))
-  (println "autoshutter:" (core getAutoShutter))
   (load-property-sequences (:properties trigger-sequence))
   (let [absolute-slices (load-slice-sequence (:slices trigger-sequence) relative-z)]
     (start-property-sequences (:properties trigger-sequence))
@@ -280,7 +277,7 @@
     {:pix pix :tags (dissoc tags "StartTime-ms")}))

 (defn make-multicamera-events [event]
-  (let [num-camera-channels (core getNumberOfCameraChannels)]
+  (let [num-camera-channels (long (core getNumberOfCameraChannels))]
     (for [camera-channel (range num-camera-channels)]
       (let [super-channel-index (+ camera-channel (* num-camera-channels (event :channel-index)))]
         (assoc event :channel-index super-channel-index
@@ -302,30 +299,26 @@
                 (swap! state assoc
                        :burst-time-offset (- (elapsed-time @state)
                                              (core-time-from-tags (image :tags)))))
-              (println (image+ :tags))
+              ;(println (image+ :tags))
               (.put out-queue (make-TaggedImage (annotate-image image+ evt @state
                                                                 (burst-time (:tags image) @state)))))
             (when (core isBufferOverflowed)
               (swap! state assoc :stop true)
               (ReportingUtils/showError "Circular buffer overflowed."))))
-        (flatten (map make-multicamera-events) (event :burst-data)))))
+        (flatten (map make-multicamera-events (event :burst-data))))))
   (while (and (not (@state :stop)) (. mmc isSequenceRunning))
     (Thread/sleep 5)))

 (defn collect-snap-image [event out-queue]
-  (log "collect-snap-image")
-  (doall
-    (for [event1 (make-multicamera-events event)]
-      (let [image
-            {:pix (core getImage (event1 :camera-channel-index))
-             :tags nil}]
-        (log "collect-snap-image: "
-             (select-keys event [:position-index :frame-index
-                                 :slice-index :channel-index]))
-        (when out-queue
-          (.put out-queue
-                (make-TaggedImage (annotate-image image event1 @state (elapsed-time @state)))))
-        image))))
+  (let [image
+        {:pix (core getImage)
+         :tags nil}]
+    (select-keys event [:position-index :frame-index
+                        :slice-index :channel-index])
+    (when out-queue
+      (.put out-queue
+            (make-TaggedImage (annotate-image image event @state (elapsed-time @state)))))
+    image))

 (defn return-config []
   (dorun (map set-property
@@ -486,7 +479,7 @@
              (recall-z-reference current-position))
           #(when-let [wait-time-ms (:wait-time-ms event)]
              (acq-sleep wait-time-ms))
-          #(when (:autofocus event)
+          #(when (get event :autofocus)
              (run-autofocus))
           #(when check-z-ref
              (store-z-reference current-position))
@@ -522,6 +515,7 @@
 ;; generic metadata

 (defn convert-settings [^SequenceSettings settings]
+  (def seqSettings settings)
   (-> settings
     (data-object-to-map)
     (rekey
@@ -559,14 +553,14 @@
                 (:properties channel)))
             default-cam)]
     (set-property chan-cam)
-    (let [n (int (core getNumberOfComponents))]
+    (let [n (long (core getNumberOfComponents))]
       (set-property default-cam)
       (get {1 1 , 4 3} n))))

 (defn make-summary-metadata [settings]
-  (let [depth (int (core getBytesPerPixel))
+  (let [depth (core getBytesPerPixel)
         channels (settings :channels)
-        num-camera-channels (core getNumberOfCameraChannels)
+        num-camera-channels (long (core getNumberOfCameraChannels))
         super-channels (flatten (for [channel channels] (repeat num-camera-channels channel)))]
      (JSONObject. {
       "BitDepth" (core getImageBitDepth)
@@ -633,10 +627,7 @@
 		cache (doto (MMImageCache. (TaggedImageStorageRam. summary-metadata))
 						(.setSummaryMetadata summary-metadata))]
 		(doto (VirtualAcquisitionDisplay. cache nil)
-                           (.promptToSave false)
-                            (.setChannelDisplayRange 0 0 256)
-                            (.setChannelDisplayRange 1 0 256)
-                            (.setChannelDisplayRange 2 0 256))))
+                           (.promptToSave false))))

 (defn create-basic-event []
   {:position-index 0, :position nil,
@@ -661,7 +652,7 @@
   (let [myTaggedImage (make-TaggedImage tagged-img)
         cache (.getImageCache display)]
     (.putImage cache myTaggedImage)
-    (.showImage display (. myTaggedImage tags) true false)
+    (.showImage display myTaggedImage)
     (when focus
       (.show display))))

@@ -702,7 +693,7 @@
                                   this-time (System/currentTimeMillis)
                                   dt (- 33 (- this-time last-time))]
                               (if first-image (reset-snap-window img)  )
-                              (Thread/sleep (max 0 dt))
+                              (Thread/sleep (max 0 dt))
                               (if (.windowClosed @snap-window)
                                 (edt (.enableLiveMode gui false))
                                 (show-image @snap-window img first-image)  )
@@ -810,8 +801,6 @@
   (doto
     (proxy [AcquisitionWrapperEngine] []
       (runPipeline [^SequenceSettings settings]
-        (println "ss positions: " (.size (.positions settings)))
-        (println "position-count: " (.getNumberOfPositions (.getPositionList gui)))
         (-run settings this)
     (.setCore mmc (.getAutofocusManager gui))
     (.setParentGUI gui)


limit conferences and ratings | fixes #54

--- src/clj/conference_rating/db_handler.clj
+++ src/clj/conference_rating/db_handler.clj
@@ -29,7 +29,7 @@
     (clear-id-in-doc document)))

 (defn get-conferences-list [db]
-  (let [list (mc/find-maps db "conferences")]
+  (let [list (mc/find-maps db "conferences" {:limit 100})]
     (map clear-id-in-doc list)))

 (defn get-conference [id db]
@@ -43,7 +43,7 @@
     valid))

 (s/defn ^:always-validate get-ratings :- [schemas/Rating] [conference-id db]
-  (let [rating-list (mc/find-maps db "ratings" {:conference-id conference-id})
+  (let [rating-list (mc/find-maps db "ratings" {:conference-id conference-id :limit 100})
         cleared-ratings (->> rating-list
                              (map clear-id-in-doc)
                              (map schemas/coerce-rating)


Knivbyen

Knivbyen

--- src/clj/mokkameister/resources/slack.clj
+++ src/clj/mokkameister/resources/slack.clj
@@ -48,6 +48,7 @@
     (train ":coffee:" ":hocho:")
     (train ":coffee:" ":timwendelboe:")
     (train ":coffee:" ":jan-richter:")
+    (train ":syringe:" ":hocho:")
     ":steam_locomotive::coffee::coffee::running::running::running::dash:"
     "All aboard the coffee train\n:steam_locomotive::coffee::coffee::running::running::running::dash:"
     "Det er kaffi å få på kjøken!"


move request-animation-frame stuff into utils. Its not pixi specific.

--- src/cljs/infinitelives/utils/events.cljs
+++ src/cljs/infinitelives/utils/events.cljs
@@ -152,3 +152,76 @@
 "
   [code]
   (@key-state (key-codes code)))
+
+;;
+;; Animation handler
+;;
+(defn make-request-animation-frame
+  "compose a function that is the r-a-f func. returns a function. This returned function takes a callback and ensures
+  its called next frame"
+  []
+  (cond
+   (.-requestAnimationFrame js/window)
+   #(.requestAnimationFrame js/window %)
+
+   (.-webkitRequestAnimationFrame js/window)
+   #(.webkitRequestAnimationFrame js/window %)
+
+   (.-mozRequestAnimationFrame js/window)
+   #(.mozRequestAnimationFrame js/window %)
+
+   (.-oRequestAnimationFrame js/window)
+   #(.oRequestAnimationFrame js/window %)
+
+   (.-msRequestAnimationFrame js/window)
+   #(.msRequestAnimationFrame js/window %)
+
+   :else
+   #(.setTimeout js/window % (/ 1000 *target-fps*))))
+
+;; build the actual function
+(def
+  ^{:arglist '([callback])
+    :doc "schedules the passed in callback to be fired once, next animation frame."}
+  request-animation-frame (make-request-animation-frame))
+
+(defn next-frame
+  "returns a single use channel which closes on next frame callback.
+  pulling from it waits exactly one frame. eg
+
+  ```
+  ;; wait one frame
+  (<! (next-frame))
+  ```"
+  []
+  (let [c (chan)]
+    (request-animation-frame #(close! c))
+    c))
+
+(defn wait-frames
+  "returns a channel which closes when a certain number
+  of frames have passed. eg
+
+  ```
+  ;; wait 10 frames
+  (<! (wait-frames 10))
+  ```"
+  [frames]
+  (go
+    (loop [i frames]
+      (when (pos? i)
+        (<! (next-frame))
+        (recur (dec i))))))
+
+(defn wait-time
+  "returns a channel which closes when a certain amount of
+  time in milliseconds has passed, but determines that time by counting
+  the requestAnimationFrame callbacks, so that when tab focus is lost,
+  the callback, and thus this wait is suspended.
+
+  ```
+  ;; wait one seconds worth of frames
+  (<! (wait-time 1000))
+  ```"
+  [delay]
+  (wait-frames (* 60 (/ delay 1000))))


Lowered log level

Lowered log level

--- src/clojure/staircase/routes/service.clj
+++ src/clojure/staircase/routes/service.clj
@@ -5,7 +5,7 @@
         staircase.helpers
         ring.util.response)
   (:require
-            [clojure.tools.logging :refer (info)]
+            [clojure.tools.logging :refer (info debug)]
             [devlin.table-utils :refer (full-outer-join)]
             [clj-http.client :as client]
     ))
@@ -15,7 +15,7 @@
   (let [http-conf {:as :json :throw-exceptions false}
         token-coords [:body :token]
         session-url  (str (:root service) "/session")]
-    (info "Registering for" service session-url)
+    (debug "Registering for" service session-url)
     (-> session-url
         (client/get http-conf)
         (get-in token-coords))))


Small tweak to alternation code; shouldn't change behavior

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -164,7 +164,7 @@
                             result-genome []]
                        (if (or (>= i (count (if use-s1 s1 s2))) ;; finished current program
                                (> (count result-genome) (* 2 max-points))) ;; runaway growth
-                         (apply list result-genome);; Return
+                         (seq result-genome);; Return, converting back into a sequence
                          (if (< (lrand) alternation-rate)
                            (recur (max 0 (+' i (Math/round (*' alignment-deviation (gaussian-noise-factor)))))
                                   (not use-s1)


Start translating protocol schema to spec

--- src/com/frereth/common/communication.clj
+++ src/com/frereth/common/communication.clj
@@ -2,6 +2,7 @@
   "This is really about higher-level messaging abstractions"
   (:require [cljeromq.common :as mq-cmn]
             [cljeromq.core :as mq]
+            [clojure.spec :as s]
             [com.frereth.common.schema :as fr-sch]
             [com.frereth.common.util :as util]
             [hara.event :refer (raise)]
@@ -33,6 +34,20 @@
               ;; for including them both.
               ;; And sticking GET params in the URL has always seemed pretty suspect
               (s2/optional-key :body) s2/Str})
+
+(s/def ::major int?)
+(s/def ::minor int?)
+(s/def ::detail string?)
+(s/def ::version (s/keys :req [::major ::minor::detail]))
+(s/def ::protocol #{::lolcatz})
+(s/def ::header-key (s/or :name string?
+                          :keyed keyword?
+                          :symbol symbol?))
+(s/def ::headers (s/map-of ::header-key (complement nil?)))
+;;; Note that it really *is* pretty inefficient to include the boilerplate with every request.
+;;; Should really just negotiate the protocol version during the initial handshake.
+(s/def ::request (s/keys :req [::version ::protocol]
+                         :opt [::headers]))

 (def router-message
   "The contents are byte-arrays? Really??


Use pmap to build the response in parallel

--- src/main/hbase_region_inspector/core.clj
+++ src/main/hbase_region_inspector/core.clj
@@ -220,7 +220,7 @@
                   (fn [regions] (sort-by score-fn regions))
                   (fn [regions] (sort-by (comp vec reverse score-fn) regions)))
         ;; Sort the regions in each server
-        grouped (map #(update % :regions sort-fn) grouped)
+        grouped (pmap #(update % :regions sort-fn) grouped)
         ;; Find the local sum of the metric of each region
         grouped (map #(assoc % :sum (reduce + (filter pos? (map metric (:regions %)))))
                      grouped)


Simplify default :on-error.

Simplify default :on-error.

--- web/src/immutant/web/async.clj
+++ web/src/immutant/web/async.clj
@@ -225,7 +225,7 @@
    * :on-error - `(fn [throwable] ...)` - Called when an error occurs on the send.
      If the error requires the channel to be closed, the [[as-channel]] :on-close
      callback will also be invoked. If this callback throws an exception, it will be
-     reported to the [[as-channel]] :on-error callback [`#(when % (throw %))`]
+     reported to the [[as-channel]] :on-error callback [`#(throw %)`]

    Returns nil if the channel is closed when the send is initiated, true
    otherwise. If the channel is already closed, :on-success won't be


Use configurator to avoid AbstractMethodError, thx Ben/Toby

--- web/src/immutant/web/javax.clj
+++ web/src/immutant/web/javax.clj
@@ -19,7 +19,7 @@
   (:require [ring.util.servlet :as ring])
   (:import [javax.servlet.http HttpServlet HttpServletRequest]
            [javax.websocket Endpoint MessageHandler$Whole]
-           [javax.websocket.server ServerEndpointConfig$Builder]))
+           [javax.websocket.server ServerEndpointConfig$Builder ServerEndpointConfig$Configurator]))

 (defn create-servlet
   "Encapsulate a ring handler within a servlet's service method"
@@ -51,9 +51,13 @@
       (proxy-super init servlet-config)
       (let [context (.getServletContext servlet-config)
             path (.getContextPath context)
+            container (.getAttribute context "javax.websocket.server.ServerContainer")
             endpoint (create-endpoint callbacks)
-            config (.build (ServerEndpointConfig$Builder/create (class endpoint) path))
-            container (.getAttribute context "javax.websocket.server.ServerContainer")]
+            config (.. ServerEndpointConfig$Builder
+                     (create (class endpoint) path)
+                     (configurator (proxy [ServerEndpointConfig$Configurator] []
+                                     (getEndpointInstance [c] endpoint)))
+                     build)]
         (.addEndpoint container config)))
     (service [request response]
       (if-let [fallback (and fallback (ring/make-service-method fallback))]


Bugfix for kv-reduce on lazy maps

Bugfix for kv-reduce on lazy maps

Previously, the arguments were out of order because of the confusing
discrepancy between the argument order in kv-reduce and IKVReduce. This
caused odd errors when invoking kv-reduce on a lazy map.

--- cortex/src/cortex/util.cljc
+++ cortex/src/cortex/util.cljc
@@ -289,7 +289,7 @@

   clojure.lang.IKVReduce
   (kvreduce [this f init]
-    (reduce-kv (map-vals force contents) f init))
+    (reduce-kv f init (into {} this)))

   clojure.lang.ILookup
   (valAt [this k]


remove unused imports (#69)

remove unused imports (#69)

--- waiter/src/waiter/security.clj
+++ waiter/src/waiter/security.clj
@@ -8,10 +8,7 @@
 ;;       The copyright notice above does not evidence any
 ;;       actual or intended publication of such source code.
 ;;
-(ns waiter.security
-  (:require [clj-time.core :as t]
-            [clojure.core.cache :as cache]
-            [waiter.utils :as utils]))
+(ns waiter.security)

 (defprotocol EntitlementManager
   "Security related methods"


Removed para in call to info method (forgot in previous commit).

--- src/app/core.clj
+++ src/app/core.clj
@@ -65,7 +65,7 @@

 (defn run-linter-mode [opts]
   (when (not (:dir opts))
-    (info opts "Linter, no directory indicated. Using current directory")
+    (info "Linter, no directory indicated. Using current directory")
     (linter ".")
     (System/exit 0))
   (linter (:dir opts))


v1.12.2

--- build.boot
+++ build.boot
@@ -9,7 +9,7 @@
 	'[adzerk.bootlaces :refer :all]
 	'[cljsjs.boot-cljsjs.packaging :refer :all])

-(def +ver+ "1.10.2")
+(def +ver+ "1.12.2")
 (def +version+ (str +ver+ "-SNAPSHOT"))
 (bootlaces! +version+)


Update re-console - nil fix

Update re-console - nil fix


pluging in boot-check

pluging in boot-check

--- build.boot
+++ build.boot
@@ -25,6 +25,7 @@
                   [adzerk/bootlaces       "0.1.13"          :scope "test"]
                   [adzerk/boot-logservice "1.0.1"           :scope "test"]
                   [adzerk/boot-test       "1.0.6"           :scope "test"]
+                  [tolitius/boot-check    "0.1.0-SNAPSHOT"  :scope "test"]

                   ;; boot cljs
                   [adzerk/boot-cljs            "1.7.170-3"       :scope "test"]
@@ -42,8 +43,9 @@
          '[adzerk.boot-cljs :refer [cljs]]
          '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
          '[adzerk.boot-reload :refer [reload]]
+         '[tolitius.boot-check :as check]
+         '[tolitius.boot-stripper :refer [strip-deps-attr]]
          '[pandeiro.boot-http :refer :all]
-         '[tolitius.boot-stripper :refer [strip-deps-attr]]
          '[crisptrutski.boot-cljs-test :as tcs]
          '[clojure.tools.logging :as log]
          '[clojure.tools.namespace.repl :refer [set-refresh-dirs]])
@@ -90,6 +92,11 @@
   (comp
     (cljs :optimizations :advanced :ids #{"mount"})))

+(deftask check-sources []
+  (set-env! :source-paths #(conj % "dev/clj" "dev/cljs" "test/core" "test/clj" "test/cljs"))
+  (comp
+    (check/with-kibit)))
+
 (deftask cljs-dev
   "mount cljs dev example"
   []


Don't Speak.

Don't Speak.

I know what you're thinking.

I don't need your reasons.

Don't tell me 'cause it hurts.

--- build.boot
+++ build.boot
@@ -40,7 +40,7 @@

 (deftask test [] ;; the tests rely on having the jar kicking about!
   (testing)
-  (comp (target) (speak) (boot-test/test)))
+  (comp (target) (boot-test/test)))

 (deftask autotest []
   (comp (watch) (test)))


bump dep versions

bump dep versions

--- build.boot
+++ build.boot
@@ -3,11 +3,11 @@
  #{"src/clj" "src/cljs"}

  :dependencies
- '[[org.clojure/clojurescript "0.0-3308"]
-   [pandeiro/boot-http        "0.6.3-SNAPSHOT"]
+ '[[org.clojure/clojurescript "1.7.48"]
+   [pandeiro/boot-http        "0.6.3"]
    [kovasb/gamma              "0.0-135"]
    [kovasb/gamma-driver       "0.0-49"]
-   [adzerk/boot-cljs          "0.0-3308-0"]
+   [adzerk/boot-cljs          "1.7.48-SNAPSHOT"]
    [adzerk/boot-cljs-repl     "0.1.10-SNAPSHOT"]
    [adzerk/boot-reload        "0.3.1"]])


#97: self hosted 0.1.13-SNAPSHOT

#97: self hosted 0.1.13-SNAPSHOT

--- build.boot
+++ build.boot
@@ -1,4 +1,4 @@
-(def +version+ "0.1.12")
+(def +version+ "0.1.13-SNAPSHOT")

 (set-env!
   :source-paths #{"src"}


Integrate boot-test into build steps

Integrate boot-test into build steps

--- build.boot
+++ build.boot
@@ -88,7 +88,7 @@
             ))

 (require
- '[adzerk.boot-test      :as boot-test]
+ '[adzerk.boot-test      :refer [test] :rename {test test-clj}]
  '[adzerk.boot-cljs      :refer [cljs]]
  '[adzerk.boot-cljs-repl :refer [cljs-repl-env start-repl]]
  '[adzerk.boot-reload    :refer [reload]]
@@ -172,10 +172,14 @@

 (deftask test []
   (comp (testing)
+        (development)
+        (test-clj)
         (test-cljs :js-env :phantom
                    :exit?  true)))

 (deftask auto-test []
   (comp (testing)
+        (development)
         (watch)
+        (test-clj)
         (test-cljs :js-env :phantom)))


Remove old require from demo site code

Remove old require from demo site code

--- prerender/sitetools/prerender.cljs
+++ prerender/sitetools/prerender.cljs
@@ -5,7 +5,6 @@
             [reagent.core :as r]
             [reagent.dom.server :as server]
             [reagent.debug :refer-macros [dbg log dev?]]
-            [reagent.interop :as i :refer-macros [$ $!]]
             [sitetools.core :as tools]

             ;; Node libs


Changed indentation for CSS styles

Changed indentation for CSS styles

--- src/om_navigate/screens/custom-tabs.cljs
+++ src/om_navigate/screens/custom-tabs.cljs
@@ -4,16 +4,16 @@
             [om-navigate.navigate :as nav]
             [om-navigate.screens.sample-text :refer [SampleText]]))

-(def styles {:container     {:marginTop      20}
-             :tab-container {:flexDirection  "row"
-                             :height         40}
-             :tab           {:flex           1
-                             :alignItems     "center"
-                             :justifyContent "center"
-                             :margin         4
-                             :borderWidth    1
-                             :borderColor    "#ddd"
-                             :borderRadius   4}})
+(def styles {:container {:marginTop 20}
+             :tab-container {:flexDirection "row"
+                             :height 40}
+             :tab {:flex 1
+                   :alignItems "center"
+                   :justifyContent "center"
+                   :margin 4
+                   :borderWidth 1
+                   :borderColor "#ddd"
+                   :borderRadius 4}})

 (def sample-text (om/factory SampleText))


license

license

--- src/aws/model.clj
+++ src/aws/model.clj
@@ -1,3 +1,14 @@
+(comment
+  Celestial, Copyright 2012 Ronen Narkis, narkisr.com
+  Licensed under the Apache License,
+  Version 2.0  (the "License") you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.)
+
 (ns aws.model
   (:use [flatland.useful.map :only  (dissoc-in*)]
         [celestial.model :only (clone)])


Improve error reporting when a ugen with an argument with mode :num-outs isn't passed a number (i.e. a control proxy).

--- src/overtone/sc/machinery/ugen/specs.clj
+++ src/overtone/sc/machinery/ugen/specs.clj
@@ -203,11 +203,18 @@
     ;;simply return the ugen if there's no problem with rates
     ugen))

+(defn- ensure-num-out-arg-is-number!
+  [val ug]
+  (when-not (number? val)
+    (throw (IllegalArgumentException. (str "Argument for ugen " (:name ug) " must be a number, yet found: " (with-out-str (pr val)))))))
+
 (defn- with-num-outs-mode [spec ugen]
   (let [args-specs    (args-with-specs (:args ugen) spec :mode)
         [args n-outs] (reduce (fn [[args n-outs] [arg mode]]
                                 (if (= :num-outs mode)
-                                  [args arg]
+                                  (do
+                                    (ensure-num-out-arg-is-number! arg ugen)
+                                    [args arg])
                                   [(conj args arg) n-outs]))
                               [[] (:n-outputs ugen)]
                               args-specs)]


Refactored def with fn to defn-

Refactored def with fn to defn-

--- search-app/src/cmr/search/data/query_to_elastic.clj
+++ search-app/src/cmr/search/data/query_to_elastic.clj
@@ -63,17 +63,17 @@
                  query-string-reserved-characters-regex
                  "\\\\$1")))

-(def keywords-in-condition
+(defn- keywords-in-condition
   "Returns a list of keywords if the condition contains a keyword condition or nil if not."
-  (fn [condition]
-    (when (not= (type condition) cmr.search.models.query.NegatedCondition)
-      (or (when (= :keyword (:field condition))
-            (str/split (str/lower-case (:query-str condition)) #" "))
-          ;; Call this function recursively on nested conditions, e.g., AND or OR conditions.
-          (when-let [conds (:conditions condition)]
-            (some #(keywords-in-condition %1) conds))
-          ;; Call this function recursively for a single nested condition.
-          (when-let [con (:condition condition)] (keywords-in-condition con))))))
+  [condition]
+  (when (not= (type condition) cmr.search.models.query.NegatedCondition)
+    (or (when (= :keyword (:field condition))
+          (str/split (str/lower-case (:query-str condition)) #" "))
+        ;; Call this function recursively on nested conditions, e.g., AND or OR conditions.
+        (when-let [conds (:conditions condition)]
+          (some #(keywords-in-condition %1) conds))
+        ;; Call this function recursively for a single nested condition.
+        (when-let [con (:condition condition)] (keywords-in-condition con)))))

 (defn- keywords-in-query
   "Returns a list of keywords if the query contains a keyword condition or nil if not.


Filtered additional 3rd party packages

Filtered additional 3rd party packages

--- src/alfresco_technical_validation/binary_validation.clj
+++ src/alfresco_technical_validation/binary_validation.clj
@@ -166,6 +166,9 @@
                            AND NOT(n.package =~ 'com.license4j.*')
                            AND NOT(n.package =~ 'com.aspose.*')
                            AND NOT(n.package =~ 'asposewobfuscated.*')
+                           AND NOT(n.package =~ 'groovy.*')
+                           AND NOT(n.package =~ 'org.gradle.*')
+                           AND NOT(n.package =~ 'proguard.*')
                         RETURN DISTINCT n.package AS PackageName
                          ORDER BY PackageName
                        ")
@@ -359,6 +362,9 @@
                            AND NOT(n.package =~ 'com.license4j.*')
                            AND NOT(n.package =~ 'com.aspose.*')
                            AND NOT(n.package =~ 'asposewobfuscated.*')
+                           AND NOT(n.package =~ 'groovy.*')
+                           AND NOT(n.package =~ 'org.gradle.*')
+                           AND NOT(n.package =~ 'proguard.*')
                            AND HAS(m.name)
                            AND m.name IN [
                                            'org.alfresco.service.cmr.search.ResultSet',


Remove unnecessary binding.

Remove unnecessary binding.

--- src/buzz/core.clj
+++ src/buzz/core.clj
@@ -8,13 +8,16 @@

 (defn default-update-ex
   "Default exception handler for update-fn."
+  #_(try
+      (throw (NullPointerException. "Oh no"))
+      (catch Exception ex
+        (default-update-ex "Msg" ex)))
   [msg ex]
   (let [err-msg (str
                  "Error occured while handling message.\n"
                  "  Event: " (with-out-str (pp/pprint msg) "\n")
                  "  Error: " (with-out-str (.printStackTrace ex (PrintWriter. *out*))))]
-    (binding [*out* *err*]
-      (.println *err* err-msg))))
+    (.println *err* err-msg)))

 (defn- handle-msg
   "Handles messages."


CMR-2146: Renamed validation

CMR-2146: Renamed validation

--- metadata-db-app/src/cmr/metadata_db/services/concept_validations.clj
+++ metadata-db-app/src/cmr/metadata_db/services/concept_validations.clj
@@ -134,7 +134,7 @@
   "Validates a concept. Throws an error if invalid."
   (util/build-validator :invalid-data default-concept-validation))

-(def validate-concept-no-provider
+(def validate-tag-concept
   "validates a tag concept. Throws an error if invalid."
   (util/build-validator :invalid-data tag-concept-validation))

@@ -149,8 +149,7 @@

 (defmethod validate-concept :tag
   [concept]
-  ;; tags never have a provider-id
-  (validate-concept-no-provider concept))
+  (validate-tag-concept concept))

 (defmethod validate-concept :access-group
   [concept]


Disable login button when input is missing

--- frontend/src/cruncher/views.cljs
+++ frontend/src/cruncher/views.cljs
@@ -101,7 +101,7 @@
                         (apply dom/tbody nil
                                (map #(poketable-entry (lib/merge-react-key %)) (lib/inventory-pokemon))))
              #_(let [jquery (js* "$")]
-               (.stickyTableHeaders (jquery "#poketable"))))))
+                 (.stickyTableHeaders (jquery "#poketable"))))))
 (def poketable (om/factory PokeTable {}))

@@ -150,6 +150,16 @@
                                        :onClick #(commit-component-state this :service "ptc")
                                        :name    "google-ptc-switch"})
                        "Pokemon Trainer Club")))
+
+(defn validate-login-button
+  "Show Login button and disable it when one of these fields is empty."
+  [email password location service]
+  (let [not-empty? (and
+                     (pos? (count email))
+                     (pos? (count password))
+                     (pos? (count location))
+                     (pos? (count service)))]
+    (vlib/button-primary #(auth/login email password location service) not-empty? "Login")))

 (defui Login
   Object
@@ -187,7 +197,7 @@
                                                             :value       location
                                                             :placeholder "Düsseldorf, Germany"}))
                                    (google-ptc-switch this)
-                                   (vlib/button-primary #(auth/login email password location service) "Login"))))))))
+                                   (validate-login-button email password location service))))))))
 (def login (om/factory Login))

 (defn view-dispatcher