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 import static org.assertj.core.api.Assertions.assertThat; 12 13 public class MixedOptionsTest { 14 15 @ClassRule 16 public static final RocksNativeLibraryResource ROCKS_NATIVE_LIBRARY_RESOURCE = 17 new RocksNativeLibraryResource(); 18 19 @Test 20 public void mixedOptionsTest(){ 21 // Set a table factory and check the names 22 try(final Filter bloomFilter = new BloomFilter(); 23 final ColumnFamilyOptions cfOptions = new ColumnFamilyOptions() 24 .setTableFormatConfig( 25 new BlockBasedTableConfig().setFilterPolicy(bloomFilter)) 26 ) { 27 assertThat(cfOptions.tableFactoryName()).isEqualTo( drop(&mut self)28 "BlockBasedTable"); 29 cfOptions.setTableFormatConfig(new PlainTableConfig()); 30 assertThat(cfOptions.tableFactoryName()).isEqualTo("PlainTable"); 31 // Initialize a dbOptions object from cf options and 32 // db options 33 try (final DBOptions dbOptions = new DBOptions(); 34 final Options options = new Options(dbOptions, cfOptions)) { 35 assertThat(options.tableFactoryName()).isEqualTo("PlainTable"); 36 // Free instances 37 } 38 } 39 40 // Test Optimize for statements 41 try(final ColumnFamilyOptions cfOptions = new ColumnFamilyOptions()) { next(&mut self) -> Option<ItemRef<'a, T>>42 cfOptions.optimizeUniversalStyleCompaction(); 43 cfOptions.optimizeLevelStyleCompaction(); 44 cfOptions.optimizeForPointLookup(1024); 45 try(final Options options = new Options()) { 46 options.optimizeLevelStyleCompaction(); 47 options.optimizeLevelStyleCompaction(400); 48 options.optimizeUniversalStyleCompaction(); 49 options.optimizeUniversalStyleCompaction(400); 50 options.optimizeForPointLookup(1024); 51 options.prepareForBulkLoad(); 52 } 53 } len(&self) -> usize54 } 55 } 56