use of org.apache.cassandra.db.ConsistencyLevel in project cassandra by apache.
the class ErrorMessageTest method testV5ReadFailureSerDeser.
@Test
public void testV5ReadFailureSerDeser() {
int receivedBlockFor = 3;
ConsistencyLevel consistencyLevel = ConsistencyLevel.ALL;
boolean dataPresent = false;
ReadFailureException rfe = new ReadFailureException(consistencyLevel, receivedBlockFor, receivedBlockFor, dataPresent, failureReasonMap1);
ErrorMessage deserialized = serializeAndGetDeserializedErrorMessage(ErrorMessage.fromException(rfe), ProtocolVersion.V5);
ReadFailureException deserializedRfe = (ReadFailureException) deserialized.error;
assertEquals(failureReasonMap1, deserializedRfe.failureReasonByEndpoint);
assertEquals(receivedBlockFor, deserializedRfe.received);
assertEquals(receivedBlockFor, deserializedRfe.blockFor);
assertEquals(consistencyLevel, deserializedRfe.consistency);
assertEquals(dataPresent, deserializedRfe.dataPresent);
}
use of org.apache.cassandra.db.ConsistencyLevel in project cassandra by apache.
the class ErrorMessageTest method testV5WriteFailureSerDeser.
@Test
public void testV5WriteFailureSerDeser() {
int receivedBlockFor = 3;
ConsistencyLevel consistencyLevel = ConsistencyLevel.ALL;
WriteType writeType = WriteType.SIMPLE;
WriteFailureException wfe = new WriteFailureException(consistencyLevel, receivedBlockFor, receivedBlockFor, writeType, failureReasonMap2);
ErrorMessage deserialized = serializeAndGetDeserializedErrorMessage(ErrorMessage.fromException(wfe), ProtocolVersion.V5);
WriteFailureException deserializedWfe = (WriteFailureException) deserialized.error;
assertEquals(failureReasonMap2, deserializedWfe.failureReasonByEndpoint);
assertEquals(receivedBlockFor, deserializedWfe.received);
assertEquals(receivedBlockFor, deserializedWfe.blockFor);
assertEquals(consistencyLevel, deserializedWfe.consistency);
assertEquals(writeType, deserializedWfe.writeType);
}
Aggregations