return deserializedEvent;
}
private HistoryEvent testSummaryProtoConversion(HistoryEvent historyEvent)
throws IOException {
SummaryEvent event = (SummaryEvent) historyEvent;
ByteArrayOutputStream os = new ByteArrayOutputStream();
HistoryEvent deserializedEvent = null;
event.toSummaryProtoStream(os);
os.flush();
os.close();
LOG.info("Serialized event to byte array"
+ ", eventType=" + historyEvent.getEventType()
+ ", bufLen=" + os.toByteArray().length);
SummaryEventProto summaryEventProto =
SummaryEventProto.parseDelimitedFrom(
new ByteArrayInputStream(os.toByteArray()));
deserializedEvent = ReflectionUtils.createClazzInstance(
event.getClass().getName());
((SummaryEvent)deserializedEvent).fromSummaryProtoStream(summaryEventProto);
return deserializedEvent;
}