multi store test, doesnt work
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package net.runelite.cache.fs;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
@@ -39,4 +39,33 @@ public class StoreTest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManyFiles() throws IOException
|
||||
{
|
||||
Random random = new Random(42L);
|
||||
|
||||
try (Store store = new Store(folder.getRoot()))
|
||||
{
|
||||
Index index = store.addIndex(0);
|
||||
Archive archive = index.addArchive(0);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
File file = archive.addFile(i);
|
||||
// file.setNameHash(random.nextInt());
|
||||
byte[] data = new byte[random.nextInt(1024)];
|
||||
random.nextBytes(data);
|
||||
file.setContents(data);
|
||||
}
|
||||
|
||||
store.save();
|
||||
|
||||
try (Store store2 = new Store(folder.getRoot()))
|
||||
{
|
||||
store2.load();
|
||||
|
||||
Assert.assertEquals(store, store2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user