From ada90fb027c5890a4b76b5bb9f86af78c21ec25e Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 23 Aug 2020 22:39:26 +0100 Subject: [PATCH] Add DiskStore tests Signed-off-by: Graham --- cache/build.gradle.kts | 2 + .../java/dev/openrs2/cache/DiskStoreTest.kt | 669 ++++++++++++++++++ .../main_file_cache.dat2 | Bin 0 -> 7990 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../corrupt-eof-late/main_file_cache.dat2 | Bin 0 -> 7632 bytes .../corrupt-eof-late/main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 8804 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 9324 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 9324 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 9324 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 8804 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 8284 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 8804 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 8804 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 8804 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 8284 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../empty-archive/main_file_cache.dat2 | 0 .../empty-archive/main_file_cache.idx255 | 0 .../empty-archives/main_file_cache.dat2 | 0 .../empty-archives/main_file_cache.idx0 | 0 .../empty-archives/main_file_cache.idx255 | 0 .../disk-store/empty/main_file_cache.dat2 | 0 .../fragmented/main_file_cache.dat2 | Bin 0 -> 2276 bytes .../fragmented/main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 7660 bytes .../main_file_cache.idx255 | Bin 0 -> 393222 bytes .../main_file_cache.dat2 | Bin 0 -> 7660 bytes .../main_file_cache.idx255 | Bin 0 -> 393222 bytes .../main_file_cache.dat2 | Bin 0 -> 7632 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../multiple-blocks/main_file_cache.dat2 | Bin 0 -> 7632 bytes .../multiple-blocks/main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 537 bytes .../main_file_cache.idx255 | Bin 0 -> 393222 bytes .../main_file_cache.dat2 | Bin 0 -> 537 bytes .../main_file_cache.idx255 | Bin 0 -> 393222 bytes .../main_file_cache.dat2 | Bin 0 -> 535 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../single-block-removed/main_file_cache.dat2 | Bin 0 -> 535 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../single-block/main_file_cache.dat2 | Bin 0 -> 535 bytes .../single-block/main_file_cache.idx255 | Bin 0 -> 12 bytes .../main_file_cache.dat2 | Bin 0 -> 1240 bytes .../main_file_cache.idx255 | Bin 0 -> 393222 bytes .../two-blocks-extended/main_file_cache.dat2 | Bin 0 -> 1240 bytes .../main_file_cache.idx255 | Bin 0 -> 393222 bytes .../main_file_cache.dat2 | Bin 0 -> 1236 bytes .../main_file_cache.idx255 | Bin 0 -> 12 bytes .../two-blocks/main_file_cache.dat2 | Bin 0 -> 1236 bytes .../two-blocks/main_file_cache.idx255 | Bin 0 -> 12 bytes .../openrs2/util/io/InputStreamExtensions.kt | 32 + .../dev/openrs2/util/io/PathExtensions.kt | 58 ++ 82 files changed, 761 insertions(+) create mode 100644 cache/src/test/java/dev/openrs2/cache/DiskStoreTest.kt create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-eof-early-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-eof-early-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-eof-early/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-eof-early/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-archive-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-archive-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-archive/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-archive/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-block-number-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-block-number-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-block-number/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-block-number/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-outside-data-file-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-outside-data-file-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-outside-data-file/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-outside-data-file/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-eof-early-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-eof-early-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-eof-early/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-eof-early/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-block-number-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-block-number-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-block-number/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-block-number/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-group-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-group-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-group/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-group/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-outside-data-file-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-outside-data-file-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-outside-data-file/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-outside-data-file/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/empty-archive/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/empty-archive/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/empty-archives/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/empty-archives/main_file_cache.idx0 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/empty-archives/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/empty/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/fragmented/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/fragmented/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-removed/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-removed/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/single-block/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-overwritten/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-overwritten/main_file_cache.idx255 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks/main_file_cache.dat2 create mode 100644 cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks/main_file_cache.idx255 create mode 100644 util/src/main/java/dev/openrs2/util/io/InputStreamExtensions.kt diff --git a/cache/build.gradle.kts b/cache/build.gradle.kts index 0825e5352b..88e049b8f4 100644 --- a/cache/build.gradle.kts +++ b/cache/build.gradle.kts @@ -8,6 +8,8 @@ dependencies { implementation(project(":compress")) implementation(project(":crypto")) implementation(project(":util")) + + testImplementation("com.google.jimfs:jimfs:${Versions.jimfs}") } publishing { diff --git a/cache/src/test/java/dev/openrs2/cache/DiskStoreTest.kt b/cache/src/test/java/dev/openrs2/cache/DiskStoreTest.kt new file mode 100644 index 0000000000..a1ec357876 --- /dev/null +++ b/cache/src/test/java/dev/openrs2/cache/DiskStoreTest.kt @@ -0,0 +1,669 @@ +package dev.openrs2.cache + +import com.google.common.jimfs.Configuration +import com.google.common.jimfs.Jimfs +import dev.openrs2.buffer.use +import dev.openrs2.util.io.recursiveCopy +import dev.openrs2.util.io.recursiveEquals +import io.netty.buffer.Unpooled +import org.junit.jupiter.api.assertThrows +import java.io.FileNotFoundException +import java.nio.file.Paths +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +object DiskStoreTest { + private val root = Paths.get(DiskStoreTest::class.java.getResource("disk-store").toURI()) + + @Test + fun testCreateArchive() { + writeTest("empty-archive") { store -> + store.create(255) + } + + writeTest("empty-archives") { store -> + store.create(0) + store.create(255) + } + } + + @Test + fun testArchiveExists() { + readTest("empty") { store -> + assertFalse(store.exists(0)) + assertFalse(store.exists(1)) + assertFalse(store.exists(254)) + assertFalse(store.exists(255)) + } + + readTest("empty-archive") { store -> + assertFalse(store.exists(0)) + assertFalse(store.exists(1)) + assertFalse(store.exists(254)) + assertTrue(store.exists(255)) + } + + readTest("empty-archives") { store -> + assertTrue(store.exists(0)) + assertFalse(store.exists(1)) + assertFalse(store.exists(254)) + assertTrue(store.exists(255)) + } + } + + @Test + fun testListArchives() { + readTest("empty") { store -> + assertEquals(emptyList(), store.list()) + } + + readTest("empty-archive") { store -> + assertEquals(listOf(255), store.list()) + } + + readTest("empty-archives") { store -> + assertEquals(listOf(0, 255), store.list()) + } + } + + @Test + fun testRemoveArchive() { + overwriteTest("empty-archives", "empty-archive") { store -> + store.remove(0) + } + + overwriteTest("empty-archive", "empty") { store -> + store.remove(255) + } + + overwriteTest("empty", "empty") { store -> + store.remove(0) + store.remove(255) + } + } + + @Test + fun testGroupExists() { + readTest("single-block") { store -> + assertFalse(store.exists(0, 0)) + assertFalse(store.exists(255, 0)) + assertTrue(store.exists(255, 1)) + assertFalse(store.exists(255, 2)) + } + } + + @Test + fun testListGroups() { + readTest("single-block") { store -> + assertEquals(listOf(1), store.list(255)) + } + + readTest("single-block-extended") { store -> + assertEquals(listOf(65536), store.list(255)) + } + } + + @Test + fun testListNonExistent() { + readTest("empty") { store -> + assertThrows { + store.list(0) + } + } + } + + @Test + fun testReadSingleBlock() { + readTest("single-block") { store -> + Unpooled.wrappedBuffer("OpenRS2".toByteArray()).use { expected -> + store.read(255, 1).use { actual -> + assertEquals(expected, actual) + } + } + } + } + + @Test + fun testReadSingleBlockExtended() { + readTest("single-block-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".toByteArray()).use { expected -> + store.read(255, 65536).use { actual -> + assertEquals(expected, actual) + } + } + } + } + + @Test + fun testReadTwoBlocks() { + readTest("two-blocks") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(100).toByteArray()).use { expected -> + store.read(255, 1).use { actual -> + assertEquals(expected, actual) + } + } + } + } + + @Test + fun testReadTwoBlocksExtended() { + readTest("two-blocks-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(100).toByteArray()).use { expected -> + store.read(255, 65536).use { actual -> + assertEquals(expected, actual) + } + } + } + } + + @Test + fun testReadMultipleBlocks() { + readTest("multiple-blocks") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1000).toByteArray()).use { expected -> + store.read(255, 1).use { actual -> + assertEquals(expected, actual) + } + } + } + } + + @Test + fun testReadMultipleBlocksExtended() { + readTest("multiple-blocks-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1000).toByteArray()).use { expected -> + store.read(255, 65536).use { actual -> + assertEquals(expected, actual) + } + } + } + } + + @Test + fun testReadNonExistent() { + readTest("single-block") { store -> + assertThrows { + store.read(0, 0) + } + + assertThrows { + store.read(255, 0) + } + + assertThrows { + store.read(255, 2) + } + } + } + + @Test + fun testReadOverwritten() { + readTest("single-block-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("two-blocks-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("multiple-blocks-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(200).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + } + + @Test + fun testReadFragmented() { + readTest("fragmented") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(100).toByteArray()).use { expected -> + for (j in 0 until 2) { + store.read(255, j).use { actual -> + assertEquals(expected, actual) + } + } + } + } + } + + @Test + fun testWriteSingleBlock() { + writeTest("single-block") { store -> + Unpooled.wrappedBuffer("OpenRS2".toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + } + + @Test + fun testWriteSingleBlockExtended() { + writeTest("single-block-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + } + + @Test + fun testWriteTwoBlocks() { + writeTest("two-blocks") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(100).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + } + + @Test + fun testWriteTwoBlocksExtended() { + writeTest("two-blocks-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(100).toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + } + + @Test + fun testWriteMultipleBlocks() { + writeTest("multiple-blocks") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1000).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + } + + @Test + fun testWriteMultipleBlocksExtended() { + writeTest("multiple-blocks-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1000).toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + } + + @Test + fun testWriteFragmented() { + writeTest("fragmented") { store -> + for (i in 1..2) { + Unpooled.wrappedBuffer("OpenRS2".repeat(i * 50).toByteArray()).use { buf -> + for (j in 0 until 2) { + store.write(255, j, buf.slice()) + } + } + } + } + } + + @Test + fun testOverwriteShorter() { + overwriteTest("single-block", "single-block-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("two-blocks", "two-blocks-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("multiple-blocks", "multiple-blocks-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(200).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + } + + @Test + fun testOverwriteShorterExtended() { + overwriteTest("single-block-extended", "single-block-extended-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + + overwriteTest("two-blocks-extended", "two-blocks-extended-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + + overwriteTest("multiple-blocks-extended", "multiple-blocks-extended-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(200).toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + } + + @Test + fun testOverwriteLonger() { + overwriteTest("single-block", "two-blocks") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(100).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("single-block", "multiple-blocks") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1000).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("two-blocks", "multiple-blocks") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1000).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + } + + @Test + fun testOverwriteLongerExtended() { + overwriteTest("single-block-extended", "two-blocks-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(100).toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + + overwriteTest("single-block-extended", "multiple-blocks-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1000).toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + + overwriteTest("two-blocks-extended", "multiple-blocks-extended") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1000).toByteArray()).use { buf -> + store.write(255, 65536, buf) + } + } + } + + @Test + fun testRemoveGroup() { + overwriteTest("empty", "empty") { store -> + store.remove(0, 0) + } + + overwriteTest("single-block", "single-block") { store -> + store.remove(255, 2) + } + + overwriteTest("single-block", "single-block-removed") { store -> + store.remove(255, 1) + } + } + + @Test + fun testReadCorrupt() { + readTest("corrupt-eof-late") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-first-eof-early") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-first-invalid-archive") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-first-invalid-block-number") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-first-invalid-group") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-first-outside-data-file") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-second-eof-early") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-second-invalid-archive") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-second-invalid-block-number") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-second-invalid-group") { store -> + assertThrows { + store.read(255, 1).release() + } + } + + readTest("corrupt-second-outside-data-file") { store -> + assertThrows { + store.read(255, 1).release() + } + } + } + + @Test + fun testOverwriteCorrupt() { + overwriteTest("corrupt-eof-late", "corrupt-eof-late-overwritten") { store -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1050).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-first-eof-early", "corrupt-first-eof-early-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-first-invalid-archive", "corrupt-first-invalid-archive-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-first-invalid-block-number", "corrupt-first-invalid-block-number-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-first-invalid-group", "corrupt-first-invalid-group-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-first-outside-data-file", "corrupt-first-outside-data-file-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-second-eof-early", "corrupt-second-eof-early-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-second-invalid-archive", "corrupt-second-invalid-archive-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest( + "corrupt-second-invalid-block-number", + "corrupt-second-invalid-block-number-overwritten" + ) { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-second-invalid-group", "corrupt-second-invalid-group-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + + overwriteTest("corrupt-second-outside-data-file", "corrupt-second-outside-data-file-overwritten") { store -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { buf -> + store.write(255, 1, buf) + } + } + } + + @Test + fun testReadOverwrittenCorrupt() { + readTest("corrupt-eof-late-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("OpenRS2".repeat(1050).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-first-eof-early-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-first-invalid-archive-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-first-invalid-block-number-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-first-invalid-group-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-first-outside-data-file-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-second-eof-early-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-second-invalid-archive-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-second-invalid-block-number-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-second-invalid-group-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + + readTest("corrupt-second-outside-data-file-overwritten") { store -> + store.read(255, 1).use { actual -> + Unpooled.wrappedBuffer("Hello".repeat(300).toByteArray()).use { expected -> + assertEquals(expected, actual) + } + } + } + } + + private fun readTest(name: String, f: (Store) -> Unit) { + DiskStore.open(root.resolve(name)).use { store -> + f(store) + } + } + + private fun writeTest(name: String, f: (Store) -> Unit) { + Jimfs.newFileSystem(Configuration.unix()).use { fs -> + val actual = fs.getPath("/cache") + DiskStore.create(actual).use { store -> + f(store) + } + + val expected = root.resolve(name) + assertTrue(expected.recursiveEquals(actual)) + } + } + + private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) { + Jimfs.newFileSystem(Configuration.unix()).use { fs -> + val actual = fs.getPath("/cache") + root.resolve(src).recursiveCopy(actual) + + DiskStore.open(actual).use { store -> + f(store) + } + + val expected = root.resolve(name) + assertTrue(expected.recursiveEquals(actual)) + } + } +} diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..f226cc4cf2bce5a37b288073da6ee662eeca35fc GIT binary patch literal 7990 zcmeI1xedcG6hmKp-`>TG1aM|>8)W}RVLGo6kZRO_JW}Kr09MsU3JPO`Q5C;u(CE37R3F4rIz9b@gD?uD|Fcj06 z>>Ubj7AOvS7}Fcg4N)8nFr_z|8=^QEVNP%KULRcIV1gyR(L5=LgBjNJM(_2(DGnCc d(i?Bt+3|@G2P^F9jo#~nLmX`SaQxHW_yrN6^AZ36 literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..8ce7e65c5da2dfa3a9158a7aaee054904e36e812 GIT binary patch literal 12 PcmZQz00WtA3=E6_191S< literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..a8b430225e399408678a4e84c02629a6efc40789 GIT binary patch literal 7632 zcmeI0xe>xp5JMk6@D07t2s5Szrwsiki^$vnk@SuRxg}h8a6S(}Q(A4vDy!Y25 zpXmt1fk_ z>>UbD7AOt|n9>`~4N)A7FsC<~8=^RvU`cQEJ|7(7V1_ll(L5=Lg9WzqM(^{%E)G_> Vr8l0kv*U^o2OHee8~=1Z_yWnUd4d1{ literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-eof-late/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-eof-early-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-eof-early-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..ee0714da86edb51e3b683b7c02c384e6b0c399ce GIT binary patch literal 8804 zcmeI1yAgvx5JP4De_RVyIP;9DfsDcKKUoVR3UFei3n1Tl+LKOzk0-zh-1aGq@mSXN z?T_pX$N@=6G1%N)QJ!}qQ+lJhA&P?$=JZB$Llg%SEa{Ej>w{Aq%&?|6nkNNuu)vny=)FET#K8)W V^u|kec6=hl!KR<4^u|A}559fmd2s*$ literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-eof-early/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-eof-early/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-archive-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-archive-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..2732d102e0ed2f155390b7dd8d1d7cc0d29bbe65 GIT binary patch literal 9324 zcmeI1I}XA?5JOG=Uj$d-6m*f2Go*`v`!|C(RW6VM>@AXh^z5~F03T0)6S$-)WSBnd zYhE7yiH?9Akc2#pfwlxlK?W3IH_%oBImm%Bd?{!vfgBV-70w3QN+1U%P=_O;wi3ue z1vDWVleI&^!2-!a4YZ-1mbJ4%azb*@0G)fIxFM2*7UMpntB&IYFwih~K3^hR?-6bCb`>5b-wC=M3b(i_c_f;d=VPj57j2;yLa WdwSy~J3Fojaj@&7DZTMe&j&valz4Oi literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-archive/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-archive/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-block-number-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-block-number-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..d5b8c341a4e61f01b5ba9b12cff7e85da6a3e20e GIT binary patch literal 9324 zcmeI1IS#^55JMl?R|Hq#6m&@84Cx}^{>@;CCKsT9aUv!C=-J=?1AaUKP2ixHB5tqs zvD`2IB^|+sgEEXkZV8Bk0;;eZD4`A?3b~aa4k~EE*&w$P#6b;hI3ng&f;ecP zi=;6*cPQ9dpg3rucW+E?h~l7w!M!oLA&P?@M)$_t*9WUO7+`X5Or8|P!3eW^WA5vN zMI20UbZ^{c=Zr^$IGD9FzK_=< zk7)^h9JCb-yd@wG8t5wBz*`C8poP9N6ugxn4mubr-oRT4;-H7IViCQSAPxqY%G4%% zn}SOV6bB>B$&Ka>Q5;OLBsZEjL~$^~n%wBUJ~+j}0$XyUxl<4aE9}XQ-s^)y9Bgn; VZoGJB#}Oe8cKtRbH~wjT@CDH=d2|2( literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-block-number/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-block-number/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..5780026f917a9b2fbe0e7e34ab780fc5a256d664 GIT binary patch literal 9324 zcmeI1OA5k35JaE(n7`;%JcTR zjihaI?xtX8f#RTn&bcwUA&P?*dgsREhA0j?7@Qk(j}I1c(8K85n7mUE2Lnvbjk(7M zvp5*x5OmL3dvaT=x($+wJAQCQN3UZ4;6lmW_ J*bDww2_I3=#-soM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..f7c437d5befdee01cbff4a86738b0c54eedd2b73 GIT binary patch literal 12 PcmZQz00Y)L3=I4L1Ec`) literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..7a138a55fd93f001011bc56bd671f17818e5f0e0 GIT binary patch literal 7632 zcmeI1I}QRt3_~CL|8f{Eg0!4rTg3gF;09?gKxNMq(?`#Voq?QG;8%gBo}cr5ydHT> zOTbN+wt|7T1VljtU8Ng%D?uEz&{u|nw-Urb2Sddhcq>61^e|Q|qPG&n!2na4+GKB2 zaA|?!V1zlj(Yzswg9(=8M)QU!4rW-B8@<;Dr#M((OKvoG3gTdeJ-N|)eQ=0_4erT} T7w_yiBE-S2-=^foKdleGnW1@d literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-invalid-group/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-outside-data-file-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-outside-data-file-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..ee0714da86edb51e3b683b7c02c384e6b0c399ce GIT binary patch literal 8804 zcmeI1yAgvx5JP4De_RVyIP;9DfsDcKKUoVR3UFei3n1Tl+LKOzk0-zh-1aGq@mSXN z?T_pX$N@=6E&W=xnIN0>jl-~HK^}!b&V0nN5 literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-outside-data-file/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-first-outside-data-file/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-eof-early-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-eof-early-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..b1060f1c13cbe9416e8a101d2a52bb52e02e2b7c GIT binary patch literal 8284 zcmeI1yAi@b5JMlv{}1kkD#(~IH8}GC{U?h|L<0n{y1>qNp7x{@_;>=Ez+s<45tnt_ z9{!}AfjAHebC`nMA`k@yl(F8I+xhzRFX;%x!4ax32Dv354oaxQ+aR|R#6bm3_)^HN z1aVM98}E3L0oDZs4s1ad3yO@+f#KK^(NuSF(Y(62w6VLnR`5D?uFeFqUad z_6`LX3ls+fOzDm0hA0k3nA0204N)9Su%tJ7uMZA!FvFVOXr2_r!2(-)qxbq?7Y8dm W(i<=kH<_14#I(cva literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-eof-early/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-eof-early/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..9d619276b88cea77152b7d24df0b681fee343f32 GIT binary patch literal 8804 zcmeI1xeWqA6hjSrUqCHXL52i1Y_m5+2bz*IhlYauv@2aQ}9-TIH-Vz$p+p^ z5C=8TG7-^R3F4puI-160?@+L@KylClJ-ySicQ#m^P#ko?kiF5|5XC_cjM*E_4N)8n zz?8kwJSm8S5jbRTG>-`4U{cYPy>XMBzxhS1E#6O@PtSB>+D7lPReqqJ2~6kwze;!m D8@m)@ literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..6c97b5aaba4205a2a9855883b28bd68625f91cf3 GIT binary patch literal 12 PcmZQz00Y)L3=E6_1C{{e literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..5bc95ef5879ecde8a6995813ef4eb33e2350ce68 GIT binary patch literal 7632 zcmeI1xe)?E5Cfb0UxFbKs*V`WrO4kIgm(#GN$adX)zV6{kdp~$0=M53ntFcD_wjn< zG97_95D6{8z*_>MpnI9~|OfgL``8 TB|AGl5#nIiM^k#^pVkLo6smZ1 literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-archive/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-block-number-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-block-number-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..b74961c6626d386c10075abd414b925e378cd560 GIT binary patch literal 8804 zcmeI1I}U?D5JOG)|B{@AQ>2RoXP`rn`!^FK8V-;q*jqq9dY-k{fR87@2_*Xz9`Tx& zW%EaN1_uXeeCBnWhPQvBBOnJiAPZxlEdg?n0(p2FXe)snWIz$V6ttB<4sxIjdjoAH zkb?rK!WL0m3FM#z>JYWb+NR*N0?9!IG|r9U3y~buKO41|yPdfXLot^U<@{o`sxDKohupr_j{neZ2PP zJ(uYSejKzF47?>E4jSkxZs4s1anM3vc@(^rAPzdXR_ z>>UbD7AOt|n9>`~4N)A7FsC<~8=^RvU`cQEULPFdV1_ll(L5=Lg9WzqM(_2(E)G_> Wr8l0kv*QyX4mN!>r8oX*eeeOBt9fz& literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-block-number/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-block-number/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-group-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-group-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..32a963ee5957dfd10ecd031728c16759f54a965c GIT binary patch literal 8804 zcmeI1I}U?D5JOG)|B{@AQ>2RoXP`rn`!^FK8V-;q*jqq9dY-k{fR87@2_*Xz9`Tx& zW%EaN1_udgeCBnWhPQvBBj7%`0a+LWZ3&Qr6v)HdKwAmqAOniH#*=scO41|yPdfXLot^U<@{o`sxDKohupr_j{neZ2PP zJ(uYSek8ON47?>EKWLzE&W=xnIN0>Zkly&G^}z?5sd;h$ literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-group/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-invalid-group/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-outside-data-file-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/corrupt-second-outside-data-file-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..b1060f1c13cbe9416e8a101d2a52bb52e02e2b7c GIT binary patch literal 8284 zcmeI1yAi@b5JMlv{}1kkD#(~IH8}GC{U?h|L<0n{y1>qNp7x{@_;>=Ez+s<45tnt_ z9{!}AfjAHebC`nMA`k@yl(F8I+xhzRFX;%x!4ax32Dv354oaxQ+aR|R#6bm3_)^HN z1aVM98}yJ|A)hH3c5(i8PY|-{ToAu%CJ4sdQxm;cVj(!$67$2D)6qr=~IQm zZri>;bOfydIXGAl2VvUaIzPAjvbrBRD1g#@UeQ;fGA{@@I0Kc%(k-=qB9Ma;sLkgU z{fy46CjvRBfW~6!mRj!-$UzOX=JSdYW-8-}Kn@z9vsk*N)~yRGIcS02d|pw;&7Wuj za?k;T_QufGm>l%LsJ$_?btDG^FllcLZH>vn2wb!`CT`6*9)TQ8$NNI)cKFMk@B*iK Br<(u( literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..b54c104b05cf9518fc6882f5bee71afbec31c81d GIT binary patch literal 393222 zcmeIu0TBQ&2mqn?*1xAQOt1zJfx>_R0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^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HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ b0|pEjFkrxd0RsjM7%*VKfB^%afwwgW1P}o2 literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..0ed8a349125270115342c6ad295d498cfa6bef4a GIT binary patch literal 7660 zcmeI1ISv9r5Ce<7PaeZZR)RN>BL1H=E5jQ|>`5kWt7haF#=q|xJ|L}ma{vGU literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-extended/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..75758c3999d0442d8d154e56c7ca1c8e905967f1 GIT binary patch literal 393222 zcmeIufdBw748X9C<6`qC8Nm$_gcJr07%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1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krxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM b7%*VKfB^#r3>YwAz<>b*1`HVZ47{y50!RRL literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..7e27d58220b860ed601ad7c19ac6bda2c07840a2 GIT binary patch literal 7632 zcmeI1I}*bn3`94M|DPPjr%0EX257A~sgGsRD%6D>T!GF?j8qt|!gLOm9JD}h zg;L?{(8?NNA_pBXSbk#&gD{r@!6pYiFk1F-5C)Mj*vY{FOy)czMMDr8$iWEA79?DS z=_EWkn1DsT(a|SLK_mw=u*x?EuN3590XF%@D2eZwUUIMkH~B_KpD2Es9Bk?Tf_&qD GPW%VDtf!j* literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..04b0a33e041021d627f1611f2a7bd28358c02c9b GIT binary patch literal 12 PcmZQz00ZV13=E6_1H1t3 literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..c18b0a8e55b0ecfe0756771a3765e29a963c0d11 GIT binary patch literal 7632 zcmeI1xe)?E5Cfb0UxFbKs*V`WrO4kIgm(#GN$adX)zV6{kdp~$0=M53ntFcD_wjn< zG97_95D9Gs18)h4f(E*Z8+a>09JJ6^9tCeDh=UG>N;dFTf;i}5tVBd_C5VForZSDm z-l5=Pf#P6ld2;{& literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/multiple-blocks/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..fba8761c34ff5b7e2836fd5b87c9b0a798b56100 GIT binary patch literal 12 PcmZQz00Zd=1_nj|0rUWM literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..b0c7b8455d7a05e8d2302ae355647a9d6b3fab77 GIT binary patch literal 537 bcmZQz7zLvt01N>}Xej*mNX^N~4>ke-6leo_ literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..473e9b0e23d57b5880f9e301245e69a6aa376582 GIT binary patch literal 393222 zcmeIuF#!Mo2*99u*uSy~Yyc4`3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*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krxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA Zz<>b*1`HT5V8DO@0|pEjFz^j*%>e*)00#g7 literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..2c0af58d075dcf72ee485f7487364300fb136570 GIT binary patch literal 537 bcmZQz7zLvt01N>}Xej*mFG$S`3N``&6lnu$ literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-extended/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..38f300ee86ead7fee89a7803690df8fccc2a50e7 GIT binary patch literal 393222 zcmeIuF#!Mo2*99u*}t&~Yyc4`3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA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7%*VKfB^#r3>YwA Zz<>b*1`HT5V8DO@0|pEjFz^j*%>e*?00{s9 literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..cf5db899592e51c553bd38fbdd71c9ff5387435f GIT binary patch literal 535 bcmZQz7zLvt01N>}a47uuNX^N~4>ke-6l4Q> literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..0ce79af97a3c7eaaf18911ddffd9c95642aefb52 GIT binary patch literal 12 OcmZQzfB;qo21Wn?Api#e literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-removed/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-removed/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..98a426d1d82802721dc2e6fb46fc7600b9db6a2e GIT binary patch literal 535 bcmZQz7zLvt01N>}a47uuFG$S`3N``&6lDWy literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-removed/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block-removed/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..ce58bc9f84b9623e708de4eb8427a57d9f9a160f GIT binary patch literal 12 KcmZQzKmY&$3;+QD literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..98a426d1d82802721dc2e6fb46fc7600b9db6a2e GIT binary patch literal 535 bcmZQz7zLvt01N>}a47uuFG$S`3N``&6lDWy literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/single-block/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..e52747c6a6f3accf3b67701d9c28e8bf202e9689 GIT binary patch literal 12 OcmZQzfB<#|21Wn?DF6uo literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..11283f701cd89c057f7a1ea28fe94e95b25aa9a3 GIT binary patch literal 1240 ucmZQz7zLvt01N>}Xej*mNX^N~4>s~INX-ixrAAs1fYSjeE&LzaDF6WF2J;pG literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..473e9b0e23d57b5880f9e301245e69a6aa376582 GIT binary patch literal 393222 zcmeIuF#!Mo2*99u*uSy~Yyc4`3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<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pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA Zz<>b*1`HT5V8DO@0|pEjFz^j*%>e*)00#g7 literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..e65472c881846d6aecac70c38f0fc34d681575b7 GIT binary patch literal 1240 qcmZQz7zLvt01N>}NGLG<_b*7z3ko(GrAA~BfYSjeE&Lza-Uk4_r}GE^ literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-extended/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..85d024ede9904d66f2c8bc1265d6f78153d72093 GIT binary patch literal 393222 zcmeIu0RaFo2*9BE{*er4f;WH&6b1|!Fkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ z0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VK zfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<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pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5 zV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj aFkrxd0RsjM7%*VKfB^#r3>f$fysbF{TL8cS literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-overwritten/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-overwritten/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..e73e8f0cdf01a6e580579165e09510b3a568d700 GIT binary patch literal 1236 ucmZQz7zLvt01N>}a47uuNX^N~4>s~INX-ixrAA&50Mh{|CHx=C@ecrnSMwGC literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-overwritten/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks-overwritten/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..0ce79af97a3c7eaaf18911ddffd9c95642aefb52 GIT binary patch literal 12 OcmZQzfB;qo21Wn?Api#e literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks/main_file_cache.dat2 b/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks/main_file_cache.dat2 new file mode 100644 index 0000000000000000000000000000000000000000..82120dc1fca8b5be200b7bcb2d60bd97268b63f2 GIT binary patch literal 1236 qcmZQz7zLvt01N>}P$)3{_b*7z3ko(GrABBF0Mh{|CHx=C$p8Rf6!QoG literal 0 HcmV?d00001 diff --git a/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks/main_file_cache.idx255 b/cache/src/test/resources/dev/openrs2/cache/disk-store/two-blocks/main_file_cache.idx255 new file mode 100644 index 0000000000000000000000000000000000000000..c9752fe83721667b5d2a8f3648a9eed3e38a55d7 GIT binary patch literal 12 PcmZQz00X8y3=E6_0|x-W literal 0 HcmV?d00001 diff --git a/util/src/main/java/dev/openrs2/util/io/InputStreamExtensions.kt b/util/src/main/java/dev/openrs2/util/io/InputStreamExtensions.kt new file mode 100644 index 0000000000..450c73b177 --- /dev/null +++ b/util/src/main/java/dev/openrs2/util/io/InputStreamExtensions.kt @@ -0,0 +1,32 @@ +package dev.openrs2.util.io + +import java.io.InputStream +import java.util.Arrays + +fun InputStream.contentEquals(other: InputStream): Boolean { + val buf1 = ByteArray(4096) + val buf2 = ByteArray(4096) + + while (true) { + val n1 = read(buf1, 0, buf1.size) + if (n1 == -1) { + return other.read() == -1 + } + + var off = 0 + var remaining = n1 + while (remaining > 0) { + val n2 = other.read(buf2, off, remaining) + if (n2 == -1) { + return false + } + + off += n2 + remaining -= n2 + } + + if (!Arrays.equals(buf1, 0, n1, buf2, 0, n1)) { + return false + } + } +} diff --git a/util/src/main/java/dev/openrs2/util/io/PathExtensions.kt b/util/src/main/java/dev/openrs2/util/io/PathExtensions.kt index a6565a8beb..d01ae5bb71 100644 --- a/util/src/main/java/dev/openrs2/util/io/PathExtensions.kt +++ b/util/src/main/java/dev/openrs2/util/io/PathExtensions.kt @@ -4,7 +4,10 @@ import java.io.BufferedWriter import java.io.OutputStream import java.nio.channels.FileChannel import java.nio.charset.Charset +import java.nio.file.CopyOption +import java.nio.file.FileVisitOption import java.nio.file.Files +import java.nio.file.LinkOption import java.nio.file.OpenOption import java.nio.file.Path import java.nio.file.StandardCopyOption @@ -19,6 +22,61 @@ fun Path.fsync() { } } +fun Path.recursiveCopy( + destination: Path, + visitOptions: Array = emptyArray(), + copyOptions: Array = emptyArray() +) { + for (sourceFile in Files.walk(this, *visitOptions)) { + val destinationFile = destination.resolve(this.relativize(sourceFile).toString()) + + if (Files.isDirectory(sourceFile)) { + Files.createDirectory(destinationFile) + } else { + Files.copy(sourceFile, destinationFile, *copyOptions) + } + } +} + +fun Path.recursiveEquals( + other: Path, + linkOptions: Array = emptyArray(), + openOptions: Array = emptyArray() +): Boolean { + val list1 = Files.newDirectoryStream(this).use { stream -> + stream.map { this.relativize(it).toString() }.sorted().toList() + } + + val list2 = Files.newDirectoryStream(other).use { stream -> + stream.map { other.relativize(it).toString() }.sorted().toList() + } + + if (list1 != list2) { + return false + } + + for (file in list1) { + val file1 = this.resolve(file) + val file2 = other.resolve(file) + + if (Files.isDirectory(file1, *linkOptions)) { + if (!Files.isDirectory(file2, *linkOptions)) { + return false + } + } else { + Files.newInputStream(file1, *openOptions).use { input1 -> + Files.newInputStream(file2, *openOptions).use { input2 -> + if (!input1.contentEquals(input2)) { + return false + } + } + } + } + } + + return true +} + inline fun useTempFile( prefix: String? = null, suffix: String? = null,