Search in sources :

Example 6 with PageUserInformations

use of org.olat.modules.portfolio.PageUserInformations in project OpenOLAT by OpenOLAT.

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 7 with PageUserInformations

use of org.olat.modules.portfolio.PageUserInformations in project OpenOLAT by OpenOLAT.

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 8 with PageUserInformations

use of org.olat.modules.portfolio.PageUserInformations in project OpenOLAT by OpenOLAT.

the class PageUserInfosDAOTest method getPageUserInfos.

@Test
public void getPageUserInfos() {
    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();
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    Assert.assertEquals(coach, reloadedInfos.getIdentity());
    Assert.assertEquals(page, reloadedInfos.getPage());
    Assert.assertEquals(PageUserStatus.inProcess, reloadedInfos.getStatus());
    Assert.assertFalse(reloadedInfos.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 9 with PageUserInformations

use of org.olat.modules.portfolio.PageUserInformations in project OpenOLAT by OpenOLAT.

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 10 with PageUserInformations

use of org.olat.modules.portfolio.PageUserInformations in project OpenOLAT by OpenOLAT.

the class PageUserInfosDAOTest method deletePageUserInfosRestricted_page.

@Test
public void deletePageUserInfosRestricted_page() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-6");
    BinderImpl binder = binderDao.createAndPersist("Binder pui6", "A binder with a page for infos to delete", 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();
    // check that we have something to delete
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    // update
    pageUserInfosDao.delete(page);
    dbInstance.commitAndCloseSession();
    // check that we have deleted something
    PageUserInformations deletedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNull(deletedInfos);
}
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)

Aggregations

PageUserInformations (org.olat.modules.portfolio.PageUserInformations)20 Page (org.olat.modules.portfolio.Page)18 Section (org.olat.modules.portfolio.Section)16 Identity (org.olat.core.id.Identity)14 Test (org.junit.Test)12 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)12 HashMap (java.util.HashMap)4 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 BaseFullWebappPopupLayoutFactory (org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory)2 SortKey (org.olat.core.commons.persistence.SortKey)2 UserRequest (org.olat.core.gui.UserRequest)2 Component (org.olat.core.gui.components.Component)2 Dropdown (org.olat.core.gui.components.dropdown.Dropdown)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2