use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class LectureServiceTest method addTeacher.
@Test
public void addTeacher() {
Identity teacher = JunitTestHelper.createAndPersistIdentityAsRndUser("teacher-1");
Identity notTeacher = JunitTestHelper.createAndPersistIdentityAsRndUser("teacher-2");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = createMinimalLectureBlock(entry);
dbInstance.commitAndCloseSession();
// enable lecture on this entry
RepositoryEntryLectureConfiguration config = lectureService.getRepositoryEntryLectureConfiguration(entry);
config.setLectureEnabled(true);
config = lectureService.updateRepositoryEntryLectureConfiguration(config);
lectureService.addTeacher(lectureBlock, teacher);
dbInstance.commitAndCloseSession();
boolean isTeacher = lectureService.hasLecturesAsTeacher(entry, teacher);
Assert.assertTrue(isTeacher);
boolean isNotTeacher = lectureService.hasLecturesAsTeacher(entry, notTeacher);
Assert.assertFalse(isNotTeacher);
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class LectureServiceTest method getRepositoryEntryLectureConfiguration.
@Test
public void getRepositoryEntryLectureConfiguration() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
RepositoryEntryLectureConfiguration config = lectureService.getRepositoryEntryLectureConfiguration(entry);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(config);
Assert.assertEquals(entry, config.getEntry());
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class RepositoryEntryLectureConfigurationDAOTest method cloneConfigureLectureConfiguration.
@Test
public void cloneConfigureLectureConfiguration() {
// create a configuration
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
RepositoryEntry cloneEntry = JunitTestHelper.createAndPersistRepositoryEntry();
RepositoryEntryLectureConfiguration config = lectureConfigurationDao.createConfiguration(entry);
config.setLectureEnabled(true);
config.setOverrideModuleDefault(true);
config.setCalculateAttendanceRate(Boolean.TRUE);
config.setRequiredAttendanceRate(0.75d);
config.setParticipantCalendarSyncEnabled(Boolean.TRUE);
config.setTeacherCalendarSyncEnabled(Boolean.TRUE);
RepositoryEntryLectureConfiguration mergedConfig = lectureConfigurationDao.update(config);
dbInstance.commitAndCloseSession();
// clone it
RepositoryEntryLectureConfiguration clonedConfig = lectureConfigurationDao.cloneConfiguration(mergedConfig, cloneEntry);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(clonedConfig);
RepositoryEntryLectureConfiguration reloadedClonedConfig = lectureConfigurationDao.getConfiguration(cloneEntry);
Assert.assertEquals(clonedConfig, reloadedClonedConfig);
Assert.assertEquals(true, reloadedClonedConfig.isLectureEnabled());
Assert.assertEquals(true, reloadedClonedConfig.isOverrideModuleDefault());
Assert.assertEquals(Boolean.TRUE, reloadedClonedConfig.getCalculateAttendanceRate());
Assert.assertEquals(0.75d, reloadedClonedConfig.getRequiredAttendanceRate(), 0.0001);
Assert.assertEquals(Boolean.TRUE, reloadedClonedConfig.getParticipantCalendarSyncEnabled());
Assert.assertEquals(Boolean.TRUE, reloadedClonedConfig.getTeacherCalendarSyncEnabled());
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class RepositoryEntryLectureConfigurationDAOTest method getRepositoryEntryLectureConfiguration_lectureBlock.
@Test
public void getRepositoryEntryLectureConfiguration_lectureBlock() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
RepositoryEntryLectureConfiguration config = lectureConfigurationDao.createConfiguration(entry);
dbInstance.commit();
LectureBlock lectureBlock = lectureBlockDao.createLectureBlock(entry);
lectureBlock.setStartDate(new Date());
lectureBlock.setEndDate(new Date());
lectureBlock.setTitle("Hello lecturers");
lectureBlock = lectureBlockDao.update(lectureBlock);
dbInstance.commitAndCloseSession();
// get the configuration
RepositoryEntryLectureConfiguration reloadedConfig = lectureConfigurationDao.getConfiguration(lectureBlock);
Assert.assertEquals(config, reloadedConfig);
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class RepositoryEntryLectureConfigurationDAOTest method isConfigurationEnabledFor.
@Test
public void isConfigurationEnabledFor() {
// create a configuration
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
RepositoryEntryLectureConfiguration config = lectureConfigurationDao.createConfiguration(entry);
config.setLectureEnabled(true);
RepositoryEntryLectureConfiguration mergedConfig = lectureConfigurationDao.update(config);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(mergedConfig);
// check that the configuration enables the lectures feature
boolean enabled = lectureConfigurationDao.isConfigurationEnabledFor(entry);
Assert.assertTrue(enabled);
}
Aggregations