http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DBOptionsTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DBOptionsTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DBOptionsTest.java deleted file mode 100644 index 11b7435..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DBOptionsTest.java +++ /dev/null @@ -1,637 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Test; - -import java.nio.file.Paths; -import java.util.*; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DBOptionsTest { - - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - public static final Random rand = PlatformRandomHelper. - getPlatformSpecificRandomFactory(); - - @Test - public void getDBOptionsFromProps() { - // setup sample properties - final Properties properties = new Properties(); - properties.put("allow_mmap_reads", "true"); - properties.put("bytes_per_sync", "13"); - try(final DBOptions opt = DBOptions.getDBOptionsFromProps(properties)) { - assertThat(opt).isNotNull(); - assertThat(String.valueOf(opt.allowMmapReads())). - isEqualTo(properties.get("allow_mmap_reads")); - assertThat(String.valueOf(opt.bytesPerSync())). - isEqualTo(properties.get("bytes_per_sync")); - } - } - - @Test - public void failDBOptionsFromPropsWithIllegalValue() { - // setup sample properties - final Properties properties = new Properties(); - properties.put("tomato", "1024"); - properties.put("burger", "2"); - try(final DBOptions opt = DBOptions.getDBOptionsFromProps(properties)) { - assertThat(opt).isNull(); - } - } - - @Test(expected = IllegalArgumentException.class) - public void failDBOptionsFromPropsWithNullValue() { - try(final DBOptions opt = DBOptions.getDBOptionsFromProps(null)) { - //no-op - } - } - - @Test(expected = IllegalArgumentException.class) - public void failDBOptionsFromPropsWithEmptyProps() { - try(final DBOptions opt = DBOptions.getDBOptionsFromProps( - new Properties())) { - //no-op - } - } - - @Test - public void linkageOfPrepMethods() { - try (final DBOptions opt = new DBOptions()) { - opt.optimizeForSmallDb(); - } - } - - @Test - public void env() { - try (final DBOptions opt = new DBOptions(); - final Env env = Env.getDefault()) { - opt.setEnv(env); - assertThat(opt.getEnv()).isSameAs(env); - } - } - - @Test - public void setIncreaseParallelism() { - try(final DBOptions opt = new DBOptions()) { - final int threads = Runtime.getRuntime().availableProcessors() * 2; - opt.setIncreaseParallelism(threads); - } - } - - @Test - public void createIfMissing() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setCreateIfMissing(boolValue); - assertThat(opt.createIfMissing()).isEqualTo(boolValue); - } - } - - @Test - public void createMissingColumnFamilies() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setCreateMissingColumnFamilies(boolValue); - assertThat(opt.createMissingColumnFamilies()).isEqualTo(boolValue); - } - } - - @Test - public void errorIfExists() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setErrorIfExists(boolValue); - assertThat(opt.errorIfExists()).isEqualTo(boolValue); - } - } - - @Test - public void paranoidChecks() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setParanoidChecks(boolValue); - assertThat(opt.paranoidChecks()).isEqualTo(boolValue); - } - } - - @Test - public void maxTotalWalSize() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setMaxTotalWalSize(longValue); - assertThat(opt.maxTotalWalSize()).isEqualTo(longValue); - } - } - - @Test - public void maxOpenFiles() { - try(final DBOptions opt = new DBOptions()) { - final int intValue = rand.nextInt(); - opt.setMaxOpenFiles(intValue); - assertThat(opt.maxOpenFiles()).isEqualTo(intValue); - } - } - - @Test - public void maxFileOpeningThreads() { - try(final DBOptions opt = new DBOptions()) { - final int intValue = rand.nextInt(); - opt.setMaxFileOpeningThreads(intValue); - assertThat(opt.maxFileOpeningThreads()).isEqualTo(intValue); - } - } - - @Test - public void useFsync() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setUseFsync(boolValue); - assertThat(opt.useFsync()).isEqualTo(boolValue); - } - } - - @Test - public void dbPaths() { - final List<DbPath> dbPaths = new ArrayList<>(); - dbPaths.add(new DbPath(Paths.get("/a"), 10)); - dbPaths.add(new DbPath(Paths.get("/b"), 100)); - dbPaths.add(new DbPath(Paths.get("/c"), 1000)); - - try(final DBOptions opt = new DBOptions()) { - assertThat(opt.dbPaths()).isEqualTo(Collections.emptyList()); - - opt.setDbPaths(dbPaths); - - assertThat(opt.dbPaths()).isEqualTo(dbPaths); - } - } - - @Test - public void dbLogDir() { - try(final DBOptions opt = new DBOptions()) { - final String str = "path/to/DbLogDir"; - opt.setDbLogDir(str); - assertThat(opt.dbLogDir()).isEqualTo(str); - } - } - - @Test - public void walDir() { - try(final DBOptions opt = new DBOptions()) { - final String str = "path/to/WalDir"; - opt.setWalDir(str); - assertThat(opt.walDir()).isEqualTo(str); - } - } - - @Test - public void deleteObsoleteFilesPeriodMicros() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setDeleteObsoleteFilesPeriodMicros(longValue); - assertThat(opt.deleteObsoleteFilesPeriodMicros()).isEqualTo(longValue); - } - } - - @Test - public void baseBackgroundCompactions() { - try (final DBOptions opt = new DBOptions()) { - final int intValue = rand.nextInt(); - opt.setBaseBackgroundCompactions(intValue); - assertThat(opt.baseBackgroundCompactions()). - isEqualTo(intValue); - } - } - - @Test - public void maxBackgroundCompactions() { - try(final DBOptions opt = new DBOptions()) { - final int intValue = rand.nextInt(); - opt.setMaxBackgroundCompactions(intValue); - assertThat(opt.maxBackgroundCompactions()).isEqualTo(intValue); - } - } - - @Test - public void maxSubcompactions() { - try (final DBOptions opt = new DBOptions()) { - final int intValue = rand.nextInt(); - opt.setMaxSubcompactions(intValue); - assertThat(opt.maxSubcompactions()). - isEqualTo(intValue); - } - } - - @Test - public void maxBackgroundFlushes() { - try(final DBOptions opt = new DBOptions()) { - final int intValue = rand.nextInt(); - opt.setMaxBackgroundFlushes(intValue); - assertThat(opt.maxBackgroundFlushes()).isEqualTo(intValue); - } - } - - @Test - public void maxLogFileSize() throws RocksDBException { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setMaxLogFileSize(longValue); - assertThat(opt.maxLogFileSize()).isEqualTo(longValue); - } - } - - @Test - public void logFileTimeToRoll() throws RocksDBException { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setLogFileTimeToRoll(longValue); - assertThat(opt.logFileTimeToRoll()).isEqualTo(longValue); - } - } - - @Test - public void keepLogFileNum() throws RocksDBException { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setKeepLogFileNum(longValue); - assertThat(opt.keepLogFileNum()).isEqualTo(longValue); - } - } - - @Test - public void recycleLogFileNum() throws RocksDBException { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setRecycleLogFileNum(longValue); - assertThat(opt.recycleLogFileNum()).isEqualTo(longValue); - } - } - - @Test - public void maxManifestFileSize() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setMaxManifestFileSize(longValue); - assertThat(opt.maxManifestFileSize()).isEqualTo(longValue); - } - } - - @Test - public void tableCacheNumshardbits() { - try(final DBOptions opt = new DBOptions()) { - final int intValue = rand.nextInt(); - opt.setTableCacheNumshardbits(intValue); - assertThat(opt.tableCacheNumshardbits()).isEqualTo(intValue); - } - } - - @Test - public void walSizeLimitMB() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setWalSizeLimitMB(longValue); - assertThat(opt.walSizeLimitMB()).isEqualTo(longValue); - } - } - - @Test - public void walTtlSeconds() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setWalTtlSeconds(longValue); - assertThat(opt.walTtlSeconds()).isEqualTo(longValue); - } - } - - @Test - public void manifestPreallocationSize() throws RocksDBException { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setManifestPreallocationSize(longValue); - assertThat(opt.manifestPreallocationSize()).isEqualTo(longValue); - } - } - - @Test - public void useDirectReads() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setUseDirectReads(boolValue); - assertThat(opt.useDirectReads()).isEqualTo(boolValue); - } - } - - @Test - public void useDirectIoForFlushAndCompaction() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setUseDirectIoForFlushAndCompaction(boolValue); - assertThat(opt.useDirectIoForFlushAndCompaction()).isEqualTo(boolValue); - } - } - - @Test - public void allowFAllocate() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setAllowFAllocate(boolValue); - assertThat(opt.allowFAllocate()).isEqualTo(boolValue); - } - } - - @Test - public void allowMmapReads() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setAllowMmapReads(boolValue); - assertThat(opt.allowMmapReads()).isEqualTo(boolValue); - } - } - - @Test - public void allowMmapWrites() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setAllowMmapWrites(boolValue); - assertThat(opt.allowMmapWrites()).isEqualTo(boolValue); - } - } - - @Test - public void isFdCloseOnExec() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setIsFdCloseOnExec(boolValue); - assertThat(opt.isFdCloseOnExec()).isEqualTo(boolValue); - } - } - - @Test - public void statsDumpPeriodSec() { - try(final DBOptions opt = new DBOptions()) { - final int intValue = rand.nextInt(); - opt.setStatsDumpPeriodSec(intValue); - assertThat(opt.statsDumpPeriodSec()).isEqualTo(intValue); - } - } - - @Test - public void adviseRandomOnOpen() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setAdviseRandomOnOpen(boolValue); - assertThat(opt.adviseRandomOnOpen()).isEqualTo(boolValue); - } - } - - @Test - public void dbWriteBufferSize() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setDbWriteBufferSize(longValue); - assertThat(opt.dbWriteBufferSize()).isEqualTo(longValue); - } - } - - @Test - public void accessHintOnCompactionStart() { - try(final DBOptions opt = new DBOptions()) { - final AccessHint accessHint = AccessHint.SEQUENTIAL; - opt.setAccessHintOnCompactionStart(accessHint); - assertThat(opt.accessHintOnCompactionStart()).isEqualTo(accessHint); - } - } - - @Test - public void newTableReaderForCompactionInputs() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setNewTableReaderForCompactionInputs(boolValue); - assertThat(opt.newTableReaderForCompactionInputs()).isEqualTo(boolValue); - } - } - - @Test - public void compactionReadaheadSize() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setCompactionReadaheadSize(longValue); - assertThat(opt.compactionReadaheadSize()).isEqualTo(longValue); - } - } - - @Test - public void randomAccessMaxBufferSize() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setRandomAccessMaxBufferSize(longValue); - assertThat(opt.randomAccessMaxBufferSize()).isEqualTo(longValue); - } - } - - @Test - public void writableFileMaxBufferSize() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setWritableFileMaxBufferSize(longValue); - assertThat(opt.writableFileMaxBufferSize()).isEqualTo(longValue); - } - } - - @Test - public void useAdaptiveMutex() { - try(final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setUseAdaptiveMutex(boolValue); - assertThat(opt.useAdaptiveMutex()).isEqualTo(boolValue); - } - } - - @Test - public void bytesPerSync() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setBytesPerSync(longValue); - assertThat(opt.bytesPerSync()).isEqualTo(longValue); - } - } - - @Test - public void walBytesPerSync() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setWalBytesPerSync(longValue); - assertThat(opt.walBytesPerSync()).isEqualTo(longValue); - } - } - - @Test - public void enableThreadTracking() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setEnableThreadTracking(boolValue); - assertThat(opt.enableThreadTracking()).isEqualTo(boolValue); - } - } - - @Test - public void delayedWriteRate() { - try(final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setDelayedWriteRate(longValue); - assertThat(opt.delayedWriteRate()).isEqualTo(longValue); - } - } - - @Test - public void allowConcurrentMemtableWrite() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setAllowConcurrentMemtableWrite(boolValue); - assertThat(opt.allowConcurrentMemtableWrite()).isEqualTo(boolValue); - } - } - - @Test - public void enableWriteThreadAdaptiveYield() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setEnableWriteThreadAdaptiveYield(boolValue); - assertThat(opt.enableWriteThreadAdaptiveYield()).isEqualTo(boolValue); - } - } - - @Test - public void writeThreadMaxYieldUsec() { - try (final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setWriteThreadMaxYieldUsec(longValue); - assertThat(opt.writeThreadMaxYieldUsec()).isEqualTo(longValue); - } - } - - @Test - public void writeThreadSlowYieldUsec() { - try (final DBOptions opt = new DBOptions()) { - final long longValue = rand.nextLong(); - opt.setWriteThreadSlowYieldUsec(longValue); - assertThat(opt.writeThreadSlowYieldUsec()).isEqualTo(longValue); - } - } - - @Test - public void skipStatsUpdateOnDbOpen() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setSkipStatsUpdateOnDbOpen(boolValue); - assertThat(opt.skipStatsUpdateOnDbOpen()).isEqualTo(boolValue); - } - } - - @Test - public void walRecoveryMode() { - try (final DBOptions opt = new DBOptions()) { - for (final WALRecoveryMode walRecoveryMode : WALRecoveryMode.values()) { - opt.setWalRecoveryMode(walRecoveryMode); - assertThat(opt.walRecoveryMode()).isEqualTo(walRecoveryMode); - } - } - } - - @Test - public void allow2pc() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setAllow2pc(boolValue); - assertThat(opt.allow2pc()).isEqualTo(boolValue); - } - } - - @Test - public void rowCache() { - try (final DBOptions opt = new DBOptions()) { - assertThat(opt.rowCache()).isNull(); - - try(final Cache lruCache = new LRUCache(1000)) { - opt.setRowCache(lruCache); - assertThat(opt.rowCache()).isEqualTo(lruCache); - } - - try(final Cache clockCache = new ClockCache(1000)) { - opt.setRowCache(clockCache); - assertThat(opt.rowCache()).isEqualTo(clockCache); - } - } - } - - @Test - public void failIfOptionsFileError() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setFailIfOptionsFileError(boolValue); - assertThat(opt.failIfOptionsFileError()).isEqualTo(boolValue); - } - } - - @Test - public void dumpMallocStats() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setDumpMallocStats(boolValue); - assertThat(opt.dumpMallocStats()).isEqualTo(boolValue); - } - } - - @Test - public void avoidFlushDuringRecovery() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setAvoidFlushDuringRecovery(boolValue); - assertThat(opt.avoidFlushDuringRecovery()).isEqualTo(boolValue); - } - } - - @Test - public void avoidFlushDuringShutdown() { - try (final DBOptions opt = new DBOptions()) { - final boolean boolValue = rand.nextBoolean(); - opt.setAvoidFlushDuringShutdown(boolValue); - assertThat(opt.avoidFlushDuringShutdown()).isEqualTo(boolValue); - } - } - - @Test - public void rateLimiter() { - try(final DBOptions options = new DBOptions(); - final DBOptions anotherOptions = new DBOptions(); - final RateLimiter rateLimiter = new RateLimiter(1000, 100 * 1000, 1)) { - options.setRateLimiter(rateLimiter); - // Test with parameter initialization - anotherOptions.setRateLimiter( - new RateLimiter(1000)); - } - } - - @Test - public void statistics() { - try(final DBOptions options = new DBOptions()) { - final Statistics statistics = options.statistics(); - assertThat(statistics).isNull(); - } - - try(final Statistics statistics = new Statistics(); - final DBOptions options = new DBOptions().setStatistics(statistics); - final Statistics stats = options.statistics()) { - assertThat(stats).isNotNull(); - } - } -}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DirectComparatorTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DirectComparatorTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DirectComparatorTest.java deleted file mode 100644 index 9b593d0..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DirectComparatorTest.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import java.io.IOException; -import java.nio.file.FileSystems; - -public class DirectComparatorTest { - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Rule - public TemporaryFolder dbFolder = new TemporaryFolder(); - - @Test - public void directComparator() throws IOException, RocksDBException { - - final AbstractComparatorTest comparatorTest = new AbstractComparatorTest() { - @Override - public AbstractComparator getAscendingIntKeyComparator() { - return new DirectComparator(new ComparatorOptions()) { - - @Override - public String name() { - return "test.AscendingIntKeyDirectComparator"; - } - - @Override - public int compare(final DirectSlice a, final DirectSlice b) { - final byte ax[] = new byte[4], bx[] = new byte[4]; - a.data().get(ax); - b.data().get(bx); - return compareIntKeys(ax, bx); - } - }; - } - }; - - // test the round-tripability of keys written and read with the DirectComparator - comparatorTest.testRoundtrip(FileSystems.getDefault().getPath( - dbFolder.getRoot().getAbsolutePath())); - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DirectSliceTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DirectSliceTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DirectSliceTest.java deleted file mode 100644 index 48ae52a..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/DirectSliceTest.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Test; - -import java.nio.ByteBuffer; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DirectSliceTest { - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Test - public void directSlice() { - try(final DirectSlice directSlice = new DirectSlice("abc"); - final DirectSlice otherSlice = new DirectSlice("abc")) { - assertThat(directSlice.toString()).isEqualTo("abc"); - // clear first slice - directSlice.clear(); - assertThat(directSlice.toString()).isEmpty(); - // get first char in otherslice - assertThat(otherSlice.get(0)).isEqualTo("a".getBytes()[0]); - // remove prefix - otherSlice.removePrefix(1); - assertThat(otherSlice.toString()).isEqualTo("bc"); - } - } - - @Test - public void directSliceWithByteBuffer() { - final byte[] data = "Some text".getBytes(); - final ByteBuffer buffer = ByteBuffer.allocateDirect(data.length + 1); - buffer.put(data); - buffer.put(data.length, (byte)0); - - try(final DirectSlice directSlice = new DirectSlice(buffer)) { - assertThat(directSlice.toString()).isEqualTo("Some text"); - } - } - - @Test - public void directSliceWithByteBufferAndLength() { - final byte[] data = "Some text".getBytes(); - final ByteBuffer buffer = ByteBuffer.allocateDirect(data.length); - buffer.put(data); - try(final DirectSlice directSlice = new DirectSlice(buffer, 4)) { - assertThat(directSlice.toString()).isEqualTo("Some"); - } - } - - @Test(expected = IllegalArgumentException.class) - public void directSliceInitWithoutDirectAllocation() { - final byte[] data = "Some text".getBytes(); - final ByteBuffer buffer = ByteBuffer.wrap(data); - try(final DirectSlice directSlice = new DirectSlice(buffer)) { - //no-op - } - } - - @Test(expected = IllegalArgumentException.class) - public void directSlicePrefixInitWithoutDirectAllocation() { - final byte[] data = "Some text".getBytes(); - final ByteBuffer buffer = ByteBuffer.wrap(data); - try(final DirectSlice directSlice = new DirectSlice(buffer, 4)) { - //no-op - } - } - - @Test - public void directSliceClear() { - try(final DirectSlice directSlice = new DirectSlice("abc")) { - assertThat(directSlice.toString()).isEqualTo("abc"); - directSlice.clear(); - assertThat(directSlice.toString()).isEmpty(); - directSlice.clear(); // make sure we don't double-free - } - } - - @Test - public void directSliceRemovePrefix() { - try(final DirectSlice directSlice = new DirectSlice("abc")) { - assertThat(directSlice.toString()).isEqualTo("abc"); - directSlice.removePrefix(1); - assertThat(directSlice.toString()).isEqualTo("bc"); - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/EnvOptionsTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/EnvOptionsTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/EnvOptionsTest.java deleted file mode 100644 index 9933b1e..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/EnvOptionsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Test; - -import java.util.Random; - -import static org.assertj.core.api.Assertions.assertThat; - -public class EnvOptionsTest { - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = new RocksMemoryResource(); - - public static final Random rand = PlatformRandomHelper.getPlatformSpecificRandomFactory(); - - @Test - public void useMmapReads() { - try (final EnvOptions envOptions = new EnvOptions()) { - final boolean boolValue = rand.nextBoolean(); - envOptions.setUseMmapReads(boolValue); - assertThat(envOptions.useMmapReads()).isEqualTo(boolValue); - } - } - - @Test - public void useMmapWrites() { - try (final EnvOptions envOptions = new EnvOptions()) { - final boolean boolValue = rand.nextBoolean(); - envOptions.setUseMmapWrites(boolValue); - assertThat(envOptions.useMmapWrites()).isEqualTo(boolValue); - } - } - - @Test - public void useDirectReads() { - try (final EnvOptions envOptions = new EnvOptions()) { - final boolean boolValue = rand.nextBoolean(); - envOptions.setUseDirectReads(boolValue); - assertThat(envOptions.useDirectReads()).isEqualTo(boolValue); - } - } - - @Test - public void useDirectWrites() { - try (final EnvOptions envOptions = new EnvOptions()) { - final boolean boolValue = rand.nextBoolean(); - envOptions.setUseDirectWrites(boolValue); - assertThat(envOptions.useDirectWrites()).isEqualTo(boolValue); - } - } - - @Test - public void allowFallocate() { - try (final EnvOptions envOptions = new EnvOptions()) { - final boolean boolValue = rand.nextBoolean(); - envOptions.setAllowFallocate(boolValue); - assertThat(envOptions.allowFallocate()).isEqualTo(boolValue); - } - } - - @Test - public void setFdCloexecs() { - try (final EnvOptions envOptions = new EnvOptions()) { - final boolean boolValue = rand.nextBoolean(); - envOptions.setSetFdCloexec(boolValue); - assertThat(envOptions.setFdCloexec()).isEqualTo(boolValue); - } - } - - @Test - public void bytesPerSync() { - try (final EnvOptions envOptions = new EnvOptions()) { - final long longValue = rand.nextLong(); - envOptions.setBytesPerSync(longValue); - assertThat(envOptions.bytesPerSync()).isEqualTo(longValue); - } - } - - @Test - public void fallocateWithKeepSize() { - try (final EnvOptions envOptions = new EnvOptions()) { - final boolean boolValue = rand.nextBoolean(); - envOptions.setFallocateWithKeepSize(boolValue); - assertThat(envOptions.fallocateWithKeepSize()).isEqualTo(boolValue); - } - } - - @Test - public void compactionReadaheadSize() { - try (final EnvOptions envOptions = new EnvOptions()) { - final int intValue = rand.nextInt(); - envOptions.setCompactionReadaheadSize(intValue); - assertThat(envOptions.compactionReadaheadSize()).isEqualTo(intValue); - } - } - - @Test - public void randomAccessMaxBufferSize() { - try (final EnvOptions envOptions = new EnvOptions()) { - final int intValue = rand.nextInt(); - envOptions.setRandomAccessMaxBufferSize(intValue); - assertThat(envOptions.randomAccessMaxBufferSize()).isEqualTo(intValue); - } - } - - @Test - public void writableFileMaxBufferSize() { - try (final EnvOptions envOptions = new EnvOptions()) { - final int intValue = rand.nextInt(); - envOptions.setWritableFileMaxBufferSize(intValue); - assertThat(envOptions.writableFileMaxBufferSize()).isEqualTo(intValue); - } - } - - @Test - public void rateLimiter() { - try (final EnvOptions envOptions = new EnvOptions(); - final RateLimiter rateLimiter1 = new RateLimiter(1000, 100 * 1000, 1)) { - envOptions.setRateLimiter(rateLimiter1); - assertThat(envOptions.rateLimiter()).isEqualTo(rateLimiter1); - - try(final RateLimiter rateLimiter2 = new RateLimiter(1000)) { - envOptions.setRateLimiter(rateLimiter2); - assertThat(envOptions.rateLimiter()).isEqualTo(rateLimiter2); - } - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/FilterTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/FilterTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/FilterTest.java deleted file mode 100644 index c610963..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/FilterTest.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Test; - -public class FilterTest { - - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Test - public void filter() { - // new Bloom filter - final BlockBasedTableConfig blockConfig = new BlockBasedTableConfig(); - try(final Options options = new Options()) { - - try(final Filter bloomFilter = new BloomFilter()) { - blockConfig.setFilter(bloomFilter); - options.setTableFormatConfig(blockConfig); - } - - try(final Filter bloomFilter = new BloomFilter(10)) { - blockConfig.setFilter(bloomFilter); - options.setTableFormatConfig(blockConfig); - } - - try(final Filter bloomFilter = new BloomFilter(10, false)) { - blockConfig.setFilter(bloomFilter); - options.setTableFormatConfig(blockConfig); - } - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/FlushTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/FlushTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/FlushTest.java deleted file mode 100644 index 46a5cdc..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/FlushTest.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import static org.assertj.core.api.Assertions.assertThat; - -public class FlushTest { - - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Rule - public TemporaryFolder dbFolder = new TemporaryFolder(); - - @Test - public void flush() throws RocksDBException { - try(final Options options = new Options() - .setCreateIfMissing(true) - .setMaxWriteBufferNumber(10) - .setMinWriteBufferNumberToMerge(10); - final WriteOptions wOpt = new WriteOptions() - .setDisableWAL(true); - final FlushOptions flushOptions = new FlushOptions() - .setWaitForFlush(true)) { - assertThat(flushOptions.waitForFlush()).isTrue(); - - try(final RocksDB db = RocksDB.open(options, - dbFolder.getRoot().getAbsolutePath())) { - db.put(wOpt, "key1".getBytes(), "value1".getBytes()); - db.put(wOpt, "key2".getBytes(), "value2".getBytes()); - db.put(wOpt, "key3".getBytes(), "value3".getBytes()); - db.put(wOpt, "key4".getBytes(), "value4".getBytes()); - assertThat(db.getProperty("rocksdb.num-entries-active-mem-table")) - .isEqualTo("4"); - db.flush(flushOptions); - assertThat(db.getProperty("rocksdb.num-entries-active-mem-table")) - .isEqualTo("0"); - } - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/InfoLogLevelTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/InfoLogLevelTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/InfoLogLevelTest.java deleted file mode 100644 index 48ecfa1..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/InfoLogLevelTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.rocksdb.util.Environment; - -import java.io.IOException; - -import static java.nio.file.Files.readAllBytes; -import static java.nio.file.Paths.get; -import static org.assertj.core.api.Assertions.assertThat; - -public class InfoLogLevelTest { - - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Rule - public TemporaryFolder dbFolder = new TemporaryFolder(); - - @Test - public void testInfoLogLevel() throws RocksDBException, - IOException { - try (final RocksDB db = - RocksDB.open(dbFolder.getRoot().getAbsolutePath())) { - db.put("key".getBytes(), "value".getBytes()); - assertThat(getLogContentsWithoutHeader()).isNotEmpty(); - } - } - - @Test - public void testFatalLogLevel() throws RocksDBException, - IOException { - try (final Options options = new Options(). - setCreateIfMissing(true). - setInfoLogLevel(InfoLogLevel.FATAL_LEVEL); - final RocksDB db = RocksDB.open(options, - dbFolder.getRoot().getAbsolutePath())) { - assertThat(options.infoLogLevel()). - isEqualTo(InfoLogLevel.FATAL_LEVEL); - db.put("key".getBytes(), "value".getBytes()); - // As InfoLogLevel is set to FATAL_LEVEL, here we expect the log - // content to be empty. - assertThat(getLogContentsWithoutHeader()).isEmpty(); - } - } - - @Test - public void testFatalLogLevelWithDBOptions() - throws RocksDBException, IOException { - try (final DBOptions dbOptions = new DBOptions(). - setInfoLogLevel(InfoLogLevel.FATAL_LEVEL); - final Options options = new Options(dbOptions, - new ColumnFamilyOptions()). - setCreateIfMissing(true); - final RocksDB db = - RocksDB.open(options, dbFolder.getRoot().getAbsolutePath())) { - assertThat(dbOptions.infoLogLevel()). - isEqualTo(InfoLogLevel.FATAL_LEVEL); - assertThat(options.infoLogLevel()). - isEqualTo(InfoLogLevel.FATAL_LEVEL); - db.put("key".getBytes(), "value".getBytes()); - assertThat(getLogContentsWithoutHeader()).isEmpty(); - } - } - - @Test(expected = IllegalArgumentException.class) - public void failIfIllegalByteValueProvided() { - InfoLogLevel.getInfoLogLevel((byte) -1); - } - - @Test - public void valueOf() { - assertThat(InfoLogLevel.valueOf("DEBUG_LEVEL")). - isEqualTo(InfoLogLevel.DEBUG_LEVEL); - } - - /** - * Read LOG file contents into String. - * - * @return LOG file contents as String. - * @throws IOException if file is not found. - */ - private String getLogContentsWithoutHeader() throws IOException { - final String separator = Environment.isWindows() ? - "\n" : System.getProperty("line.separator"); - final String[] lines = new String(readAllBytes(get( - dbFolder.getRoot().getAbsolutePath() + "/LOG"))).split(separator); - - int first_non_header = lines.length; - // Identify the last line of the header - for (int i = lines.length - 1; i >= 0; --i) { - if (lines[i].indexOf("Options.") >= 0 && lines[i].indexOf(':') >= 0) { - first_non_header = i + 1; - break; - } - } - StringBuilder builder = new StringBuilder(); - for (int i = first_non_header; i < lines.length; ++i) { - builder.append(lines[i]).append(separator); - } - return builder.toString(); - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/IngestExternalFileOptionsTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/IngestExternalFileOptionsTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/IngestExternalFileOptionsTest.java deleted file mode 100644 index 83e0dd1..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/IngestExternalFileOptionsTest.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Test; - -import java.util.Random; - -import static org.assertj.core.api.Assertions.assertThat; - -public class IngestExternalFileOptionsTest { - @ClassRule - public static final RocksMemoryResource rocksMemoryResource - = new RocksMemoryResource(); - - public static final Random rand = - PlatformRandomHelper.getPlatformSpecificRandomFactory(); - - @Test - public void createExternalSstFileInfoWithoutParameters() { - try (final IngestExternalFileOptions options = - new IngestExternalFileOptions()) { - assertThat(options).isNotNull(); - } - } - - @Test - public void createExternalSstFileInfoWithParameters() { - final boolean moveFiles = rand.nextBoolean(); - final boolean snapshotConsistency = rand.nextBoolean(); - final boolean allowGlobalSeqNo = rand.nextBoolean(); - final boolean allowBlockingFlush = rand.nextBoolean(); - try (final IngestExternalFileOptions options = - new IngestExternalFileOptions(moveFiles, snapshotConsistency, - allowGlobalSeqNo, allowBlockingFlush)) { - assertThat(options).isNotNull(); - assertThat(options.moveFiles()).isEqualTo(moveFiles); - assertThat(options.snapshotConsistency()).isEqualTo(snapshotConsistency); - assertThat(options.allowGlobalSeqNo()).isEqualTo(allowGlobalSeqNo); - assertThat(options.allowBlockingFlush()).isEqualTo(allowBlockingFlush); - } - } - - @Test - public void moveFiles() { - try (final IngestExternalFileOptions options = - new IngestExternalFileOptions()) { - final boolean moveFiles = rand.nextBoolean(); - options.setMoveFiles(moveFiles); - assertThat(options.moveFiles()).isEqualTo(moveFiles); - } - } - - @Test - public void snapshotConsistency() { - try (final IngestExternalFileOptions options = - new IngestExternalFileOptions()) { - final boolean snapshotConsistency = rand.nextBoolean(); - options.setSnapshotConsistency(snapshotConsistency); - assertThat(options.snapshotConsistency()).isEqualTo(snapshotConsistency); - } - } - - @Test - public void allowGlobalSeqNo() { - try (final IngestExternalFileOptions options = - new IngestExternalFileOptions()) { - final boolean allowGlobalSeqNo = rand.nextBoolean(); - options.setAllowGlobalSeqNo(allowGlobalSeqNo); - assertThat(options.allowGlobalSeqNo()).isEqualTo(allowGlobalSeqNo); - } - } - - @Test - public void allowBlockingFlush() { - try (final IngestExternalFileOptions options = - new IngestExternalFileOptions()) { - final boolean allowBlockingFlush = rand.nextBoolean(); - options.setAllowBlockingFlush(allowBlockingFlush); - assertThat(options.allowBlockingFlush()).isEqualTo(allowBlockingFlush); - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/KeyMayExistTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/KeyMayExistTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/KeyMayExistTest.java deleted file mode 100644 index 8092270..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/KeyMayExistTest.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public class KeyMayExistTest { - - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Rule - public TemporaryFolder dbFolder = new TemporaryFolder(); - - @Test - public void keyMayExist() throws RocksDBException { - final List<ColumnFamilyDescriptor> cfDescriptors = Arrays.asList( - new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY), - new ColumnFamilyDescriptor("new_cf".getBytes()) - ); - - final List<ColumnFamilyHandle> columnFamilyHandleList = new ArrayList<>(); - try (final DBOptions options = new DBOptions() - .setCreateIfMissing(true) - .setCreateMissingColumnFamilies(true); - final RocksDB db = RocksDB.open(options, - dbFolder.getRoot().getAbsolutePath(), - cfDescriptors, columnFamilyHandleList)) { - try { - assertThat(columnFamilyHandleList.size()). - isEqualTo(2); - db.put("key".getBytes(), "value".getBytes()); - // Test without column family - StringBuilder retValue = new StringBuilder(); - boolean exists = db.keyMayExist("key".getBytes(), retValue); - assertThat(exists).isTrue(); - assertThat(retValue.toString()).isEqualTo("value"); - - // Test without column family but with readOptions - try (final ReadOptions readOptions = new ReadOptions()) { - retValue = new StringBuilder(); - exists = db.keyMayExist(readOptions, "key".getBytes(), retValue); - assertThat(exists).isTrue(); - assertThat(retValue.toString()).isEqualTo("value"); - } - - // Test with column family - retValue = new StringBuilder(); - exists = db.keyMayExist(columnFamilyHandleList.get(0), "key".getBytes(), - retValue); - assertThat(exists).isTrue(); - assertThat(retValue.toString()).isEqualTo("value"); - - // Test with column family and readOptions - try (final ReadOptions readOptions = new ReadOptions()) { - retValue = new StringBuilder(); - exists = db.keyMayExist(readOptions, - columnFamilyHandleList.get(0), "key".getBytes(), - retValue); - assertThat(exists).isTrue(); - assertThat(retValue.toString()).isEqualTo("value"); - } - - // KeyMayExist in CF1 must return false - assertThat(db.keyMayExist(columnFamilyHandleList.get(1), - "key".getBytes(), retValue)).isFalse(); - } finally { - for (final ColumnFamilyHandle columnFamilyHandle : - columnFamilyHandleList) { - columnFamilyHandle.close(); - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/LRUCacheTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/LRUCacheTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/LRUCacheTest.java deleted file mode 100644 index d2cd15b..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/LRUCacheTest.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import org.junit.Test; - -public class LRUCacheTest { - - static { - RocksDB.loadLibrary(); - } - - @Test - public void newLRUCache() { - final long capacity = 1000; - final int numShardBits = 16; - final boolean strictCapacityLimit = true; - final double highPriPoolRatio = 5; - try(final Cache lruCache = new LRUCache(capacity, - numShardBits, strictCapacityLimit, highPriPoolRatio)) { - //no op - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/LoggerTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/LoggerTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/LoggerTest.java deleted file mode 100644 index f83cff3..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/LoggerTest.java +++ /dev/null @@ -1,238 +0,0 @@ -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.assertj.core.api.Assertions.assertThat; - -public class LoggerTest { - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Rule - public TemporaryFolder dbFolder = new TemporaryFolder(); - - @Test - public void customLogger() throws RocksDBException { - final AtomicInteger logMessageCounter = new AtomicInteger(); - try (final Options options = new Options(). - setInfoLogLevel(InfoLogLevel.DEBUG_LEVEL). - setCreateIfMissing(true); - final Logger logger = new Logger(options) { - // Create new logger with max log level passed by options - @Override - protected void log(InfoLogLevel infoLogLevel, String logMsg) { - assertThat(logMsg).isNotNull(); - assertThat(logMsg.length()).isGreaterThan(0); - logMessageCounter.incrementAndGet(); - } - } - ) { - // Set custom logger to options - options.setLogger(logger); - - try (final RocksDB db = RocksDB.open(options, - dbFolder.getRoot().getAbsolutePath())) { - // there should be more than zero received log messages in - // debug level. - assertThat(logMessageCounter.get()).isGreaterThan(0); - } - } - } - - @Test - public void warnLogger() throws RocksDBException { - final AtomicInteger logMessageCounter = new AtomicInteger(); - try (final Options options = new Options(). - setInfoLogLevel(InfoLogLevel.WARN_LEVEL). - setCreateIfMissing(true); - - final Logger logger = new Logger(options) { - // Create new logger with max log level passed by options - @Override - protected void log(InfoLogLevel infoLogLevel, String logMsg) { - assertThat(logMsg).isNotNull(); - assertThat(logMsg.length()).isGreaterThan(0); - logMessageCounter.incrementAndGet(); - } - } - ) { - - // Set custom logger to options - options.setLogger(logger); - - try (final RocksDB db = RocksDB.open(options, - dbFolder.getRoot().getAbsolutePath())) { - // there should be zero messages - // using warn level as log level. - assertThat(logMessageCounter.get()).isEqualTo(0); - } - } - } - - - @Test - public void fatalLogger() throws RocksDBException { - final AtomicInteger logMessageCounter = new AtomicInteger(); - try (final Options options = new Options(). - setInfoLogLevel(InfoLogLevel.FATAL_LEVEL). - setCreateIfMissing(true); - - final Logger logger = new Logger(options) { - // Create new logger with max log level passed by options - @Override - protected void log(InfoLogLevel infoLogLevel, String logMsg) { - assertThat(logMsg).isNotNull(); - assertThat(logMsg.length()).isGreaterThan(0); - logMessageCounter.incrementAndGet(); - } - } - ) { - - // Set custom logger to options - options.setLogger(logger); - - try (final RocksDB db = RocksDB.open(options, - dbFolder.getRoot().getAbsolutePath())) { - // there should be zero messages - // using fatal level as log level. - assertThat(logMessageCounter.get()).isEqualTo(0); - } - } - } - - @Test - public void dbOptionsLogger() throws RocksDBException { - final AtomicInteger logMessageCounter = new AtomicInteger(); - try (final DBOptions options = new DBOptions(). - setInfoLogLevel(InfoLogLevel.FATAL_LEVEL). - setCreateIfMissing(true); - final Logger logger = new Logger(options) { - // Create new logger with max log level passed by options - @Override - protected void log(InfoLogLevel infoLogLevel, String logMsg) { - assertThat(logMsg).isNotNull(); - assertThat(logMsg.length()).isGreaterThan(0); - logMessageCounter.incrementAndGet(); - } - } - ) { - // Set custom logger to options - options.setLogger(logger); - - final List<ColumnFamilyDescriptor> cfDescriptors = - Arrays.asList( - new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY)); - final List<ColumnFamilyHandle> cfHandles = new ArrayList<>(); - - try (final RocksDB db = RocksDB.open(options, - dbFolder.getRoot().getAbsolutePath(), - cfDescriptors, cfHandles)) { - try { - // there should be zero messages - // using fatal level as log level. - assertThat(logMessageCounter.get()).isEqualTo(0); - } finally { - for (final ColumnFamilyHandle columnFamilyHandle : cfHandles) { - columnFamilyHandle.close(); - } - } - } - } - } - - @Test - public void setWarnLogLevel() { - final AtomicInteger logMessageCounter = new AtomicInteger(); - try (final Options options = new Options(). - setInfoLogLevel(InfoLogLevel.FATAL_LEVEL). - setCreateIfMissing(true); - final Logger logger = new Logger(options) { - // Create new logger with max log level passed by options - @Override - protected void log(InfoLogLevel infoLogLevel, String logMsg) { - assertThat(logMsg).isNotNull(); - assertThat(logMsg.length()).isGreaterThan(0); - logMessageCounter.incrementAndGet(); - } - } - ) { - assertThat(logger.infoLogLevel()). - isEqualTo(InfoLogLevel.FATAL_LEVEL); - logger.setInfoLogLevel(InfoLogLevel.WARN_LEVEL); - assertThat(logger.infoLogLevel()). - isEqualTo(InfoLogLevel.WARN_LEVEL); - } - } - - @Test - public void setInfoLogLevel() { - final AtomicInteger logMessageCounter = new AtomicInteger(); - try (final Options options = new Options(). - setInfoLogLevel(InfoLogLevel.FATAL_LEVEL). - setCreateIfMissing(true); - final Logger logger = new Logger(options) { - // Create new logger with max log level passed by options - @Override - protected void log(InfoLogLevel infoLogLevel, String logMsg) { - assertThat(logMsg).isNotNull(); - assertThat(logMsg.length()).isGreaterThan(0); - logMessageCounter.incrementAndGet(); - } - } - ) { - assertThat(logger.infoLogLevel()). - isEqualTo(InfoLogLevel.FATAL_LEVEL); - logger.setInfoLogLevel(InfoLogLevel.DEBUG_LEVEL); - assertThat(logger.infoLogLevel()). - isEqualTo(InfoLogLevel.DEBUG_LEVEL); - } - } - - @Test - public void changeLogLevelAtRuntime() throws RocksDBException { - final AtomicInteger logMessageCounter = new AtomicInteger(); - try (final Options options = new Options(). - setInfoLogLevel(InfoLogLevel.FATAL_LEVEL). - setCreateIfMissing(true); - - // Create new logger with max log level passed by options - final Logger logger = new Logger(options) { - @Override - protected void log(InfoLogLevel infoLogLevel, String logMsg) { - assertThat(logMsg).isNotNull(); - assertThat(logMsg.length()).isGreaterThan(0); - logMessageCounter.incrementAndGet(); - } - } - ) { - // Set custom logger to options - options.setLogger(logger); - - try (final RocksDB db = RocksDB.open(options, - dbFolder.getRoot().getAbsolutePath())) { - - // there should be zero messages - // using fatal level as log level. - assertThat(logMessageCounter.get()).isEqualTo(0); - - // change log level to debug level - logger.setInfoLogLevel(InfoLogLevel.DEBUG_LEVEL); - - db.put("key".getBytes(), "value".getBytes()); - db.flush(new FlushOptions().setWaitForFlush(true)); - - // messages shall be received due to previous actions. - assertThat(logMessageCounter.get()).isNotEqualTo(0); - } - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MemTableTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MemTableTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MemTableTest.java deleted file mode 100644 index 59503d4..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MemTableTest.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MemTableTest { - - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Test - public void hashSkipListMemTable() throws RocksDBException { - try(final Options options = new Options()) { - // Test HashSkipListMemTableConfig - HashSkipListMemTableConfig memTableConfig = - new HashSkipListMemTableConfig(); - assertThat(memTableConfig.bucketCount()). - isEqualTo(1000000); - memTableConfig.setBucketCount(2000000); - assertThat(memTableConfig.bucketCount()). - isEqualTo(2000000); - assertThat(memTableConfig.height()). - isEqualTo(4); - memTableConfig.setHeight(5); - assertThat(memTableConfig.height()). - isEqualTo(5); - assertThat(memTableConfig.branchingFactor()). - isEqualTo(4); - memTableConfig.setBranchingFactor(6); - assertThat(memTableConfig.branchingFactor()). - isEqualTo(6); - options.setMemTableConfig(memTableConfig); - } - } - - @Test - public void skipListMemTable() throws RocksDBException { - try(final Options options = new Options()) { - SkipListMemTableConfig skipMemTableConfig = - new SkipListMemTableConfig(); - assertThat(skipMemTableConfig.lookahead()). - isEqualTo(0); - skipMemTableConfig.setLookahead(20); - assertThat(skipMemTableConfig.lookahead()). - isEqualTo(20); - options.setMemTableConfig(skipMemTableConfig); - } - } - - @Test - public void hashLinkedListMemTable() throws RocksDBException { - try(final Options options = new Options()) { - HashLinkedListMemTableConfig hashLinkedListMemTableConfig = - new HashLinkedListMemTableConfig(); - assertThat(hashLinkedListMemTableConfig.bucketCount()). - isEqualTo(50000); - hashLinkedListMemTableConfig.setBucketCount(100000); - assertThat(hashLinkedListMemTableConfig.bucketCount()). - isEqualTo(100000); - assertThat(hashLinkedListMemTableConfig.hugePageTlbSize()). - isEqualTo(0); - hashLinkedListMemTableConfig.setHugePageTlbSize(1); - assertThat(hashLinkedListMemTableConfig.hugePageTlbSize()). - isEqualTo(1); - assertThat(hashLinkedListMemTableConfig. - bucketEntriesLoggingThreshold()). - isEqualTo(4096); - hashLinkedListMemTableConfig. - setBucketEntriesLoggingThreshold(200); - assertThat(hashLinkedListMemTableConfig. - bucketEntriesLoggingThreshold()). - isEqualTo(200); - assertThat(hashLinkedListMemTableConfig. - ifLogBucketDistWhenFlush()).isTrue(); - hashLinkedListMemTableConfig. - setIfLogBucketDistWhenFlush(false); - assertThat(hashLinkedListMemTableConfig. - ifLogBucketDistWhenFlush()).isFalse(); - assertThat(hashLinkedListMemTableConfig. - thresholdUseSkiplist()). - isEqualTo(256); - hashLinkedListMemTableConfig.setThresholdUseSkiplist(29); - assertThat(hashLinkedListMemTableConfig. - thresholdUseSkiplist()). - isEqualTo(29); - options.setMemTableConfig(hashLinkedListMemTableConfig); - } - } - - @Test - public void vectorMemTable() throws RocksDBException { - try(final Options options = new Options()) { - VectorMemTableConfig vectorMemTableConfig = - new VectorMemTableConfig(); - assertThat(vectorMemTableConfig.reservedSize()). - isEqualTo(0); - vectorMemTableConfig.setReservedSize(123); - assertThat(vectorMemTableConfig.reservedSize()). - isEqualTo(123); - options.setMemTableConfig(vectorMemTableConfig); - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MergeTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MergeTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MergeTest.java deleted file mode 100644 index 73b9086..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MergeTest.java +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import java.util.Arrays; -import java.util.List; -import java.util.ArrayList; - -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MergeTest { - - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Rule - public TemporaryFolder dbFolder = new TemporaryFolder(); - - @Test - public void stringOption() - throws InterruptedException, RocksDBException { - try (final Options opt = new Options() - .setCreateIfMissing(true) - .setMergeOperatorName("stringappend"); - final RocksDB db = RocksDB.open(opt, - dbFolder.getRoot().getAbsolutePath())) { - // writing aa under key - db.put("key".getBytes(), "aa".getBytes()); - // merge bb under key - db.merge("key".getBytes(), "bb".getBytes()); - - final byte[] value = db.get("key".getBytes()); - final String strValue = new String(value); - assertThat(strValue).isEqualTo("aa,bb"); - } - } - - @Test - public void cFStringOption() - throws InterruptedException, RocksDBException { - - try (final ColumnFamilyOptions cfOpt1 = new ColumnFamilyOptions() - .setMergeOperatorName("stringappend"); - final ColumnFamilyOptions cfOpt2 = new ColumnFamilyOptions() - .setMergeOperatorName("stringappend") - ) { - final List<ColumnFamilyDescriptor> cfDescriptors = Arrays.asList( - new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY, cfOpt1), - new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY, cfOpt2) - ); - - final List<ColumnFamilyHandle> columnFamilyHandleList = new ArrayList<>(); - try (final DBOptions opt = new DBOptions() - .setCreateIfMissing(true) - .setCreateMissingColumnFamilies(true); - final RocksDB db = RocksDB.open(opt, - dbFolder.getRoot().getAbsolutePath(), cfDescriptors, - columnFamilyHandleList)) { - try { - // writing aa under key - db.put(columnFamilyHandleList.get(1), - "cfkey".getBytes(), "aa".getBytes()); - // merge bb under key - db.merge(columnFamilyHandleList.get(1), - "cfkey".getBytes(), "bb".getBytes()); - - byte[] value = db.get(columnFamilyHandleList.get(1), - "cfkey".getBytes()); - String strValue = new String(value); - assertThat(strValue).isEqualTo("aa,bb"); - } finally { - for (final ColumnFamilyHandle handle : columnFamilyHandleList) { - handle.close(); - } - } - } - } - } - - @Test - public void operatorOption() - throws InterruptedException, RocksDBException { - try (final StringAppendOperator stringAppendOperator = new StringAppendOperator(); - final Options opt = new Options() - .setCreateIfMissing(true) - .setMergeOperator(stringAppendOperator); - final RocksDB db = RocksDB.open(opt, - dbFolder.getRoot().getAbsolutePath())) { - // Writing aa under key - db.put("key".getBytes(), "aa".getBytes()); - - // Writing bb under key - db.merge("key".getBytes(), "bb".getBytes()); - - final byte[] value = db.get("key".getBytes()); - final String strValue = new String(value); - - assertThat(strValue).isEqualTo("aa,bb"); - } - } - - @Test - public void cFOperatorOption() - throws InterruptedException, RocksDBException { - try (final StringAppendOperator stringAppendOperator = new StringAppendOperator(); - final ColumnFamilyOptions cfOpt1 = new ColumnFamilyOptions() - .setMergeOperator(stringAppendOperator); - final ColumnFamilyOptions cfOpt2 = new ColumnFamilyOptions() - .setMergeOperator(stringAppendOperator) - ) { - final List<ColumnFamilyDescriptor> cfDescriptors = Arrays.asList( - new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY, cfOpt1), - new ColumnFamilyDescriptor("new_cf".getBytes(), cfOpt2) - ); - final List<ColumnFamilyHandle> columnFamilyHandleList = new ArrayList<>(); - try (final DBOptions opt = new DBOptions() - .setCreateIfMissing(true) - .setCreateMissingColumnFamilies(true); - final RocksDB db = RocksDB.open(opt, - dbFolder.getRoot().getAbsolutePath(), cfDescriptors, - columnFamilyHandleList) - ) { - try { - // writing aa under key - db.put(columnFamilyHandleList.get(1), - "cfkey".getBytes(), "aa".getBytes()); - // merge bb under key - db.merge(columnFamilyHandleList.get(1), - "cfkey".getBytes(), "bb".getBytes()); - byte[] value = db.get(columnFamilyHandleList.get(1), - "cfkey".getBytes()); - String strValue = new String(value); - - // Test also with createColumnFamily - try (final ColumnFamilyOptions cfHandleOpts = - new ColumnFamilyOptions() - .setMergeOperator(stringAppendOperator); - final ColumnFamilyHandle cfHandle = - db.createColumnFamily( - new ColumnFamilyDescriptor("new_cf2".getBytes(), - cfHandleOpts)) - ) { - // writing xx under cfkey2 - db.put(cfHandle, "cfkey2".getBytes(), "xx".getBytes()); - // merge yy under cfkey2 - db.merge(cfHandle, new WriteOptions(), "cfkey2".getBytes(), - "yy".getBytes()); - value = db.get(cfHandle, "cfkey2".getBytes()); - String strValueTmpCf = new String(value); - - assertThat(strValue).isEqualTo("aa,bb"); - assertThat(strValueTmpCf).isEqualTo("xx,yy"); - } - } finally { - for (final ColumnFamilyHandle columnFamilyHandle : - columnFamilyHandleList) { - columnFamilyHandle.close(); - } - } - } - } - } - - @Test - public void operatorGcBehaviour() - throws RocksDBException { - try (final StringAppendOperator stringAppendOperator = new StringAppendOperator()) { - try (final Options opt = new Options() - .setCreateIfMissing(true) - .setMergeOperator(stringAppendOperator); - final RocksDB db = RocksDB.open(opt, - dbFolder.getRoot().getAbsolutePath())) { - //no-op - } - - - // test reuse - try (final Options opt = new Options() - .setMergeOperator(stringAppendOperator); - final RocksDB db = RocksDB.open(opt, - dbFolder.getRoot().getAbsolutePath())) { - //no-op - } - - // test param init - try (final StringAppendOperator stringAppendOperator2 = new StringAppendOperator(); - final Options opt = new Options() - .setMergeOperator(stringAppendOperator2); - final RocksDB db = RocksDB.open(opt, - dbFolder.getRoot().getAbsolutePath())) { - //no-op - } - - // test replace one with another merge operator instance - try (final Options opt = new Options() - .setMergeOperator(stringAppendOperator); - final StringAppendOperator newStringAppendOperator = new StringAppendOperator()) { - opt.setMergeOperator(newStringAppendOperator); - try (final RocksDB db = RocksDB.open(opt, - dbFolder.getRoot().getAbsolutePath())) { - //no-op - } - } - } - } - - @Test - public void emptyStringInSetMergeOperatorByName() { - try (final Options opt = new Options() - .setMergeOperatorName(""); - final ColumnFamilyOptions cOpt = new ColumnFamilyOptions() - .setMergeOperatorName("")) { - //no-op - } - } - - @Test(expected = IllegalArgumentException.class) - public void nullStringInSetMergeOperatorByNameOptions() { - try (final Options opt = new Options()) { - opt.setMergeOperatorName(null); - } - } - - @Test(expected = IllegalArgumentException.class) - public void - nullStringInSetMergeOperatorByNameColumnFamilyOptions() { - try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { - opt.setMergeOperatorName(null); - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MixedOptionsTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MixedOptionsTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MixedOptionsTest.java deleted file mode 100644 index ff68b1b..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MixedOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). - -package org.rocksdb; - -import org.junit.ClassRule; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MixedOptionsTest { - - @ClassRule - public static final RocksMemoryResource rocksMemoryResource = - new RocksMemoryResource(); - - @Test - public void mixedOptionsTest(){ - // Set a table factory and check the names - try(final Filter bloomFilter = new BloomFilter(); - final ColumnFamilyOptions cfOptions = new ColumnFamilyOptions() - .setTableFormatConfig( - new BlockBasedTableConfig().setFilter(bloomFilter)) - ) { - assertThat(cfOptions.tableFactoryName()).isEqualTo( - "BlockBasedTable"); - cfOptions.setTableFormatConfig(new PlainTableConfig()); - assertThat(cfOptions.tableFactoryName()).isEqualTo("PlainTable"); - // Initialize a dbOptions object from cf options and - // db options - try (final DBOptions dbOptions = new DBOptions(); - final Options options = new Options(dbOptions, cfOptions)) { - assertThat(options.tableFactoryName()).isEqualTo("PlainTable"); - // Free instances - } - } - - // Test Optimize for statements - try(final ColumnFamilyOptions cfOptions = new ColumnFamilyOptions()) { - cfOptions.optimizeUniversalStyleCompaction(); - cfOptions.optimizeLevelStyleCompaction(); - cfOptions.optimizeForPointLookup(1024); - try(final Options options = new Options()) { - options.optimizeLevelStyleCompaction(); - options.optimizeLevelStyleCompaction(400); - options.optimizeUniversalStyleCompaction(); - options.optimizeUniversalStyleCompaction(400); - options.optimizeForPointLookup(1024); - options.prepareForBulkLoad(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MutableColumnFamilyOptionsTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MutableColumnFamilyOptionsTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MutableColumnFamilyOptionsTest.java deleted file mode 100644 index f631905..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/MutableColumnFamilyOptionsTest.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). -package org.rocksdb; - -import org.junit.Test; -import org.rocksdb.MutableColumnFamilyOptions.MutableColumnFamilyOptionsBuilder; - -import java.util.NoSuchElementException; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MutableColumnFamilyOptionsTest { - - @Test - public void builder() { - final MutableColumnFamilyOptionsBuilder builder = - MutableColumnFamilyOptions.builder(); - builder - .setWriteBufferSize(10) - .setInplaceUpdateNumLocks(5) - .setDisableAutoCompactions(true) - .setParanoidFileChecks(true); - - assertThat(builder.writeBufferSize()).isEqualTo(10); - assertThat(builder.inplaceUpdateNumLocks()).isEqualTo(5); - assertThat(builder.disableAutoCompactions()).isEqualTo(true); - assertThat(builder.paranoidFileChecks()).isEqualTo(true); - } - - @Test(expected = NoSuchElementException.class) - public void builder_getWhenNotSet() { - final MutableColumnFamilyOptionsBuilder builder = - MutableColumnFamilyOptions.builder(); - - builder.writeBufferSize(); - } - - @Test - public void builder_build() { - final MutableColumnFamilyOptions options = MutableColumnFamilyOptions - .builder() - .setWriteBufferSize(10) - .setParanoidFileChecks(true) - .build(); - - assertThat(options.getKeys().length).isEqualTo(2); - assertThat(options.getValues().length).isEqualTo(2); - assertThat(options.getKeys()[0]) - .isEqualTo( - MutableColumnFamilyOptions.MemtableOption.write_buffer_size.name()); - assertThat(options.getValues()[0]).isEqualTo("10"); - assertThat(options.getKeys()[1]) - .isEqualTo( - MutableColumnFamilyOptions.MiscOption.paranoid_file_checks.name()); - assertThat(options.getValues()[1]).isEqualTo("true"); - } - - @Test - public void mutableColumnFamilyOptions_toString() { - final String str = MutableColumnFamilyOptions - .builder() - .setWriteBufferSize(10) - .setInplaceUpdateNumLocks(5) - .setDisableAutoCompactions(true) - .setParanoidFileChecks(true) - .build() - .toString(); - - assertThat(str).isEqualTo("write_buffer_size=10;inplace_update_num_locks=5;" - + "disable_auto_compactions=true;paranoid_file_checks=true"); - } - - @Test - public void mutableColumnFamilyOptions_parse() { - final String str = "write_buffer_size=10;inplace_update_num_locks=5;" - + "disable_auto_compactions=true;paranoid_file_checks=true"; - - final MutableColumnFamilyOptionsBuilder builder = - MutableColumnFamilyOptions.parse(str); - - assertThat(builder.writeBufferSize()).isEqualTo(10); - assertThat(builder.inplaceUpdateNumLocks()).isEqualTo(5); - assertThat(builder.disableAutoCompactions()).isEqualTo(true); - assertThat(builder.paranoidFileChecks()).isEqualTo(true); - } -} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/java/src/test/java/org/rocksdb/NativeLibraryLoaderTest.java ---------------------------------------------------------------------- diff --git a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/NativeLibraryLoaderTest.java b/thirdparty/rocksdb/java/src/test/java/org/rocksdb/NativeLibraryLoaderTest.java deleted file mode 100644 index ab60081..0000000 --- a/thirdparty/rocksdb/java/src/test/java/org/rocksdb/NativeLibraryLoaderTest.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. -// This source code is licensed under both the GPLv2 (found in the -// COPYING file in the root directory) and Apache 2.0 License -// (found in the LICENSE.Apache file in the root directory). -package org.rocksdb; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.rocksdb.util.Environment; - -import java.io.File; -import java.io.IOException; -import java.nio.file.*; - -import static org.assertj.core.api.Assertions.assertThat; - -public class NativeLibraryLoaderTest { - - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); - - @Test - public void tempFolder() throws IOException { - NativeLibraryLoader.getInstance().loadLibraryFromJarToTemp( - temporaryFolder.getRoot().getAbsolutePath()); - final Path path = Paths.get(temporaryFolder.getRoot().getAbsolutePath(), - Environment.getJniLibraryFileName("rocksdb")); - assertThat(Files.exists(path)).isTrue(); - assertThat(Files.isReadable(path)).isTrue(); - } - - @Test - public void overridesExistingLibrary() throws IOException { - File first = NativeLibraryLoader.getInstance().loadLibraryFromJarToTemp( - temporaryFolder.getRoot().getAbsolutePath()); - NativeLibraryLoader.getInstance().loadLibraryFromJarToTemp( - temporaryFolder.getRoot().getAbsolutePath()); - assertThat(first.exists()).isTrue(); - } -}