/**
* @throws Exception
*/
@Test
public void testCachingLabelDAO() throws Exception {
ILabel label1 = fFactory.createLabel(null, "Hello");
label1.setOrder(5);
label1= DynamicDAO.save(label1);
Long label1Id = label1.getId();
ILabel label2 = fFactory.createLabel(null, "Hello World");
label2.setColor("255,255,0");
label2= DynamicDAO.save(label2);
Long label2Id = label2.getId();
ILabel label3 = fFactory.createLabel(null, "Foo Bar");
label3.setProperty("key", "value");
label3= DynamicDAO.save(label3);
Long label3Id = label3.getId();
DynamicDAO.save(label1);
DynamicDAO.save(label2);
DynamicDAO.save(label3);
label1 = null;
label2 = null;
label3 = null;
/* Reopen Database */
Owl.getPersistenceService().shutdown(false);
System.gc();
Owl.getPersistenceService().startup(new NullOperationMonitor());
/* Assert Folders */
CachingDAO dao = (CachingDAO) DynamicDAO.getDAO(ILabelDAO.class);
label1 = (ILabel) dao.load(label1Id);
assertEquals("Hello", label1.getName());
assertEquals(5, label1.getOrder());
label2 = (ILabel) dao.load(label2Id);
assertEquals("Hello World", label2.getName());
assertEquals("255,255,0", label2.getColor());
label3 = (ILabel) dao.load(label3Id);
assertEquals("Foo Bar", label3.getName());
assertEquals("value", label3.getProperty("key"));
}