Skip to content

Commit

Permalink
Test ctor throws on invalid key
Browse files Browse the repository at this point in the history
Also, use public configuration key string for the encryption key.
  • Loading branch information
Derek Dagit committed Feb 20, 2013
1 parent 98292be commit 7970fee
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@
"Throws RuntimeException when no encryption key is given.")
)

(deftest test-encrypts-and-decrypts-message
(deftest test-constructor-throws-on-invalid-key
; The encryption key must be hexadecimal.
(let [conf {BlowfishTupleSerializer/SECRET_KEY "0123456789abcdefg"}]
(is (thrown? RuntimeException (new BlowfishTupleSerializer nil conf))
"Throws RuntimeException when an invalid encryption key is given.")
)
)

(deftest test-encrypts-and-decrypts-message
(let [
test-text (str
"Tetraodontidae is a family of primarily marine and estuarine fish of the order"
Expand All @@ -32,7 +39,7 @@
)
kryo (new Kryo)
arbitrary-key "7dd6fb3203878381b08f9c89d25ed105"
storm_conf {"topology.tuple.serializer.blowfish.key" arbitrary-key}
storm_conf {BlowfishTupleSerializer/SECRET_KEY arbitrary-key}
writer-bts (new BlowfishTupleSerializer kryo storm_conf)
reader-bts (new BlowfishTupleSerializer kryo storm_conf)
buf-size 1024
Expand Down

0 comments on commit 7970fee

Please sign in to comment.