-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Almost working document support in Java
- Loading branch information
Kai Mast
committed
Feb 22, 2015
1 parent
073a718
commit 6deae06
Showing
11 changed files
with
197 additions
and
93 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,52 @@ | ||
import java.util.*; | ||
|
||
import org.hyperdex.client.Client; | ||
import org.hyperdex.client.ByteString; | ||
import org.hyperdex.client.Document; | ||
import org.hyperdex.client.HyperDexClientException; | ||
import org.hyperdex.client.Iterator; | ||
import org.hyperdex.client.LessEqual; | ||
import org.hyperdex.client.GreaterEqual; | ||
import org.hyperdex.client.LessThan; | ||
import org.hyperdex.client.GreaterThan; | ||
import org.hyperdex.client.Range; | ||
import org.hyperdex.client.Regex; | ||
import org.hyperdex.client.LengthEquals; | ||
import org.hyperdex.client.LengthLessEqual; | ||
import org.hyperdex.client.LengthGreaterEqual; | ||
|
||
import org.junit.*; | ||
import static org.junit.Assert.* ; | ||
|
||
public class DataTypeListString | ||
public class DataTypeDocument | ||
{ | ||
private Client c; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
c = new Client(args[0], Integer.parseInt(args[1])); | ||
public void setUpHyperdexClient() throws Exception { | ||
c = new Client(System.getProperty("hyperdex_host"), | ||
Integer.parseInt(System.getProperty("hyperdex_port"))); | ||
} | ||
|
||
@After | ||
public void destroyHyperdexClient() { | ||
c = null; | ||
} | ||
|
||
@Test | ||
public void insertEmptyValue() throws HyperDexClientException { | ||
Map<String, Object> attrs = new HashMap<String, Object>(); | ||
|
||
Boolean res = c.put("kv", "k", attrs); | ||
assertTrue(res); | ||
|
||
Map<String, Object> get = c.get("kv", "k"); | ||
Map<String, Object> expected = new HashMap<String, Object>(); | ||
expected.put("v", new Document("{}")); | ||
assertEquals(expected, get); | ||
} | ||
|
||
@Test | ||
public static void insertDocument() | ||
{ | ||
public void insertEmptyDocument() throws HyperDexClientException { | ||
Map<String, Object> attrs = new HashMap<String, Object>(); | ||
attrs.put("v", new Document("{}")); | ||
|
||
Boolean res = c.put("kv", "k", attrs); | ||
assertTrue(res); | ||
|
||
Map<String, Object> get = c.get("kv", "k"); | ||
Map<String, Object> expected = new HashMap<String, Object>(); | ||
expected.put("v", new Document("{}")); | ||
assertEquals(expected, get); | ||
} | ||
} | ||
|
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
Oops, something went wrong.