Skip to content

Instantly share code, notes, and snippets.

@ludo1026
Created December 11, 2013 13:19
Show Gist options
  • Save ludo1026/7910288 to your computer and use it in GitHub Desktop.
Save ludo1026/7910288 to your computer and use it in GitHub Desktop.
Tutorial Couchbase - Test
package org.tuto.couchbase;
import com.couchbase.client.CouchbaseClient;
import org.junit.Assert;
import org.junit.Test;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
public class CouchbaseTest {
@Test
public void connect() throws Exception {
List<URI> uris = new ArrayList<URI>();
uris.add(new URI("http://127.0.0.1:8091/pools"));
String bucketName = "default";
String pwd = "";
// Connection
CouchbaseClient client = new CouchbaseClient(uris, bucketName, pwd);
String key = "article_2013-12-11";
String value = "{\n\"titre\":\"couchbase\"\n}";
// Set
client.set(key, value);
// Get
String result = (String) client.get(key);
Assert.assertEquals(value, result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment