use of org.olat.core.commons.services.notifications.manager.NotificationsManagerImpl in project OpenOLAT by OpenOLAT.
the class NotificationsManagerTest method testDuplicateSubscribers.
@Test(expected = DBRuntimeException.class)
public void testDuplicateSubscribers() throws Exception {
try {
PublisherData pd = new PublisherData("CreateSubscriber@2x", "e.g. forumdata=keyofforum", null);
SubscriptionContext sc = new SubscriptionContext("Course", new Long(1238778567), UUID.randomUUID().toString().replace("-", ""));
Identity id = JunitTestHelper.createAndPersistIdentityAsUser("fci@2x-" + UUID.randomUUID().toString());
Publisher publisher = notificationManager.getOrCreatePublisher(sc, pd);
dbInstance.commit();
((NotificationsManagerImpl) notificationManager).doCreateAndPersistSubscriber(publisher, id);
dbInstance.commit();
((NotificationsManagerImpl) notificationManager).doCreateAndPersistSubscriber(publisher, id);
dbInstance.commit();
} catch (Exception e) {
dbInstance.rollback();
throw e;
}
}
use of org.olat.core.commons.services.notifications.manager.NotificationsManagerImpl in project openolat by klemens.
the class NotificationsManagerTest method testDuplicateSubscribers.
@Test(expected = DBRuntimeException.class)
public void testDuplicateSubscribers() throws Exception {
try {
PublisherData pd = new PublisherData("CreateSubscriber@2x", "e.g. forumdata=keyofforum", null);
SubscriptionContext sc = new SubscriptionContext("Course", new Long(1238778567), UUID.randomUUID().toString().replace("-", ""));
Identity id = JunitTestHelper.createAndPersistIdentityAsUser("fci@2x-" + UUID.randomUUID().toString());
Publisher publisher = notificationManager.getOrCreatePublisher(sc, pd);
dbInstance.commit();
((NotificationsManagerImpl) notificationManager).doCreateAndPersistSubscriber(publisher, id);
dbInstance.commit();
((NotificationsManagerImpl) notificationManager).doCreateAndPersistSubscriber(publisher, id);
dbInstance.commit();
} catch (Exception e) {
dbInstance.rollback();
throw e;
}
}
Aggregations