@@ -93,6 +93,7 @@ public void setUp() {
9393 AnalyticsClient newClient () {
9494 return new AnalyticsClient (
9595 messageQueue ,
96+ null ,
9697 segmentService ,
9798 50 ,
9899 TimeUnit .HOURS .toMillis (1 ),
@@ -271,6 +272,7 @@ public void flushHowManyTimesNecessaryToStayWithinLimit() throws InterruptedExce
271272 AnalyticsClient client =
272273 new AnalyticsClient (
273274 messageQueue ,
275+ null ,
274276 segmentService ,
275277 50 ,
276278 TimeUnit .HOURS .toMillis (1 ),
@@ -360,7 +362,7 @@ public void batchRetriesForNetworkErrors() {
360362 Response <UploadResponse > failureResponse = Response .error (429 , ResponseBody .create (null , "" ));
361363
362364 // Throw a network error 3 times.
363- when (segmentService .upload (batch ))
365+ when (segmentService .upload (null , batch ))
364366 .thenReturn (Calls .response (failureResponse ))
365367 .thenReturn (Calls .response (failureResponse ))
366368 .thenReturn (Calls .response (failureResponse ))
@@ -370,7 +372,7 @@ public void batchRetriesForNetworkErrors() {
370372 batchUploadTask .run ();
371373
372374 // Verify that we tried to upload 4 times, 3 failed and 1 succeeded.
373- verify (segmentService , times (4 )).upload (batch );
375+ verify (segmentService , times (4 )).upload (null , batch );
374376 verify (callback ).success (trackMessage );
375377 }
376378
@@ -385,7 +387,7 @@ public void batchRetriesForHTTP5xxErrors() {
385387 Response <UploadResponse > successResponse = Response .success (200 , response );
386388 Response <UploadResponse > failResponse =
387389 Response .error (500 , ResponseBody .create (null , "Server Error" ));
388- when (segmentService .upload (batch ))
390+ when (segmentService .upload (null , batch ))
389391 .thenReturn (Calls .response (failResponse ))
390392 .thenReturn (Calls .response (failResponse ))
391393 .thenReturn (Calls .response (failResponse ))
@@ -395,7 +397,7 @@ public void batchRetriesForHTTP5xxErrors() {
395397 batchUploadTask .run ();
396398
397399 // Verify that we tried to upload 4 times, 3 failed and 1 succeeded.
398- verify (segmentService , times (4 )).upload (batch );
400+ verify (segmentService , times (4 )).upload (null , batch );
399401 verify (callback ).success (trackMessage );
400402 }
401403
@@ -409,7 +411,7 @@ public void batchRetriesForHTTP429Errors() {
409411 Response <UploadResponse > successResponse = Response .success (200 , response );
410412 Response <UploadResponse > failResponse =
411413 Response .error (429 , ResponseBody .create (null , "Rate Limited" ));
412- when (segmentService .upload (batch ))
414+ when (segmentService .upload (null , batch ))
413415 .thenReturn (Calls .response (failResponse ))
414416 .thenReturn (Calls .response (failResponse ))
415417 .thenReturn (Calls .response (failResponse ))
@@ -419,7 +421,7 @@ public void batchRetriesForHTTP429Errors() {
419421 batchUploadTask .run ();
420422
421423 // Verify that we tried to upload 4 times, 3 failed and 1 succeeded.
422- verify (segmentService , times (4 )).upload (batch );
424+ verify (segmentService , times (4 )).upload (null , batch );
423425 verify (callback ).success (trackMessage );
424426 }
425427
@@ -432,13 +434,13 @@ public void batchDoesNotRetryForNon5xxAndNon429HTTPErrors() {
432434 // Throw a HTTP error that should not be retried.
433435 Response <UploadResponse > failResponse =
434436 Response .error (404 , ResponseBody .create (null , "Not Found" ));
435- when (segmentService .upload (batch )).thenReturn (Calls .response (failResponse ));
437+ when (segmentService .upload (null , batch )).thenReturn (Calls .response (failResponse ));
436438
437439 BatchUploadTask batchUploadTask = new BatchUploadTask (client , BACKO , batch , DEFAULT_RETRIES );
438440 batchUploadTask .run ();
439441
440442 // Verify we only tried to upload once.
441- verify (segmentService ).upload (batch );
443+ verify (segmentService ).upload (null , batch );
442444 verify (callback ).failure (eq (trackMessage ), any (IOException .class ));
443445 }
444446
@@ -449,13 +451,13 @@ public void batchDoesNotRetryForNonNetworkErrors() {
449451 Batch batch = batchFor (trackMessage );
450452
451453 Call <UploadResponse > networkFailure = Calls .failure (new RuntimeException ());
452- when (segmentService .upload (batch )).thenReturn (networkFailure );
454+ when (segmentService .upload (null , batch )).thenReturn (networkFailure );
453455
454456 BatchUploadTask batchUploadTask = new BatchUploadTask (client , BACKO , batch , DEFAULT_RETRIES );
455457 batchUploadTask .run ();
456458
457459 // Verify we only tried to upload once.
458- verify (segmentService ).upload (batch );
460+ verify (segmentService ).upload (null , batch );
459461 verify (callback ).failure (eq (trackMessage ), any (RuntimeException .class ));
460462 }
461463
@@ -465,7 +467,7 @@ public void givesUpAfterMaxRetries() {
465467 TrackMessage trackMessage = TrackMessage .builder ("foo" ).userId ("bar" ).build ();
466468 Batch batch = batchFor (trackMessage );
467469
468- when (segmentService .upload (batch ))
470+ when (segmentService .upload (null , batch ))
469471 .thenAnswer (
470472 new Answer <Call <UploadResponse >>() {
471473 public Call <UploadResponse > answer (InvocationOnMock invocation ) {
@@ -480,7 +482,7 @@ public Call<UploadResponse> answer(InvocationOnMock invocation) {
480482
481483 // DEFAULT_RETRIES == maxRetries
482484 // tries 11(one normal run + 10 retries) even though default is 50 in AnalyticsClient.java
483- verify (segmentService , times (11 )).upload (batch );
485+ verify (segmentService , times (11 )).upload (null , batch );
484486 verify (callback )
485487 .failure (
486488 eq (trackMessage ),
@@ -499,7 +501,7 @@ public void hasDefaultRetriesSetTo3() {
499501 TrackMessage trackMessage = TrackMessage .builder ("foo" ).userId ("bar" ).build ();
500502 Batch batch = batchFor (trackMessage );
501503
502- when (segmentService .upload (batch ))
504+ when (segmentService .upload (null , batch ))
503505 .thenAnswer (
504506 new Answer <Call <UploadResponse >>() {
505507 public Call <UploadResponse > answer (InvocationOnMock invocation ) {
@@ -514,7 +516,7 @@ public Call<UploadResponse> answer(InvocationOnMock invocation) {
514516
515517 // DEFAULT_RETRIES == maxRetries
516518 // tries 11(one normal run + 10 retries)
517- verify (segmentService , times (4 )).upload (batch );
519+ verify (segmentService , times (4 )).upload (null , batch );
518520 verify (callback )
519521 .failure (
520522 eq (trackMessage ),
@@ -619,7 +621,7 @@ public void neverRetries() {
619621 TrackMessage trackMessage = TrackMessage .builder ("foo" ).userId ("bar" ).build ();
620622 Batch batch = batchFor (trackMessage );
621623
622- when (segmentService .upload (batch ))
624+ when (segmentService .upload (null , batch ))
623625 .thenAnswer (
624626 new Answer <Call <UploadResponse >>() {
625627 public Call <UploadResponse > answer (InvocationOnMock invocation ) {
@@ -633,7 +635,7 @@ public Call<UploadResponse> answer(InvocationOnMock invocation) {
633635 batchUploadTask .run ();
634636
635637 // runs once but never retries
636- verify (segmentService , times (1 )).upload (batch );
638+ verify (segmentService , times (1 )).upload (null , batch );
637639 verify (callback )
638640 .failure (
639641 eq (trackMessage ),
@@ -830,6 +832,7 @@ public void submitBatchBelowThreshold() throws InterruptedException {
830832 AnalyticsClient client =
831833 new AnalyticsClient (
832834 messageQueue ,
835+ null ,
833836 segmentService ,
834837 50 ,
835838 TimeUnit .HOURS .toMillis (1 ),
@@ -869,6 +872,7 @@ public void submitBatchAboveThreshold() throws InterruptedException {
869872 AnalyticsClient client =
870873 new AnalyticsClient (
871874 messageQueue ,
875+ null ,
872876 segmentService ,
873877 50 ,
874878 TimeUnit .HOURS .toMillis (1 ),
@@ -907,6 +911,7 @@ public void submitManySmallMessagesBatchAboveThreshold() throws InterruptedExcep
907911 AnalyticsClient client =
908912 new AnalyticsClient (
909913 messageQueue ,
914+ null ,
910915 segmentService ,
911916 50 ,
912917 TimeUnit .HOURS .toMillis (1 ),
0 commit comments