Add basic store object

This commit is contained in:
Adam
2015-10-12 21:16:03 -04:00
parent 57a55d43e1
commit 50a30553b9
5 changed files with 19 additions and 7 deletions

View File

@@ -12,7 +12,8 @@ public class DataFileTest
public void test1() throws IOException
{
File file = new File("d:/rs/07/test/test.dat");
DataFile df = new DataFile(42, file);
Store store = new Store();
DataFile df = new DataFile(store, 42, file);
int sector = df.write(3, ByteBuffer.wrap("test".getBytes()));
ByteBuffer buf = df.read(3, sector, 4);
String str = new String(buf.array());
@@ -27,7 +28,8 @@ public class DataFileTest
for (int i = 0; i < 1024; ++i) b[i] = (byte) i;
File file = new File("d:/rs/07/test/test.dat");
DataFile df = new DataFile(42, file);
Store store = new Store();
DataFile df = new DataFile(store, 42, file);
int sector = df.write(0x1FFFF, ByteBuffer.wrap(b));
ByteBuffer buf = df.read(0x1FFFF, sector, b.length);
Assert.assertArrayEquals(b, buf.array());

View File

@@ -11,7 +11,8 @@ public class IndexFileTest
public void test1() throws IOException
{
File file = new File("d:/rs/07/test/test.dat");
IndexFile index = new IndexFile(5, file);
Store store = new Store();
IndexFile index = new IndexFile(store, 5, file);
IndexEntry entry = new IndexEntry(index, 7, 8, 9);
index.write(entry);
IndexEntry entry2 = index.read(7);