[RocksJava] Merged & rebased to HEAD

This commit is contained in:
fyrz 2014-11-11 08:49:00 +01:00
parent 74057d6d2d
commit b6abab8b77
2 changed files with 18 additions and 47 deletions

View File

@ -26,9 +26,10 @@ public class KeyMayExistTest {
@Test
public void keyMayExist() throws RocksDBException {
<<<<<<< HEAD
RocksDB db;
DBOptions options = new DBOptions();
RocksDB db = null;
DBOptions options = null;
try {
options = new DBOptions();
options.setCreateIfMissing(true)
.setCreateMissingColumnFamilies(true);
// open database using cf names
@ -50,32 +51,6 @@ public class KeyMayExistTest {
assertThat(exists).isTrue();
assertThat(retValue.toString()).
isEqualTo("value");
=======
RocksDB db = null;
Options options = null;
try {
options = new Options();
options.setCreateIfMissing(true)
.setCreateMissingColumnFamilies(true);
// open database using cf names
List<String> cfNames = new ArrayList<>();
List<ColumnFamilyHandle> columnFamilyHandleList =
new ArrayList<>();
cfNames.add("default");
cfNames.add("new_cf");
db = RocksDB.open(options,
dbFolder.getRoot().getAbsolutePath(),
cfNames, columnFamilyHandleList);
assertThat(columnFamilyHandleList.size()).
isEqualTo(2);
db.put("key".getBytes(), "value".getBytes());
// Test without column family
StringBuffer retValue = new StringBuffer();
boolean exists = db.keyMayExist("key".getBytes(), retValue);
assertThat(exists).isTrue();
assertThat(retValue.toString()).
isEqualTo("value");
>>>>>>> [RocksJava] Integrated review comments from D28209
// Test without column family but with readOptions
retValue = new StringBuffer();
@ -93,7 +68,6 @@ public class KeyMayExistTest {
assertThat(retValue.toString()).
isEqualTo("value");
<<<<<<< HEAD
// Test with column family and readOptions
retValue = new StringBuffer();
exists = db.keyMayExist(new ReadOptions(),
@ -102,16 +76,6 @@ public class KeyMayExistTest {
assertThat(exists).isTrue();
assertThat(retValue.toString()).
isEqualTo("value");
=======
// Test with column family and readOptions
retValue = new StringBuffer();
exists = db.keyMayExist(new ReadOptions(),
columnFamilyHandleList.get(0), "key".getBytes(),
retValue);
assertThat(exists).isTrue();
assertThat(retValue.toString()).
isEqualTo("value");
>>>>>>> [RocksJava] Integrated review comments from D28209
// KeyMayExist in CF1 must return false
assertThat(db.keyMayExist(columnFamilyHandleList.get(1),

View File

@ -13,13 +13,20 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.ClassRule;
import org.junit.Test;
import org.rocksdb.WriteOptions;
import static org.assertj.core.api.Assertions.assertThat;
public class WriteBatchHandlerTest {
static {
RocksDB.loadLibrary();
}
@ClassRule
public static final RocksMemoryResource rocksMemoryResource =
new RocksMemoryResource();
public static void main(final String[] args) throws IOException, RocksDBException {
@Test
public void writeBatchHandler() throws IOException, RocksDBException {
// setup test data
final List<Tuple<Action, Tuple<byte[], byte[]>>> testEvents = new ArrayList<>();