use of org.olat.modules.lecture.LectureBlock in project OpenOLAT by OpenOLAT.
the class LectureBlockReminderDAOTest method createMinimalLectureBlock.
private LectureBlock createMinimalLectureBlock(int dayInThePast) {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = lectureBlockDao.createLectureBlock(entry);
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DATE, -dayInThePast);
lectureBlock.setStartDate(cal.getTime());
lectureBlock.setEndDate(cal.getTime());
lectureBlock.setTitle("Hello lecturers");
return lectureBlockDao.update(lectureBlock);
}
use of org.olat.modules.lecture.LectureBlock in project OpenOLAT by OpenOLAT.
the class LectureBlockReminderDAOTest method deleteReminder.
@Test
public void deleteReminder() {
// create a reminder
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("reminder-to-delete-1");
LectureBlock lectureBlock = createMinimalLectureBlock(2);
LectureBlockReminderImpl reminder = lectureBlockReminderDao.createReminder(lectureBlock, id, "Delete it");
dbInstance.commitAndCloseSession();
Assert.assertNotNull(reminder);
// delete the reminders
int deletedRows = lectureBlockReminderDao.deleteReminders(id);
Assert.assertEquals(1, deletedRows);
dbInstance.commitAndCloseSession();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -3);
List<LectureBlockToTeacher> toRemind = lectureBlockReminderDao.getLectureBlockTeachersToReminder(cal.getTime());
boolean hasId = false;
for (LectureBlockToTeacher remind : toRemind) {
if (remind.getLectureBlock().equals(lectureBlock)) {
if (remind.getTeacher().equals(id)) {
hasId = true;
}
}
}
Assert.assertFalse(hasId);
}
use of org.olat.modules.lecture.LectureBlock in project OpenOLAT by OpenOLAT.
the class LectureParticipantSummaryDAOTest method createMinimalLectureBlock.
private LectureBlock createMinimalLectureBlock(RepositoryEntry entry) {
LectureBlock lectureBlock = lectureBlockDao.createLectureBlock(entry);
lectureBlock.setStartDate(new Date());
lectureBlock.setEndDate(new Date());
lectureBlock.setTitle("Hello lecturers");
return lectureBlockDao.update(lectureBlock);
}
use of org.olat.modules.lecture.LectureBlock in project openolat by klemens.
the class LectureBlockAuditLogDAOTest method getAuditLog_byLectureBlock.
@Test
public void getAuditLog_byLectureBlock() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = lectureBlockDao.createLectureBlock(entry);
lectureBlock.setStartDate(new Date());
lectureBlock.setEndDate(new Date());
lectureBlock.setTitle("I will be loged");
lectureBlock = lectureBlockDao.update(lectureBlock);
lectureBlockAuditLogDao.auditLog(LectureBlockAuditLog.Action.autoclose, "Before", "After", "Close the absence of course", lectureBlock, null, entry, null, null);
dbInstance.commitAndCloseSession();
// load the audit log
List<LectureBlockAuditLog> auditLog = lectureBlockAuditLogDao.getAuditLog(lectureBlock);
Assert.assertNotNull(auditLog);
Assert.assertEquals(1, auditLog.size());
// check the entry
LectureBlockAuditLog logEntry = auditLog.get(0);
Assert.assertEquals(entry.getKey(), logEntry.getEntryKey());
Assert.assertEquals("Before", logEntry.getBefore());
Assert.assertEquals("After", logEntry.getAfter());
Assert.assertEquals("Close the absence of course", logEntry.getMessage());
Assert.assertEquals(LectureBlockAuditLog.Action.autoclose.name(), logEntry.getAction());
}
use of org.olat.modules.lecture.LectureBlock in project openolat by klemens.
the class LectureBlockAuditLogDAOTest method xmlAuditLog.
@Test
public void xmlAuditLog() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = lectureBlockDao.createLectureBlock(entry);
lectureBlock.setStartDate(new Date());
lectureBlock.setEndDate(new Date());
lectureBlock.setTitle("Hello lecturers");
lectureBlock = lectureBlockDao.update(lectureBlock);
dbInstance.commitAndCloseSession();
String xml = lectureBlockAuditLogDao.toXml(lectureBlock);
Assert.assertNotNull(xml);
}
Aggregations