use of org.bboxdb.commons.entity.PersonEntity in project bboxdb by jnidzwetzki.
the class TestMemtable method testInsertAndReadPerson.
/**
* Test insert2
* @throws Exception
*/
@Test(timeout = 60000)
public void testInsertAndReadPerson() throws Exception {
final PersonEntity person1 = new PersonEntity("Jan", "Jansen", 30);
final ObjectSerializer<PersonEntity> serializer = new ObjectSerializer<PersonEntity>();
final Tuple createdTuple = new Tuple("1", null, serializer.serialize(person1));
memtable.put(createdTuple);
final List<Tuple> readTupleList = memtable.get("1");
Assert.assertTrue(readTupleList.size() == 1);
final Tuple readTuple = readTupleList.get(0);
final PersonEntity readPerson1 = serializer.deserialize(readTuple.getDataBytes());
Assert.assertEquals(person1, readPerson1);
}
use of org.bboxdb.commons.entity.PersonEntity in project bboxdb by jnidzwetzki.
the class TestObjectSerializer method testSerializer2.
@Test(timeout = 60000)
public void testSerializer2() throws ClassNotFoundException, IOException {
final PersonEntity test = new PersonEntity("Jan", "Jensen", 30);
ObjectSerializer<PersonEntity> serializer = new ObjectSerializer<PersonEntity>();
final PersonEntity deserialize = serializer.deserialize(serializer.serialize(test));
Assert.assertEquals(test, deserialize);
Assert.assertTrue(test.toString().length() > 10);
Assert.assertEquals(test.hashCode(), deserialize.hashCode());
}
use of org.bboxdb.commons.entity.PersonEntity in project bboxdb by jnidzwetzki.
the class TestStorageManager method testInsertAndReadPerson.
@Test(timeout = 60000)
public void testInsertAndReadPerson() throws Exception {
final PersonEntity person1 = new PersonEntity("Jan", "Jansen", 30);
final ObjectSerializer<PersonEntity> serializer = new ObjectSerializer<PersonEntity>();
final Tuple createdTuple = new Tuple("1", BoundingBox.FULL_SPACE, serializer.serialize(person1));
storageManager.put(createdTuple);
final List<Tuple> readTuples = storageManager.get("1");
Assert.assertTrue(readTuples.size() == 1);
final Tuple readTuple = readTuples.get(0);
final PersonEntity readPerson1 = serializer.deserialize(readTuple.getDataBytes());
Assert.assertEquals(person1, readPerson1);
}
Aggregations