@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
//test cookbook example from quickstart wiki
public void testCookbook(RootBuilderWrapper<Long, Greeting> builders) throws Exception
{
Client r2Client = new TransportClientAdapter(new HttpClientFactory().getClient(Collections.<String, String>emptyMap()));
RestClient restClient = new RestClient(r2Client, "http://localhost:1338/");
// GET
Request<Greeting> request = builders.get().id(1L).build();
ResponseFuture<Greeting> future = restClient.sendRequest(request);
Response<Greeting> greetingResponse = future.getResponse();
Assert.assertNotNull(greetingResponse.getEntity().getMessage());
// POST
Greeting greeting = new Greeting(greetingResponse.getEntity().data().copy());
final String NEW_MESSAGE = "This is a new message!";
greeting.setMessage(NEW_MESSAGE);
Request<EmptyRecord> writeRequest = builders.update().id(1L).input(greeting).build();
restClient.sendRequest(writeRequest).getResponse();
// GET again, to verify that our POST worked.
Request<Greeting> request2 = builders.get().id(1L).build();
ResponseFuture<Greeting> future2 = restClient.sendRequest(request2);
greetingResponse = future2.get();
Assert.assertEquals(greetingResponse.getEntity().getMessage(), NEW_MESSAGE);
// shut down client
FutureCallback<None> futureCallback = new FutureCallback<None>();
r2Client.shutdown(futureCallback);
futureCallback.get();
}