Added SerializationTest for object payload (which is probably the most important)

This commit is contained in:
2015-04-28 18:36:07 +02:00
parent 407c432f3c
commit 00bd6a08b7
18 changed files with 104 additions and 7 deletions

View File

@ -42,7 +42,7 @@ abstract class JdbcHelper {
static {
Flyway flyway = new Flyway();
flyway.setDataSource(DB_URL, DB_USER, null);
flyway.setDataSource(DB_URL, DB_USER, DB_PWD);
flyway.migrate();
}

View File

@ -72,7 +72,7 @@ public class JdbcInventory extends JdbcHelper implements Inventory {
}
@Override
public void storeObject(int version, ObjectMessage object) {
public void storeObject(ObjectMessage object) {
try {
PreparedStatement ps = getConnection().prepareStatement("INSERT INTO Inventory (hash, stream, expires, data, type, version) VALUES (?, ?, ?, ?, ?, ?)");
InventoryVector iv = object.getInventoryVector();
@ -82,7 +82,7 @@ public class JdbcInventory extends JdbcHelper implements Inventory {
ps.setLong(3, object.getExpiresTime());
writeBlob(ps, 4, object);
ps.setLong(5, object.getType());
ps.setInt(6, version);
ps.setLong(6, object.getVersion());
ps.executeUpdate();
} catch (SQLException e) {
LOG.error("Error storing object of type " + object.getPayload().getClass().getSimpleName(), e);

View File

@ -44,7 +44,7 @@ public class SimpleInventory implements Inventory {
}
@Override
public void storeObject(int version, ObjectMessage object) {
public void storeObject(ObjectMessage object) {
throw new NotImplementedException();
}

View File

@ -4,5 +4,5 @@ CREATE TABLE Inventory (
expires BIGINT NOT NULL,
data BLOB NOT NULL,
type BIGINT NOT NULL,
version INT NOT NULL
version BIGINT NOT NULL
);