Search in sources :

Example 1 with SentReminderImpl

use of org.olat.modules.reminder.model.SentReminderImpl in project OpenOLAT by OpenOLAT.

the class ReminderDAOTest method getSendReminders_byRepositoryEntry.

@Test
public void getSendReminders_byRepositoryEntry() {
    // create and reminder and an identity
    Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-8");
    Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-8a");
    Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-8b");
    RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
    Reminder savedReminder = createAndSaveReminder(entry, creator, 8);
    dbInstance.commitAndCloseSession();
    Assert.assertNotNull(savedReminder);
    // send 3 reminders
    SentReminderImpl sentReminder1 = reminderDao.markAsSend(savedReminder, recepient1, "ok");
    SentReminderImpl sentReminder2 = reminderDao.markAsSend(savedReminder, recepient2, "error");
    SentReminderImpl sentReminder3 = reminderDao.markAsSend(savedReminder, recepient2, "error");
    dbInstance.commitAndCloseSession();
    // load the sent reminder log
    List<SentReminder> sentReminders = reminderDao.getSendReminders(entry);
    Assert.assertNotNull(sentReminders);
    Assert.assertEquals(3, sentReminders.size());
    Assert.assertTrue(sentReminders.contains(sentReminder1));
    Assert.assertTrue(sentReminders.contains(sentReminder2));
    Assert.assertTrue(sentReminders.contains(sentReminder3));
}
Also used : Reminder(org.olat.modules.reminder.Reminder) SentReminder(org.olat.modules.reminder.SentReminder) SentReminderImpl(org.olat.modules.reminder.model.SentReminderImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) SentReminder(org.olat.modules.reminder.SentReminder) Test(org.junit.Test)

Example 2 with SentReminderImpl

use of org.olat.modules.reminder.model.SentReminderImpl in project OpenOLAT by OpenOLAT.

the class ReminderDAOTest method getSendReminders_byReminder.

@Test
public void getSendReminders_byReminder() {
    // create and reminder and an identity
    Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-7");
    Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-7a");
    Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-7b");
    RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
    Reminder savedReminder = createAndSaveReminder(entry, creator, 7);
    dbInstance.commitAndCloseSession();
    Assert.assertNotNull(savedReminder);
    // send 3 reminders
    SentReminderImpl sentReminder1 = reminderDao.markAsSend(savedReminder, recepient1, "ok");
    SentReminderImpl sentReminder2 = reminderDao.markAsSend(savedReminder, recepient2, "error");
    SentReminderImpl sentReminder3 = reminderDao.markAsSend(savedReminder, recepient1, "error");
    dbInstance.commitAndCloseSession();
    // load the sent reminder log
    List<SentReminder> sentReminders = reminderDao.getSendReminders(savedReminder);
    Assert.assertNotNull(sentReminders);
    Assert.assertEquals(3, sentReminders.size());
    Assert.assertTrue(sentReminders.contains(sentReminder1));
    Assert.assertTrue(sentReminders.contains(sentReminder2));
    Assert.assertTrue(sentReminders.contains(sentReminder3));
}
Also used : Reminder(org.olat.modules.reminder.Reminder) SentReminder(org.olat.modules.reminder.SentReminder) SentReminderImpl(org.olat.modules.reminder.model.SentReminderImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) SentReminder(org.olat.modules.reminder.SentReminder) Test(org.junit.Test)

Example 3 with SentReminderImpl

use of org.olat.modules.reminder.model.SentReminderImpl in project openolat by klemens.

the class ReminderDAOTest method getSendReminders_byReminder.

