<commit_before>(ns celestial.fixtures
  (:import 
     java.awt.datatransfer.StringSelection
     java.awt.Toolkit)
  (:refer-clojure :exclude [type])
  (:require 
    [celestial.redis :as r]
    [celestial.persistency :as p])
  (:use [celestial.common :only (slurp-edn)]))

(def redis-prox-spec (slurp-edn "fixtures/redis-system.edn"))

(def redis-bridged-prox (slurp-edn "fixtures/redis-system-bridged.edn"))

(def redis-type (slurp-edn "fixtures/redis-type.edn"))

(def redis-ec2-spec (slurp-edn "fixtures/redis-ec2-system.edn"))

(def redis-vc-spec (slurp-edn "fixtures/redis-vc-system.edn"))

(def local-prox (slurp-edn "fixtures/celestial.edn"))

(def proxmox-3 (slurp-edn "fixtures/proxmox-3.edn"))

(def clustered-prox (slurp-edn "fixtures/celestial-cluster.edn"))

(def redis-actions (slurp-edn "fixtures/redis-actions.edn"))

(def user-quota (slurp-edn "fixtures/user-quota.edn"))

(defn clipboard-copy [s]
  (let [clp (.getSystemClipboard (Toolkit/getDefaultToolkit))]
    (.setContents clp (StringSelection. s) nil)))

;; (clipboard-copy (clojure.data.json/write-str redis-type :escape-slash false))
;; (clipboard-copy (clojure.data.json/write-str redis-prox-spec :escape-slash false))

(defn is-type? [type]
  (fn [exception] 
    (= type (get-in (.getData exception) [:object :type]))))

(defn with-m? [m]
  (fn [actual]
    (= (get-in (.getData actual) [:object :errors]) m)))

(defmacro with-conf 
  "Using fixture/celestial.edn conf file"
  [f & body]
  (if (symbol? f)
    `(with-redefs [celestial.config/config ~f]
       ~@body 
       )
    `(with-redefs [celestial.config/config celestial.fixtures/local-prox]
       ~@(conj body f) 
       )))

(defn populate []
  (r/clear-all)
  (p/add-type redis-type)
  (p/add-action redis-actions)
  (doseq [i (range 100)] 
    (if (= 0 (mod i 2)) 
      (p/add-system redis-prox-spec)
      (p/add-system redis-ec2-spec))))

(def host (.getHostName (java.net.InetAddress/getLocalHost)))

(def puppet-ami (merge-with merge redis-ec2-spec {:aws {:image-id "ami-f5e2ff81" :key-name host}}))<commit_msg>adding default dev env<commit_after>(ns celestial.fixtures
  (:import 
     java.awt.datatransfer.StringSelection
     java.awt.Toolkit)
  (:refer-clojure :exclude [type])
  (:require 
    [celestial.redis :as r]
    [celestial.persistency :as p])
  (:use [celestial.common :only (slurp-edn)]))

(def redis-prox-spec (slurp-edn "fixtures/redis-system.edn"))

(def redis-bridged-prox (slurp-edn "fixtures/redis-system-bridged.edn"))

(def redis-type (slurp-edn "fixtures/redis-type.edn"))

(def redis-ec2-spec (slurp-edn "fixtures/redis-ec2-system.edn"))

(def redis-vc-spec (slurp-edn "fixtures/redis-vc-system.edn"))

(def local-prox (slurp-edn "fixtures/celestial.edn"))

(def proxmox-3 (slurp-edn "fixtures/proxmox-3.edn"))

(def clustered-prox (slurp-edn "fixtures/celestial-cluster.edn"))

(def redis-actions (slurp-edn "fixtures/redis-actions.edn"))

(def user-quota (slurp-edn "fixtures/user-quota.edn"))

(defn clipboard-copy [s]
  (let [clp (.getSystemClipboard (Toolkit/getDefaultToolkit))]
    (.setContents clp (StringSelection. s) nil)))

;; (clipboard-copy (clojure.data.json/write-str redis-type :escape-slash false))
;; (clipboard-copy (clojure.data.json/write-str redis-prox-spec :escape-slash false))

(defn is-type? [type]
  (fn [exception] 
    (= type (get-in (.getData exception) [:object :type]))))

(defn with-m? [m]
  (fn [actual]
    (= (get-in (.getData actual) [:object :errors]) m)))

(defmacro with-conf 
  "Using fixture/celestial.edn conf file"
  [f & body]
  (if (symbol? f)
    `(with-redefs [celestial.config/config ~f celestial.model/env :dev]
       ~@body 
       )
    `(with-redefs [celestial.config/config celestial.fixtures/local-prox celestial.model/env :dev ]
       ~@(conj body f) 
       )))

(defn populate []
  (r/clear-all)
  (p/add-type redis-type)
  (p/add-action redis-actions)
  (doseq [i (range 100)] 
    (if (= 0 (mod i 2)) 
      (p/add-system redis-prox-spec)
      (p/add-system redis-ec2-spec))))

(def host (.getHostName (java.net.InetAddress/getLocalHost)))

(def puppet-ami (merge-with merge redis-ec2-spec {:aws {:image-id "ami-f5e2ff81" :key-name host}}))
{'fraction_non_alphanumeric': 0.17742706838833094, 'fraction_numerical': 0.007173601147776184, 'mean_word_length': 3.7480136208853576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '331727', 'n_tokens_mistral': 1802, 'n_tokens_neox': 1715, 'n_words': 322}