use of io.crate.blob.PutChunkReplicaRequest in project crate by crate.
the class SerializationTests method testPutChunkReplicaRequestSerialization.
@Test
public void testPutChunkReplicaRequestSerialization() throws Exception {
BytesStreamOutput outputStream = new BytesStreamOutput();
UUID transferId = UUID.randomUUID();
PutChunkReplicaRequest requestOut = new PutChunkReplicaRequest();
requestOut.index("foo");
requestOut.transferId = transferId;
requestOut.currentPos = 10;
requestOut.isLast = false;
requestOut.content = new BytesArray(new byte[] { 0x65, 0x66 });
requestOut.sourceNodeId = "nodeId";
requestOut.writeTo(outputStream);
StreamInput inputStream = StreamInput.wrap(outputStream.bytes());
PutChunkReplicaRequest requestIn = new PutChunkReplicaRequest();
requestIn.readFrom(inputStream);
assertEquals(requestOut.currentPos, requestIn.currentPos);
assertEquals(requestOut.isLast, requestIn.isLast);
assertEquals(requestOut.content, requestIn.content);
assertEquals(requestOut.transferId, requestIn.transferId);
assertEquals(requestOut.index(), requestIn.index());
}
Aggregations