public void testBatchUpdateRequestBuilder(ProtocolVersion version, String expectedUri)
{
BatchUpdateRequestBuilder<Long, TestRecord> builder =
new BatchUpdateRequestBuilder<Long, TestRecord>(TEST_URI, TestRecord.class, _COLL_SPEC, RestliRequestOptions.DEFAULT_OPTIONS);
Map<Long, TestRecord> updates = new HashMap<Long, TestRecord>();
updates.put(1L, new TestRecord());
updates.put(2L, new TestRecord());
updates.put(3L, new TestRecord());
BatchUpdateRequest<Long, TestRecord> request = builder.inputs(updates).build();
testBaseUriGeneration(request);
testIdsForBatchRequest(request, new HashSet<Long>(Arrays.asList(1L, 2L, 3L)));
Assert.assertEquals(request.isSafe(), false);
Assert.assertEquals(request.isIdempotent(), true);
BatchRequest<TestRecord> expectedRequest = new BatchRequest<TestRecord>(new DataMap(), TestRecord.class);
expectedRequest.getEntities().put("1", new TestRecord());
expectedRequest.getEntities().put("2", new TestRecord());
expectedRequest.getEntities().put("3", new TestRecord());
@SuppressWarnings({"unchecked","rawtypes"})
KeyValueRecordFactory<Long, TestRecord> factory =
new KeyValueRecordFactory<Long, TestRecord>(Long.class,
null,
null,
null,
TestRecord.class);
@SuppressWarnings({"unchecked","rawtypes"})
CollectionRequest<KeyValueRecord> collectionRequest =
buildCollectionRequest(factory,
new Long[]{1L, 2L, 3L},
new TestRecord[]{new TestRecord(), new TestRecord(), new TestRecord()});
checkBasicRequest(request,
expectedUri,
ResourceMethod.BATCH_UPDATE,
collectionRequest,