}
@Test
public void serializationTest() throws IOException, ClassNotFoundException {
int cacheSize = 10;
Cache cache = createCache(cacheSize, 3600 * 1000);
String cacheKey = "key";
for (int i = 0; i < cacheSize; i++) {
CmisObject obj = this.createCmisObject("id" + i);
cache.put(obj, cacheKey);
}
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(buffer);
out.writeObject(cache);
out.close();
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
Cache cache2 = (Cache) in.readObject();
in.close();
for (int k = 0; k < cacheSize; k++) {
CmisObject o1 = cache.getById("id" + k, cacheKey);
CmisObject o2 = cache2.getById("id" + k, cacheKey);
Assert.assertEquals(o1.getId(), o2.getId());
}
}