Search in sources :

Example 61 with LectureBlock

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);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) Calendar(java.util.Calendar) RepositoryEntry(org.olat.repository.RepositoryEntry) Date(java.util.Date)

Example 62 with 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);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) LectureBlockToTeacher(org.olat.modules.lecture.model.LectureBlockToTeacher) Calendar(java.util.Calendar) Identity(org.olat.core.id.Identity) LectureBlockReminderImpl(org.olat.modules.lecture.model.LectureBlockReminderImpl) Test(org.junit.Test)

Example 63 with LectureBlock

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);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) Date(java.util.Date)

Example 64 with 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());
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) RepositoryEntry(org.olat.repository.RepositoryEntry) LectureBlockAuditLog(org.olat.modules.lecture.LectureBlockAuditLog) Date(java.util.Date) Test(org.junit.Test)

Example 65 with LectureBlock

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);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) RepositoryEntry(org.olat.repository.RepositoryEntry) Date(java.util.Date) Test(org.junit.Test)

Aggregations

LectureBlock (org.olat.modules.lecture.LectureBlock)232 Identity (org.olat.core.id.Identity)132 Test (org.junit.Test)116 RepositoryEntry (org.olat.repository.RepositoryEntry)98 Date (java.util.Date)64 LectureBlockRollCall (org.olat.modules.lecture.LectureBlockRollCall)42 URI (java.net.URI)30 ArrayList (java.util.ArrayList)30 HttpResponse (org.apache.http.HttpResponse)30 Group (org.olat.basesecurity.Group)30 Calendar (java.util.Calendar)26 ICourse (org.olat.course.ICourse)24 BusinessGroup (org.olat.group.BusinessGroup)24 CourseConfigVO (org.olat.restapi.support.vo.CourseConfigVO)24 LectureBlockToGroup (org.olat.modules.lecture.LectureBlockToGroup)22 RepositoryEntryLectureConfiguration (org.olat.modules.lecture.RepositoryEntryLectureConfiguration)20 LecturesBlockSearchParameters (org.olat.modules.lecture.model.LecturesBlockSearchParameters)16 List (java.util.List)14 HttpGet (org.apache.http.client.methods.HttpGet)14 LectureBlockToTeacher (org.olat.modules.lecture.model.LectureBlockToTeacher)14