Skip to content

Commit

Permalink
fix rawfile tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorva918 committed Oct 25, 2023
1 parent f8e9acb commit fe0881d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
Binary file added parquet-file-sample-data/sub1.parquet
Binary file not shown.
Binary file added parquet-file-sample-data/sub2.parquet
Binary file not shown.
Binary file added parquet-file-sample-data/sub3.parquet
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ protected Pair<Long, Long> generateEventsFromInputStream(CountingInputStream inp
byte[] byteArray = inputStream.readAllBytes();
//TODO: Batching

consumer.accept(new PravegaWriterEvent(routingKey, nextSequenceNumber, byteArray));
nextSequenceNumber++;
if (byteArray.length > 0) { //non-empty file
consumer.accept(new PravegaWriterEvent(routingKey, nextSequenceNumber, byteArray));
nextSequenceNumber++;
}
final long endOffset = inputStream.getCount();

return new ImmutablePair<>(nextSequenceNumber, endOffset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void TestFile() throws IOException {
final List<PravegaWriterEvent> events = new ArrayList<>();
Pair<Long, Long> nextSequenceNumberAndOffset = eventGenerator.generateEventsFromInputStream(inputStream, 100, events::add);
log.info("events={}", events);
Assert.assertEquals(102L, (long) nextSequenceNumberAndOffset.getLeft());
Assert.assertEquals(101L, (long) nextSequenceNumberAndOffset.getLeft());
Assert.assertEquals(rawfileStr.length(), (long) nextSequenceNumberAndOffset.getRight());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void getNewFilesTest() {

@Test
public void getDirectoryListingTest() throws IOException {
final List<FileNameWithOffset> actual = FileUtils.getDirectoryListing("../raw-file-sample-data","parquet");
final List<FileNameWithOffset> actual = FileUtils.getDirectoryListing(
"../raw-file-sample-data/","parquet");
log.info("actual={}", actual);
}
}

0 comments on commit fe0881d

Please sign in to comment.