use of org.olat.modules.portfolio.model.BinderImpl in project openolat by klemens.
the class BinderDAOTest method createBinderWithSection.
@Test
public void createBinderWithSection() {
String title = "Binder 2";
String summary = "Binder with one section.";
BinderImpl binder = binderDao.createAndPersist(title, summary, null, null);
String sectionTitle = "First section";
String sectionDesc = "My first section.";
binderDao.createSection(sectionTitle, sectionDesc, null, null, binder);
dbInstance.commitAndCloseSession();
}
use of org.olat.modules.portfolio.model.BinderImpl in project openolat by klemens.
the class BinderUserInformationsDAOTest method updateBinderUserInformations.
@Test
public void updateBinderUserInformations() {
Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("bu-1");
BinderImpl binder = binderDao.createAndPersist("Binder infos", "Binder with one section.", null, null);
dbInstance.commitAndCloseSession();
// update the infos
binderUserInformationsDAO.updateBinderUserInformations(binder, identity);
dbInstance.commit();
// load the infos and check
BinderUserInformations infos = binderUserInformationsDAO.getBinderUserInfos(binder, identity);
Assert.assertNotNull(infos);
Assert.assertNotNull(infos.getKey());
Assert.assertNotNull(infos.getCreationDate());
Assert.assertNotNull(infos.getLastModified());
Assert.assertNotNull(infos.getInitialLaunch());
Assert.assertNotNull(infos.getRecentLaunch());
Assert.assertEquals(1, infos.getVisit());
Assert.assertEquals(binder, infos.getBinder());
Assert.assertEquals(identity, infos.getIdentity());
}
use of org.olat.modules.portfolio.model.BinderImpl in project openolat by klemens.
the class PageDAOTest method createBinderWithSectionAndPage.
@Test
public void createBinderWithSectionAndPage() {
BinderImpl binder = binderDao.createAndPersist("Binder p1", "A binder with a page", null, null);
Section section = binderDao.createSection("Section", "First section", null, null, binder);
dbInstance.commitAndCloseSession();
Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, reloadedSection, null);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(page);
Assert.assertNotNull(page.getKey());
Assert.assertNotNull(page.getCreationDate());
Assert.assertNotNull(page.getLastModified());
Assert.assertEquals("New page", page.getTitle());
Assert.assertEquals("A brand new page.", page.getSummary());
}
use of org.olat.modules.portfolio.model.BinderImpl in project openolat by klemens.
the class PageDAOTest method getOwnedPages.
@Test
public void getOwnedPages() {
// an owned binder
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("pf-1");
Binder binder = portfolioService.createNewBinder("Binder p2", "A binder with 2 page", null, author);
Section section = binderDao.createSection("Section", "First section", null, null, binder);
dbInstance.commitAndCloseSession();
Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
Page page1 = pageDao.createAndPersist("Page 1", "A page with content.", null, null, true, reloadedSection, null);
Page page2 = pageDao.createAndPersist("Page 2", "A page with content.", null, null, true, reloadedSection, null);
Page page3 = pageDao.createAndPersist("Anime", "Princess Mononoke is the second most famous anime of Miazaki.", null, null, true, reloadedSection, null);
dbInstance.commitAndCloseSession();
// a not owned binder
BinderImpl binderAlt = binderDao.createAndPersist("Not my binder", "A binder that I don't own", null, null);
Section sectionAlt = binderDao.createSection("Section", "First section", null, null, binderAlt);
dbInstance.commitAndCloseSession();
Section reloadedSectionAlt = binderDao.loadSectionByKey(sectionAlt.getKey());
Page pageAlt = pageDao.createAndPersist("Page alt", "A page with alternative content.", null, null, true, reloadedSectionAlt, null);
dbInstance.commitAndCloseSession();
// reload
List<Page> sectionPages = pageDao.getOwnedPages(author, null);
Assert.assertNotNull(sectionPages);
Assert.assertEquals(3, sectionPages.size());
Assert.assertTrue(sectionPages.contains(page1));
Assert.assertTrue(sectionPages.contains(page2));
Assert.assertTrue(sectionPages.contains(page3));
Assert.assertFalse(sectionPages.contains(pageAlt));
// reload
List<Page> searchedPages = pageDao.getOwnedPages(author, "Miazaki");
Assert.assertNotNull(searchedPages);
Assert.assertEquals(1, searchedPages.size());
Assert.assertFalse(searchedPages.contains(page1));
Assert.assertFalse(searchedPages.contains(page2));
Assert.assertTrue(searchedPages.contains(page3));
Assert.assertFalse(sectionPages.contains(pageAlt));
}
use of org.olat.modules.portfolio.model.BinderImpl in project openolat by klemens.
the class EvaluationFormSessionDAOTest method createSessionForPortfolio.
@Test
public void createSessionForPortfolio() {
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("eva-1");
BinderImpl binder = binderDao.createAndPersist("Binder evaluation 1", "A binder with an evaluation", null, null);
Section section = binderDao.createSection("Section", "First section", null, null, binder);
dbInstance.commit();
Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
Page page = pageDao.createAndPersist("Page 1", "A page with an evalutation.", null, null, true, reloadedSection, null);
dbInstance.commit();
RepositoryEntry formEntry = createFormEntry("Eva. form for session");
PageBody reloadedBody = pageDao.loadPageBodyByKey(page.getBody().getKey());
EvaluationFormSession session = evaluationFormSessionDao.createSessionForPortfolio(id, reloadedBody, formEntry);
dbInstance.commit();
Assert.assertNotNull(session);
Assert.assertNotNull(session.getKey());
Assert.assertNotNull(session.getCreationDate());
Assert.assertNotNull(session.getLastModified());
Assert.assertEquals(reloadedBody, session.getPageBody());
Assert.assertEquals(id, session.getIdentity());
}
Aggregations