31
31
import java .lang .reflect .Method ;
32
32
import java .net .URI ;
33
33
import java .util .ArrayList ;
34
- import java .util .Arrays ;
34
+ import java .util .Collections ;
35
35
import java .util .HashMap ;
36
36
import java .util .HashSet ;
37
37
import java .util .List ;
@@ -159,7 +159,7 @@ void asyncApiBigDataTest() throws Throwable
159
159
}
160
160
161
161
@ Test
162
- void rxApiBigDataTest () throws Throwable
162
+ void rxApiBigDataTest ()
163
163
{
164
164
assertRxIsAvailable ();
165
165
Bookmark bookmark = createNodesRx ( bigDataTestBatchCount (), BIG_DATA_TEST_BATCH_SIZE , driver );
@@ -221,7 +221,17 @@ Config config()
221
221
222
222
abstract C createContext ();
223
223
224
- abstract List <BlockingCommand <C >> createTestSpecificBlockingCommands ();
224
+ List <BlockingCommand <C >> createTestSpecificBlockingCommands () {
225
+ return Collections .emptyList ();
226
+ }
227
+
228
+ List <AsyncCommand <C >> createTestSpecificAsyncCommands () {
229
+ return Collections .emptyList ();
230
+ }
231
+
232
+ List <RxCommand <C >> createTestSpecificRxCommands () {
233
+ return Collections .emptyList ();
234
+ }
225
235
226
236
abstract boolean handleWriteFailure ( Throwable error , C context );
227
237
@@ -245,23 +255,15 @@ private List<BlockingCommand<C>> createBlockingCommands()
245
255
{
246
256
List <BlockingCommand <C >> commands = new ArrayList <>();
247
257
248
- commands .add ( new BlockingReadQuery <>( driver , false ) );
249
- commands .add ( new BlockingReadQuery <>( driver , true ) );
250
-
251
- commands .add ( new BlockingReadQueryInTx <>( driver , false ) );
252
- commands .add ( new BlockingReadQueryInTx <>( driver , true ) );
258
+ commands .add ( new BlockingReadQueryWithRetries <>( driver , false ) );
259
+ commands .add ( new BlockingReadQueryWithRetries <>( driver , true ) );
253
260
254
- commands .add ( new BlockingWriteQuery <>( this , driver , false ) );
255
- commands .add ( new BlockingWriteQuery <>( this , driver , true ) );
261
+ commands .add ( new BlockingWriteQueryWithRetries <>( this , driver , false ) );
262
+ commands .add ( new BlockingWriteQueryWithRetries <>( this , driver , true ) );
256
263
257
- commands .add ( new BlockingWriteQueryInTx <>( this , driver , false ) );
258
- commands .add ( new BlockingWriteQueryInTx <>( this , driver , true ) );
264
+ commands .add ( new BlockingWrongQueryWithRetries <>( driver ) );
259
265
260
- commands .add ( new BlockingWrongQuery <>( driver ) );
261
- commands .add ( new BlockingWrongQueryInTx <>( driver ) );
262
-
263
- commands .add ( new BlockingFailingQuery <>( driver ) );
264
- commands .add ( new BlockingFailingQueryInTx <>( driver ) );
266
+ commands .add ( new BlockingFailingQueryWithRetries <>( driver ) );
265
267
266
268
commands .add ( new FailedAuth <>( databaseUri (), config () ) );
267
269
@@ -299,29 +301,19 @@ private List<Future<?>> launchRxWorkerThreads( C context )
299
301
300
302
private List <RxCommand <C >> createRxCommands ()
301
303
{
302
- return Arrays .asList (
303
- new RxReadQuery <>( driver , false ),
304
- new RxReadQuery <>( driver , true ),
305
-
306
- new RxWriteQuery <>( this , driver , false ),
307
- new RxWriteQuery <>( this , driver , true ),
304
+ List <RxCommand <C >> commands = new ArrayList <>();
308
305
309
- new RxReadQueryInTx <>( driver , false ),
310
- new RxReadQueryInTx <>( driver , true ),
306
+ commands . add ( new RxReadQueryWithRetries <>( driver , false ) );
307
+ commands . add ( new RxReadQueryWithRetries <>( driver , true ) );
311
308
312
- new RxWriteQueryInTx <>( this , driver , false ),
313
- new RxWriteQueryInTx <>( this , driver , true ),
309
+ commands . add ( new RxWriteQueryWithRetries <>( this , driver , false ) );
310
+ commands . add ( new RxWriteQueryWithRetries <>( this , driver , true ) );
314
311
315
- new RxReadQueryWithRetries <>( driver , false ),
316
- new RxReadQueryWithRetries <>( driver , false ),
312
+ commands .add ( new RxFailingQueryWithRetries <>( driver ) );
317
313
318
- new RxWriteQueryWithRetries <>( this , driver , false ),
319
- new RxWriteQueryWithRetries <>( this , driver , true ),
314
+ commands .addAll ( createTestSpecificRxCommands () );
320
315
321
- new RxFailingQuery <>( driver ),
322
- new RxFailingQueryInTx <>( driver ),
323
- new RxFailingQueryWithRetries <>( driver )
324
- );
316
+ return commands ;
325
317
}
326
318
327
319
private Future <Void > launchRxWorkerThread ( ExecutorService executor , List <RxCommand <C >> commands , C context )
@@ -367,23 +359,15 @@ private List<AsyncCommand<C>> createAsyncCommands()
367
359
{
368
360
List <AsyncCommand <C >> commands = new ArrayList <>();
369
361
370
- commands .add ( new AsyncReadQuery <>( driver , false ) );
371
- commands .add ( new AsyncReadQuery <>( driver , true ) );
372
-
373
- commands .add ( new AsyncReadQueryInTx <>( driver , false ) );
374
- commands .add ( new AsyncReadQueryInTx <>( driver , true ) );
375
-
376
- commands .add ( new AsyncWriteQuery <>( this , driver , false ) );
377
- commands .add ( new AsyncWriteQuery <>( this , driver , true ) );
362
+ commands .add ( new AsyncReadQueryWithRetries <>( driver , false ) );
363
+ commands .add ( new AsyncReadQueryWithRetries <>( driver , true ) );
378
364
379
- commands .add ( new AsyncWriteQueryInTx <>( this , driver , false ) );
380
- commands .add ( new AsyncWriteQueryInTx <>( this , driver , true ) );
365
+ commands .add ( new AsyncWriteQueryWithRetries <>( this , driver , false ) );
366
+ commands .add ( new AsyncWriteQueryWithRetries <>( this , driver , true ) );
381
367
382
- commands .add ( new AsyncWrongQuery <>( driver ) );
383
- commands .add ( new AsyncWrongQueryInTx <>( driver ) );
368
+ commands .add ( new AsyncWrongQueryWithRetries <>( driver ) );
384
369
385
- commands .add ( new AsyncFailingQuery <>( driver ) );
386
- commands .add ( new AsyncFailingQueryInTx <>( driver ) );
370
+ commands .add ( new AsyncFailingQueryWithRetries <>( driver ) );
387
371
388
372
return commands ;
389
373
}
0 commit comments