1010
1111import java .nio .charset .StandardCharsets ;
1212import java .util .ArrayList ;
13- import java .util .Arrays ;
1413import java .util .List ;
15- import org .junit .jupiter .api .Test ;
1614import org .junit .jupiter .params .ParameterizedTest ;
1715import org .junit .jupiter .params .provider .MethodSource ;
18- import org . junit . jupiter . params . provider . Arguments ;
19- import java .util .stream .Stream ;
16+
17+ import java .util .stream .IntStream ;
2018import org .junit .jupiter .api .io .TempDir ;
2119import java .io .File ;
20+
2221public class PutMultiplePartsTest {
23- static Stream <Integer > data () {
24- return Stream .of (2 , 3 , 250 , 20000 );
22+
23+ static IntStream parameters () {
24+ return IntStream .of (2 , 3 , 250 , 20000 );
2525 }
2626
2727 @ TempDir
2828 File dbFolder ;
2929
30- private final int numParts ;
31-
32- public PutMultiplePartsTest (final Integer numParts ) {
33- this .numParts = numParts ;
34- }
35-
36- @ Test
37- public void putUntracked () throws RocksDBException {
30+ @ ParameterizedTest
31+ @ MethodSource ("parameters" )
32+ public void putUntracked (final int numParts ) throws RocksDBException {
3833 try (final Options options = new Options ().setCreateIfMissing (true );
3934 final TransactionDBOptions txnDbOptions = new TransactionDBOptions ();
4035 final TransactionDB txnDB =
@@ -48,11 +43,12 @@ public void putUntracked() throws RocksDBException {
4843 txnDB .syncWal ();
4944 }
5045
51- validateResults ();
46+ validateResults (numParts );
5247 }
5348
54- @ Test
55- public void put () throws RocksDBException {
49+ @ ParameterizedTest
50+ @ MethodSource ("parameters" )
51+ public void put (final int numParts ) throws RocksDBException {
5652 try (final Options options = new Options ().setCreateIfMissing (true );
5753 final TransactionDBOptions txnDbOptions = new TransactionDBOptions ();
5854 final TransactionDB txnDB =
@@ -66,11 +62,12 @@ public void put() throws RocksDBException {
6662 txnDB .syncWal ();
6763 }
6864
69- validateResults ();
65+ validateResults (numParts );
7066 }
7167
72- @ Test
73- public void putUntrackedCF () throws RocksDBException {
68+ @ ParameterizedTest
69+ @ MethodSource ("parameters" )
70+ public void putUntrackedCF (final int numParts ) throws RocksDBException {
7471 try (final Options options = new Options ().setCreateIfMissing (true );
7572 final TransactionDBOptions txnDbOptions = new TransactionDBOptions ();
7673 final TransactionDB txnDB =
@@ -86,10 +83,12 @@ public void putUntrackedCF() throws RocksDBException {
8683 txnDB .syncWal ();
8784 }
8885
89- validateResultsCF ();
86+ validateResultsCF (numParts );
9087 }
91- @ Test
92- public void putCF () throws RocksDBException {
88+
89+ @ ParameterizedTest
90+ @ MethodSource ("parameters" )
91+ public void putCF (final int numParts ) throws RocksDBException {
9392 try (final Options options = new Options ().setCreateIfMissing (true );
9493 final TransactionDBOptions txnDbOptions = new TransactionDBOptions ();
9594 final TransactionDB txnDB =
@@ -105,10 +104,10 @@ public void putCF() throws RocksDBException {
105104 txnDB .syncWal ();
106105 }
107106
108- validateResultsCF ();
107+ validateResultsCF (numParts );
109108 }
110109
111- private void validateResults () throws RocksDBException {
110+ private void validateResults (final int numParts ) throws RocksDBException {
112111 try (final RocksDB db = RocksDB .open (new Options (), dbFolder .getAbsolutePath ())) {
113112 final List <byte []> keys = generateItemsAsList ("key" , ":" , numParts );
114113 final byte [][] values = generateItems ("value" , "" , numParts );
@@ -126,7 +125,7 @@ private void validateResults() throws RocksDBException {
126125 }
127126 }
128127
129- private void validateResultsCF () throws RocksDBException {
128+ private void validateResultsCF (final int numParts ) throws RocksDBException {
130129 final List <ColumnFamilyDescriptor > columnFamilyDescriptors = new ArrayList <>();
131130 columnFamilyDescriptors .add (new ColumnFamilyDescriptor ("cfTest" .getBytes ()));
132131 columnFamilyDescriptors .add (new ColumnFamilyDescriptor ("default" .getBytes ()));
0 commit comments