Missing delete and tags, otherwise set

Missing delete and tags, otherwise set

--- src/ardoq/swagger/update_swagger2.clj
+++ src/ardoq/swagger/update_swagger2.clj
@@ -30,55 +30,73 @@
           {}
           definitions))

-(defn update-references [client operation]
-  "random return")
-
-(defn create-operation [client {parent :component} {_id :_id :as model} wid path methods tags defs]
+(defn create-or-update-operation [client {parent :component} {_id :_id :as model} wid path methods tags defs resource components]
+  (doseq [child (:children parent)]
+    ;;We need to find if the name of the children parent and check if they fit with path+method
+    ;;If we got a child thats ont in the path+method list it should get deleted.
+    ;;Something link filtering the list of childs towards components then checking the name of each towards methods.
+    "This"
+    )
   (doall (keep
           (fn [[method-name method]]
             (if (not (= method-name (keyword "parameters")))
-              (-> (api/map->Component {:name (str (name path) "/" (name method-name))
-                                       :description (common/generate-operation-description method defs)
-                                       :rootWorkspace (str wid)
-                                       :model _id
-                                       :parent (:_id parent)
-                                       :method method-name
-                                       :typeId (api/type-id-by-name model "Operation")})
-                  (api/create client)
-                  (assoc :return-model (doall (map
-                                               (fn [[_ v]] (get-in v [:schema]))
-                                               (:responses method)))
-                         :input-models (:parameters method)
-                         :security (:security method)))))
+              (or (some-> (first (filter #(and
+                                           (= (:parent %) (:_id resource))
+                                           (= (str (:name resource) "/" (name method-name)) (:name %)))
+                                         components))
+                          (assoc :description (common/generate-operation-description method defs))
+                          (api/map->Component)
+                          (api/update client)
+                          (assoc :return-model (doall (map
+                                                       (fn [[_ v]] (get-in v [:schema]))
+                                                       (:responses method)))
+                                 :input-models (:parameters method)
+                                 :security (:security method)))
+                  (-> (api/map->Component {:name (str (name path) "/" (name method-name))
+                                           :description (common/generate-operation-description method defs)
+                                           :rootWorkspace (str wid)
+                                           :model _id
+                                           :parent (:_id parent)
+                                           :method method-name
+                                           :typeId (api/type-id-by-name model "Operation")})
+                      (api/create client)
+                      (assoc :return-model (doall (map
+                                                   (fn [[_ v]] (get-in v [:schema]))
+                                                   (:responses method)))
+                             :input-models (:parameters method)
+                             :security (:security method))))))
           methods)))

-(defn create-method [client [path methods] {wid :_id :as workspace} params {_id :_id :as model} tags params defs securs]
+(defn create-method [client [path methods] {wid :_id :as workspace} params {_id :_id :as model} tags defs securs]
   (let [description (:description (first (vals methods)))
         parameters (:parameters (first (vals methods)))
         parent {:resource path
                 :paramters parameters
                 :component (-> (api/->Component path (or description "") (str wid) _id (api/type-id-by-name model "Resource") nil)
                     (api/create client))}
-        op (create-operation client parent model wid path methods tags defs)]
+        op (create-or-update-operation client parent model wid path methods tags defs nil nil)]
     (refs/create-resource-refs client parent params)
     (refs/create-refs client op defs securs)
-    ;;Should create the sub operations straight away. We know they don't exist anyway
-    ;;And all references we need seeing how they all come from within or parameters
-    ;;Those that don't get created seperately
     parent))

-(defn update-operation [client method resource]
+(defn update-operation [client [path methods] {wid :_id :as workspace} params {_id :_id :as model} tags defs securs resource]
   ;;The path/resource operation itself has no true values, we just keep it as is
   ;;But the internal are different in regards to methods it has.
   ;;However these are connected by parent in the resource
   ;;Only question remaining is if the consume or produces need changing

   ;;Things that might change - responses, parameters, produces, tags, references
-
-
-  ;(common/update-comp client resource spec)
-
-  "Random return")
+  (let [description (:description (first (vals methods)))
+        parameters (:parameters (first (vals methods)))
+        parent {:resource path
+                :paramters parameters
+                :component (-> (api/map->Component resource)
+                               (api/update client))}
+        ;;Create or update op here
+        op (create-or-update-operation client parent model wid path methods tags defs resource (:components workspace))]
+    (refs/create-resource-refs client parent params)
+    (refs/create-refs client op defs securs)
+    parent))

 (defn update-operations [client resources {paths :paths :as spec} workspace model defs params securs tags]
   ;;This runs two times doseq filter.
@@ -88,13 +106,12 @@
   (reduce (fn [acc [def-name data :as component]]
             (assoc acc (keyword def-name)
                    (or (some->> (first (filter #(= (name def-name) (:name %)) resources))
-                                (update-operation client (first (rest component))))
-                       (first (vals (create-method client component workspace params model tags params defs securs))))))
+                                (update-operation client component workspace params model tags defs securs))
+                       (first (vals (create-method client component workspace params model tags defs securs))))))
           {}
           paths)
-  (refs/interdependent-model-refs client defs)
-  (common/find-or-create-fields client model);;THIS MIGHT BE A BIT EXCESSIVE
-  )
+  (refs/interdependent-model-refs client defs) ;;This doesn't happen for some reason
+  (common/find-or-create-fields client model))

 (defn delete-references [client {references :references :as workspace}]
   (doseq [ref references]


RS & CC | #60 | Use jsoup as enlive parser

--- src/objective8/templates/objective.clj
+++ src/objective8/templates/objective.clj
@@ -1,5 +1,6 @@
 (ns objective8.templates.objective
   (:require [net.cgrand.enlive-html :as html]
+            [net.cgrand.jsoup :as jsoup]
             [objective8.templates.page-furniture :as f]))

 (defn text->p-nodes
@@ -11,7 +12,7 @@
     (map (fn [p] (html/html [:p p])) (clojure.string/split text
                                                            newline-followed-by-optional-whitespace)))))

-(def objective-template (html/html-resource "templates/jade/objective.html"))
+(def objective-template (html/html-resource "templates/jade/objective.html" {:parser jsoup/parser}))

 (defn objective-page [context]
   (apply str


CMR-3701: Commited collection_ingest_test.clj

--- system-int-test/test/cmr/system_int_test/ingest/collection_ingest_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_ingest_test.clj
@@ -7,20 +7,23 @@
     [clojure.string :as string]
     [clojure.test :refer :all]
     [cmr.access-control.test.util :as ac]
+    [cmr.common.date-time-parser :as p]
     [cmr.common.log :as log :refer (debug info warn error)]
     [cmr.common.mime-types :as mt]
-    [cmr.transmit.config :as transmit-config]
     [cmr.common.util :as util]
     [cmr.mock-echo.client.echo-util :as e]
     [cmr.system-int-test.data2.collection :as dc]
     [cmr.system-int-test.data2.core :as d]
     [cmr.system-int-test.data2.granule :as dg]
+    [cmr.system-int-test.data2.umm-spec-collection :as data-umm-c]
     [cmr.system-int-test.system :as s]
     [cmr.system-int-test.utils.dev-system-util :as dev-sys-util]
     [cmr.system-int-test.utils.index-util :as index]
     [cmr.system-int-test.utils.ingest-util :as ingest]
     [cmr.system-int-test.utils.metadata-db-util :as mdb]
     [cmr.system-int-test.utils.search-util :as search]
+    [cmr.transmit.config :as transmit-config]
+    [cmr.umm-spec.models.umm-common-models :as umm-cmn]
     [cmr.umm-spec.test.expected-conversion :as exc]
     [cmr.umm-spec.test.location-keywords-helper :as lkt]
     [cmr.umm-spec.umm-spec-core :as umm-spec]))
