Created
December 11, 2013 13:19
-
-
Save ludo1026/7910288 to your computer and use it in GitHub Desktop.
Tutorial Couchbase - Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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