]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/java/src/test/java/org/rocksdb/OptimisticTransactionOptionsTest.java
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rocksdb / java / src / test / java / org / rocksdb / OptimisticTransactionOptionsTest.java
CommitLineData
11fdf7f2
TL
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
6package org.rocksdb;
7
8import org.junit.Test;
f67539c2 9import org.rocksdb.util.BytewiseComparator;
11fdf7f2
TL
10
11import java.util.Random;
12
13import static org.assertj.core.api.Assertions.assertThat;
14
15public class OptimisticTransactionOptionsTest {
16
17 private static final Random rand = PlatformRandomHelper.
18 getPlatformSpecificRandomFactory();
19
20 @Test
21 public void setSnapshot() {
22 try (final OptimisticTransactionOptions opt = new OptimisticTransactionOptions()) {
23 final boolean boolValue = rand.nextBoolean();
24 opt.setSetSnapshot(boolValue);
25 assertThat(opt.isSetSnapshot()).isEqualTo(boolValue);
26 }
27 }
28
29 @Test
30 public void comparator() {
31 try (final OptimisticTransactionOptions opt = new OptimisticTransactionOptions();
f67539c2
TL
32 final ComparatorOptions copt = new ComparatorOptions()
33 .setUseDirectBuffer(true);
34 final AbstractComparator comparator = new BytewiseComparator(copt)) {
11fdf7f2
TL
35 opt.setComparator(comparator);
36 }
37 }
38}