 (ns com.sixsq.slipstream.ssclj.resources.simu-usage-test
   (:require
     [clojure.test                                       :refer :all]
+    [clojure.java.shell                                 :only [sh] :as sh]
     [com.sixsq.slipstream.ssclj.resources.usage-record  :refer :all]
     [com.sixsq.slipstream.ssclj.usage.record-keeper     :as rc]
     [korma.core                                         :as kc]

  []
  (compute-summaries (some-days)))

(defn compute-weekly-summaries
  []
  (->> (some-days)
       (drop 3) ;; so that first day is monday
       (take-nth 7)
       compute-summaries))

(defn curl
  [qs]
  (println
    (str "curl -H \"slipstream-authn-info: super ADMIN\" -X GET \"http://localhost:8201/ssclj/Usage"
       (tu/urlencode-params qs) "\"")))
(defn populate-usage-records
  []
  (rc/-init)
  (doseq [day (some-days)]
    (println "Populating " day)
    (doseq [i (range nb-records-per-day)]
      (kc/insert rc/usage_records (kc/values (rand-usage-record day))))))


