@Override public SmallEvent build() { try { SmallEvent record = new SmallEvent(); record.user_id = fieldSetFlags()[0] ? this.user_id : (java.lang.Long) defaultValue(fields()[0]); record.session_id = fieldSetFlags()[1] ? this.session_id : (java.lang.String) defaultValue(fields()[1]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
@Test public void testGetReaderSchemaForCompatibleSpecific() { Class<SmallEvent> type = SmallEvent.class; Schema writerSchema = StandardEvent.getClassSchema(); Schema expResult = SmallEvent.getClassSchema(); Schema result = DataModelUtil.getReaderSchema(type, writerSchema); assertEquals(expResult, result); }
private static SmallEvent toSmallEvent(StandardEvent event) { return SmallEvent.newBuilder() .setUserId(event.getUserId()) .setSessionId(event.getSessionId()) .build(); }