@@ -157,8 +157,90 @@ void assignUserIdTest0() {
157
157
}
158
158
159
159
@ Test
160
- @ DisplayName ("batch" )
160
+ @ DisplayName ("allows batch method with `addObject` action " )
161
161
void batchTest0 () {
162
+ String indexName0 = "theIndexName" ;
163
+ BatchWriteParams batchWriteParams0 = new BatchWriteParams ();
164
+ {
165
+ List <BatchOperation > requests1 = new ArrayList <>();
166
+ {
167
+ BatchOperation requests_02 = new BatchOperation ();
168
+ {
169
+ Action action3 = Action .fromValue ("addObject" );
170
+ requests_02 .setAction (action3 );
171
+ Map <String , String > body3 = new HashMap <>();
172
+ {
173
+ String key4 = "value" ;
174
+ body3 .put ("key" , key4 );
175
+ }
176
+ requests_02 .setBody (body3 );
177
+ }
178
+ requests1 .add (requests_02 );
179
+ }
180
+ batchWriteParams0 .setRequests (requests1 );
181
+ }
182
+
183
+ assertDoesNotThrow (() -> {
184
+ client .batch (indexName0 , batchWriteParams0 );
185
+ });
186
+ EchoResponse req = echo .getLastResponse ();
187
+
188
+ assertEquals (req .path , "/1/indexes/theIndexName/batch" );
189
+ assertEquals (req .method , "POST" );
190
+
191
+ assertDoesNotThrow (() -> {
192
+ JSONAssert .assertEquals (
193
+ "{\" requests\" :[{\" action\" :\" addObject\" ,\" body\" :{\" key\" :\" value\" }}]}" ,
194
+ req .body ,
195
+ JSONCompareMode .STRICT_ORDER
196
+ );
197
+ });
198
+ }
199
+
200
+ @ Test
201
+ @ DisplayName ("allows batch method with `clear` action" )
202
+ void batchTest1 () {
203
+ String indexName0 = "theIndexName" ;
204
+ BatchWriteParams batchWriteParams0 = new BatchWriteParams ();
205
+ {
206
+ List <BatchOperation > requests1 = new ArrayList <>();
207
+ {
208
+ BatchOperation requests_02 = new BatchOperation ();
209
+ {
210
+ Action action3 = Action .fromValue ("clear" );
211
+ requests_02 .setAction (action3 );
212
+ Map <String , String > body3 = new HashMap <>();
213
+ {
214
+ String key4 = "value" ;
215
+ body3 .put ("key" , key4 );
216
+ }
217
+ requests_02 .setBody (body3 );
218
+ }
219
+ requests1 .add (requests_02 );
220
+ }
221
+ batchWriteParams0 .setRequests (requests1 );
222
+ }
223
+
224
+ assertDoesNotThrow (() -> {
225
+ client .batch (indexName0 , batchWriteParams0 );
226
+ });
227
+ EchoResponse req = echo .getLastResponse ();
228
+
229
+ assertEquals (req .path , "/1/indexes/theIndexName/batch" );
230
+ assertEquals (req .method , "POST" );
231
+
232
+ assertDoesNotThrow (() -> {
233
+ JSONAssert .assertEquals (
234
+ "{\" requests\" :[{\" action\" :\" clear\" ,\" body\" :{\" key\" :\" value\" }}]}" ,
235
+ req .body ,
236
+ JSONCompareMode .STRICT_ORDER
237
+ );
238
+ });
239
+ }
240
+
241
+ @ Test
242
+ @ DisplayName ("allows batch method with `delete` action" )
243
+ void batchTest2 () {
162
244
String indexName0 = "theIndexName" ;
163
245
BatchWriteParams batchWriteParams0 = new BatchWriteParams ();
164
246
{
@@ -197,6 +279,170 @@ void batchTest0() {
197
279
});
198
280
}
199
281
282
+ @ Test
283
+ @ DisplayName ("allows batch method with `deleteObject` action" )
284
+ void batchTest3 () {
285
+ String indexName0 = "theIndexName" ;
286
+ BatchWriteParams batchWriteParams0 = new BatchWriteParams ();
287
+ {
288
+ List <BatchOperation > requests1 = new ArrayList <>();
289
+ {
290
+ BatchOperation requests_02 = new BatchOperation ();
291
+ {
292
+ Action action3 = Action .fromValue ("deleteObject" );
293
+ requests_02 .setAction (action3 );
294
+ Map <String , String > body3 = new HashMap <>();
295
+ {
296
+ String key4 = "value" ;
297
+ body3 .put ("key" , key4 );
298
+ }
299
+ requests_02 .setBody (body3 );
300
+ }
301
+ requests1 .add (requests_02 );
302
+ }
303
+ batchWriteParams0 .setRequests (requests1 );
304
+ }
305
+
306
+ assertDoesNotThrow (() -> {
307
+ client .batch (indexName0 , batchWriteParams0 );
308
+ });
309
+ EchoResponse req = echo .getLastResponse ();
310
+
311
+ assertEquals (req .path , "/1/indexes/theIndexName/batch" );
312
+ assertEquals (req .method , "POST" );
313
+
314
+ assertDoesNotThrow (() -> {
315
+ JSONAssert .assertEquals (
316
+ "{\" requests\" :[{\" action\" :\" deleteObject\" ,\" body\" :{\" key\" :\" value\" }}]}" ,
317
+ req .body ,
318
+ JSONCompareMode .STRICT_ORDER
319
+ );
320
+ });
321
+ }
322
+
323
+ @ Test
324
+ @ DisplayName ("allows batch method with `partialUpdateObject` action" )
325
+ void batchTest4 () {
326
+ String indexName0 = "theIndexName" ;
327
+ BatchWriteParams batchWriteParams0 = new BatchWriteParams ();
328
+ {
329
+ List <BatchOperation > requests1 = new ArrayList <>();
330
+ {
331
+ BatchOperation requests_02 = new BatchOperation ();
332
+ {
333
+ Action action3 = Action .fromValue ("partialUpdateObject" );
334
+ requests_02 .setAction (action3 );
335
+ Map <String , String > body3 = new HashMap <>();
336
+ {
337
+ String key4 = "value" ;
338
+ body3 .put ("key" , key4 );
339
+ }
340
+ requests_02 .setBody (body3 );
341
+ }
342
+ requests1 .add (requests_02 );
343
+ }
344
+ batchWriteParams0 .setRequests (requests1 );
345
+ }
346
+
347
+ assertDoesNotThrow (() -> {
348
+ client .batch (indexName0 , batchWriteParams0 );
349
+ });
350
+ EchoResponse req = echo .getLastResponse ();
351
+
352
+ assertEquals (req .path , "/1/indexes/theIndexName/batch" );
353
+ assertEquals (req .method , "POST" );
354
+
355
+ assertDoesNotThrow (() -> {
356
+ JSONAssert .assertEquals (
357
+ "{\" requests\" :[{\" action\" :\" partialUpdateObject\" ,\" body\" :{\" key\" :\" value\" }}]}" ,
358
+ req .body ,
359
+ JSONCompareMode .STRICT_ORDER
360
+ );
361
+ });
362
+ }
363
+
364
+ @ Test
365
+ @ DisplayName ("allows batch method with `partialUpdateObjectNoCreate` action" )
366
+ void batchTest5 () {
367
+ String indexName0 = "theIndexName" ;
368
+ BatchWriteParams batchWriteParams0 = new BatchWriteParams ();
369
+ {
370
+ List <BatchOperation > requests1 = new ArrayList <>();
371
+ {
372
+ BatchOperation requests_02 = new BatchOperation ();
373
+ {
374
+ Action action3 = Action .fromValue ("partialUpdateObjectNoCreate" );
375
+ requests_02 .setAction (action3 );
376
+ Map <String , String > body3 = new HashMap <>();
377
+ {
378
+ String key4 = "value" ;
379
+ body3 .put ("key" , key4 );
380
+ }
381
+ requests_02 .setBody (body3 );
382
+ }
383
+ requests1 .add (requests_02 );
384
+ }
385
+ batchWriteParams0 .setRequests (requests1 );
386
+ }
387
+
388
+ assertDoesNotThrow (() -> {
389
+ client .batch (indexName0 , batchWriteParams0 );
390
+ });
391
+ EchoResponse req = echo .getLastResponse ();
392
+
393
+ assertEquals (req .path , "/1/indexes/theIndexName/batch" );
394
+ assertEquals (req .method , "POST" );
395
+
396
+ assertDoesNotThrow (() -> {
397
+ JSONAssert .assertEquals (
398
+ "{\" requests\" :[{\" action\" :\" partialUpdateObjectNoCreate\" ,\" body\" :{\" key\" :\" value\" }}]}" ,
399
+ req .body ,
400
+ JSONCompareMode .STRICT_ORDER
401
+ );
402
+ });
403
+ }
404
+
405
+ @ Test
406
+ @ DisplayName ("allows batch method with `updateObject` action" )
407
+ void batchTest6 () {
408
+ String indexName0 = "theIndexName" ;
409
+ BatchWriteParams batchWriteParams0 = new BatchWriteParams ();
410
+ {
411
+ List <BatchOperation > requests1 = new ArrayList <>();
412
+ {
413
+ BatchOperation requests_02 = new BatchOperation ();
414
+ {
415
+ Action action3 = Action .fromValue ("updateObject" );
416
+ requests_02 .setAction (action3 );
417
+ Map <String , String > body3 = new HashMap <>();
418
+ {
419
+ String key4 = "value" ;
420
+ body3 .put ("key" , key4 );
421
+ }
422
+ requests_02 .setBody (body3 );
423
+ }
424
+ requests1 .add (requests_02 );
425
+ }
426
+ batchWriteParams0 .setRequests (requests1 );
427
+ }
428
+
429
+ assertDoesNotThrow (() -> {
430
+ client .batch (indexName0 , batchWriteParams0 );
431
+ });
432
+ EchoResponse req = echo .getLastResponse ();
433
+
434
+ assertEquals (req .path , "/1/indexes/theIndexName/batch" );
435
+ assertEquals (req .method , "POST" );
436
+
437
+ assertDoesNotThrow (() -> {
438
+ JSONAssert .assertEquals (
439
+ "{\" requests\" :[{\" action\" :\" updateObject\" ,\" body\" :{\" key\" :\" value\" }}]}" ,
440
+ req .body ,
441
+ JSONCompareMode .STRICT_ORDER
442
+ );
443
+ });
444
+ }
445
+
200
446
@ Test
201
447
@ DisplayName ("batchAssignUserIds" )
202
448
void batchAssignUserIdsTest0 () {
0 commit comments