Permalink
Browse files

Test ctor throws on invalid key

Also, use public configuration key string for the encryption key.
  • Loading branch information...
1 parent 98292be commit 7970feeb90c36e0338a7e84aafaace7569129319 @d2r d2r committed Feb 20, 2013
Showing with 9 additions and 2 deletions.
  1. +9 −2 test/clj/backtype/storm/security/serialization/BlowfishTupleSerializer_test.clj
View
11 test/clj/backtype/storm/security/serialization/BlowfishTupleSerializer_test.clj
@@ -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"
@@ -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

0 comments on commit 7970fee

Please sign in to comment.