use of voldemort.rest.coordinator.config.CoordinatorConfig in project voldemort by voldemort.
the class CoordinatorRestAPITest method testLargeValueSizeVersionedPut.
@Test
public void testLargeValueSizeVersionedPut() {
String key = "amigo";
String payload = generateRandomString(new CoordinatorConfig().getHttpMessageDecoderMaxChunkSize() * 10, ValueType.ALPHA);
String newPayload = generateRandomString(new CoordinatorConfig().getHttpMessageDecoderMaxChunkSize() * 10, ValueType.ALPHA);
// 1. Do a put
doPut(key, payload, null);
// 2. Do a get on the same key
TestVersionedValue response = doGet(key, null);
if (response == null) {
fail("key does not exist after a put. ");
}
System.out.println("Received value: " + response.getValue());
// 3. Do a versioned put based on the version received previously
doPut(key, newPayload, response.getVc());
// 4. Do a get again on the same key
TestVersionedValue newResponse = doGet(key);
if (newResponse == null) {
fail("key does not exist after the versioned put. ");
}
assertEquals("Returned response does not have a higer version", Occurred.AFTER, newResponse.getVc().compare(response.getVc()));
assertEquals("Returned response does not have a higer version", Occurred.BEFORE, response.getVc().compare(newResponse.getVc()));
System.out.println("Received value after the Versioned put: " + newResponse.getValue());
if (!newResponse.getValue().equals(newPayload)) {
fail("Received value is incorrect ! Expected : " + newPayload + " but got : " + newResponse.getValue());
}
}
Aggregations