From cd82beb0cbee9d62820f2e5a12034dd5540b7702 Mon Sep 17 00:00:00 2001 From: fyrz Date: Tue, 11 Nov 2014 18:59:04 +0100 Subject: [PATCH] [RocksJava] Merged in latest changes. --- java/Makefile | 6 +++--- java/org/rocksdb/test/FlushTest.java | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/java/Makefile b/java/Makefile index 99664c6ef..0f4d42244 100644 --- a/java/Makefile +++ b/java/Makefile @@ -34,7 +34,7 @@ NATIVE_JAVA_CLASSES = org.rocksdb.AbstractComparator\ org.rocksdb.WriteBatch.Handler\ org.rocksdb.test.WriteBatchInternal\ org.rocksdb.test.WriteBatchTest\ - org.rocksdb.WriteOptions\ + org.rocksdb.WriteOptions\ ROCKSDB_MAJOR = $(shell egrep "ROCKSDB_MAJOR.[0-9]" ../include/rocksdb/version.h | cut -d ' ' -f 3) ROCKSDB_MINOR = $(shell egrep "ROCKSDB_MINOR.[0-9]" ../include/rocksdb/version.h | cut -d ' ' -f 3) @@ -92,8 +92,9 @@ clean: javadocs: 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 -cp $(JAVA_TESTCLASSPATH) org/rocksdb/test/*.java @cp ../HISTORY.md ./HISTORY-CPP.md @rm -f ./HISTORY-CPP.md 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: 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) db_bench: java diff --git a/java/org/rocksdb/test/FlushTest.java b/java/org/rocksdb/test/FlushTest.java index 1742be67f..3e47668b7 100644 --- a/java/org/rocksdb/test/FlushTest.java +++ b/java/org/rocksdb/test/FlushTest.java @@ -4,16 +4,23 @@ // of patent rights can be found in the PATENTS file in the same directory. package org.rocksdb.test; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; import org.rocksdb.*; public class FlushTest { - static final String db_path = "/tmp/rocksdbjni_flush_test"; - static { - RocksDB.loadLibrary(); - } + @ClassRule + public static final RocksMemoryResource rocksMemoryResource = + new RocksMemoryResource(); + + @Rule + public TemporaryFolder dbFolder = new TemporaryFolder(); - public static void main(String[] args) { + @Test + public void flush() { RocksDB db = null; Options options = new Options(); WriteOptions wOpt = new WriteOptions(); @@ -26,7 +33,7 @@ public class FlushTest { options.setMinWriteBufferNumberToMerge(10); flushOptions.setWaitForFlush(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, "key2".getBytes(), "value2".getBytes());