22
33import com .exceptionless .exceptionlessclient .TestFixtures ;
44import com .exceptionless .exceptionlessclient .configuration .Configuration ;
5- import com .exceptionless .exceptionlessclient .exceptions .ClientException ;
5+ import com .exceptionless .exceptionlessclient .exceptions .SubmissionException ;
66import com .exceptionless .exceptionlessclient .models .Event ;
77import com .exceptionless .exceptionlessclient .models .submission .SubmissionResponse ;
88import com .exceptionless .exceptionlessclient .storage .InMemoryStorage ;
@@ -64,10 +64,10 @@ public void itCanProcessABatchSuccessfully() {
6464
6565 SubmissionResponse response =
6666 SubmissionResponse .builder ().message ("test-message" ).statusCode (200 ).build ();
67- doReturn (response ).when (submissionClient ).postEvents (List .of (event ), false );
67+ doReturn (response ).when (submissionClient ).postEvents (List .of (event ));
6868
6969 queue .onEventsPosted (testHandler );
70- queue .process (false );
70+ queue .process ();
7171
7272 assertThat (storage .peek ()).isNull ();
7373 verify (testHandler , times (1 )).accept (List .of (event ), response );
@@ -87,11 +87,11 @@ public void itShouldNotProcessIfCurrentlyProcessingEvents()
8787 return response ;
8888 })
8989 .when (submissionClient )
90- .postEvents (List .of (event ), false );
90+ .postEvents (List .of (event ));
9191
9292 queue .onEventsPosted (testHandler );
93- Future <?> future = Executors .newSingleThreadExecutor ().submit (() -> queue .process (false ));
94- queue .process (false );
93+ Future <?> future = Executors .newSingleThreadExecutor ().submit (() -> queue .process ());
94+ queue .process ();
9595 future .get ();
9696
9797 assertThat (storage .get (2 )).hasSize (1 ); // Only one is processed
@@ -101,7 +101,7 @@ public void itShouldNotProcessIfCurrentlyProcessingEvents()
101101 @ Test
102102 public void itShouldNotPostEmptyEvents () {
103103 queue .onEventsPosted (testHandler );
104- queue .process (false );
104+ queue .process ();
105105
106106 verifyZeroInteractions (submissionClient );
107107 verifyZeroInteractions (testHandler );
@@ -111,10 +111,10 @@ public void itShouldNotPostEmptyEvents() {
111111 public void itShouldSuspendProcessingOnClientException () {
112112 storage .save (event );
113113
114- doThrow (new ClientException ("test" )).when (submissionClient ).postEvents (List .of (event ), false );
114+ doThrow (new SubmissionException ("test" )).when (submissionClient ).postEvents (List .of (event ));
115115
116116 queue .onEventsPosted (testHandler );
117- queue .process (false );
117+ queue .process ();
118118
119119 assertThat (queue .isProcessingCurrentlySuspended ()).isTrue ();
120120 assertThat (storage .peek ().getValue ()).isEqualTo (event );
@@ -127,10 +127,10 @@ public void itShouldSuspendProcessingIfServiceIsUnavailable() {
127127
128128 SubmissionResponse response =
129129 SubmissionResponse .builder ().message ("test-message" ).statusCode (503 ).build ();
130- doReturn (response ).when (submissionClient ).postEvents (List .of (event ), false );
130+ doReturn (response ).when (submissionClient ).postEvents (List .of (event ));
131131
132132 queue .onEventsPosted (testHandler );
133- queue .process (false );
133+ queue .process ();
134134
135135 assertThat (queue .isProcessingCurrentlySuspended ()).isTrue ();
136136 assertThat (storage .peek ().getValue ()).isEqualTo (event );
@@ -143,10 +143,10 @@ public void itShouldSuspendAndDiscardProcessingAndClearQueueIfNoPayment() {
143143
144144 SubmissionResponse response =
145145 SubmissionResponse .builder ().message ("test-message" ).statusCode (402 ).build ();
146- doReturn (response ).when (submissionClient ).postEvents (List .of (event ), false );
146+ doReturn (response ).when (submissionClient ).postEvents (List .of (event ));
147147
148148 queue .onEventsPosted (testHandler );
149- queue .process (false );
149+ queue .process ();
150150
151151 assertThat (queue .isProcessingCurrentlySuspended ()).isTrue ();
152152 assertThat (storage .peek ()).isNull (); // queue is cleared
@@ -163,10 +163,10 @@ public void itShouldSuspendProcessingAndClearQueueIfUnableToAuthenticate() {
163163
164164 SubmissionResponse response =
165165 SubmissionResponse .builder ().message ("test-message" ).statusCode (401 ).build ();
166- doReturn (response ).when (submissionClient ).postEvents (List .of (event ), false );
166+ doReturn (response ).when (submissionClient ).postEvents (List .of (event ));
167167
168168 queue .onEventsPosted (testHandler );
169- queue .process (false );
169+ queue .process ();
170170
171171 assertThat (queue .isProcessingCurrentlySuspended ()).isTrue ();
172172 assertThat (storage .peek ()).isNull (); // queue is cleared
@@ -179,10 +179,10 @@ public void itShouldSuspendProcessingAndClearQueueForNotFoundResponse() {
179179
180180 SubmissionResponse response =
181181 SubmissionResponse .builder ().message ("test-message" ).statusCode (404 ).build ();
182- doReturn (response ).when (submissionClient ).postEvents (List .of (event ), false );
182+ doReturn (response ).when (submissionClient ).postEvents (List .of (event ));
183183
184184 queue .onEventsPosted (testHandler );
185- queue .process (false );
185+ queue .process ();
186186
187187 assertThat (queue .isProcessingCurrentlySuspended ()).isTrue ();
188188 assertThat (storage .peek ()).isNull (); // queue is cleared
@@ -195,10 +195,10 @@ public void itShouldSuspendProcessingAndClearQueueForBadRequest() {
195195
196196 SubmissionResponse response =
197197 SubmissionResponse .builder ().message ("test-message" ).statusCode (400 ).build ();
198- doReturn (response ).when (submissionClient ).postEvents (List .of (event ), false );
198+ doReturn (response ).when (submissionClient ).postEvents (List .of (event ));
199199
200200 queue .onEventsPosted (testHandler );
201- queue .process (false );
201+ queue .process ();
202202
203203 assertThat (queue .isProcessingCurrentlySuspended ()).isTrue ();
204204 assertThat (storage .peek ()).isNull (); // queue is cleared
@@ -211,10 +211,10 @@ public void itShouldSuspendProcessingByDefault() {
211211
212212 SubmissionResponse response =
213213 SubmissionResponse .builder ().message ("test-message" ).statusCode (-1 ).build ();
214- doReturn (response ).when (submissionClient ).postEvents (List .of (event ), false );
214+ doReturn (response ).when (submissionClient ).postEvents (List .of (event ));
215215
216216 queue .onEventsPosted (testHandler );
217- queue .process (false );
217+ queue .process ();
218218
219219 assertThat (queue .isProcessingCurrentlySuspended ()).isTrue ();
220220 assertThat (storage .peek ().getValue ()).isEqualTo (event );
@@ -239,22 +239,22 @@ public void itShouldReduceSubmissionBatchSizeIfRequestEntitiesAreTooLarge() {
239239
240240 SubmissionResponse response =
241241 SubmissionResponse .builder ().message ("test-message" ).statusCode (413 ).build ();
242- doReturn (response ).when (submissionClient ).postEvents (anyList (), anyBoolean () );
242+ doReturn (response ).when (submissionClient ).postEvents (anyList ());
243243
244244 queue .onEventsPosted (testHandler );
245- queue .process (false );
245+ queue .process ();
246246
247247 assertThat (storage .get (10 )).hasSize (10 );
248248 verify (testHandler , times (1 )).accept (anyList (), eq (response ));
249249
250- queue .process (false );
250+ queue .process ();
251251
252252 // One invocation with full batch
253253 verify (submissionClient , times (1 ))
254- .postEvents (argThat (argument -> argument .size () == 3 ), anyBoolean () );
254+ .postEvents (argThat (argument -> argument .size () == 3 ));
255255 // One invocation with reduced batch
256256 verify (submissionClient , times (1 ))
257- .postEvents (argThat (argument -> argument .size () == 2 ), anyBoolean () );
257+ .postEvents (argThat (argument -> argument .size () == 2 ));
258258 }
259259
260260 @ Test
@@ -265,10 +265,10 @@ public void itShouldDiscardEventsIfItCantReduceSubmissionSizeAndRequestEntitiesA
265265
266266 SubmissionResponse response =
267267 SubmissionResponse .builder ().message ("test-message" ).statusCode (413 ).build ();
268- doReturn (response ).when (submissionClient ).postEvents (anyList (), anyBoolean () );
268+ doReturn (response ).when (submissionClient ).postEvents (anyList ());
269269
270270 queue .onEventsPosted (testHandler );
271- queue .process (false );
271+ queue .process ();
272272
273273 assertThat (storage .get (10 )).hasSize (9 );
274274 verify (testHandler , times (1 )).accept (anyList (), eq (response ));
@@ -292,30 +292,30 @@ public void itShouldResetSubmissionBatchSizeOnNextSuccessfulResponse() {
292292
293293 doReturn (SubmissionResponse .builder ().message ("test-message" ).statusCode (413 ).build ())
294294 .when (submissionClient )
295- .postEvents (anyList (), anyBoolean () );
296- queue .process (false );
295+ .postEvents (anyList ());
296+ queue .process ();
297297
298298 doReturn (SubmissionResponse .builder ().message ("test-message" ).statusCode (200 ).build ())
299299 .when (submissionClient )
300- .postEvents (anyList (), anyBoolean () );
301- queue .process (false );
302- queue .process (false );
300+ .postEvents (anyList ());
301+ queue .process ();
302+ queue .process ();
303303
304304 // Two invocations with full batch; First with the default size and next after a successful
305305 // response
306306 verify (submissionClient , times (2 ))
307- .postEvents (argThat (argument -> argument .size () == 3 ), anyBoolean () );
307+ .postEvents (argThat (argument -> argument .size () == 3 ));
308308 // One invocation with reduced batch
309309 verify (submissionClient , times (1 ))
310- .postEvents (argThat (argument -> argument .size () == 2 ), anyBoolean () );
310+ .postEvents (argThat (argument -> argument .size () == 2 ));
311311 }
312312
313313 @ Test
314314 public void itShouldProcessEventsUsingTimer () throws InterruptedException {
315315 storage .save (event );
316316 SubmissionResponse response =
317317 SubmissionResponse .builder ().message ("test-message" ).statusCode (200 ).build ();
318- doReturn (response ).when (submissionClient ).postEvents (List .of (event ), false );
318+ doReturn (response ).when (submissionClient ).postEvents (List .of (event ));
319319
320320 Configuration configuration =
321321 TestFixtures .aDefaultConfiguration ().submissionBatchSize (1 ).build ();
0 commit comments