Commit missing MockDB changes

This commit is contained in:
nicksavers 2014-07-16 23:34:22 +02:00
parent 6c90111ea0
commit 132fab65de
1 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,8 @@
package org.ethereum.trie;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.iq80.leveldb.DB;
import org.iq80.leveldb.DBException;
@ -13,11 +15,11 @@ import org.iq80.leveldb.WriteOptions;
public class MockDB implements DB {
private int addedItems;
Map<byte[], byte[]> storage = new HashMap<byte[], byte[]>();
@Override
public void close() throws IOException {
// TODO Auto-generated method stub
storage.clear();
}
@Override
@ -33,7 +35,7 @@ public class MockDB implements DB {
@Override
public void delete(byte[] arg0) throws DBException {
// TODO Auto-generated method stub
storage.remove(arg0);
}
@Override
@ -45,8 +47,7 @@ public class MockDB implements DB {
@Override
public byte[] get(byte[] arg0) throws DBException {
// TODO Auto-generated method stub
return null;
return storage.get(arg0);
}
@Override
@ -86,9 +87,8 @@ public class MockDB implements DB {
}
@Override
public void put(byte[] arg0, byte[] arg1) throws DBException {
// TODO Auto-generated method stub
addedItems++;
public void put(byte[] key, byte[] value) throws DBException {
storage.put(key, value);
}
@Override
@ -126,6 +126,6 @@ public class MockDB implements DB {
* @return int
*/
public int getAddedItems() {
return addedItems;
return storage.size();
}
}