Search in sources :

Example 21 with BinderImpl

use of org.olat.modules.portfolio.model.BinderImpl in project openolat by klemens.

the class BinderDAOTest method createBinderWithSection_2steps.

@Test
public void createBinderWithSection_2steps() {
    String title = "Binder 2";
    String summary = "Binder with one section.";
    Binder binder = binderDao.createAndPersist(title, summary, null, null);
    dbInstance.commitAndCloseSession();
    String section1Title = "First section";
    String section1Desc = "My first section.";
    binder = binderDao.loadByKey(binder.getKey());
    Section section1 = binderDao.createSection(section1Title, section1Desc, null, null, binder);
    dbInstance.commitAndCloseSession();
    String section2Title = "Second section";
    String section2Desc = "My second section.";
    binder = binderDao.loadByKey(binder.getKey());
    Section section2 = binderDao.createSection(section2Title, section2Desc, null, null, binder);
    dbInstance.commitAndCloseSession();
    Binder reloadedBinder = binderDao.loadByKey(binder.getKey());
    List<Section> sections = ((BinderImpl) reloadedBinder).getSections();
    Assert.assertNotNull(sections);
    Assert.assertEquals(2, sections.size());
    Assert.assertEquals(section1, sections.get(0));
    Assert.assertEquals(section2, sections.get(1));
}
Also used : Binder(org.olat.modules.portfolio.Binder) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 22 with BinderImpl

use of org.olat.modules.portfolio.model.BinderImpl in project openolat by klemens.

the class PageDAOTest method getPages_section.

@Test
public void getPages_section() {
    BinderImpl binder = binderDao.createAndPersist("Binder p2", "A binder with 2 page", null, null);
    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("Page 3", "A page with the demonstration of Hawking about black hole'evaporation.", null, null, true, reloadedSection, null);
    dbInstance.commitAndCloseSession();
    // reload
    List<Page> sectionPages = pageDao.getPages(reloadedSection);
    Assert.assertNotNull(sectionPages);
    Assert.assertEquals(3, sectionPages.size());
    Assert.assertTrue(sectionPages.contains(page1));
    Assert.assertTrue(sectionPages.contains(page2));
    Assert.assertTrue(sectionPages.contains(page3));
}
Also used : BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 23 with BinderImpl

use of org.olat.modules.portfolio.model.BinderImpl in project OpenOLAT by OpenOLAT.

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());
}
Also used : EvaluationFormSession(org.olat.modules.forms.EvaluationFormSession) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) PageBody(org.olat.modules.portfolio.PageBody) Test(org.junit.Test)

Example 24 with BinderImpl

use of org.olat.modules.portfolio.model.BinderImpl in project OpenOLAT by OpenOLAT.

the class BinderDAOTest method createNewBinder.

@Test
public void createNewBinder() {
    String title = "My portfolio";
    String summary = "My live";
    BinderImpl binder = binderDao.createAndPersist(title, summary, null, null);
    dbInstance.commitAndCloseSession();
    Assert.assertNotNull(binder);
    Assert.assertNotNull(binder.getKey());
    Assert.assertNotNull(binder.getCreationDate());
    Assert.assertNotNull(binder.getLastModified());
    Assert.assertNotNull(binder.getBaseGroup());
    Assert.assertEquals(title, binder.getTitle());
    Assert.assertEquals(summary, binder.getSummary());
    Binder reloadedBinder = binderDao.loadByKey(binder.getKey());
    Assert.assertNotNull(reloadedBinder);
    Assert.assertNotNull(reloadedBinder.getKey());
    Assert.assertEquals(binder.getKey(), reloadedBinder.getKey());
    Assert.assertEquals(binder, reloadedBinder);
    Assert.assertNotNull(reloadedBinder.getCreationDate());
    Assert.assertNotNull(reloadedBinder.getLastModified());
    Assert.assertEquals(title, reloadedBinder.getTitle());
    Assert.assertEquals(summary, reloadedBinder.getSummary());
}
Also used : Binder(org.olat.modules.portfolio.Binder) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Test(org.junit.Test)

Example 25 with BinderImpl

use of org.olat.modules.portfolio.model.BinderImpl in project OpenOLAT by OpenOLAT.

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();
}
Also used : BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Test(org.junit.Test)

Aggregations

BinderImpl (org.olat.modules.portfolio.model.BinderImpl)64 Section (org.olat.modules.portfolio.Section)40 Test (org.junit.Test)38 Page (org.olat.modules.portfolio.Page)32 Identity (org.olat.core.id.Identity)22 Binder (org.olat.modules.portfolio.Binder)14 PageUserInformations (org.olat.modules.portfolio.PageUserInformations)12 RepositoryEntry (org.olat.repository.RepositoryEntry)12 OLATResource (org.olat.resource.OLATResource)10 ICourse (org.olat.course.ICourse)8 CourseNode (org.olat.course.nodes.CourseNode)8 PortfolioCourseNode (org.olat.course.nodes.PortfolioCourseNode)8 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)8 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)8 AssessedBinder (org.olat.modules.portfolio.model.AssessedBinder)8 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)8 Date (java.util.Date)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 PageBody (org.olat.modules.portfolio.PageBody)6 BigDecimal (java.math.BigDecimal)4