44
55import org .junit .Before ;
66import org .junit .Test ;
7+ import redis .clients .jedis .JedisPool ;
8+ import redis .clients .jedis .JedisPoolConfig ;
9+ import redis .clients .jedis .Pipeline ;
710
811import static junit .framework .TestCase .*;
912
@@ -28,13 +31,13 @@ public IRLObject() {
2831
2932public class ClientTest {
3033
31- private Client c ;
34+ private JReJSON c ;
3235 private Gson g ;
3336
3437 @ Before
3538 public void initialize () {
3639 g = new Gson ();
37- c = new Client ("localhost" , 6379 );
40+ c = new JReJSON ("localhost" , 6379 );
3841 }
3942
4043 @ Test
@@ -67,7 +70,7 @@ public void setExistingPathOnlyIfExistsShouldSucceed() throws Exception {
6770
6871 c .set ("obj" , new IRLObject ());
6972 Path p = new Path (".str" );
70- c .set ("obj" , "strangle" , Client .ExistenceModifier .MUST_EXIST , p );
73+ c .set ("obj" , "strangle" , JReJSON .ExistenceModifier .MUST_EXIST , p );
7174 assertEquals ("strangle" , c .get ("obj" , p ));
7275 }
7376
@@ -77,7 +80,7 @@ public void setNonExistingOnlyIfNotExistsShouldSucceed() throws Exception {
7780
7881 c .set ("obj" , new IRLObject ());
7982 Path p = new Path (".none" );
80- c .set ("obj" , "strangle" , Client .ExistenceModifier .NOT_EXISTS , p );
83+ c .set ("obj" , "strangle" , JReJSON .ExistenceModifier .NOT_EXISTS , p );
8184 assertEquals ("strangle" , c .get ("obj" , p ));
8285 }
8386
@@ -87,7 +90,7 @@ public void setExistingPathOnlyIfNotExistsShouldFail() throws Exception {
8790
8891 c .set ("obj" , new IRLObject ());
8992 Path p = new Path (".str" );
90- c .set ("obj" , "strangle" , Client .ExistenceModifier .NOT_EXISTS , p );
93+ c .set ("obj" , "strangle" , JReJSON .ExistenceModifier .NOT_EXISTS , p );
9194 }
9295
9396 @ Test (expected = Exception .class )
@@ -96,7 +99,7 @@ public void setNonExistingPathOnlyIfExistsShouldFail() throws Exception {
9699
97100 c .set ("obj" , new IRLObject ());
98101 Path p = new Path (".none" );
99- c .set ("obj" , "strangle" , Client .ExistenceModifier .MUST_EXIST , p );
102+ c .set ("obj" , "strangle" , JReJSON .ExistenceModifier .MUST_EXIST , p );
100103 }
101104
102105 @ Test (expected = Exception .class )
@@ -175,4 +178,33 @@ public void typeException() throws Exception {
175178 c .type ("foobar" , new Path (".foo[1]" ));
176179 }
177180
181+ @ Test (expected = Exception .class )
182+ public void type1Exception () throws Exception {
183+ c ._conn ().flushDB ();
184+ c .set ("foobar" , new FooBarObject (), Path .RootPath ());
185+ c .type ("foobar" , new Path (".foo[1]" ));
186+
187+ JedisPoolConfig conf = new JedisPoolConfig ();
188+ conf .setMaxTotal (poolSize );
189+ conf .setTestOnBorrow (false );
190+ conf .setTestOnReturn (false );
191+ conf .setTestOnCreate (false );
192+ conf .setTestWhileIdle (false );
193+ conf .setMinEvictableIdleTimeMillis (60000 );
194+ conf .setTimeBetweenEvictionRunsMillis (30000 );
195+ conf .setNumTestsPerEvictionRun (-1 );
196+ conf .setFairness (true );
197+
198+ JedisPool pool = new JedisPool (conf , "localhost" , 6379 ,1000 );
199+
200+ JReJSON jReJSON = (JReJSON ) pool .getResource ();
201+
202+
203+
204+ //Pipeline pipe = jReJSON.pipelined();
205+
206+
207+ }
208+
209+
178210}
0 commit comments