Skip to content

Commit

Permalink
Moving to ns com.github.drsnyder.beanstalk
Browse files Browse the repository at this point in the history
Using "beanstalk" wasn't in keeping with the module naming convention
so I'm moving beanstalk to com.github.drsnyder.beanstalk.
  • Loading branch information
drsnyder committed Jan 8, 2012
1 parent 4123193 commit 36cb860
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
6 changes: 3 additions & 3 deletions README.markdown
Expand Up @@ -25,12 +25,12 @@ For example:
Two examples are provided:

; start consumer
lein run -m beanstalk.examples.consumer
lein run -m com.github.drsnyder.beanstalk.examples.consumer

; send some data
lein run -m beanstalk.examples.producer -m "hello" -n 5
lein run -m com.github.drsnyder.beanstalk.examples.producer -m "hello" -n 5
; send shutdown
lein run -m beanstalk.examples.producer -m "exit"
lein run -m com.github.drsnyder.beanstalk.examples.producer -m "exit"

## License

Expand Down
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject beanstalk "1.0.0-SNAPSHOT"
(defproject com.github.drsnyder/beanstalk "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]]
Expand Down
@@ -1,4 +1,4 @@
(ns beanstalk.core
(ns com.github.drsnyder.beanstalk
(:refer-clojure :exclude [read peek use])
(:use [clojure.contrib.condition :only [raise]]
[clojure.string :only [split lower-case]]
Expand Down
@@ -1,16 +1,16 @@
(ns beanstalk.examples.consumer
(ns com.github.drsnyder.beanstalk.examples.consumer
(:gen-class)
(:refer-clojure :exclude [read peek use])
(:use clojure.contrib.command-line)
(:use beanstalk.core))
(:use com.github.drsnyder.beanstalk))

; .clojure
; ./src:./classes:./lib:beanstalk-1.0.0-SNAPSHOT.jar
; (compile 'beanstalk.examples.consumer)
; java -cp ./classes/:./lib/clojure-1.2.0.jar:./lib/clojure-contrib-1.2.0.jar beanstalk.examples.consumer
; (compile 'com.github.drsnyder.beanstalk.examples.consumer)
; java -cp ./classes/:./lib/clojure-1.2.0.jar:./lib/clojure-contrib-1.2.0.jar com.github.drsnyder.beanstalk.examples.consumer
;
; simpler:
; lein run -m beanstalk.examples.consumer
; lein run -m com.github.drsnyder.beanstalk.examples.consumer

(defn -main [& args]
(with-command-line args
Expand Down
@@ -1,16 +1,16 @@
(ns beanstalk.examples.producer
(ns com.github.drsnyder.beanstalk.examples.producer
(:gen-class)
(:refer-clojure :exclude [read peek use])
(:use clojure.contrib.command-line)
(:use beanstalk.core))
(:use com.github.drsnyder.beanstalk))

; .clojure
; ./src:./classes:./lib:beanstalk-1.0.0-SNAPSHOT.jar
; (compile 'beanstalk.examples.producer)
; java -cp ./classes/:./lib/clojure-1.2.0.jar:./lib/clojure-contrib-1.2.0.jar beanstalk.examples.producer
; (compile 'com.github.drsnyder.beanstalk.examples.producer)
; java -cp ./classes/:./lib/clojure-1.2.0.jar:./lib/clojure-contrib-1.2.0.jar com.github.drsnyder.beanstalk.examples.producer
;
; simpler:
; lein run -m beanstalk.examples.producer
; lein run -m com.github.drsnyder.beanstalk.examples.producer

(defn -main [& args]
(with-command-line args
Expand Down
@@ -1,24 +1,25 @@
(ns beanstalk.core-test
(ns com.github.drsnyder.beanstalk-test
(:refer-clojure :exclude [read peek use])
(:use beanstalk.core clojure.test))
(:use [com.github.drsnyder.beanstalk :as beanstalk]
clojure.test))

; tracing: sudo tcpdump -i lo0 -tnNqA tcp port 11300

(deftest test-beanstalk
(let [b (new-beanstalk)]
(is (and (not (nil? b))
(instance? beanstalk.core.Beanstalk b)))))
(instance? com.github.drsnyder.beanstalk.Beanstalk b)))))

(deftest test-stats
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [b (new-beanstalk)
result (.stats b)]
(is (not (nil? (:payload result))))
(is (> (.length (:payload result)) 0)))))


(deftest test-put
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [b (new-beanstalk)
result (.put b 0 0 10 5 "hello")]
(println (str "result => " result))
Expand All @@ -30,7 +31,7 @@


(deftest test-use
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [b (new-beanstalk)
result (.use b "test-tube")]
(println (str "result => " result))
Expand All @@ -39,7 +40,7 @@


(deftest test-reserve
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [p (new-beanstalk) ; producer
c (new-beanstalk) ; consumer
use-p (.use p "test-tube")
Expand All @@ -58,7 +59,7 @@

;; make these tests more stable-- use a random tube?
(deftest test-reserve-with-timeout
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [data "hello-reserve-with-timeout"
p (new-beanstalk)
c (new-beanstalk)
Expand All @@ -76,7 +77,7 @@


(deftest test-release
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [p (new-beanstalk) ; producer
c (new-beanstalk) ; consumer
use-p (.use p "test-tube")
Expand All @@ -94,7 +95,7 @@
(is (= true (.delete c (:id put-p)))))))

(deftest test-bury
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [p (new-beanstalk) ; producer
c (new-beanstalk) ; consumer
use-p (.use p "test-tube")
Expand All @@ -111,7 +112,7 @@
(is (= true (.delete c (:id put-p)))))))

(deftest test-touch
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [p (new-beanstalk) ; producer
c (new-beanstalk) ; consumer
use-p (.use p "test-tube")
Expand All @@ -128,15 +129,15 @@
(is (= true (.delete c (:id put-p)))))))

(deftest test-ignore
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [c (new-beanstalk)
watch-c (.watch c "test-tube")
ignore-c (.ignore c "default")]
(println (str "ignore: result ignore => " ignore-c))
(is (> (:count ignore-c) 0)))))

(deftest test-peek
(binding [ beanstalk.core/*debug* true ]
(binding [ beanstalk/*debug* true ]
(let [p (new-beanstalk) ; producer
c (new-beanstalk) ; consumer
data (str "hello " (rand-int 100))
Expand Down

0 comments on commit 36cb860

Please sign in to comment.