   (:require [pdok.featured
              [dynamic-config :as dc]
              [config :as config]
-             [persistence :as persistence]
-             [geoserver :as geoserver]
              [timeline :as timeline]
              [processor :as processor]
              [extracts :as e]

                          (= valid-from (nth %1 1))) extracts)
      (remove #(= version (nth % 0)) extracts))))

(defn- deleted-versions [extracts dataset collection extract-type records]
    (doseq [record records]
      (swap! extracts remove-extract-record record)))

(defn- query [table selector]
  (when (pg/table-exists? test-db "featured_regression_regression-set" table)

  (let [[expected-dataset expected-collection expected-records]
        (with-open [in (io/reader expected-changelog)] (parse-changelog in))
        filestore (config/filestore changelog-dir)
        parsed-changelogs (doall (map (fn [log] (with-open [in (io/input-stream (fs/get-file filestore log))
                                                            zip (ZipInputStream. in)]
                                                  (.getNextEntry zip)
                                                  (parse-changelog zip))) changelogs))
        all-records (mapcat (fn [[_ _ records]] records) parsed-changelogs)]
    (is (every? #(= [expected-dataset expected-collection] %) (->> parsed-changelogs (map (partial take 2)))))
    (is (every? #(not (nil? %)) (->> all-records (filter #(#{:new :change :close} (:action %))) (map :feature))))
