             [com.gfredericks.test.chuck :refer [times]]
             [com.gfredericks.test.chuck.clojure-test :refer [checking]]))
 
-(defn new-replica []
-    (atom {:replica {:job-scheduler :onyx.job-scheduler/balanced
-                     :messaging {:onyx.messaging/impl :dummy-messenger}}
-           :message-id 0}))
-
-
 (def messenger (dummy-messenger {:onyx.peer/try-join-once? false}))
 
 (def id (java.util.UUID/randomUUID))

                                (close-peer (:event @previous-peer-state)))))
   :real/command #'new-log-after-crash})


(def add-to-log-espec
  {:model/args (fn [state]
                 [gen/int])
   :next-state (fn [state [arg] result]
                 (conj state arg))
   :real/command #'add-to-bookkeeper})

(defn new-peer-log []
  (reset! bookkeeper-peer-state {:ledger-ids []
                                 :event-log []})
  ;; must setup before new-pipeline so that ledger id is recorded
  (swap! bookkeeper-peer-state assoc :event (new-pipeline)))

(defn close-peer-cleanup [state]
  (close-peer (:event @bookkeeper-peer-state)))


(def peer-config (assoc (:peer-config config) 
                        :onyx/id id
                        :onyx.bookkeeper/write-batch-size 2 
                        :onyx.bookkeeper/write-batch-timeout 5))

(def bookkeeper-peer-state (atom nil))

(defn init-state [& args]
  [])
