INewsBin subSubSubRoot1NB1 = DynamicDAO.save(fFactory.createNewsBin(null, subSubSubRoot1, "Sub Sub Sub Root 1 Newsbin 1"));
Long subSubSubRoot1NB1Id = subSubSubRoot1NB1.getId();
setProperties(subSubSubRoot1NB1);
/* Search Marks */
ISearchMark rootSM1 = DynamicDAO.save(fFactory.createSearchMark(null, root1, "Root Searchmark 1"));
Long rootSM1Id = rootSM1.getId();
setProperties(rootSM1);
ISearchMark rootSM2 = DynamicDAO.save(fFactory.createSearchMark(null, root1, "Root Searchmark 2"));
Long rootSM2Id = rootSM2.getId();
setProperties(rootSM2);
ISearchMark subRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot1, "Sub Root 1 Searchmark 1"));
Long subRoot1SM1Id = subRoot1SM1.getId();
setProperties(subRoot1SM1);
ISearchMark subRoot1SM2 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot1, "Sub Root 1 Searchmark 2"));
Long subRoot1SM2Id = subRoot1SM2.getId();
setProperties(subRoot1SM2);
ISearchMark subRoot2SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot2, "Sub Root 2 Searchmark 1"));
Long subRoot2SM1Id = subRoot2SM1.getId();
setProperties(subRoot2SM1);
ISearchMark subRoot3SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot3, "Sub Root 3 Searchmark 1"));
Long subRoot3SM1Id = subRoot3SM1.getId();
setProperties(subRoot3SM1);
ISearchMark subSubRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subSubRoot1, "Sub Sub Root 1 Searchmark 1"));
Long subSubRoot1SM1Id = subSubRoot1SM1.getId();
setProperties(subSubRoot1SM1);
ISearchMark subSubSubRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subSubSubRoot1, "Sub Sub Sub Root 1 Searchmark 1"));
Long subSubSubRoot1SM1Id = subSubSubRoot1SM1.getId();
setProperties(subSubSubRoot1SM1);
DynamicDAO.save(root1);
/* Reopen Database */
Owl.getPersistenceService().shutdown(false);
root1 = null;
root2 = null;
root3 = null;
subRoot1 = null;
subRoot2 = null;
subRoot3 = null;
subSubRoot1 = null;
subSubSubRoot1 = null;
rootBM1 = null;
rootBM2 = null;
subRoot1BM1 = null;
subRoot1BM2 = null;
subRoot2BM1 = null;
subRoot3BM1 = null;
subSubRoot1BM1 = null;
subSubSubRoot1BM1 = null;
rootNB1 = null;
rootNB2 = null;
subRoot1NB1 = null;
subRoot1NB2 = null;
subRoot2NB1 = null;
subRoot3NB1 = null;
subSubRoot1NB1 = null;
subSubSubRoot1NB1 = null;
rootSM1 = null;
rootSM2 = null;
subRoot1SM1 = null;
subRoot1SM2 = null;
subRoot2SM1 = null;
subRoot3SM1 = null;
subSubRoot1SM1 = null;
subSubSubRoot1SM1 = null;
System.gc();
Owl.getPersistenceService().startup(new NullOperationMonitor());
/* Assert Folders */
CachingDAO dao = (CachingDAO) DynamicDAO.getDAO(IFolderDAO.class);
root1 = (IFolder) dao.load(rootFolder1Id);
assertNotNull(root1);
assertEquals("Root 1", root1.getName());
assertProperties(root1);
root2 = (IFolder) dao.load(rootFolder2Id);
assertNotNull(root2);
assertEquals("Root 2", root2.getName());
assertProperties(root2);
root3 = (IFolder) dao.load(rootFolder3Id);
assertNotNull(root3);
assertEquals("Root 3", root3.getName());
assertProperties(root3);
subRoot1 = (IFolder) dao.load(subRootFolder1Id);
assertNotNull(subRoot1);
assertEquals("Sub Root 1", subRoot1.getName());
assertProperties(subRoot1);
subRoot2 = (IFolder) dao.load(subRootFolder2Id);
assertNotNull(subRoot2);
assertEquals("Sub Root 2", subRoot2.getName());
assertProperties(subRoot2);
subRoot3 = (IFolder) dao.load(subRootFolder3Id);
assertNotNull(subRoot3);
assertEquals("Sub Root 3", subRoot3.getName());
assertProperties(subRoot3);
subSubRoot1 = (IFolder) dao.load(subSubRootFolder1Id);
assertNotNull(subSubRoot1);
assertEquals("Sub Sub Root 1", subSubRoot1.getName());
assertProperties(subSubRoot1);
subSubSubRoot1 = (IFolder) dao.load(subSubSubRootFolder1Id);
assertNotNull(subSubSubRoot1);
assertEquals("Sub Sub Sub Root 1", subSubSubRoot1.getName());
assertProperties(subSubSubRoot1);
/* Assert Bookmarks */
dao = (CachingDAO) DynamicDAO.getDAO(IBookMarkDAO.class);
rootBM1 = (IBookMark) dao.load(rootBM1Id);
assertNotNull(rootBM1);
assertEquals("Root Bookmark 1", rootBM1.getName());
assertProperties(rootBM1);
rootBM2 = (IBookMark) dao.load(rootBM2Id);
assertNotNull(rootBM2);
assertEquals("Root Bookmark 2", rootBM2.getName());
assertProperties(rootBM2);
subRoot1BM1 = (IBookMark) dao.load(subRoot1BM1Id);
assertNotNull(subRoot1BM1);
assertEquals("Sub Root 1 Bookmark 1", subRoot1BM1.getName());
assertProperties(subRoot1BM1);
subRoot1BM2 = (IBookMark) dao.load(subRoot1BM2Id);
assertNotNull(subRoot1BM2);
assertEquals("Sub Root 1 Bookmark 2", subRoot1BM2.getName());
assertProperties(subRoot1BM2);
subRoot2BM1 = (IBookMark) dao.load(subRoot2BM1Id);
assertNotNull(subRoot2BM1);
assertEquals("Sub Root 2 Bookmark 1", subRoot2BM1.getName());
assertProperties(subRoot2BM1);
subRoot3BM1 = (IBookMark) dao.load(subRoot3BM1Id);
assertNotNull(subRoot3BM1);
assertEquals("Sub Root 3 Bookmark 1", subRoot3BM1.getName());
assertProperties(subRoot3BM1);
subSubRoot1BM1 = (IBookMark) dao.load(subSubRoot1BM1Id);
assertNotNull(subSubRoot1BM1);
assertEquals("Sub Sub Root 1 Bookmark 1", subSubRoot1BM1.getName());
assertProperties(subSubRoot1BM1);
subSubSubRoot1BM1 = (IBookMark) dao.load(subSubSubRoot1BM1Id);
assertNotNull(subSubSubRoot1BM1);
assertEquals("Sub Sub Sub Root 1 Bookmark 1", subSubSubRoot1BM1.getName());
assertProperties(subSubSubRoot1BM1);
/* Assert News Bins */
dao = (CachingDAO) DynamicDAO.getDAO(INewsBinDAO.class);
rootNB1 = (INewsBin) dao.load(rootNB1Id);
assertNotNull(rootNB1);
assertEquals("Root Newsbin 1", rootNB1.getName());
assertProperties(rootNB1);
rootNB2 = (INewsBin) dao.load(rootNB2Id);
assertNotNull(rootNB2);
assertEquals("Root Newsbin 2", rootNB2.getName());
assertProperties(rootNB2);
subRoot1NB1 = (INewsBin) dao.load(subRoot1NB1Id);
assertNotNull(subRoot1NB1);
assertEquals("Sub Root 1 Newsbin 1", subRoot1NB1.getName());
assertProperties(subRoot1NB1);
subRoot1NB2 = (INewsBin) dao.load(subRoot1NB2Id);
assertNotNull(subRoot1NB2);
assertEquals("Sub Root 1 Newsbin 2", subRoot1NB2.getName());
assertProperties(subRoot1NB2);
subRoot2NB1 = (INewsBin) dao.load(subRoot2NB1Id);
assertNotNull(subRoot2NB1);
assertEquals("Sub Root 2 Newsbin 1", subRoot2NB1.getName());
assertProperties(subRoot2NB1);
subRoot3NB1 = (INewsBin) dao.load(subRoot3NB1Id);
assertNotNull(subRoot3NB1);
assertEquals("Sub Root 3 Newsbin 1", subRoot3NB1.getName());
assertProperties(subRoot3NB1);
subSubRoot1NB1 = (INewsBin) dao.load(subSubRoot1NB1Id);
assertNotNull(subSubRoot1NB1);
assertEquals("Sub Sub Root 1 Newsbin 1", subSubRoot1NB1.getName());
assertProperties(subSubRoot1NB1);
subSubSubRoot1NB1 = (INewsBin) dao.load(subSubSubRoot1NB1Id);
assertNotNull(subSubSubRoot1NB1);
assertEquals("Sub Sub Sub Root 1 Newsbin 1", subSubSubRoot1NB1.getName());
assertProperties(subSubSubRoot1NB1);
/* Assert Search Marks */
dao = (CachingDAO) DynamicDAO.getDAO(ISearchMarkDAO.class);
rootSM1 = (ISearchMark) dao.load(rootSM1Id);
assertNotNull(rootSM1);
assertEquals("Root Searchmark 1", rootSM1.getName());
assertProperties(rootSM1);
rootSM2 = (ISearchMark) dao.load(rootSM2Id);
assertNotNull(rootSM2);
assertEquals("Root Searchmark 2", rootSM2.getName());
assertProperties(rootSM2);
subRoot1SM1 = (ISearchMark) dao.load(subRoot1SM1Id);
assertNotNull(subRoot1SM1);
assertEquals("Sub Root 1 Searchmark 1", subRoot1SM1.getName());
assertProperties(subRoot1SM1);
subRoot1SM2 = (ISearchMark) dao.load(subRoot1SM2Id);
assertNotNull(subRoot1SM2);
assertEquals("Sub Root 1 Searchmark 2", subRoot1SM2.getName());
assertProperties(subRoot1SM2);
subRoot2SM1 = (ISearchMark) dao.load(subRoot2SM1Id);
assertNotNull(subRoot2SM1);
assertEquals("Sub Root 2 Searchmark 1", subRoot2SM1.getName());
assertProperties(subRoot2SM1);
subRoot3SM1 = (ISearchMark) dao.load(subRoot3SM1Id);
assertNotNull(subRoot3SM1);
assertEquals("Sub Root 3 Searchmark 1", subRoot3SM1.getName());
assertProperties(subRoot3SM1);
subSubRoot1SM1 = (ISearchMark) dao.load(subSubRoot1SM1Id);
assertNotNull(subSubRoot1SM1);
assertEquals("Sub Sub Root 1 Searchmark 1", subSubRoot1SM1.getName());
assertProperties(subSubRoot1SM1);
subSubSubRoot1SM1 = (ISearchMark) dao.load(subSubSubRoot1SM1Id);
assertNotNull(subSubSubRoot1SM1);
assertEquals("Sub Sub Sub Root 1 Searchmark 1", subSubSubRoot1SM1.getName());
assertProperties(subSubSubRoot1SM1);
}