Skip to content

Instantly share code, notes, and snippets.

@sheki sheki/
Created Feb 24, 2011

What would you like to do?
A sample test to test Riak.
package ZZZ.platform.kv.riak;
import com.basho.riak.client.RiakClient;
import com.basho.riak.client.request.RequestMeta;
import com.basho.riak.client.response.FetchResponse;
import ZZZ.platform.config.ZZZConfig;
import ZZZ.platform.logging.ZZZLogger;
*FoxPerfTest executes the RiakReaderTest in a Runnable Class in the order of BeforeTest, Test and AfterTest methods with certain profiling embedded. A ThreadPoolExecutor is used to execute tasks, each task containing a new RiakReaderTask.
public class RiakReaderTask implements FoxPerfTest
private String key = null;
private String bucketName = null;
private RiakClient client = null;
private FoxLogger logger = null;
private FetchResponse fetchedValue = null;
private String url = null;
@Override //NOT a JUNIT method,
public void afterTest() throws Exception
if (fetchedValue != null)
bucketName = null;
key = null;
fetchedValue = null;
@Override //NOT JUNIT
public void beforeTest() throws Exception
key = SharedQueue.poll();
if(key == null)
throw new Exception("key value null");
bucketName = ZZZConfig.findString("kv.riak.bucket", "bucket1");
logger = ZZZLogger.getLogger(this.getClass());
if(client == null)
url = "http://" + ZZZConfig.findString("kv.riak.node", "localhost") + ":"
+ ZZZConfig.findInteger("kv.riak.port", 8098) + "/riak";
client = new RiakClient(url);
public void testRun() throws Exception
fetchedValue = client.fetch(bucketName, key,RequestMeta.readParams(3));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.