1 // Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 //  This source code is licensed under both the GPLv2 (found in the
3 //  COPYING file in the root directory) and Apache 2.0 License
4 //  (found in the LICENSE.Apache file in the root directory).
5 
6 package org.rocksdb;
7 
8 import org.junit.ClassRule;
9 import org.junit.Test;
10 
11 public class FilterTest {
12 
13   @ClassRule
14   public static final RocksNativeLibraryResource ROCKS_NATIVE_LIBRARY_RESOURCE =
15       new RocksNativeLibraryResource();
16 
17   @Test
filter()18   public void filter() {
19     // new Bloom filter
20     final BlockBasedTableConfig blockConfig = new BlockBasedTableConfig();
21     try(final Options options = new Options()) {
22 
23       try(final Filter bloomFilter = new BloomFilter()) {
24         blockConfig.setFilterPolicy(bloomFilter);
25         options.setTableFormatConfig(blockConfig);
26       }
27 
28       try(final Filter bloomFilter = new BloomFilter(10)) {
29         blockConfig.setFilterPolicy(bloomFilter);
30         options.setTableFormatConfig(blockConfig);
31       }
32 
33       try(final Filter bloomFilter = new BloomFilter(10, false)) {
34         blockConfig.setFilterPolicy(bloomFilter);
35         options.setTableFormatConfig(blockConfig);
36       }
37     }
38   }
39 }
40