File tree Expand file tree Collapse file tree 4 files changed +27
-26
lines changed
main/com/schooner/MemCached
test/com/schooner/MemCached Expand file tree Collapse file tree 4 files changed +27
-26
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ build.dir=classes
3333test.build.dir =testclasses
3434build.instr.dir =classesinstr
3535project =java_memcached-release
36- ver =2.5.1
36+ ver =2.5.2
3737junit.jar =lib/junit.jar
3838log4j.jar =lib/log4j.jar
3939emma.dir =lib
Original file line number Diff line number Diff line change @@ -1224,14 +1224,14 @@ private final class Connection {
12241224
12251225 public Connection (SchoonerSockIO sock , ArrayList <String > keys ) throws IOException {
12261226 this .sock = sock ;
1227- List <byte []> bufList = new ArrayList <byte []>(keys .size ());
1228- int size = 0 ;
1229- for (String key : keys ) {
1230- byte [] buf = key .getBytes ();
1231- bufList .add (buf );
1232- size += buf .length ;
1233- }
1234- size = size + (bufList .size ()+ 1 )* 24 ;
1227+ List <byte []> bufList = new ArrayList <byte []>(keys .size ());
1228+ int size = 0 ;
1229+ for (String key : keys ) {
1230+ byte [] buf = key .getBytes ();
1231+ bufList .add (buf );
1232+ size += buf .length ;
1233+ }
1234+ size = size + (bufList .size () + 1 ) * 24 ;
12351235 outgoing = ByteBuffer .allocateDirect (size );
12361236 outgoing .clear ();
12371237 for (String key : keys ) {
@@ -1314,8 +1314,8 @@ public ByteBuffer getBuffer() {
13141314 }
13151315
13161316 public String toString () {
1317- return new StringBuffer ().append ("Connection to " ).append (sock .getHost ()).append (" with " ). append (
1318- incoming .size ()).append (" bufs; done is " ).append (isDone ).toString ();
1317+ return new StringBuffer ().append ("Connection to " ).append (sock .getHost ()).append (" with " )
1318+ . append ( incoming .size ()).append (" bufs; done is " ).append (isDone ).toString ();
13191319 }
13201320 }
13211321
Original file line number Diff line number Diff line change @@ -337,15 +337,16 @@ public void testGetMulti() {
337337 }
338338
339339 public void testGetMutiArrayStringArray () {
340- mc .set ("foo1" , "bar1" );
341- mc .set ("foo2" , "bar2" );
342- mc .set ("foo3" , "bar3" );
343- String [] args = { "foo1" , "foo2" , "foo3" };
344- String [] expected = { "bar1" , "bar2" , "bar3" };
340+ final int multiSize = 1000 ;
341+ final String [] args = new String [multiSize ];
342+ for (int i = 0 ; i < multiSize ; ++i ) {
343+ args [i ] = "foo" + i ;
344+ mc .set (args [i ], "bar" + i );
345+ }
345346 Object [] actual = mc .getMultiArray (args );
346- assertEquals (expected . length , actual .length );
347+ assertEquals (multiSize , actual .length );
347348 for (int i = 0 ; i < actual .length ; i ++) {
348- assertEquals (expected [ i ] , actual [i ]);
349+ assertEquals ("bar" + i , actual [i ]);
349350 }
350351 }
351352
Original file line number Diff line number Diff line change @@ -418,16 +418,16 @@ public void testGetMultiString() {
418418 }
419419
420420 public void testGetMutiArrayStringArray () {
421- mc .set ("foo1" , "bar1" );
422- mc .set ("foo2" , "bar2" );
423- mc .set ("foo3" , "bar3" );
424- String [] args = { "foo1" , "foo2" , "foo3" };
425- String [] expected = { "bar1" , "bar2" , "bar3" };
421+ final int multiSize = 1000 ;
422+ final String [] args = new String [multiSize ];
423+ for (int i = 0 ; i < multiSize ; ++i ) {
424+ args [i ] = "foo" + i ;
425+ mc .set (args [i ], "bar" + i );
426+ }
426427 Object [] actual = mc .getMultiArray (args );
427- assertNull (mc .getMultiArray (null ));
428- assertEquals (expected .length , actual .length );
428+ assertEquals (multiSize , actual .length );
429429 for (int i = 0 ; i < actual .length ; i ++) {
430- assertEquals (expected [ i ] , actual [i ]);
430+ assertEquals ("bar" + i , actual [i ]);
431431 }
432432 }
433433
You can’t perform that action at this time.
0 commit comments