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).
8 import org
.junit
.ClassRule
;
10 import org
.junit
.Test
;
11 import org
.junit
.rules
.TemporaryFolder
;
13 import static java
.nio
.charset
.StandardCharsets
.UTF_8
;
15 public class HdfsEnvTest
{
18 public static final RocksNativeLibraryResource ROCKS_NATIVE_LIBRARY_RESOURCE
=
19 new RocksNativeLibraryResource();
22 public TemporaryFolder dbFolder
= new TemporaryFolder();
24 // expect org.rocksdb.RocksDBException: Not compiled with hdfs support
25 @Test(expected
= RocksDBException
.class)
26 public void construct() throws RocksDBException
{
27 try (final Env env
= new HdfsEnv("hdfs://localhost:5000")) {
32 // expect org.rocksdb.RocksDBException: Not compiled with hdfs support
33 @Test(expected
= RocksDBException
.class)
34 public void construct_integration() throws RocksDBException
{
35 try (final Env env
= new HdfsEnv("hdfs://localhost:5000");
36 final Options options
= new Options()
37 .setCreateIfMissing(true)
40 try (final RocksDB db
= RocksDB
.open(options
, dbFolder
.getRoot().getPath())) {
41 db
.put("key1".getBytes(UTF_8
), "value1".getBytes(UTF_8
));