Search in sources :

Example 46 with BinderImpl

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

the class PageUserInfosDAOTest method createPageUserInfos.

@Test
public void createPageUserInfos() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-1");
    BinderImpl binder = binderDao.createAndPersist("Binder pui1", "A binder with a page for infos", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, section, null);
    dbInstance.commitAndCloseSession();
    PageUserInformations infos = pageUserInfosDao.create(PageUserStatus.incoming, page, coach);
    Assert.assertNotNull(infos);
    Assert.assertEquals(coach, infos.getIdentity());
    Assert.assertEquals(page, infos.getPage());
    Assert.assertEquals(PageUserStatus.incoming, infos.getStatus());
    Assert.assertFalse(infos.isMark());
    dbInstance.commit();
}
Also used : PageUserInformations(org.olat.modules.portfolio.PageUserInformations) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 47 with BinderImpl

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

the class PageUserInfosDAOTest method updatePageUserInfosRestricted.

@Test
public void updatePageUserInfosRestricted() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-4");
    BinderImpl binder = binderDao.createAndPersist("Binder pui4", "A binder with a page for infos to batch update", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, section, null);
    PageUserInformations infos = pageUserInfosDao.create(PageUserStatus.inProcess, page, coach);
    dbInstance.commitAndCloseSession();
    // update
    pageUserInfosDao.updateStatus(page, PageUserStatus.done, PageUserStatus.inProcess);
    dbInstance.commitAndCloseSession();
    // check nothing changed
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    Assert.assertEquals(PageUserStatus.done, reloadedInfos.getStatus());
    dbInstance.commit();
}
Also used : PageUserInformations(org.olat.modules.portfolio.PageUserInformations) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 48 with BinderImpl

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

the class PageUserInfosDAOTest method updatePageUserInfosRestricted_nothing.

@Test
public void updatePageUserInfosRestricted_nothing() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-5");
    BinderImpl binder = binderDao.createAndPersist("Binder pui5", "A binder with a page for infos to batch udate", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, section, null);
    PageUserInformations infos = pageUserInfosDao.create(PageUserStatus.inProcess, page, coach);
    dbInstance.commitAndCloseSession();
    // update
    pageUserInfosDao.updateStatus(page, PageUserStatus.done, PageUserStatus.incoming);
    dbInstance.commitAndCloseSession();
    // check nothing changed
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    Assert.assertEquals(PageUserStatus.inProcess, reloadedInfos.getStatus());
    dbInstance.commit();
}
Also used : PageUserInformations(org.olat.modules.portfolio.PageUserInformations) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 49 with BinderImpl

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

the class PageUserInfosDAOTest method updatePageUserInfos.

@Test
public void updatePageUserInfos() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-2");
    BinderImpl binder = binderDao.createAndPersist("Binder pui1", "A binder with a page for infos", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, section, null);
    PageUserInformations infos = pageUserInfosDao.create(PageUserStatus.inProcess, page, coach);
    dbInstance.commitAndCloseSession();
    // update
    pageUserInfosDao.updateStatus(page, PageUserStatus.done);
    dbInstance.commitAndCloseSession();
    // check
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    Assert.assertEquals(PageUserStatus.done, reloadedInfos.getStatus());
    dbInstance.commit();
}
Also used : PageUserInformations(org.olat.modules.portfolio.PageUserInformations) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 50 with BinderImpl

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

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)

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