@@ -36,13 +39,13 @@
 ;; Verify a new concept is ingested successfully.
 (deftest collection-ingest-test
   (testing "ingest of a new concept"
-    (let [concept (dc/collection-concept {})
+    (let [concept (data-umm-c/collection-concept {})
           {:keys [concept-id revision-id]} (ingest/ingest-concept concept)]
       (index/wait-until-indexed)
       (is (mdb/concept-exists-in-mdb? concept-id revision-id))
       (is (= 1 revision-id))))
   (testing "ingest of a concept with a revision id"
-    (let [concept (dc/collection-concept {:revision-id 5})
+    (let [concept (data-umm-c/collection-concept {:revision-id 5})
           {:keys [concept-id revision-id]} (ingest/ingest-concept concept)]
       (index/wait-until-indexed)
       (is (= 5 revision-id))
@@ -57,7 +60,7 @@
 (deftest collection-ingest-user-id-test
   (testing "ingest of new concept"
     (util/are2 [ingest-headers expected-user-id]
-      (let [concept (dc/collection-concept {})
+      (let [concept (data-umm-c/collection-concept {})
             {:keys [concept-id revision-id]} (ingest/ingest-concept concept ingest-headers)]
         (index/wait-until-indexed)
         (assert-user-id concept-id revision-id expected-user-id))
@@ -79,7 +82,7 @@
                 ingest-header2 expected-user-id2
                 ingest-header3 expected-user-id3
                 ingest-header4 expected-user-id4]
-      (let [concept (dc/collection-concept {})
+      (let [concept (data-umm-c/collection-concept {})
             {:keys [concept-id revision-id]} (ingest/ingest-concept concept ingest-header1)]
         (ingest/ingest-concept concept ingest-header2)
         (ingest/delete-concept concept ingest-header3)
@@ -105,7 +108,7 @@
 ;; Verify deleting non-existent concepts returns good error messages
 (deftest deletion-of-non-existent-concept-error-message-test
   (testing "collection"
-    (let [concept (dc/collection-concept {})
+    (let [concept (data-umm-c/collection-concept {})
           response (ingest/delete-concept concept {:raw? true})
           {:keys [errors]} (ingest/parse-ingest-body :xml response)]
       (is (re-find #"Collection with native id \[.*?\] in provider \[PROV1\] does not exist"
@@ -114,7 +117,7 @@
 ;; Collection with concept-id ingest and update scenarios.
 (deftest collection-w-concept-id-ingest-test
   (let [supplied-concept-id "C1000-PROV1"
-        concept (dc/collection-concept {:concept-id supplied-concept-id
+        concept (data-umm-c/collection-concept {:concept-id supplied-concept-id
                                         :native-id "Atlantic-1"})]
     (testing "ingest of a new concept with concept-id present"
       (let [{:keys [concept-id revision-id]} (ingest/ingest-concept concept)]
@@ -141,12 +144,16 @@
 ;; Verify that the accept header works
 (deftest collection-ingest-accept-header-response-test
   (testing "json response"
-    (let [concept (dc/collection-concept {:concept-id "C1200000000-PROV1"})
+    (let [concept (data-umm-c/collection-concept {:EntryTitle "E1"
+                                                  :ShortName "S1"
+                                                  :concept-id "C1200000000-PROV1"})
           response (ingest/ingest-concept concept {:accept-format :json :raw? true})]
       (is (= {:concept-id (:concept-id concept) :revision-id 1}
              (select-keys (ingest/parse-ingest-body :json response) [:concept-id :revision-id])))))
   (testing "xml response"
-    (let [concept (dc/collection-concept {:concept-id "C1200000001-PROV1"})
+    (let [concept (data-umm-c/collection-concept {:EntryTitle "E2"
+                                                  :ShortName "S2"
+                                                  :concept-id "C1200000001-PROV1"})
           response (ingest/ingest-concept concept {:accept-format :xml :raw? true})]
       (is (= {:concept-id (:concept-id concept) :revision-id 1}
              (select-keys (ingest/parse-ingest-body :xml response) [:concept-id :revision-id]))))))
@@ -154,13 +161,13 @@
 ;; Verify that the accept header works with returned errors
 (deftest collection-ingest-with-errors-accept-header-test
   (testing "json response"
-    (let [concept-with-empty-body  (assoc (dc/collection-concept {}) :metadata "")
+    (let [concept-with-empty-body  (assoc (data-umm-c/collection-concept {}) :metadata "")
           response (ingest/ingest-concept concept-with-empty-body
                                           {:accept-format :json :raw? true})
           {:keys [errors]} (ingest/parse-ingest-body :json response)]
       (is (re-find #"XML content is too short." (first errors)))))
   (testing "xml response"
-    (let [concept-with-empty-body  (assoc (dc/collection-concept {}) :metadata "")
+    (let [concept-with-empty-body  (assoc (data-umm-c/collection-concept {}) :metadata "")
           response (ingest/ingest-concept concept-with-empty-body
                                           {:accept-format :xml :raw? true})
           {:keys [errors]} (ingest/parse-ingest-body :xml response)]
@@ -169,7 +176,7 @@
 ;; Verify that XML is returned for ingest errros when the headers aren't set
 (deftest collection-ingest-with-errors-no-accept-header-test
   (testing "xml response"
-    (let [concept-with-empty-body  (assoc (dc/collection-concept {}) :metadata "")
+    (let [concept-with-empty-body  (assoc (data-umm-c/collection-concept {}) :metadata "")
           response (ingest/ingest-concept concept-with-empty-body
                                           {:raw? true})
           {:keys [errors]} (ingest/parse-ingest-body :xml response)]
@@ -178,15 +185,17 @@
 ;; Verify that the accept header works with deletions
 (deftest delete-collection-with-accept-header-test
   (testing "json response"
-    (let [coll1 (d/ingest "PROV1" (dc/collection))
-          response (ingest/delete-concept (d/item->concept coll1 :echo10) {:accept-format :json
+    (let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E1"
+                                                                              :ShortName "S1"}))
+          response (ingest/delete-concept (d/umm-c-collection->concept coll1 :echo10) {:accept-format :json
                                                                            :raw? true})]
       (is (= {:concept-id (:concept-id coll1) :revision-id 2}
              (select-keys (ingest/parse-ingest-body :json response) [:concept-id :revision-id])))))
   (testing "xml response"
-    (let [coll1 (d/ingest "PROV1" (dc/collection))
+    (let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E2"
+                                                                              :ShortName "S2"}))
           _ (index/wait-until-indexed)
-          response (ingest/delete-concept (d/item->concept coll1 :echo10) {:accept-format :xml
+          response (ingest/delete-concept (d/umm-c-collection->concept coll1 :echo10) {:accept-format :xml
                                                                            :raw? true})]
       (is (= {:concept-id (:concept-id coll1) :revision-id 2}
              (select-keys (ingest/parse-ingest-body :xml response) [:concept-id :revision-id]))))))
@@ -194,7 +203,7 @@
 ;; Verify that XML is returned for deletion errros when the accept header isn't set
 (deftest collection-deletion-with-errors-no-accept-header-test
   (testing "xml response"
-    (let [concept (dc/collection-concept {})
+    (let [concept (data-umm-c/collection-concept {})
           response (ingest/delete-concept concept {:raw? true})
           {:keys [errors]} (ingest/parse-ingest-body :xml response)]
       (is (re-find #"Collection with native id \[.*?\] in provider \[PROV1\] does not exist"
@@ -203,18 +212,24 @@
 ;; Verify that xml response is returned for ingests of xml content type
 (deftest collection-ingest-with-reponse-format-from-content-type
   (testing "echo10"
-    (let [concept (dc/collection-concept {:concept-id "C1-PROV1"} :echo10)
+    (let [concept (data-umm-c/collection-concept {:EntryTitle "E1"
+                                                  :ShortName "S1"
+                                                  :concept-id "C1-PROV1"} :echo10)
           response (ingest/ingest-concept concept {:raw? true})]
       (is (= {:concept-id "C1-PROV1" :revision-id 1}
              (select-keys (ingest/parse-ingest-body :xml response) [:concept-id :revision-id])))))
   (testing "dif"
-    (let [concept (d/item->concept (assoc (dc/collection-dif {:concept-id "C2-PROV1"})
+    (let [concept (d/umm-c-collection->concept (assoc (data-umm-c/collection {:EntryTitle "E2"
+                                                                  :ShortName "S2"
+                                                                  :concept-id "C2-PROV1"})
                                           :provider-id "PROV1") :dif)
           response (ingest/ingest-concept concept {:raw? true})]
       (is (= {:concept-id "C2-PROV1" :revision-id 1}
              (select-keys (ingest/parse-ingest-body :xml response) [:concept-id :revision-id])))))
   (testing "iso"
-    (let [concept (dc/collection-concept {:concept-id "C3-PROV1"} :iso-smap)
+    (let [concept (data-umm-c/collection-concept {:EntryTitle "E3"
+                                                  :ShortName "S3"
+                                                  :concept-id "C3-PROV1"} :iso-smap)
           response (ingest/ingest-concept concept {:raw? true})]
       (is (= {:concept-id "C3-PROV1" :revision-id 1}
              (select-keys (ingest/parse-ingest-body :xml response) [:concept-id :revision-id]))))))
@@ -222,67 +237,67 @@
 ;; Note entry-id only exists in the DIF format.  For other formats we set the entry ID to be a
 ;; a concatenation of short name and version ID.
 (deftest collection-w-entry-id-validation-test
-  (let [coll1-1 (dc/collection-dif {:concept-id "C1-PROV1"
-                                    :short-name "EID-1"
-                                    :entry-title "ET-1"
-                                    :native-id "NID-1"})
-        coll1-2 (assoc-in coll1-1 [:product :short-name] "EID-2")
-        coll1-3 (dc/collection-dif {:concept-id "C3-PROV1"
-                                    :short-name "EID-3"
-                                    :entry-title "ET-3"
-                                    :native-id "NID-3"})
-        coll1-4 (assoc-in coll1-3 [:product :short-name] "EID-4")
+  (let [coll1-1 (data-umm-c/collection {:concept-id "C1-PROV1"
+                                        :ShortName "EID-1"
+                                        :EntryTitle "ET-1"
+                                        :native-id "NID-1"})
+        coll1-2 (assoc-in coll1-1 [:ShortName] "EID-2")
+        coll1-3 (data-umm-c/collection {:concept-id "C3-PROV1"
+                                        :ShortName "EID-3"
+                                        :EntryTitle "ET-3"
+                                        :native-id "NID-3"})
+        coll1-4 (assoc-in coll1-3 [:ShortName] "EID-4")
         ;; ingest the collections/granules for test
-        _ (d/ingest "PROV1" coll1-1 {:format :dif})
-        coll3 (d/ingest "PROV1" coll1-3 {:format :dif})
-        gran1 (d/ingest "PROV1" (dg/granule coll3 {:granule-ur "Granule1"}))
-        gran2 (d/ingest "PROV1" (dg/granule coll3 {:granule-ur "Granule2"}))]
+        _ (d/ingest-umm-spec-collection "PROV1" coll1-1 {:format :dif})
+        coll3 (d/ingest-umm-spec-collection "PROV1" coll1-3 {:format :dif})
+        gran1 (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll3 (:concept-id coll3) {:granule-ur "Granule1"}))
+        gran2 (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll3 (:concept-id coll3) {:granule-ur "Granule2"}))]
     (index/wait-until-indexed)

     (testing "update the collection with a different entry-id is OK"
       (let [{:keys [status concept-id revision-id errors]}
-            (d/ingest "PROV1" coll1-2 {:format :dif})]
+            (d/ingest-umm-spec-collection "PROV1" coll1-2 {:format :dif})]
         (is (= ["C1-PROV1" 2 200 nil] [concept-id revision-id status errors]))))

     (testing "update the collection that has granules with a different entry-id is allowed"
       ;; For CMR-2403 we decided to temporary allow collection identifiers to be updated even
       ;; with existing granules for the collection. We will change this with CMR-2485.
       (let [{:keys [status concept-id revision-id errors]}
-            (d/ingest "PROV1" coll1-4 {:format :dif :allow-failure? true})]
+            (d/ingest-umm-spec-collection "PROV1" coll1-4 {:format :dif :allow-failure? true})]
         (is (= ["C3-PROV1" 2 200 nil] [concept-id revision-id status errors]))))

     (testing "ingest collection with entry-id used by a different collection latest revision within the same provider is invalid"
-      (let [{:keys [status errors]} (d/ingest "PROV1"
+      (let [{:keys [status errors]} (d/ingest-umm-spec-collection "PROV1"
                                               (assoc coll1-2
                                                      :concept-id "C2-PROV1"
                                                      :native-id "NID-2"
-                                                     :entry-title "EID-2")
+                                                     :EntryTitle "EID-2")
                                               {:format :dif :allow-failure? true})]
-        (is (= [409 ["The Entry Id [EID-2] must be unique. The following concepts with the same entry id were found: [C1-PROV1]."]]
+        (is (= [409 ["The Entry Id [EID-2_V1] must be unique. The following concepts with the same entry id were found: [C1-PROV1]."]]
                [status errors]))))

     (testing "ingest collection with entry-id used by a different collection, but not the latest revision within the same provider is OK"
       (let [{:keys [status concept-id revision-id errors]}
-            (d/ingest "PROV1"
+            (d/ingest-umm-spec-collection "PROV1"
                       (assoc coll1-1
                              :concept-id "C2-PROV1"
                              :native-id "NID-2"
-                             :entry-title "EID-2")
+                             :EntryTitle "EID-2")
                       {:format :dif :allow-failure? true})]
         (is (= ["C2-PROV1" 1 201 nil] [concept-id revision-id status errors]))))

     (testing "entry-id and entry-title constraint violations return multiple errors"
-      (let [{:keys [status errors]} (d/ingest "PROV1"
+      (let [{:keys [status errors]} (d/ingest-umm-spec-collection "PROV1"
                                               (assoc coll1-2
                                                      :concept-id "C5-PROV1"
                                                      :native-id "NID-5")
                                               {:format :dif :allow-failure? true})]
         (is (= [409 ["The Entry Title [ET-1] must be unique. The following concepts with the same entry title were found: [C1-PROV1]."
-                     "The Entry Id [EID-2] must be unique. The following concepts with the same entry id were found: [C1-PROV1]."]]
+                     "The Entry Id [EID-2_V1] must be unique. The following concepts with the same entry id were found: [C1-PROV1]."]]
                [status errors]))))

     (testing "ingest collection with entry-id used by a collection in a different provider is OK"
-      (let [{:keys [status]} (d/ingest "PROV2"
+      (let [{:keys [status]} (d/ingest-umm-spec-collection "PROV2"
                                        (assoc coll1-2 :concept-id "C1-PROV2")
                                        {:format :dif})]
         (is (= 201 status))))))
@@ -292,7 +307,7 @@
 (deftest repeat-same-collection-ingest-test
   (testing "ingest same concept n times ..."
     (let [n 4
-          concept (dc/collection-concept {})
+          concept (data-umm-c/collection-concept {})
           created-concepts (take n (repeatedly n #(ingest/ingest-concept concept)))]
       (index/wait-until-indexed)
       (is (apply = (map :concept-id created-concepts)))
@@ -301,20 +316,21 @@
 (deftest update-collection-with-different-formats-test
   (testing "update collection in different formats ..."
     (doseq [[expected-rev coll-format] (map-indexed #(vector (inc %1) %2) [:echo10 :dif :dif10 :iso19115 :iso-smap])]
-      (let [coll (d/ingest "PROV1"
-                           (dc/collection {:short-name "S1"
-                                           :version-id "V1"
-                                           :entry-title "ET1"
-                                           :long-name "L4"
-                                           :summary (name coll-format)
+      (let [coll (d/ingest-umm-spec-collection "PROV1"
+                           (data-umm-c/collection {:ShortName "S1"
+                                           :Version "V1"
+                                           :EntryTitle "ET1"
+                                           :LongName "L4"
+                                           :Abstract (name coll-format)
                                            ;; The following fields are needed for DIF to pass xml validation
-                                           :science-keywords [(dc/science-keyword {:category "upcase"
-                                                                                :topic "Cool"
-                                                                                :term "Mild"})]
-                                           :organizations [(dc/org :distribution-center "Larc")]
+                                           :ScienceKeywords [(data-umm-c/science-keyword {:Category "upcase"
+                                                                                :Topic "Cool"
+                                                                                :Term "Mild"})]
+                                           :DataCenters [(data-umm-c/data-center ["DISTRIBUTOR"] "Larc")]
                                            ;; The following fields are needed for DIF10 to pass xml validation
-                                           :beginning-date-time "1965-12-12T12:00:00Z"
-                                           :ending-date-time "1967-12-12T12:00:00Z"})
+                                           :TemporalExtents [(data-umm-c/temporal-extent
+                                                               {:beginning-date-time "1965-12-12T12:00:00Z"
+                                                                :ending-date-time "1967-12-12T12:00:00Z"})]})
                            {:format coll-format})]
         (index/wait-until-indexed)
         (is (= expected-rev (:revision-id coll)))
@@ -322,7 +338,7 @@

 ;; Verify ingest behaves properly if empty body is presented in the request.
 (deftest empty-collection-ingest-test
-  (let [concept-with-empty-body  (assoc (dc/collection-concept {}) :metadata "")
+  (let [concept-with-empty-body  (assoc (data-umm-c/collection-concept {}) :metadata "")
         {:keys [status errors]} (ingest/ingest-concept concept-with-empty-body)]
     (index/wait-until-indexed)
     (is (= status 400))
@@ -330,9 +346,10 @@

 ;; Verify old DeleteTime concept results in 400 error.
 (deftest old-delete-time-collection-ingest-test
-  (let [coll (dc/collection {:delete-time "2000-01-01T12:00:00Z"})
+  (let [coll (data-umm-c/collection {:DataDates [(umm-cmn/map->DateType {:Date (p/parse-datetime "2000-01-01T12:00:00Z")
+                                                                        :Type "DELETE"})]})
         {:keys [status errors]} (ingest/ingest-concept
-                                  (d/item->concept (assoc coll :provider-id "PROV1") :echo10))]
+                                  (d/umm-c-collection->concept (assoc coll :provider-id "PROV1") :echo10))]
     (index/wait-until-indexed)
     (is (= status 422))
     (is (re-find #"DeleteTime 2000-01-01T12:00:00.000Z is before the current time." (first errors)))))
@@ -340,7 +357,7 @@
 (deftest delete-collection-test-old
   (testing "It should be possible to delete existing concept and the operation without revision id should
            result in revision id 1 greater than max revision id of the concept prior to the delete"
-           (let [concept (dc/collection-concept {})
+           (let [concept (data-umm-c/collection-concept {})
                  ingest-result (ingest/ingest-concept concept)
                  delete-result (ingest/delete-concept concept)
                  ingest-revision-id (:revision-id ingest-result)
@@ -348,7 +365,7 @@
              (index/wait-until-indexed)
              (is (= (inc ingest-revision-id) delete-revision-id))))
   (testing "Deleting existing concept with a revision-id should respect the revision id"
-    (let [concept (dc/collection-concept {})
+    (let [concept (data-umm-c/collection-concept {})
           ingest-result (ingest/ingest-concept concept)
           delete-result (ingest/delete-concept concept {:revision-id 5})
           delete-revision-id (:revision-id delete-result)]
@@ -357,15 +374,17 @@
       (is (mdb/concept-exists-in-mdb? (:concept-id ingest-result) 5)))))

 (deftest delete-collection-test
-  (let [coll1 (d/ingest "PROV1" (dc/collection))
-        gran1 (d/ingest "PROV1" (dg/granule coll1))
-        gran2 (d/ingest "PROV1" (dg/granule coll1))
-        coll2 (d/ingest "PROV1" (dc/collection))
-        gran3 (d/ingest "PROV1" (dg/granule coll2))]
+  (let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E1"
+                                                                            :ShortName "S1"}))
+        gran1 (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll1 (:concept-id coll1)))
+        gran2 (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll1 (:concept-id coll1)))
+        coll2 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E2"
+                                                                            :ShortName "S2"}))
+        gran3 (d/ingest "PROV1" (dg/granule-with-umm-spec-collection coll2 (:concept-id coll2)))]
     (index/wait-until-indexed)

     ;; delete collection
-    (is (= 200 (:status (ingest/delete-concept (d/item->concept coll1 :echo10)))))
+    (is (= 200 (:status (ingest/delete-concept (d/umm-c-collection->concept coll1 :echo10)))))
     (index/wait-until-indexed)

     (is (:deleted (mdb/get-concept (:concept-id coll1))) "The collection should be deleted")
@@ -391,8 +410,10 @@

 (deftest delete-collection-acls-test
   ;; Ingest a collection under PROV1.
-  (let [coll1 (d/ingest "PROV1" (dc/collection))
-        coll2 (d/ingest "PROV1" (dc/collection))
+  (let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E1"
+                                                                            :ShortName "S1"}))
+        coll2 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection {:EntryTitle "E2"
+                                                                            :ShortName "S2"}))
         token (e/login-guest (s/context))]

     ;; wait for the collections to be indexed so that ACLs will be valid
@@ -409,37 +430,37 @@
                           :catalog_item_identity {:name "coll1 ACL"
                                                   :provider_id "PROV1"
                                                   :collection_applicable true
-                                                  :collection_identifier {:entry_titles [(:entry-title coll1)]}}})
+                                                  :collection_identifier {:entry_titles [(:EntryTitle coll1)]}}})
     (ac/create-acl token {:group_permissions [{:user_type "guest"
                                                :permissions ["read"]}]
                           :catalog_item_identity {:name "coll1/coll2 ACL"
                                                   :provider_id "PROV1"
                                                   :collection_applicable true
-                                                  :collection_identifier {:entry_titles [(:entry-title coll1) (:entry-title coll2)]}}})
+                                                  :collection_identifier {:entry_titles [(:EntryTitle coll1) (:EntryTitle coll2)]}}})
     (index/wait-until-indexed)
     ;; Verify that the ACLs are found in Access Control Service search.
     (let [results (:items (ac/search-for-acls (transmit-config/echo-system-token) {:identity_type "catalog_item"}))]
       (is (= [1 1] (map :revision_id results)))
       (is (= ["coll1 ACL" "coll1/coll2 ACL"] (map :name results))))
     ;; Delete the collection via ingest.
-    (ingest/delete-concept (d/item->concept coll1 :echo10))
+    (ingest/delete-concept (d/umm-c-collection->concept coll1 :echo10))
     (index/wait-until-indexed)
     ;; Verify that those ACLs are NOT found.
     (let [results (:items (ac/search-for-acls (transmit-config/echo-system-token) {:identity_type "catalog_item"}))]
       (is (= [2] (map :revision_id results)))
       (is (= ["coll1/coll2 ACL"] (map :name results)))
-      (is (= [(:entry-title coll2)]
+      (is (= [(:EntryTitle coll2)]
              (-> (ac/get-acl token (:concept_id (first results)))
                  :catalog_item_identity
                  :collection_identifier
                  :entry_titles))))))

 (deftest delete-deleted-collection-with-new-revision-id-returns-404
-  (let [coll (d/ingest "PROV1" (dc/collection))
+  (let [coll (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection))
         concept-id (:concept-id coll)
-        native-id (:entry-title coll)
-        coll-del1 (ingest/delete-concept (d/item->concept coll :echo10) {:revision-id 5})
-        coll-del2 (ingest/delete-concept (d/item->concept coll :echo10) {:revision-id 7})]
+        native-id (:EntryTitle coll)
+        coll-del1 (ingest/delete-concept (d/umm-c-collection->concept coll :echo10) {:revision-id 5})
+        coll-del2 (ingest/delete-concept (d/umm-c-collection->concept coll :echo10) {:revision-id 7})]
     (is (= 200 (:status coll-del1)))
     (is (= 404 (:status coll-del2)))
     (is (= [(format "Concept with native-id [%s] and concept-id [%s] is already deleted."
@@ -453,7 +474,7 @@

 ;; Verify ingest is successful for request with content type that has parameters
 (deftest content-type-with-parameter-ingest-test
-  (let [concept (assoc (dc/collection-concept {})
+  (let [concept (assoc (data-umm-c/collection-concept {})
                        :format "application/echo10+xml; charset=utf-8")
         {:keys [status]} (ingest/ingest-concept concept)]
     (index/wait-until-indexed)
@@ -461,7 +482,7 @@

 ;; Verify ingest behaves properly if request is missing content type.
 (deftest missing-content-type-ingest-test
-  (let [concept-with-no-content-type  (assoc (dc/collection-concept {}) :format "")
+  (let [concept-with-no-content-type  (assoc (data-umm-c/collection-concept {}) :format "")
         response (ingest/ingest-concept concept-with-no-content-type {:accept-format :json :raw? true})
         status (:status response)
         {:keys [errors]} (ingest/parse-ingest-body :json response)]
@@ -471,7 +492,7 @@

 ;; Verify ingest behaves properly if request contains invalid content type.
 (deftest invalid-content-type-ingest-test
-  (let [concept (assoc (dc/collection-concept {}) :format "blah")
+  (let [concept (assoc (data-umm-c/collection-concept {}) :format "blah")
         response (ingest/ingest-concept concept {:accept-format :json :raw? true})
         status (:status response)
         {:keys [errors]} (ingest/parse-ingest-body :json response)]
@@ -482,7 +503,7 @@
 ;; Verify that collections with embedded / (%2F) in the native-id are handled correctly
 (deftest ingest-collection-with-slash-in-native-id-test
   (let [crazy-id "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./ ~!@#$%^&*()_+QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"
-        collection (dc/collection-concept {:entry-title crazy-id})
+        collection (data-umm-c/collection-concept {:EntryTitle crazy-id})
         {:keys [concept-id revision-id] :as response} (ingest/ingest-concept collection)
         ingested-concept (mdb/get-concept concept-id)]
     (index/wait-until-indexed)
@@ -497,8 +518,10 @@

 (deftest schema-validation-test
   (are [concept-format validation-errors]
-       (let [concept (dc/collection-concept
-                       {:beginning-date-time "2010-12-12T12:00:00Z"} concept-format)
+       (let [concept (data-umm-c/collection-concept
+                       {:TemporalExtents [(data-umm-c/temporal-extent
+                                            {:beginning-date-time "2010-12-12T12:00:00Z"})]}
+                       concept-format)
              {:keys [status errors]}
              (ingest/ingest-concept
                (assoc concept
@@ -516,18 +539,8 @@
        :echo10 ["Line 1 - cvc-datatype-valid.1.2.1: 'A.000Z' is not a valid value for 'dateTime'."
                 "Line 1 - cvc-type.3.1.3: The value 'A.000Z' of element 'BeginningDateTime' is not valid."]

-       :dif [(str "Line 1 - cvc-complex-type.2.4.a: Invalid content was found "
-                  "starting with element 'Summary'. "
-                  "One of '{\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Data_Set_Language, "
-                  "\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Originating_Center, "
-                  "\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Data_Center}' is expected.")]
-
        :dif10 ["Line 1 - cvc-datatype-valid.1.2.3: 'A.000Z' is not a valid value of union type 'DateOrTimeOrEnumType'."
-               "Line 1 - cvc-type.3.1.3: The value 'A.000Z' of element 'Beginning_Date_Time' is not valid."
-               (str "Line 1 - cvc-complex-type.2.4.a: Invalid content was found starting with element 'Summary'."
-                    " One of '{\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Dataset_Language,"
-                    " \"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Originating_Center,"
-                    " \"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Organization}' is expected.")]
+               "Line 1 - cvc-type.3.1.3: The value 'A.000Z' of element 'Beginning_Date_Time' is not valid."]

        :iso19115 [(str "Line 1 - cvc-complex-type.2.4.a: Invalid content was found "
                        "starting with element 'gmd:XXXX'. One of "
@@ -605,9 +618,9 @@

 ;; Verify ingest of collection with string larger than 80 characters for project(campaign) long name is successful (CMR-1361)
 (deftest project-long-name-can-be-upto-1024-characters
-  (let [project (dc/project "p1" (str "A long name longer than eighty characters should not result"
+  (let [project (data-umm-c/project "p1" (str "A long name longer than eighty characters should not result"
                                       " in a schema validation error"))
-        concept (assoc (dc/collection-concept {:projects [project]})
+        concept (assoc (data-umm-c/collection-concept {:projects [project]})
                        :format "application/echo10+xml; charset=utf-8")
         {:keys [status]} (ingest/ingest-concept concept)]
     (index/wait-until-indexed)


Correct and match divide by 2

Correct and match divide by 2

--- src/clj/collect_earth_online/generators/clj_point.clj
+++ src/clj/collect_earth_online/generators/clj_point.clj
@@ -129,7 +129,7 @@
                             plot-spacing
                             plot-size]
   (let [[[left bottom] [right top]] (EPSG:4326->3857 [lon-min lat-min] [lon-max lat-max])
-        [left bottom right top]     (pad-bounds left bottom right top (/ 2.0 plot-size))]
+        [left bottom right top]     (pad-bounds left bottom right top (/ plot-size 2.0))]
     (check-plot-limits (if (= "gridded" plot-distribution)
                          (count-gridded-points left bottom right top plot-spacing)
                          num-plots)


Formatting

Formatting

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -110,13 +110,13 @@
   {:ascii     (DataType/ascii)
    :bigint    (DataType/bigint)
    :blob      (DataType/blob)
-   :boolean  (DataType/cboolean)
+   :boolean   (DataType/cboolean)
    :counter   (DataType/counter)
    :decimal   (DataType/decimal)
-   :double   (DataType/cdouble)
-   :float    (DataType/cfloat)
+   :double    (DataType/cdouble)
+   :float     (DataType/cfloat)
    :inet      (DataType/inet)
-   :int      (DataType/cint)
+   :int       (DataType/cint)
    :text      (DataType/text)
    :timestamp (DataType/timestamp)
    :uuid      (DataType/uuid)


Reduce scope of some vars

Reduce scope of some vars

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -21,35 +21,7 @@
   [& column-names]
   (QueryBuilder/token (into-array column-names)))

-(def select-command-order
-  [QueryBuilder Select$Selection Select Select$Where])
-
-
-
-
-(defn- ^Clause eq
-  [^String column ^Object value]
-  (QueryBuilder/eq column value))
-
-(defn- ^Clause in
-  [^String column values]
-  (QueryBuilder/in column values))
-
-(defn- ^Clause lt
-  [^String column ^Object value]
-  (QueryBuilder/lt column value))
-
-(defn- ^Clause gt
-  [^String column ^Object value]
-  (QueryBuilder/gt column value))
-
-(defn- ^Clause lte
-  [^String column ^Object value]
-  (QueryBuilder/lte column value))
-
-(defn- ^Clause gte
-  [^String column ^Object value]
-  (QueryBuilder/gte column value))
+

 (defn asc
   [^String column-name]
@@ -67,18 +39,36 @@
   [s]
   (QueryBuilder/quote (name s)))

-(def ^:private query-type-map
-  {:in in
-   :=  eq
-   =   eq
-   :>  gt
-   >   gt
-   :>= gte
-   >=  gte
-   :<  lt
-   <   lt
-   :<= lte
-   <=  lte})
+(let [eq  (fn [^String column ^Object value]
+            (QueryBuilder/eq column value))
+
+      in  (fn [^String column values]
+            (QueryBuilder/in column values))
+
+      lt  (fn [^String column ^Object value]
+            (QueryBuilder/lt column value))
+
+      gt  (fn [^String column ^Object value]
+            (QueryBuilder/gt column value))
+
+      lte (fn [^String column ^Object value]
+            (QueryBuilder/lte column value))
+
+      gte (fn [^String column ^Object value]
+            (QueryBuilder/gte column value))]
+
+  (def ^:private query-type-map
+    {:in in
+     :=  eq
+     =   eq
+     :>  gt
+     >   gt
+     :>= gte
+     >=  gte
+     :<  lt
+     <   lt
+     :<= lte
+     <=  lte}))

 (defprotocol WhereBuilder
   (build-where [construct query-builder]))


[#222] Return question personal-data

[#222] Return question personal-data

--- api/src/clojure/org/akvo/flow_api/datastore/survey.clj
+++ api/src/clojure/org/akvo/flow_api/datastore/survey.clj
@@ -46,6 +46,7 @@
       :type type*
       :order (.getOrder question)
       :variable-name (.getVariableName question)
+      :personal-data (.getPersonalData question)
       :created-at (ds/created-at question)
       :modified-at (ds/modified-at question)}
      (when (= type* "CADDISFLY")


fix typo

fix typo

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/settings.cljs
+++ src/lt/objs/settings.cljs
@@ -420,7 +420,7 @@
                                   key
                                   [key []])
                   tag-vec [tag (str "-" key)]]]
-      (.push flat (into tag-vec commands)))
+      (.push flat (into tag-vec command)))
     (->> (js->clj flat)
          (sort-by first)
          (vec))))


re-enable workspace behavior diffs per #465

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/settings.cljs
+++ src/lt/objs/settings.cljs
@@ -75,7 +75,7 @@
                               (object/raise-reduce app/app :behaviors.diffs.user+ [])
                               ))
         ws-diff (:ws-behaviors @workspace/current-ws)
-        final (if (and false ws-diff (not (empty? ws-diff)))
+        final (if (and ws-diff (not (empty? ws-diff)))
                 (behavior-diff (safe-read ws-diff "workspace.behaviors") final)
                 final)]
     (reset! object/tags final)))


Fixed path var

Fixed path var

--- src/clj/forma/hadoop/jobs/scatter.clj
+++ src/clj/forma/hadoop/jobs/scatter.clj
@@ -260,7 +260,7 @@
               trends ([:tmp-dirs trends-path]
                         "Runs the trends processing."
                         (with-job-conf {"cascading.kryo.serializations" "forma.schema.TimeSeriesValue,carbonite.PrintDupSerializer:forma.schema.FireValue,carbonite.PrintDupSerializer:forma.schema.FormaValue,carbonite.PrintDupSerializer:forma.schema.NeighborValue,carbonite.PrintDupSerializer"}
-                          (?- (hfs-seqfile dynamic-path)
+                          (?- (hfs-seqfile trends-path)
                               (forma/analyze-trends
                                est-map (hfs-lzo-textline clean-series)))))


fix whitespace

fix whitespace

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -849,7 +849,8 @@
      ; for this entity
      (swap! ambient-settings update-in
             [~entity-id]
-            (fnil #(assoc % :delay-balances? true
+            (fnil #(assoc %
+                          :delay-balances? true
                           :delayed-account-ids #{})
                   {}))
      (let [result# (do ~@body)]


Don't use go for blocking io

Don't use go for blocking io

--- src/neovim_client/rpc.clj
+++ src/neovim_client/rpc.clj
@@ -17,14 +17,12 @@
   "Read messages from the input stream, put them on a channel."
   [input-stream]
   (let [chan (async/chan 1024)]
-    ;; TODO make these threads w/ loops, since they're handling IO
-    ;; might explain the wierd drlog blockages
-    (async/go-loop
-      []
-      (when-let [msg (msgpack/unpack input-stream)]
-        (log/info "stream -> msg -> in chan: " msg)
-        (async/>! chan msg)
-        (recur)))
+    (async/thread
+      (loop []
+        (when-let [msg (msgpack/unpack input-stream)]
+          (log/info "stream -> msg -> in chan: " msg)
+          (async/>!! chan msg)
+          (recur))))
     chan))

 (defn- write-msg!
@@ -37,12 +35,12 @@
   "Make a channel to read messages from, write to output stream."
   [output-stream]
   (let [chan (async/chan 1024)]
-    (async/go-loop
-      []
-      (when-let [msg (async/<! chan)]
-        (log/info "stream <- msg <- out chan: " msg)
-        (write-msg! (msgpack/pack msg) output-stream)
-        (recur)))
+    (async/thread
+      (loop []
+        (when-let [msg (async/<!! chan)]
+          (log/info "stream <- msg <- out chan: " msg)
+          (write-msg! (msgpack/pack msg) output-stream)
+          (recur))))
     chan))

 ;; ***** Public *****


Don't show trial banner for students (#1876)

* so we use trial for student pack, we should hide the trial banner

* moreee

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -319,7 +319,8 @@
         add-button-text "Add More"]
     (list
      [:div.parallelism-upgrades
-      (if-not (plan-model/in-trial? plan)
+      (if-not (and (plan-model/in-trial? plan)
+                   (not (plan-model/in-student-trial? plan)))
         (cond (and (project-model/osx? project)
                    (> parallelism 1))
               ;; OS X projects should not use parallelism. We don't have the
@@ -437,7 +438,8 @@
             plan (get-in data state/project-plan-path)]
         (html
           [:section
-           (when (plan-model/in-trial? plan)
+           (when (and (plan-model/in-trial? plan)
+                      (not (plan-model/in-student-trial? plan)))
              (om/build trial-activation-banner data))
            [:article
             [:legend (str "Change parallelism for " (vcs-url/project-name (get-in project-data [:project :vcs_url])))]


remove debug from tests

remove debug from tests

--- test/integration/test/slice.clj
+++ test/integration/test/slice.clj
@@ -9,7 +9,6 @@
 (deftest ^:integration test-query-slice-with-no-params
   (testing "it returns successfully as text/html"
     (let [resp (GET "/data/integration_test/slice/incomes")]
-      (println "RESPONSE" resp)
       (does= (:status resp) 200)
       (does-contain (:headers resp)
                     {"Content-Type" "text/html;charset=UTF-8" "Vary" "Accept"}))))
@@ -27,7 +26,6 @@
 (deftest ^:integration test-json
   (testing "it returns a content-type of application/json"
     (let [resp (GET "/data/integration_test/slice/incomes.json")]
-      (println "RESPONSE" resp)
       (does= (:status resp) 200)
       (does-contain (:headers resp)
                     {"Content-Type" "application/json;charset=UTF-8"}))))
@@ -35,7 +33,6 @@
 (deftest ^:integration test-jsonp
   (testing "it uses the callback we supply"
     (let [resp (GET "/data/integration_test/slice/incomes.jsonp?$callback=foo")]
-      (println "RESPONSE" resp)
       (does= (:status resp) 200)
       (does-contain (:headers resp)
                     {"Content-Type" "text/javascript;charset=UTF-8"})
@@ -43,7 +40,6 @@

   (testing "it uses 'callback' by default"
     (let [resp (GET "/data/integration_test/slice/incomes.jsonp")]
-      (println "RESPONSE" resp)
       (does= (:status resp) 200)
       (does-contain (:headers resp)
                     {"Content-Type" "text/javascript;charset=UTF-8"})
@@ -52,7 +48,6 @@
 (deftest ^:integration test-xml
   (testing "it returns a content-type of application/xml"
     (let [resp (GET "/data/integration_test/slice/incomes.xml")]
-      (println "RESPONSE" resp)
       (does= (:status resp) 200)
       (does-contain (:headers resp)
                     {"Content-Type" "application/xml;charset=UTF-8"}))))


fixed compiler warning on goog.dom when tests are run

--- test/kioo/test.cljs
+++ test/kioo/test.cljs
@@ -1,8 +1,9 @@
 (ns kioo.test
-  (:require [kioo.util :refer [strip-attr]]))
+  (:require [kioo.util :refer [strip-attr]]
+            [goog.dom :as dom]))

 (defn body []
-  (aget (goog.dom/getElementsByTagNameAndClass "body") 0))
+  (aget (dom/getElementsByTagNameAndClass "body") 0))

 (defn render-dom [children]
   (let [container (goog.dom/createDom "div")


Misc cleanup

Misc cleanup

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -193,7 +193,7 @@

 (defn process
   "This function wraps together all of the various input processing capabilities into one, with options
-  controlled by an opts hash with a heavy-handed/opinionated set of defaults:
+  controlled by an opts hash with opinionated defaults:

   * `:header` - bool; consume the first row as a header?
   * `:comment-re` - specify a regular expression to use for commenting out lines, or something falsey
@@ -202,11 +202,11 @@
   * `:cast-fns` - optional map of `colname | index -> cast-fn`; row maps will have the values as output by the
      assigned `cast-fn`."
   ([{:keys [comment-re header remove-empty cast-fns]
-                  :or   {comment-re   #"^\#"
-                         header       true
-                         remove-empty true
-                         cast-fns     {}}
-                  :as opts}
+     :or   {comment-re   #"^\#"
+            header       true
+            remove-empty true
+            cast-fns     {}}
+     :as opts}
     rows]
    (->> rows
         (?>> comment-re (remove-comments comment-re))
@@ -437,7 +437,7 @@
             file)))))

 ;; Like `slurp-and-process`, this is a convenience function which wraps together a set of opinionated options
-;; writing data to the specified file handle or filename.
+;; for writing data to the specified file handle or filename.
 ;; Note that since we use `clojure-csv` here, we offer a `:batch` option that lets you format and write small
 ;; batches of rows out at a time, to avoid contructing a massive string representation of all the data in the
 ;; case of bigger data sets.


In the specs test, log the full result when something failed

This allows us to actually see what went wrong in the test of a
function spec.

--- src/test/workflo/macros/spec_test.cljc
+++ src/test/workflo/macros/spec_test.cljc
@@ -46,5 +46,5 @@
             (let [result (first (st/check s check-opts))]
               (and (is (map? result))
                    (is (-> result :clojure.spec.test.check/ret))
-                   (is (-> result :clojure.spec.test.check/ret
-                           :result true?)))))))
+                   (is (-> result :clojure.spec.test.check/ret :result true?)
+                       (-> result :clojure.spec.test.check/ret)))))))


Fixing the memory queue test if there's an error.

--- message-queue-lib/test/cmr/message_queue/test/queue/memory_queue.clj
+++ message-queue-lib/test/cmr/message_queue/test/queue/memory_queue.clj
@@ -11,7 +11,8 @@
          max-wait-time# 2000]
      (loop [num-tries# 0]
        (when (>= (* sleep-time# num-tries#) max-wait-time#)
-         (is ~test-code "Exceeded max wait time waiting for queue to acquiesce."))
+         (is ~test-code)
+         (throw (Exception. "Exceeded max wait time waiting for queue to acquiesce.")))

        (if ~test-code
          (is ~test-code)


(SERVER-1183) Add more info to env-class-response docstring

This commit adds some more information to the docstring for the
`environment-class-response!` function, including differences in
how the response is generated depending upon the value of the
`environment-class-cache-enabled` parameter.

--- src/clj/puppetlabs/services/master/master_core.clj
+++ src/clj/puppetlabs/services/master/master_core.clj
@@ -256,8 +256,24 @@

 (schema/defn ^:always-validate
   environment-class-response! :- ringutils/RingResponse
-  "Process the environment class info, returning a ring response to be
-  propagated back up to the caller of the environment_classes endpoint"
+  "Process the environment class info, returning a Ring response to be
+  propagated back up to the caller of the environment_classes endpoint.
+
+  If the specified `environment-class-cache-enabled` is 'true', a SHA-1 hash
+  of the class info will be generated.  If the hash is equal to the supplied
+  `request-tag`, the response will have an HTTP 304 (Not Modified) status code
+  and the response body will be empty.  If the hash is not equal to the supplied
+  `request-tag`, the response will have an HTTP 200 (OK) status code and
+  the class info, serialized to JSON, will appear in the response body.  The
+  newly generated hash code, along with the specified `cache-generation-id`,
+  will be passed to the `jruby-service`, to be stored in its environment class
+  cache, and will also be returned in the response as the value for an HTTP
+  Etag header.
+
+  If the specified `environment-class-cache-enabled` is 'false', no hash
+  will be generated for the class info.  The response will always have an
+  HTTP 200 (OK) status code and the class info, serialized to JSON, as the
+  response body.  An HTTP Etag header will not appear in the response."
   [info-from-jruby :- Map
    environment :- schema/Str
    jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)


JSON doc processing handles invalid JSON correctly.

--- src/asid/json_doc_exchange.clj
+++ src/asid/json_doc_exchange.clj
@@ -33,33 +33,40 @@

 (defn json-documents [handler]
   (fn [req]
-    (let [json-doc (if (content-type-json? req)
+    (let [response (if (content-type-json? req)
                      (try
                        (let [body (rreq/body-string req)]
                          (log/info "JSON body received: " body)
-                         (json/read-str body
-                                        :key-fn keyword))
+                         (let [json-doc (json/read-str body
+                                                       :key-fn keyword)]
+                           (log/debug "Parsed json-doc: " json-doc)
+                           (handler (conj req [:json-doc json-doc]))))
                        (catch Exception ex
                          (log/error ex "JSON could not be parsed.")
                          (-> (rr/response "JSON could not be parsed.")
                              (rr/status 400))))
-                     nil)
-          _ (log/info "Parsed json-doc: " json-doc)
-          response (handler (conj req [:json-doc json-doc]))]
+                     (handler req))]
       (if (content-type-json? response)
         (conj response [:body (json/write-str (:body response))])
         response))))

-(fact
+(fact "about valid or no json in the request"
   (let [wrapper (json-documents #(:json-doc %))]
     (wrapper (mr/request :post "/" "body")) => nil?
     (wrapper (-> (mr/request :post "/" "{\"key\":10}")
-                 (mr/header "Content-Type" "app/test+json"))) => {:key 10}
+                 (mr/header "Content-Type" "app/test+json"))) => {:key 10}))
+
+(fact "about invalid json in the request"
+  (let [wrapper (json-documents (fn [req] req))]
     (wrapper (-> (mr/request :post "/" "{\"malformed\": 10")
-                 (mr/header "Content-Type" "app/test+json"))) => (contains {:status 400}))
-  (let [wrapper (json-documents (fn [req] req))]
-    (wrapper (-> (rr/response "hello"))) => (contains {:status 200
-                                                       :body "hello"})
-    (wrapper (-> (rr/response {:key 10})
-                 (rr/content-type "app+json")))) => (contains {:status 200
-                                                               :body "{\"key\":10}"}))
+                 (mr/header "Content-Type" "app/test+json"))) => (contains {:status 400})))
+
+(fact "about json in the response"
+  (let [response-provider (fn [resp]
+                            (let [app (json-documents (fn [_] resp))]
+                              (app (mr/request :get "/anything"))))]
+    (response-provider (-> (rr/response "hello"))) => (contains {:status 200
+                                                                 :body "hello"})
+    (response-provider (-> (rr/response {:key 10})
+                           (rr/content-type "app+json")))) => (contains {:status 200
+                                                                         :body "{\"key\":10}"}))


refactor param setting for better error messages

--- src/asphalt/internal/param.clj
+++ src/asphalt/internal/param.clj
@@ -68,6 +68,9 @@
 ;; ----- param setting helpers -----

+(def ^:const ba-type (Class/forName "[B"))  ;; byte-array class
+
+
 (defn set-param-value
   [^PreparedStatement prepared-statement param-type ^long param-index param-value]
   (case (get t/single-typemap param-type)
@@ -76,7 +79,10 @@
                   (.setObject prepared-statement param-index ^Object param-value))
     :boolean    (.setBoolean   prepared-statement param-index (boolean    param-value))
     :byte       (.setByte      prepared-statement param-index (byte       param-value))
-    :byte-array (.setBytes     prepared-statement param-index (byte-array param-value))
+    :byte-array (.setBytes     prepared-statement param-index (cond
+                                                                (= (type param-value) ba-type) param-value
+                                                                (nil? param-value) nil
+                                                                :else (byte-array param-value)))
     :date       (if (instance? Calendar param-value)
                   (.setDate    prepared-statement param-index (Date. (.getTimeInMillis ^Calendar param-value))
                     ^Calendar param-value)
@@ -102,6 +108,17 @@
 ;; ----- param laying helpers -----

+(defmacro verify
+  [klass instance]
+  (i/expected symbol? "a class symbol" klass)
+  (let [sym (with-meta (gensym) {:tag (str klass)})]
+    `(let [~sym ~instance]
+       (cond
+         (instance? ~klass ~sym) ~sym
+         (nil? ~sym)             nil
+         :else (i/expected ~(str "nil or instance of class " klass) ~sym)))))
+
+
 (defmacro try-param
   [pindex-sym type-label param-expr]
   `(try ~param-expr
@@ -110,13 +127,6 @@
                 (str "Error resolving SQL param " ~pindex-sym
                   ~(format " as %s: %s" type-label param-expr))
                 e#)))))
-
-
-(defmacro each-param-expr
-  "Return param setter expression."
-  [setter pstmt-sym pindex-sym type-label param-expr]
-  `(~setter ~pstmt-sym ~pindex-sym
-     (try-param ~pindex-sym ~type-label ~param-expr)))

 (defn lay-param-expr
@@ -132,9 +142,13 @@
          ~(lay-param-expr pstmt-sym (get t/multi-typemap param-type) i-sym v-sym)))
     (case (get t/single-typemap param-type)
       :nil        `(set-param-value ~pstmt-sym :nil ~pindex-sym ~pvalue-sym)
-      :boolean    `(each-param-expr ~'.setBoolean   ~pstmt-sym ~pindex-sym "boolean"    (boolean    ~pvalue-sym))
-      :byte       `(each-param-expr ~'.setByte      ~pstmt-sym ~pindex-sym "byte"       (byte       ~pvalue-sym))
-      :byte-array `(each-param-expr ~'.setBytes     ~pstmt-sym ~pindex-sym "byte-array" (byte-array ~pvalue-sym))
+      :boolean    `(.setBoolean ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "boolean"    (boolean ~pvalue-sym)))
+      :byte       `(.setByte    ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "byte"       (byte    ~pvalue-sym)))
+      :byte-array `(.setBytes   ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "byte-array" (let [v# ~pvalue-sym]
+                                                                                (cond
+                                                                                (= (type v#) ba-type) v#
+                                                                                (nil? v#)             nil
+                                                                                :else (byte-array v#)))))
       :date       `(let [p# (try-param ~pindex-sym "date" ~pvalue-sym)]
                      (cond
                        (instance? Date p#) (.setDate ~pstmt-sym ~pindex-sym ^java.sql.Date p#)
@@ -144,13 +158,15 @@
                                                  ^java.util.Calendar p#)
                        (nil? p#)    (.setDate ~pstmt-sym ~pindex-sym nil)
                        :otherwise   (i/expected "java.sql.Date or java.util.Calendar instance" p#)))
-      :double     `(each-param-expr ~'.setDouble    ~pstmt-sym ~pindex-sym "double"     (double     ~pvalue-sym))
-      :float      `(each-param-expr ~'.setFloat     ~pstmt-sym ~pindex-sym "float"      (float      ~pvalue-sym))
-      :int        `(each-param-expr ~'.setInt       ~pstmt-sym ~pindex-sym "int"        (int        ~pvalue-sym))
-      :long       `(each-param-expr ~'.setLong      ~pstmt-sym ~pindex-sym "long"       (long       ~pvalue-sym))
-      :nstring    `(each-param-expr ~'.setNString   ~pstmt-sym ~pindex-sym "string"     ~pvalue-sym)
-      :object     `(each-param-expr ~'.setObject    ~pstmt-sym ~pindex-sym "object"     ~pvalue-sym)
-      :string     `(each-param-expr ~'.setString    ~pstmt-sym ~pindex-sym "string"     ~pvalue-sym)
+      :double     `(.setDouble    ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "double"   (double     ~pvalue-sym)))
+      :float      `(.setFloat     ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "float"    (float      ~pvalue-sym)))
+      :int        `(.setInt       ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "int"      (int        ~pvalue-sym)))
+      :long       `(.setLong      ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "long"     (long       ~pvalue-sym)))
+      :nstring    `(.setNString   ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "string"   (verify java.lang.String
+                                                                                ~pvalue-sym)))
+      :object     `(.setObject    ~pstmt-sym ~pindex-sym ~pvalue-sym)
+      :string     `(.setString    ~pstmt-sym ~pindex-sym (try-param ~pindex-sym "string"   (verify java.lang.String
+                                                                                ~pvalue-sym)))
       :time       `(let [p# (try-param ~pindex-sym "time" ~pvalue-sym)]
                      (cond
                        (instance? Date p#) (.setTime ~pstmt-sym ~pindex-sym ^java.sql.Time p#)


use babel.english/morph for English, not babel.english.morphology/fo

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -666,7 +666,7 @@
                   (if (not (empty? filtered-v))  ;; TODO: this empty-filtering should be done in lexicon.cljc, not here.
                     [k filtered-v]))))
         indices (create-indices lexicon index-lexicon-on-paths)
-        morph fo
+        morph babel.english/morph
         model
         {:name "medium"
          :default-fn default-fn


+pronoun default lexical rules

+pronoun default lexical rules

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -121,7 +121,20 @@
     {:synsem {:cat :noun
               :pronoun false
               :reflexive false}})
-
+
+   (default ;; a propernoun takes no args.
+    {:synsem {:cat :noun
+              :pronoun false
+              :propernoun true
+              :subcat '()}})
+
+   (default ;; a propernoun is agr=3rd singular
+    {:synsem {:cat :noun
+              :pronoun false
+              :propernoun true
+              :agr {:number :sing
+                    :person :3rd}}})
+
    ;; </noun default rules>

    ;; <verb default rules>


fix typo

fix typo

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1902,7 +1902,7 @@
                         :sem {:pred :transfer}}}

    "understand" (let [common {:english {:past "understood"}}]
-                  (unify
+                  [(unify
                    common
                    {:synsem {:cat :verb
                              :sem {:pred :understand}}})
@@ -1916,7 +1916,7 @@
                    common
                    {:synsem {:cat :verb
                              :sem {:pred :understand-simply}}
-                    :english {:note "simply"}}))
+                    :english {:note "simply"}})])

    "upload"  {:synsem {:cat :verb
                        :sem {:pred :caricare}}}


remove some reflective calls

remove some reflective calls

--- src/main/shadow/cljs/devtools/server/fs_watch_jvm.clj
+++ src/main/shadow/cljs/devtools/server/fs_watch_jvm.clj
@@ -8,12 +8,11 @@
   (:import (shadow.util FileWatcher)
            (java.io File)))

-
 (defn service? [x]
   (and (map? x)
        (::service x)))

-(defn poll-changes [{:keys [dir watcher]}]
+(defn poll-changes [{:keys [dir ^FileWatcher watcher]}]
   (let [changes (.pollForChanges watcher)]
     (when (seq changes)
       (->> changes
@@ -25,7 +24,7 @@
                    :file (io/file dir name)
                    :event event}))
            ;; ignore empty files
-           (remove (fn [{:keys [event file] :as x}]
+           (remove (fn [{:keys [event ^File file] :as x}]
                      (and (not= event :del)
                           (zero? (.length file)))))
            ))))
@@ -52,7 +51,7 @@
           (recur)))))

   ;; shut down watchers when loop ends
-  (doseq [{:keys [watcher]} watch-dirs]
+  (doseq [{:keys [^FileWatcher watcher]} watch-dirs]
     (.close watcher))

   ::shutdown-complete)
@@ -66,7 +65,7 @@

         watch-dirs
         (->> directories
-             (map (fn [dir]
+             (map (fn [^File dir]
                     {:dir dir
                      :watcher (FileWatcher/create dir (vec file-exts))}))
              (into []))]


Rebranded client-side routes for this particular app.

--- app/src/weather/ui/route.cljs
+++ app/src/weather/ui/route.cljs
@@ -12,11 +12,9 @@
 ;
 (secretary/set-config! :prefix "#")

-(secretary/defroute "/" []
-  (reset! route {:id "messages"}))
-
-(secretary/defroute "/new" []
-  (reset! route {:id "new-message"}))
+(secretary/defroute "/:city/:date" [city date]
+  (reset! route {:city city
+                 :date date}))

 (secretary/defroute "*" []
   (reset! route nil))


hide the cosine line on even values of n; comments

--- src-cljs/ap/pages/fourier.cljs
+++ src-cljs/ap/pages/fourier.cljs
@@ -65,6 +65,9 @@

 (def x-points (map #(/ % 100) (range -314 314 1)))

+;; NOTE: I tried currying this function with a CLJS map and it was slower
+;;   than doing the calculation itself
+;; try a pure JS object next?
 (defn square-wave-cos-point [n x]
   (* (/ 4 (* n PI))
     (cos (* n x))))
@@ -73,6 +76,8 @@
   (into [] (map (fn [x]
     [x (square-wave-cos-point n x)]) x-points)))

+;; TODO: the result of the summation function here needs to be curried
+;;   for performance
 (defn square-wave-best-fit-point [n x]
   (let [r (range 1 (+ 1 n) 2)]
     (reduce + 0 (map-indexed (fn [idx n1]
@@ -101,7 +106,11 @@

 (defn square-wave-cos-series [n]
   { :color "blue"
-    :data (square-wave-cos-data n) })
+    :data (square-wave-cos-data n)
+    :lines {
+      :show (if (even? n) false true) ;; hide the cosine line when n is even
+    }
+  })

 (defn square-wave-best-fit-series [n]
   { :color "red"


Basic migration system based on db components added

--- src/clj/hellhound/tasks/db.clj
+++ src/clj/hellhound/tasks/db.clj
@@ -1,44 +1,139 @@
 (ns hellhound.tasks.db
-  (:require [hellhound.tasks.core :refer [info error warn]]
-            [clojure.edn          :as edn]
-            [joplin.repl          :as joplin]
-            [environ.core         :refer [env]]
-            [clojure.java.io      :as io]))
+  (:require
+   [clojure.edn          :as edn]
+   [environ.core         :refer [env]]
+   [clojure.java.io      :as io]
+   ;; Internals
+   [hellhound.core       :as hellhound]
+   [hellhound.tasks.core :as task]
+   [hellhound.components.core :as component]))

-(defn- joplin-config
+;; Definitions ---------------------------------------------
+;; Lock is not a great name i know, but i don't have
+;; time to think about it
+(def migrations-lock (atom []))
+(def migration-lock-file (io/resource "migration.lock"))
+
+(def migration-template
+  (long-str "(ns %s.%s)"
+            ""
+            "(defn up"
+            "  []"
+            "  ;; Your migration code goes here"
+            ")"
+            ""
+            "(defn down"
+            "  []"
+            "  ;; Your code to teardown this migration, goes here"
+            ")"))
+
+
+;; Functions -----------------------------------------------
+(defn db-config
+  "Returns database configuration from the current environment
+  configuration file."
   []
-  (joplin/load-config (io/resource "database.edn")))
+  (:db (hellhound/application-config)))

-(defn- current-env
+;; NOTE: For now we have to force a certain place for migrations
+;; (defn migration-path
+;;   "Returns the migration path on filesystem "
+;;   []
+;;   (or (:migration-path (db-config))
+;;       ))
+
+(defn databases-to-migration
   []
-  :dev)
+  (keys db-config))
+
+(defn get-lock
+  "Get the migrations listed in the `migration.lock` file and reset the
+  global `migrations-lock` atom with the exist value. If there were
+  no migrations listed will ignore resetting the atom."
+  []
+  (if (nil? migration-lock-file)
+    (throw (Exception. "Can't find migration.lock file inside resource path."))
+    (let [migrations (edn/read-string (slurp migration-lock-file))]
+      (if-not (empty? migrations)
+        (reset! migrations-lock migrations)))))
+
+(defn update-lock
+  "Update the global `migrations-lock` atom with the given `nsname`
+  and flush the changes into `migration.lock` file."
+  [nsname]
+  (let [migrations (conj @migrations-lock nsname)]
+    (spit migration-lock-file (pr-str migrations))
+    (swap! migrations-lock (fn [_] migrations))))
+
+(defn gen-nsname
+  [migration]
+  (symbol (format "%s.%s" migration-prefix migration)))
+
+(defn up
+  "load the given migration and call up function from it"
+  [migration]
+  (task/info (format "Running the migration file: %s" migration))
+  (require (gen-nsname migration))
+  (let [up-fn (ns-resolve (gen-nsname migration) 'up)]
+    (up-fn)))
+
+(defn make-file-path
+  [nsname]
+  (in-migrations (clojure.string/replace
+                  (str nsname ".clj")
+                  #"-" "_")))
+
+(defn setup-db
+  [db-name]
+  (let [db-component    (component/get-component db-name)
+        setup-component (.setup db-component)]))
+
+;; Command functions ---------------------------------------
+(defn create
+  "Calls the `setup` function of each database component provided in the
+  environment configuration. Basically each key under the `:db` entry
+  in the configuration file. The goal of this task is to create and setup
+  the necessary db related stuff.
+
+  The most important thing to remember is that the database key name in the
+  configuration **should** match the component name in the system map."
+  [& rest]
+  (map setup-db (databases-to-migration)))

 (defn migrate
-  "Start the migration process"
-  [config & rest]
-  (joplin/migrate config (current-env)))
+  "Run the migrations in order by calling `up` function of each
+  namespace."
+  [& rest]
+  (let [migrations @migrations-lock]
+    (if (empty? migrations)
+      (warn "No migration found")
+      (doseq [migration migrations]
+        (up migration)))))

 (defn new-migrate
-  "Create a new migration file with the given name"
-  ([config name]
-   (new-migrate config (:default-db config) name))
-  ([config db name & rest]
-   (println "<<<<")
-   (println config)
-   (println (current-env))
-   (println db)
-   (println name)
-   (joplin/create config (current-env) (keyword db) name)))
+  [name & rest]
+  (let [epoch     (epoch-time)
+        nsname    (str  name "_" epoch)
+        file-path (make-file-path nsname)]
+
+    (task/info "Creating migration file: " file-path)
+    (spit file-path
+          (format migration-template
+                  migration-prefix
+                  (clojure.string/replace nsname #"_" "-")))
+
+    (info "Updating migrations lock file")
+    (update-lock (clojure.string/replace nsname #"_" "-"))))

 (defn wrong-command
   [cmd]
-  (error (format "Can't find the command '%s'." cmd)))
+  (task/error (format "Can't find the command '%s'." cmd)))

 (defn -main
   [command & rest]
-  (let [config (joplin-config)]
-    (cond
-      (= command "migration") (apply new-migrate config rest)
-      (= command "migrate")   (apply migrate config rest)
-      :else (wrong-command command))))
+  (cond
+    (= command "migration") (apply new-migrate rest)
+    (= command "migrate")   (apply migrate rest)
+    (= command "create")    (apply create rest)
+    :else (wrong-command command)))


:bicyclist::dash:

:bicyclist::dash:

--- src/clj/mokkameister/train.clj
+++ src/clj/mokkameister/train.clj
@@ -8,6 +8,7 @@
                             :horse 2
                             :unicorn_face 1
                             :boar 1
+                            :bicyclist 1
                             :tractor 1})

 (def ^:private train-endings {:dash 8


Use fn for subsequent prompts in standalone mode

--- src/clj/reply/reader/jline.clj
+++ src/clj/reply/reader/jline.clj
@@ -51,7 +51,7 @@
                       :as options}]
   (simple-jline/set-jline-output!)
   (let [prompt-fn (->fn custom-prompt (fn [ns] (str ns "=> ")))
-        subsequent-prompt-fn (->fn subsequent-prompt nil)]
+        subsequent-prompt-fn (->fn subsequent-prompt (constantly nil))]
     (set-prompt-fn! prompt-fn)
     ; since construction is side-effect-y
     (reset! jline-reader (simple-jline/setup-console-reader options))


added fqn-history-list thru which you can go back to the previous fqn's + associated menu and popups

--- src/clj_ns_browser/browser.clj
+++ src/clj_ns_browser/browser.clj
@@ -449,6 +449,23 @@
                        (letfn [(id [kw] (select-id root kw))]
                          (swap! (id :ns-require-btn-atom) not))))))

+(add-app-action :fqn-history-back-action
+  (action :name "Previous FQN"
+          :key  "menu B"
+          :enabled? true
+          :handler (fn [e]
+           (let [root (to-root e)]
+             (letfn [(id [kw] (select-id root kw))]
+               (let [atm (seesaw.meta/get-meta root :fqn-history-list-atom)
+                     stck @atm]
+                 (when-let [p (and (not-empty stck) (pop stck))]
+                   (when-let [fqn (peek p)]
+                      (invoke-soon
+                        (swap! atm (fn [ll]
+                          (if (and (not-empty ll) (not-empty (pop ll)))
+                            (pop (pop ll))
+                            [])))
+                        (browser-with-fqn *ns* fqn root))))))))))

 ;; Init functions called during construction of a frame with its widget hierarchy
@@ -457,6 +474,7 @@
   [root]
   (letfn [(id [kw] (select-id root kw))]
     (seesaw.meta/put-meta! root :atom-map (make-button-atom-map all-buttons-with-atoms))
+    (seesaw.meta/put-meta! root :fqn-history-list-atom (atom []))
     (swap! all-ns-unloaded-atom (fn [& a] (all-ns-unloaded)))
     (swap! all-ns-loaded-atom (fn [& a] (all-ns-loaded)))
     (config! (id :vars-lb-sp) :preferred-size (config (id :vars-lb-sp) :size))
@@ -615,7 +633,11 @@
                                         (symbol v))]
                         (str n))
                       (fqname (selection (id :ns-lb)) v))]
-            (if (not= fqn "")
+            (when (not= fqn "")
+              ;; update fqn-history-list
+              (let [l (seesaw.meta/get-meta root :fqn-history-list-atom)]
+                (when-not (= (peek @l) fqn)
+                      (swap! l (fn [ll] (conj ll fqn)))))
               fqn)))))
       (b/tee
           (b/property (id :doc-tf) :text)))
@@ -952,7 +974,8 @@
       (config! file-menu :items [(id :new-browser-action)])

       (config! edit-menu :items [(id :copy-fqn-action) (id :fqn-from-clipboard-action)
-                                 (id :fqn-from-selection-action) (id :open-url-from-selection-action)])
+                                 (id :fqn-from-selection-action) (id :open-url-from-selection-action)
+                                  :separator (id :fqn-history-back-action)])

       (config! ns-menu :items [(id :ns-require-btn-action) :separator (id :ns-trace-btn-action) (id :ns-untrace-btn-action)])

@@ -992,7 +1015,8 @@
       (config! (id :doc-ta) :popup doc-ta-popup)
       (config! doc-ta-popup :items [(id :new-browser-action) :separator (id :copy-fqn-action)
                                     (id :fqn-from-clipboard-action) (id :fqn-from-selection-action)
-                                    (id :open-url-from-selection-action) :separator
+                                    (id :open-url-from-selection-action)
+                                    :separator (id :fqn-history-back-action) :separator
                                     ;;auto-refresh-browser-cb :separator
                                     (id :zoom-in-action) (id :zoom-out-action)])

@@ -1002,7 +1026,8 @@
                                     (id :copy-fqn-action)
                                     (id :fqn-from-clipboard-action)
                                     (id :fqn-from-selection-action)
-                                    (id :open-url-from-selection-action)
+                                    (id :open-url-from-selection-action)
+                                    :separator (id :fqn-history-back-action)
                                     :separator
                                     (id :ns-require-btn-action)
                                     :separator
@@ -1014,7 +1039,8 @@
       (config! vars-lb-popup :items [(id :new-browser-action)
                                     :separator
                                     (id :copy-fqn-action) (id :fqn-from-clipboard-action)
-                                    (id :fqn-from-selection-action) (id :open-url-from-selection-action)
+                                    (id :fqn-from-selection-action) (id :open-url-from-selection-action)
+                                    :separator (id :fqn-history-back-action)
                                     :separator
                                     (id :var-trace-btn-action)
                                     :separator


Added some more devcards to show the different API routes in action.

--- src/cljs/word_finder/core.cljs
+++ src/cljs/word_finder/core.cljs
@@ -17,7 +17,7 @@
 (enable-console-print!)

 (defcard first-card
-  (sab/html [:div "This is your first devcard :P"]))
+  (sab/html [:div "This is your first devcard :{"]))

 (defcard input-testing
   "Testing our basic input component."
@@ -43,7 +43,9 @@
   input-for-output)

 (defcard server-side-testing
-  "### Connecting to the server-side code to take the input and search for it."
+  "### Connecting to the server-side code to take the input and search for it.
+
+Search using a simple regular expression like `a.le` to find some four-letter words."
   (fn [data _]
     ;; this code is bad, callbacks in callbacks!
     (reagent/as-element [(components/input-text-field (fn [input] (server-side/find-words input (fn [server-data] (reset! data server-data)))))]))
@@ -51,10 +53,21 @@
   {:inspect-data true :history true})

 (defcard server-side-anagram
-  "### Connecting to the server-side code to take the input and search for it."
+  "### Connecting to the server-side code to take the input and search for it.
+
+Searches for exact anagrams of a word; it won't use the regular expression as above.  Try `lemon`."
   (fn [data _]
     ;; this code is bad, callbacks in callbacks!
     (reagent/as-element [(components/input-text-field (fn [input] (server-side/find-anagrams input (fn [server-data] (reset! data server-data)))))]))
+  {:value nil}
+  {:inspect-data true :history true})
+
+(defcard server-side-sub-anagrams
+  "### Connecting to the server-side code to find sub-anagrams
+
+It will find all of the words one can make with the input word."
+  (fn [data _]
+    (reagent/as-element [(components/input-text-field (fn [input] (server-side/find-sub-anagrams input (fn [server-data] (reset! data server-data)))))]))
   {:value nil}
   {:inspect-data true :history true})


Refresh project tree when window is focused

--- src/clojure/nightcode/core.clj
+++ src/clojure/nightcode/core.clj
@@ -5,7 +5,8 @@
             [nightcode.lein :as lein]
             [nightcode.projects :as p]
             [nightcode.utils :as utils])
-  (:import [org.pushingpixels.substance.api SubstanceLookAndFeel]
+  (:import [java.awt.event WindowAdapter]
+           [org.pushingpixels.substance.api SubstanceLookAndFeel]
            [org.pushingpixels.substance.api.skin GraphiteSkin])
   (:gen-class))

@@ -151,6 +152,10 @@
                          :height 768
                          :on-close :exit)
                 shortcuts/create-hints
+                (doto (.addWindowListener
+                        (proxy [WindowAdapter] []
+                          (windowActivated [e]
+                            (p/update-project-tree)))))
                 s/show!))
     ; initialize the project pane
     (p/update-project-tree)))


Remove unnecessary dialog check

Remove unnecessary dialog check

--- src/clojure/nightmod/utils.clj
+++ src/clojure/nightmod/utils.clj
@@ -9,8 +9,7 @@
             [nightmod.input :as input]
             [seesaw.core :as s])
   (:import [java.awt BorderLayout KeyboardFocusManager]
-           [java.text SimpleDateFormat]
-           [javax.swing JDialog]))
+           [java.text SimpleDateFormat]))

 (def ^:const window-width 1200)
 (def ^:const window-height 768)
@@ -41,13 +40,9 @@

 (defn new-project-name!
   [template]
-  (when-not (-> (KeyboardFocusManager/getCurrentKeyboardFocusManager)
-                .getFocusedWindow
-                type
-                (isa? JDialog))
-    (dialogs/show-text-field-dialog!
-      (nc-utils/get-string :enter-project-name)
-      (nc-utils/get-string template))))
+  (dialogs/show-text-field-dialog!
+    (nc-utils/get-string :enter-project-name)
+    (nc-utils/get-string template)))

 (defn new-project-dir!
   [project-name]


:bug: Fix unexpected internal error on frame hidding.

Because of incorrect use of hooks.

--- frontend/src/uxbox/main/ui/workspace/shapes/frame.cljs
+++ frontend/src/uxbox/main/ui/workspace/shapes/frame.cljs
@@ -43,20 +43,6 @@
                (recur (first ids) (rest ids))
                false))))))

-(defn use-mouse-over
-  [{:keys [id] :as shape}]
-  (mf/use-callback
-   (mf/deps shape)
-   (fn []
-     (st/emit! (dws/change-hover-state id true)))))
-
-(defn use-mouse-out
-  [{:keys [id] :as shape}]
-  (mf/use-callback
-   (mf/deps shape)
-   (fn []
-     (st/emit! (dws/change-hover-state id false)))))
-
 (defn frame-wrapper-factory
   [shape-wrapper]
   (let [frame-shape (frame/frame-shape shape-wrapper)]
@@ -93,7 +79,19 @@
              (fn [event]
                (dom/prevent-default event)
                (st/emit! dw/deselect-all
-                         (dw/select-shape (:id shape)))))]
+                         (dw/select-shape (:id shape)))))
+
+            on-mouse-over
+            (mf/use-callback
+             (mf/deps (:id shape))
+             (fn []
+               (st/emit! (dws/change-hover-state (:id shape) true))))
+
+            on-mouse-out
+            (mf/use-callback
+             (mf/deps (:id shape))
+             (fn []
+               (st/emit! (dws/change-hover-state (:id shape) false))))]

         (when-not (:hidden shape)
           [:g {:class (when selected? "selected")
@@ -115,8 +113,8 @@
                                ")")
                    ;; User may also select the frame with single click in the label
                    :on-click on-double-click
-                   :on-mouse-over (use-mouse-over shape)
-                   :on-mouse-out (use-mouse-out shape)}
+                   :on-mouse-over on-mouse-over
+                   :on-mouse-out on-mouse-out}
             (:name shape)]
            [:*
             [:& frame-shape


CMR-1870: Addressing TODOs.

CMR-1870: Addressing TODOs.

--- indexer-app/src/cmr/indexer/services/index_service.clj
+++ indexer-app/src/cmr/indexer/services/index_service.clj
@@ -71,24 +71,13 @@
   ;; We want the latest permitted groups to be indexed with the collections
   (acl-fetcher/refresh-acl-cache context)

-
-
   (doseq [provider-id provider-ids]
     (info "Reindexing latest collections for provider" provider-id)
     (let [latest-collections (meta-db/find-collections context {:provider-id provider-id :latest true})]
       (bulk-index context [latest-collections] false))

-    ;; TODO add comment that this won't cleanup old revisions that were removed
-    ;; Add comment on issue that we'll handle it during index management epic
-
-    ;; TODO when deploying this we need to manually delete everything from the index
-    ;; then reindex things.
-    ;; Make a note of that in the issue.
-    ;; Create the sprint release page and add that note as well along with the elastic request to send.
-
-
-    ;; TODO  when processing the message in the indexer make the _version correct (revision id + 1)
-
+    ;; Note that this will not unindex revisions that were removed directly from the database.
+    ;; We will handle that with the index management epic.
     (info "Reindexing all collection revisions for provider" provider-id)
     (let [all-revisions-batches (meta-db/find-collections-in-batches
                                   context


Turned many games back on

Turned many games back on

--- src/obb_demo/views/layout/header.cljs
+++ src/obb_demo/views/layout/header.cljs
@@ -10,7 +10,7 @@
     [:ul.nav.navbar-nav.navbar-right
       [:li [:a {:on-click #(secretary/dispatch! "/play") :href "#"} "Play!"]]
       [:li [:a {:on-click #(secretary/dispatch! "/") :href "#"} "AI vs AI"]]
-      #_[:li [:a {:on-click #(secretary/dispatch! "/many-games") :href "#"} "Many games"]]
+      [:li [:a {:on-click #(secretary/dispatch! "/many-games") :href "#"} "Many games"]]
       [:li [:a {:on-click #(secretary/dispatch! "/units") :href "#"} "Units"]]
       [:li [:a {:href "https://github.com/orionsbelt-battlegrounds/obb-rules"} "Source Code"]]]]
    ])


Population of spawn village vary with the size of the original village

--- src/amindblowingworld/civs.clj
+++ src/amindblowingworld/civs.clj
@@ -233,6 +233,10 @@

 (declare update-settlement-fun)

+(defn rand-between [min max]
+  (let [diff (- max min)]
+    (+ min (rand-int diff))))
+
 (defn spawn-new-village-from [id-settlement]
   (try
     (let [old-village   (get-settlement id-settlement)
@@ -245,7 +249,7 @@
         new-village-name (.name language)
         new-pos (free-random-land-near (.pos old-village))
         _               (assert (not (nil? new-pos)))
-        pop-new-village 100
+        pop-new-village (rand-between (/ (.pop old-village) 5) (/ (.pop old-village) 3))
         pop-old-village (- (.pop old-village) pop-new-village)
         settlement (Settlement. (get-next-id) new-village-name pop-new-village (.id tribe) new-pos)
         id-new-settlement (.id settlement)


Fix util/defconst-

Fix util/defconst-

--- src/bakyeono/litedocx/util.clj
+++ src/bakyeono/litedocx/util.clj
@@ -11,8 +11,12 @@
 ;;; def~
 (defmacro defconst-
   [symbol init]
-  `(def ^:const ^{:private true}
-     ~symbol ~init))
+  `(def
+    ~(with-meta symbol
+       (assoc (meta symbol)
+        :const true
+        :private true))
+    ~init))

 ;;; Collection
 (defn mapstr


Fix wpml.clj

Fix wpml.clj

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -54,7 +54,6 @@
 ;;; e -> clojure.data.xml/element
 ;;; Since clojure.data.xml/element is used so much,
 ;;; use 'node' as an abbreviation of it.
-;
 (defconst- node clojure.data.xml/element)

 ;;; Constants


Refactor style tag functions in wpml

Refactor style tag functions in wpml

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -409,12 +409,11 @@
         (node :w:name {:w:val name}) ; Primary Style Name
         (node :w:basedOn {:w:val "a"}) ; Parent Style ID
         (node :w:qFormat) ; Primary Style
-        (when (or word-wrap? align
-                  space-before space-after space-line
-                  indent-left indent-right indent-first-line mirror-indents?)
-          (paragraph-properties options))
-        (when (or font font-size font-color bold? italics? underline?)
-          (run-properties options))))
+        (paragraph-properties options)
+        (run-properties options)))
+
+(def default-table-style-options
+  {})

 (defn- table-border-attrs
   "Returns an attributes map for content tags of w:tblBorders tag.
@@ -426,7 +425,7 @@
    :w:space space}) ; Border Spacing Measurement)

 (defn- table-borders
-  "Returns w:tblBorders tag. Called by table-style.
+  "Returns w:tblBorders tag. Called by table-properties.

   Parameters:
   Takes one or six parameters.
@@ -446,6 +445,50 @@
      (node :w:insideH (table-border-attrs inside-h))
      (node :w:insideV (table-border-attrs inside-v)))))

+(defn- table-properties
+  "Creates w:tblPr tag node. Called by table-style.
+
+  Options: See 'Options' of table-style"
+  [{:as options
+    :keys [table-align
+           cell-margin-top cell-margin-left cell-margin-bottom cell-margin-right]}]
+  ;; Table Properties
+  (node :w:tblPr {}
+        ;; Number of Rows in Row Band
+        (node :w:tblStyleRowBandSize {:w:val 1})
+        ;; Table Alignment
+        (node :w:jc {:w:val table-align})
+        ;; Table Indent from Leading Margin
+        (node :w:tblInd {:w:val 0 :w:type "dxa"})
+        ;; Table Borders
+        (table-borders ["single" "auto" 4 0])
+        ;; Table Cell Margin
+        (node :w:tblCellMar {}
+              (node :w:top {:w:w cell-margin-top :w:type "dxa"})
+              (node :w:left {:w:w cell-margin-left :w:type "dxa"})
+              (node :w:bottom {:w:w cell-margin-bottom :w:type "dxa"})
+              (node :w:right {:w:w cell-margin-right :w:type "dxa"}))))
+
+(defn- table-row-properties
+  "Creates w:trPr tag node. Called by table-style."
+  [{:as options
+    :keys [cell-margins]
+    :or default-table-style-options}]
+  ;; Table Row Properties
+  (node :w:trPr {}
+        ;; Table Row Alignment
+        (node :w:jc {:w:val cell-h-align})))
+
+(defn- table-cell-properties
+  "Creates w:tcPr tag node. Called by table-style."
+  [{:as options
+    :keys [cell-margins]
+    :or default-table-style-options}]
+  ;; Table Cell Properties
+  (node :w:tcPr {}
+        ;; Table Cell Vertical Alignment
+        (node :w:vAlign {:w:val cell-v-align}))
+
 (defn table-style
   "Returns w:style tag for table style with w:style tag for the font,
   as a vector containing both of them.
@@ -453,6 +496,15 @@
   Parameters:
   - name: <string> Used as index. Must be unique.
   - & options: option, value, ...
+
+  Options:
+  - table-align: Alignment of table itself. Values: left, right, both, ...
+  - cell-margin-top: Margin in this side of cell. Value: numbers.
+  - cell-margin-left: Same as above.
+  - cell-margin-bottom: Same as above.
+  - cell-margin-right: Same as above.
+  - cell-h-align: Horizontal alignment inside cells. Values: left, right, both, ...
+  - cell-v-align: Vertical alignment inside cells. Values: top, bottom, center, ...

   Examples:
   - (table-style \"table1\")
@@ -467,6 +519,7 @@
              align
              space-before space-after space-line
              indent-left indent-right indent-first-line mirror-indents?
+             table-align
              cell-margin-top cell-margin-bottom cell-margin-left cell-margin-right
              cell-h-align cell-v-align]}]
   ;; Table Style Definition
@@ -476,36 +529,11 @@
         (node :w:name {:w:val name}) ; Primary Style Name
         (node :w:basedOn {:w:val "a1"}) ; Parent Style ID
         (node :w:qFormat) ; Primary Style
-        (when (or word-wrap? align
-                  space-before space-after space-line
-                  indent-left indent-right indent-first-line mirror-indents?)
-          (paragraph-properties options))
-        (when (or font font-size font-color bold? italics? underline?)
-          (run-properties options))
-        ;; Style Table Properties
-        (node :w:tblPr {}
-              ;; Number of Rows in Row Band
-              (node :w:tblStyleRowBandSize {:w:val 1})
-              ;; Table Alignment
-              (node :w:jc {:w:val "both"})
-              ;; Table Indent from Leading Margin
-              (node :w:tblInd {:w:val 0 :w:type "dxa"})
-              ;; Table Borders
-              (table-borders ["single" "auto" 4 0])
-              ;; Table Cell Margin
-              (node :w:tblCellMar {}
-                    (node :w:top {:w:w cell-margin-top :w:type "dxa"})
-                    (node :w:left {:w:w cell-margin-left :w:type "dxa"})
-                    (node :w:bottom {:w:w cell-margin-bottom :w:type "dxa"})
-                    (node :w:right {:w:w cell-margin-right :w:type "dxa"})))
-        ;; Table Row Properties
-        (node :w:trPr {}
-              ;; Table Row Alignment
-              (node :w:jc {:w:val cell-h-align}))
-        ;; Table Cell Properties
-        (node :w:tcPr {}
-              ;; Table Cell Vertical Alignment
-              (node :w:vAlign {:w:val cell-v-align}))
+        (paragraph-properties options)
+        (run-properties options)
+        (table-properties options)
+        (table-row-properties options)
+        (table-cell-properties options)
         ;; First Row Formatting Properties
         (node :w:tblStylePr {:w:type "firstRow"})
         ;; Band 1 Horizontal Formatting Properties


correct identicon in the group chat (#249)

Former-commit-id: 0912b61f70c0430483ffa6ba1026b26396481469

--- src/status_im/chat/views/message.cljs
+++ src/status_im/chat/views/message.cljs
@@ -195,9 +195,9 @@
 (defview member-photo [from]
   [photo-path [:photo-path from]]
   [view st/photo-view
-   [image {:source (if (s/blank? photo-path)
-                     res/user-no-photo
-                     {:uri photo-path})
+   [image {:source {:uri (if (s/blank? photo-path)
+                           (identicon from)
+                           photo-path)}
            :style  st/photo}]])

 (defn incoming-group-message-body


Fixed null pointer exception from missing /.

--- src/clj/elephantdb/service.clj
+++ src/clj/elephantdb/service.clj
@@ -144,7 +144,7 @@
   on completion."
   [domains local-dir]
   (let [error (atom nil)]
-    (dofor [domain domains :let [domain-path (str local-dir domain)]]
+    (dofor [domain domains :let [domain-path (str (path local-dir domain))]]
            (try (log-message "Purging old versions of domain: " domain)
                 (cleanup-domain! domain-path)
                 (catch Throwable t


adjusted forma.ops.classify to reflect FormaValue change

--- src/clj/forma/ops/classify.clj
+++ src/clj/forma/ops/classify.clj
@@ -15,7 +15,7 @@
   ;; {:pre [(instance? forma.schema.FormaValue forma-val)
          ;; (instance? forma.schema.NeighborValue neighbor-val)]}
   (let [intercept [1]
-        [fire short long t-stat break] forma-val
+        [fire short long t-stat break] (thrift/unpack forma-val)
         fire-seq (thrift/unpack fire)
         [fire-neighbors _ & more] (thrift/unpack neighbor-val) ;; skip count
         fire-neighbor (thrift/unpack fire-neighbors)]


add missing param

add missing param

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -210,12 +210,13 @@
       [:th.text-right "Balance"]
       [:th.text-center "Rec."]
       [:th " "]]
-     (->> (transactions/items-by-account (env :db)
-                                         (:id account)
-                                         (pagination/prepare-options params))
+     (->> (transactions/search-items (env :db)
+                                     {:account-id (:id account)}
+                                     (pagination/prepare-options params))
           (map #(assoc % :transaction (transactions/find-by-id
                                         (env :db)
-                                        (:transaction-id %))))
+                                        (:transaction-id %)
+                                        (:transaction-date %))))
           (map transaction-item-row))]
     [:p
      (pagination/nav