@Test public void testReadFields() throws IOException { DataInput in = mock(DataInput.class); when(in.readByte()).thenReturn((byte) fileSplitName.length()); when(in.readInt()).thenAnswer(new Answer<Integer>() { private int count = 0; private int[] answers = new int[]{basePath.length(), maxCommitTime.length(), deltaLogPaths.size(), deltaLogPaths.get(0).length()}; @Override public Integer answer(InvocationOnMock invocationOnMock) throws Throwable { return answers[count++]; } }); Answer<Void> readFullyAnswer = new Answer<Void>() { private int count = 0; private byte[][] answers = new byte[][]{ fileSplitName.getBytes(StandardCharsets.UTF_8), basePath.getBytes(StandardCharsets.UTF_8), maxCommitTime.getBytes(StandardCharsets.UTF_8), deltaLogPaths.get(0).getBytes(StandardCharsets.UTF_8), }; @Override public Void answer(InvocationOnMock invocation) throws Throwable { byte[] bytes = invocation.getArgument(0); byte[] answer = answers[count++]; System.arraycopy(answer, 0, bytes, 0, answer.length); return null; } }; doAnswer(readFullyAnswer).when(in).readFully(any()); doAnswer(readFullyAnswer).when(in).readFully(any(), anyInt(), anyInt()); HoodieRealtimeFileSplit read = new HoodieRealtimeFileSplit(); read.readFields(in); assertEquals(basePath, read.getBasePath()); assertEquals(maxCommitTime, read.getMaxCommitTime()); assertEquals(deltaLogPaths, read.getDeltaLogPaths()); assertEquals(split.toString(), read.toString()); }
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); readFromInput(in); }
HoodieRealtimeFileSplit extends FileSplit implements RealtimeSplit { @Override public void readFields(DataInput in) throws IOException { super.readFields(in); readFromInput(in); } }
HoodieRealtimeFileSplit extends FileSplit implements RealtimeSplit { @Override public void readFields(DataInput in) throws IOException { super.readFields(in); readFromInput(in); } HoodieRealtimeFileSplit();  HoodieRealtimeFileSplit(FileSplit baseSplit, String basePath, List<String> deltaLogPaths, String maxCommitTime); }
HoodieRealtimeFileSplit extends FileSplit implements RealtimeSplit { @Override public void readFields(DataInput in) throws IOException { super.readFields(in); readFromInput(in); } HoodieRealtimeFileSplit();  HoodieRealtimeFileSplit(FileSplit baseSplit, String basePath, List<String> deltaLogPaths, String maxCommitTime); List<String> getDeltaLogPaths(); String getMaxCommitTime(); String getBasePath(); void setDeltaLogPaths(List<String> deltaLogPaths); void setMaxCommitTime(String maxCommitTime); void setBasePath(String basePath); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override String toString(); }
HoodieRealtimeFileSplit extends FileSplit implements RealtimeSplit { @Override public void readFields(DataInput in) throws IOException { super.readFields(in); readFromInput(in); } HoodieRealtimeFileSplit();  HoodieRealtimeFileSplit(FileSplit baseSplit, String basePath, List<String> deltaLogPaths, String maxCommitTime); List<String> getDeltaLogPaths(); String getMaxCommitTime(); String getBasePath(); void setDeltaLogPaths(List<String> deltaLogPaths); void setMaxCommitTime(String maxCommitTime); void setBasePath(String basePath); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override String toString();  }