use of voldemort.client.protocol.RequestFormat in project voldemort by voldemort.
the class HttpStoreTest method testBadUrlOrPort.
public <T extends Exception> void testBadUrlOrPort(String url, int port, Class<T> expected) {
ByteArray key = new ByteArray("test".getBytes());
RequestFormat requestFormat = new RequestFormatFactory().getRequestFormat(RequestFormatType.VOLDEMORT_V1);
HttpParams clientParams = httpClient.getParams();
HttpConnectionParams.setConnectionTimeout(clientParams, 5000);
HttpStore badUrlHttpStore = new HttpStore("test", url, port, httpClient, requestFormat, false);
try {
badUrlHttpStore.put(key, new Versioned<byte[]>("value".getBytes(), new VectorClock()), null);
} catch (Exception e) {
assertTrue(e.getClass().equals(expected));
}
try {
badUrlHttpStore.get(key, null);
} catch (Exception e) {
assertTrue(e.getClass().equals(expected));
}
try {
badUrlHttpStore.delete(key, new VectorClock());
} catch (Exception e) {
assertTrue(e.getClass().equals(expected));
}
}
Aggregations