use of org.olat.modules.reminder.model.SentReminderImpl in project OpenOLAT by OpenOLAT.
the class ReminderDAO method markAsSend.
public SentReminderImpl markAsSend(Reminder reminder, Identity identity, String status) {
SentReminderImpl send = new SentReminderImpl();
send.setCreationDate(new Date());
send.setStatus(status);
send.setReminder(reminder);
send.setIdentity(identity);
dbInstance.getCurrentEntityManager().persist(send);
return send;
}
use of org.olat.modules.reminder.model.SentReminderImpl in project OpenOLAT by OpenOLAT.
the class ReminderDAOTest method getReminderInfos.
@Test
public void getReminderInfos() {
// create and reminder and an identity
Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-6");
Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-6a");
Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-6b");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Reminder savedReminder = createAndSaveReminder(entry, creator, 6);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(savedReminder);
// send 2 reminders
SentReminderImpl sentReminder1 = reminderDao.markAsSend(savedReminder, recepient1, "ok");
SentReminderImpl sentReminder2 = reminderDao.markAsSend(savedReminder, recepient2, "error");
dbInstance.commitAndCloseSession();
Assert.assertNotNull(sentReminder1);
Assert.assertNotNull(sentReminder2);
// check reminder infos
List<ReminderInfos> reminderInfos = reminderDao.getReminderInfos(entry);
Assert.assertNotNull(reminderInfos);
Assert.assertEquals(1, reminderInfos.size());
ReminderInfos reminderInfo = reminderInfos.get(0);
Assert.assertNotNull(reminderInfo);
Assert.assertEquals(savedReminder.getKey(), reminderInfo.getKey());
Assert.assertEquals(2, reminderInfo.getNumOfRemindersSent());
Assert.assertEquals(creator.getKey(), reminderInfo.getCreatorKey());
Assert.assertEquals("Reminder - 6", reminderInfo.getDescription());
}
use of org.olat.modules.reminder.model.SentReminderImpl in project OpenOLAT by OpenOLAT.
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 getReminderInfos.
@Test
public void getReminderInfos() {
// create and reminder and an identity
Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-6");
Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-6a");
Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-6b");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Reminder savedReminder = createAndSaveReminder(entry, creator, 6);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(savedReminder);
// send 2 reminders
SentReminderImpl sentReminder1 = reminderDao.markAsSend(savedReminder, recepient1, "ok");
SentReminderImpl sentReminder2 = reminderDao.markAsSend(savedReminder, recepient2, "error");
dbInstance.commitAndCloseSession();
Assert.assertNotNull(sentReminder1);
Assert.assertNotNull(sentReminder2);
// check reminder infos
List<ReminderInfos> reminderInfos = reminderDao.getReminderInfos(entry);
Assert.assertNotNull(reminderInfos);
Assert.assertEquals(1, reminderInfos.size());
ReminderInfos reminderInfo = reminderInfos.get(0);
Assert.assertNotNull(reminderInfo);
Assert.assertEquals(savedReminder.getKey(), reminderInfo.getKey());
Assert.assertEquals(2, reminderInfo.getNumOfRemindersSent());
Assert.assertEquals(creator.getKey(), reminderInfo.getCreatorKey());
Assert.assertEquals("Reminder - 6", reminderInfo.getDescription());
}
use of org.olat.modules.reminder.model.SentReminderImpl in project openolat by klemens.
the class ReminderDAO method markAsSend.
public SentReminderImpl markAsSend(Reminder reminder, Identity identity, String status) {
SentReminderImpl send = new SentReminderImpl();
send.setCreationDate(new Date());
send.setStatus(status);
send.setReminder(reminder);
send.setIdentity(identity);
dbInstance.getCurrentEntityManager().persist(send);
return send;
}
Aggregations