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));
}
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));
}
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));
}
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());
}
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));
}
Aggregations