Skip to content

Commit

Permalink
Use clojure.java.io/resource to get at resources in the classpath. Mu…
Browse files Browse the repository at this point in the history
…ch nicer.
  • Loading branch information
marktriggs committed Aug 7, 2011
1 parent e6672db commit b3063c0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/net/dishevelled/test/mailindex.clj
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(:require [clojure.contrib.seq :as sq]) (:require [clojure.contrib.seq :as sq])
(:import (org.apache.lucene.store RAMDirectory)) (:import (org.apache.lucene.store RAMDirectory))
(:use clojure.test (:use clojure.test
clojure.java.io
net.dishevelled.mailindex)) net.dishevelled.mailindex))




Expand All @@ -18,12 +19,11 @@




(defn get-test-messages [] (defn get-test-messages []
(let [cl (-> (Thread/currentThread) .getContextClassLoader)] (map (fn [[n filename]]
(map (fn [[n filename]] {:id {:group "test" :num (str n)}
(with-open [msg (.getResourceAsStream cl filename)] :content (.getBytes (slurp (resource filename)) "UTF-8")})
{:id {:group "test" :num (str n)} (sq/indexed ["test-message-1.mbox"
:content (.getBytes (slurp msg) "UTF-8")})) "test-message-with-html-attachment.mbox"])))
(sq/indexed ["test-message-1.mbox" "test-message-with-html-attachment.mbox"]))))




(defn index-test-messages [f] (defn index-test-messages [f]
Expand Down

0 comments on commit b3063c0

Please sign in to comment.