@Test
public void getSendReminders_byReminder() {
    // create and reminder and an identity
    Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-7");
    Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-7a");
    Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-7b");
    RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
    Reminder savedReminder = createAndSaveReminder(entry, creator, 7);
    dbInstance.commitAndCloseSession();
    Assert.assertNotNull(savedReminder);
    // send 3 reminders
    SentReminderImpl sentReminder1 = reminderDao.markAsSend(savedReminder, recepient1, "ok");
    SentReminderImpl sentReminder2 = reminderDao.markAsSend(savedReminder, recepient2, "error");
    SentReminderImpl sentReminder3 = reminderDao.markAsSend(savedReminder, recepient1, "error");
    dbInstance.commitAndCloseSession();
    // load the sent reminder log
    List<SentReminder> sentReminders = reminderDao.getSendReminders(savedReminder);
    Assert.assertNotNull(sentReminders);
    Assert.assertEquals(3, sentReminders.size());
    Assert.assertTrue(sentReminders.contains(sentReminder1));
    Assert.assertTrue(sentReminders.contains(sentReminder2));
    Assert.assertTrue(sentReminders.contains(sentReminder3));
}
Also used : Reminder(org.olat.modules.reminder.Reminder) SentReminder(org.olat.modules.reminder.SentReminder) SentReminderImpl(org.olat.modules.reminder.model.SentReminderImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) SentReminder(org.olat.modules.reminder.SentReminder) Test(org.junit.Test)

Example 4 with SentReminderImpl

use of org.olat.modules.reminder.model.SentReminderImpl in project openolat by klemens.

the class ReminderDAOTest method markAsSend.

@Test
public void markAsSend() {
    // create and reminder and an identity
    Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-5");
    Identity recepient = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-5");
    RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
    Reminder savedReminder = createAndSaveReminder(entry, creator, 5);
    Assert.assertNotNull(savedReminder);
    dbInstance.commitAndCloseSession();
    SentReminderImpl sentReminder = reminderDao.markAsSend(savedReminder, recepient, "ok");
    dbInstance.commitAndCloseSession();
    Assert.assertNotNull(sentReminder);
    Assert.assertNotNull(sentReminder.getKey());
    Assert.assertEquals("ok", sentReminder.getStatus());
    Assert.assertEquals(savedReminder, sentReminder.getReminder());
    Assert.assertEquals(recepient, sentReminder.getIdentity());
}
Also used : Reminder(org.olat.modules.reminder.Reminder) SentReminder(org.olat.modules.reminder.SentReminder) SentReminderImpl(org.olat.modules.reminder.model.SentReminderImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 5 with SentReminderImpl

use of org.olat.modules.reminder.model.SentReminderImpl in project openolat by klemens.

the class ReminderDAOTest method getSendReminders_byRepositoryEntry.

@Test
public void getSendReminders_byRepositoryEntry() {
    // create and reminder and an identity
    Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-8");
    Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-8a");
    Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-8b");
    RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
    Reminder savedReminder = createAndSaveReminder(entry, creator, 8);
    dbInstance.commitAndCloseSession();
    Assert.assertNotNull(savedReminder);
    // send 3 reminders
    SentReminderImpl sentReminder1 = reminderDao.markAsSend(savedReminder, recepient1, "ok");
    SentReminderImpl sentReminder2 = reminderDao.markAsSend(savedReminder, recepient2, "error");
    SentReminderImpl sentReminder3 = reminderDao.markAsSend(savedReminder, recepient2, "error");
    dbInstance.commitAndCloseSession();
    // load the sent reminder log
    List<SentReminder> sentReminders = reminderDao.getSendReminders(entry);
    Assert.assertNotNull(sentReminders);
    Assert.assertEquals(3, sentReminders.size());
    Assert.assertTrue(sentReminders.contains(sentReminder1));
    Assert.assertTrue(sentReminders.contains(sentReminder2));
    Assert.assertTrue(sentReminders.contains(sentReminder3));
}
Also used : Reminder(org.olat.modules.reminder.Reminder) SentReminder(org.olat.modules.reminder.SentReminder) SentReminderImpl(org.olat.modules.reminder.model.SentReminderImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) SentReminder(org.olat.modules.reminder.SentReminder) Test(org.junit.Test)

Aggregations

SentReminderImpl (org.olat.modules.reminder.model.SentReminderImpl)10 Test (org.junit.Test)8 Identity (org.olat.core.id.Identity)8 Reminder (org.olat.modules.reminder.Reminder)8 SentReminder (org.olat.modules.reminder.SentReminder)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 Date (java.util.Date)2 ReminderInfos (org.olat.modules.reminder.model.ReminderInfos)2