@Test(groups = "slow") public void testOrdering() throws Exception { Assert.assertTrue(basePath.mkdir()); final List<String> filePathsCreated = new ArrayList<String>(); final List<File> filesCreated = new ArrayList<File>(); final int expected = 50; for (int i = 0; i < expected; i++) { filePathsCreated.add(outputStream.getFileName()); Thread.sleep(17); } for (int i = expected - 1; i >= 0; i--) { final File file = new File(filePathsCreated.get(i)); Assert.assertTrue(file.createNewFile()); filesCreated.add(file); } final MockReplayer replayer = new MockReplayer(basePath.toString(), Lists.reverse(filesCreated)); replayer.readAll(); Assert.assertEquals(replayer.getSeen(), expected); }
public List<HostSamplesForTimestamp> readAll() { final List<HostSamplesForTimestamp> samples = new ArrayList<HostSamplesForTimestamp>(); readAll(true, null, new Function<HostSamplesForTimestamp, Void>() { @Override public Void apply(@Nullable final HostSamplesForTimestamp input) { if (input != null) { samples.add(input); } return null; } }); return samples; }
Replayer { public List<HostSamplesForTimestamp> readAll() { final List<HostSamplesForTimestamp> samples = new ArrayList<HostSamplesForTimestamp>(); readAll(true, null, new Function<HostSamplesForTimestamp, Void>() { @Override public Void apply(@Nullable final HostSamplesForTimestamp input) { if (input != null) { samples.add(input); } return null; } }); return samples; } }
Replayer { public List<HostSamplesForTimestamp> readAll() { final List<HostSamplesForTimestamp> samples = new ArrayList<HostSamplesForTimestamp>(); readAll(true, null, new Function<HostSamplesForTimestamp, Void>() { @Override public Void apply(@Nullable final HostSamplesForTimestamp input) { if (input != null) { samples.add(input); } return null; } }); return samples; } Replayer(final String path); }
Replayer { public List<HostSamplesForTimestamp> readAll() { final List<HostSamplesForTimestamp> samples = new ArrayList<HostSamplesForTimestamp>(); readAll(true, null, new Function<HostSamplesForTimestamp, Void>() { @Override public Void apply(@Nullable final HostSamplesForTimestamp input) { if (input != null) { samples.add(input); } return null; } }); return samples; } Replayer(final String path); List<HostSamplesForTimestamp> readAll(); void initiateShutdown(); int readAll(final boolean deleteFiles, final @Nullable DateTime minStartTime, final Function<HostSamplesForTimestamp, Void> fn); @VisibleForTesting void read(final File file, final Function<HostSamplesForTimestamp, Void> fn); void purgeOldFiles(final DateTime purgeIfOlderDate); }
Replayer { public List<HostSamplesForTimestamp> readAll() { final List<HostSamplesForTimestamp> samples = new ArrayList<HostSamplesForTimestamp>(); readAll(true, null, new Function<HostSamplesForTimestamp, Void>() { @Override public Void apply(@Nullable final HostSamplesForTimestamp input) { if (input != null) { samples.add(input); } return null; } }); return samples; } Replayer(final String path); List<HostSamplesForTimestamp> readAll(); void initiateShutdown(); int readAll(final boolean deleteFiles, final @Nullable DateTime minStartTime, final Function<HostSamplesForTimestamp, Void> fn); @VisibleForTesting void read(final File file, final Function<HostSamplesForTimestamp, Void> fn); void purgeOldFiles(final DateTime purgeIfOlderDate); @VisibleForTesting
    static final Ordering<File> FILE_ORDERING; }