[RocksJava] Merged in latest changes.

main
fyrz 10 years ago
parent b6abab8b77
commit cd82beb0cb
  1. 4
      java/Makefile
  2. 19
      java/org/rocksdb/test/FlushTest.java

@ -92,8 +92,9 @@ clean:
javadocs: javadocs:
mkdir -p javadoc; javadoc -d javadoc -sourcepath . -subpackages org -exclude org.rocksdb.test mkdir -p javadoc; javadoc -d javadoc -sourcepath . -subpackages org -exclude org.rocksdb.test
java: javadocs java: javadocs resolve_test_deps
javac org/rocksdb/util/*.java org/rocksdb/*.java javac org/rocksdb/util/*.java org/rocksdb/*.java
javac -cp $(JAVA_TESTCLASSPATH) org/rocksdb/test/*.java
@cp ../HISTORY.md ./HISTORY-CPP.md @cp ../HISTORY.md ./HISTORY-CPP.md
@rm -f ./HISTORY-CPP.md @rm -f ./HISTORY-CPP.md
javah -d $(NATIVE_INCLUDE) -jni $(NATIVE_JAVA_CLASSES) javah -d $(NATIVE_INCLUDE) -jni $(NATIVE_JAVA_CLASSES)
@ -121,7 +122,6 @@ resolve_test_deps:
test -s "$(JAVA_ASSERTJ_JAR)" || curl -k -L -o "$(JAVA_ASSERTJ_JAR)" http://central.maven.org/maven2/org/assertj/assertj-core/1.7.0/assertj-core-1.7.0.jar test -s "$(JAVA_ASSERTJ_JAR)" || curl -k -L -o "$(JAVA_ASSERTJ_JAR)" http://central.maven.org/maven2/org/assertj/assertj-core/1.7.0/assertj-core-1.7.0.jar
test: java resolve_test_deps test: java resolve_test_deps
javac -cp $(JAVA_TESTCLASSPATH) org/rocksdb/test/*.java
java -ea -Djava.library.path=.:../ -cp "$(JAVA_TESTCLASSPATH)" org.rocksdb.test.RocksJunitRunner $(JAVA_TESTS) java -ea -Djava.library.path=.:../ -cp "$(JAVA_TESTCLASSPATH)" org.rocksdb.test.RocksJunitRunner $(JAVA_TESTS)
db_bench: java db_bench: java

@ -4,16 +4,23 @@
// of patent rights can be found in the PATENTS file in the same directory. // of patent rights can be found in the PATENTS file in the same directory.
package org.rocksdb.test; package org.rocksdb.test;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.rocksdb.*; import org.rocksdb.*;
public class FlushTest { public class FlushTest {
static final String db_path = "/tmp/rocksdbjni_flush_test"; @ClassRule
static { public static final RocksMemoryResource rocksMemoryResource =
RocksDB.loadLibrary(); new RocksMemoryResource();
}
@Rule
public TemporaryFolder dbFolder = new TemporaryFolder();
public static void main(String[] args) { @Test
public void flush() {
RocksDB db = null; RocksDB db = null;
Options options = new Options(); Options options = new Options();
WriteOptions wOpt = new WriteOptions(); WriteOptions wOpt = new WriteOptions();
@ -26,7 +33,7 @@ public class FlushTest {
options.setMinWriteBufferNumberToMerge(10); options.setMinWriteBufferNumberToMerge(10);
flushOptions.setWaitForFlush(true); flushOptions.setWaitForFlush(true);
wOpt.setDisableWAL(true); wOpt.setDisableWAL(true);
db = RocksDB.open(options, db_path); db = RocksDB.open(options, dbFolder.getRoot().getAbsolutePath());
db.put(wOpt, "key1".getBytes(), "value1".getBytes()); db.put(wOpt, "key1".getBytes(), "value1".getBytes());
db.put(wOpt, "key2".getBytes(), "value2".getBytes()); db.put(wOpt, "key2".getBytes(), "value2".getBytes());

Loading…
Cancel
Save