AssertJUnit.assertEquals(AUTO_BUFFER, metadata.getBufferSize());
}
public void testSmallChunkLoading() throws CacheLoaderException {
DirectoryLoaderAdaptor adaptor = new DirectoryLoaderAdaptor(new InternalDirectoryContractImpl(), INDEX_NAME, AUTO_BUFFER);
Object loaded = adaptor.load(new ChunkCacheKey(INDEX_NAME, FILE_NAME, 0, AUTO_BUFFER));
AssertJUnit.assertTrue(loaded instanceof byte[]);
AssertJUnit.assertEquals(AUTO_BUFFER, ((byte[])loaded).length);
loaded = adaptor.load(new ChunkCacheKey(INDEX_NAME, FILE_NAME, 5, AUTO_BUFFER));
AssertJUnit.assertTrue(loaded instanceof byte[]);
AssertJUnit.assertEquals(AUTO_BUFFER, ((byte[])loaded).length);
final int lastChunk = (int)(TEST_SIZE / AUTO_BUFFER);
final long lastChunkSize = TEST_SIZE % AUTO_BUFFER;
AssertJUnit.assertEquals(9, lastChunkSize);
loaded = adaptor.load(new ChunkCacheKey(INDEX_NAME, FILE_NAME, lastChunk, AUTO_BUFFER));
AssertJUnit.assertTrue(loaded instanceof byte[]);
AssertJUnit.assertEquals(lastChunkSize, ((byte[])loaded).length);
}