Search in sources :

Example 1 with AdversarialPagedFile

use of org.neo4j.adversaries.pagecache.AdversarialPagedFile in project neo4j by neo4j.

the class PageCacheTest method readableByteChannelMustReadAllBytesInFileConsistently.

@RepeatRule.Repeat(times = 20)
@Test(timeout = SHORT_TIMEOUT_MILLIS)
public void readableByteChannelMustReadAllBytesInFileConsistently() throws Exception {
    File file = file("a");
    generateFileWithRecords(file, recordCount, recordSize);
    configureStandardPageCache();
    try (PagedFile pf = pageCache.map(file, filePageSize)) {
        RandomAdversary adversary = new RandomAdversary(0.9, 0, 0);
        AdversarialPagedFile apf = new AdversarialPagedFile(pf, adversary);
        try (ReadableByteChannel channel = apf.openReadableByteChannel()) {
            verifyRecordsInFile(channel, recordCount);
        }
    }
}
Also used : ReadableByteChannel(java.nio.channels.ReadableByteChannel) AdversarialPagedFile(org.neo4j.adversaries.pagecache.AdversarialPagedFile) AdversarialPagedFile(org.neo4j.adversaries.pagecache.AdversarialPagedFile) AdversarialPagedFile(org.neo4j.adversaries.pagecache.AdversarialPagedFile) File(java.io.File) RandomAdversary(org.neo4j.adversaries.RandomAdversary) Test(org.junit.Test)

Aggregations

File (java.io.File)1 ReadableByteChannel (java.nio.channels.ReadableByteChannel)1 Test (org.junit.Test)1 RandomAdversary (org.neo4j.adversaries.RandomAdversary)1 AdversarialPagedFile (org.neo4j.adversaries.pagecache.AdversarialPagedFile)1