I am having this issues with the java driver :
https://github.com/krestenkrab/riak-java-pb-client

After deleting a key the listKeys method still return it.
The following test case put and delete one simple key and fails when
counting the listKeys item.

Any Suggestion?

   public class RiakCacheTest extends TestCase {

 private RiakClient rc;

private String host = "172.16.194.134";

private int port = 8087;

private String bucket = "bucket";

  @Override

protected void setUp() throws Exception {

 rc = new RiakClient(this.host,this.port);

 rc.setClientID(this.getClass().toString());

}

  public void testRemove(){

 String key = "key";

 String value = "Andrea";

  RiakObject obj = new RiakObject(this.bucket, key, value);

  try{

 this.rc.store(obj);

 assertTrue(getValue(key).equals(value));

 assertEquals(keys().size(),1);

   this.rc.delete(this.bucket, key);

 assertNull(getValue(key));

 assertEquals(keys().size(),0);

   }catch(IOException e){

 e.printStackTrace();

 }

  }

 private String getValue(String key){

 String fetched = "";

 try{

 RiakObject[] ros = this.rc.fetch(this.bucket, key);

 for(RiakObject ro : ros){

  return ro.getValue().toStringUtf8();

 }

 }catch(IOException e){

 e.printStackTrace();

 }

 return null;

}


 private List keys() {

 ArrayList<String> result = new ArrayList<String>();

 ByteString bucket = ByteString.copyFromUtf8(this.bucket);

  try{

  KeySource keys = this.rc.listKeys(bucket);

  while(keys.hasNext()){

  String key = keys.next().toStringUtf8();

  result.add(key);

  }

 }catch(IOException e){

 e.printStackTrace();

 }

 return result;

}


}

-- 
Andrea Campolonghi

Cell : +39 347 2298435
acampolon...@gmail.com
and...@andreacfm.com
http://www.andreacfm.com

Railo Team
and...@getrailo.org
http://getrailo.org
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to