コード例 #1
0
 @Override
 public Collection getListElements(String instanceId, int nbReturned) throws RemoteException {
   ServicesFactory servicesFactory = ServicesFactory.getFactory();
   MailingList mailingList = servicesFactory.getMailingListService().findMailingList(instanceId);
   return servicesFactory
       .getMessageService()
       .listDisplayableMessages(mailingList, nbReturned, new OrderBy("sentDate", true));
 }
コード例 #2
0
 @Override
 public void delete(Connection con, String spaceId, String componentId, String userId)
     throws InstanciationException {
   SilverTrace.info(
       "mailingList",
       "MailingListInstanciator.delete()",
       "root.MSG_GEN_ENTER_METHOD",
       "space = " + spaceId + ", componentId = " + componentId + ", userId =" + userId);
   ServicesFactory servicesFactory = ServicesFactory.getFactory();
   servicesFactory.getMailingListService().deleteMailingList(componentId);
   SilverTrace.info("mailingList", "MailingListInstanciator.delete()", "root.MSG_GEN_EXIT_METHOD");
   servicesFactory.getMessageChecker().removeListener(componentId);
 }
コード例 #3
0
 @Override
 public void create(Connection con, String spaceId, String componentId, String userId)
     throws InstanciationException {
   SilverTrace.info(
       "mailingList",
       "MailingListInstanciator.create()",
       "root.MSG_GEN_ENTER_METHOD",
       "space = " + spaceId + ", componentId = " + componentId + ", userId =" + userId);
   MailingList mailingList = new MailingList();
   mailingList.setComponentId(componentId);
   ServicesFactory servicesFactory = ServicesFactory.getFactory();
   SilverTrace.info("mailingList", "MailingListInstanciator.create()", "root.MSG_GEN_EXIT_METHOD");
   servicesFactory.getMailingListService().createMailingList(mailingList);
   SilverTrace.info("mailingList", "MailingListInstanciator.create()", "root.MSG_GEN_EXIT_METHOD");
   // mailingList = servicesFactory.getMailingListService().findMailingList(componentId);
   MailingListComponent component = new MailingListComponent(componentId);
   servicesFactory.getMessageChecker().addMessageListener(component);
 }
 @Before
 public void onSetUp() {
   super.onSetUp();
   Mailbox.clearAll();
   IDatabaseConnection connection = null;
   try {
     connection = getConnection();
     DatabaseOperation.DELETE_ALL.execute(connection, getDataSet());
     DatabaseOperation.CLEAN_INSERT.execute(connection, getDataSet());
   } catch (Exception ex) {
     ex.printStackTrace();
   } finally {
     if (connection != null) {
       try {
         connection.getConnection().close();
       } catch (SQLException e) {
         e.printStackTrace();
       }
     }
   }
   ServicesFactory.getInstance().setApplicationContext(applicationContext);
 }
コード例 #5
0
 @Override
 public String getElementLink(Message message, String userId) {
   return ServicesFactory.getFactory().getNotificationFormatter().prepareUrl(message, false);
 }
 @Test
 public void testOnMessageNotModeratedNotify() throws Exception {
   MailingListComponent componentNotModerated = new MailingListComponent("101");
   MailingList list = ServicesFactory.getMailingListService().findMailingList("101");
   assertNotNull(list);
   assertNotNull(list.getModerators());
   assertEquals(3, list.getModerators().size());
   assertNotNull(list.getReaders());
   assertEquals(2, list.getReaders().size());
   assertFalse(list.isModerated());
   assertTrue(list.isNotify());
   Message message = ServicesFactory.getMessageService().getMessage("701");
   assertEquals(textEmailContent, message.getBody());
   message.setContentType("text/plain; charset=\"UTF-8\"");
   MessageEvent event = new MessageEvent();
   event.addMessage(message);
   componentNotModerated.onMessage(event);
   List<TextMessage> jmsMessages = MockObjectFactory.getMessages(JNDINames.JMS_QUEUE);
   assertNotNull(jmsMessages);
   assertEquals(5, jmsMessages.size());
   for (TextMessage alert : jmsMessages) {
     assertNotNull(alert.getText());
     NotificationData data = NotificationServerUtil.convertXMLToNotificationData(alert.getText());
     assertNotNull(data);
     String channel = data.getTargetChannel();
     assertEquals("SMTP", channel);
     String recipient = data.getTargetReceipt();
     assertNotNull(recipient);
     assertTrue(
         "Erreur destinataire " + recipient,
         "*****@*****.**".equals(recipient)
             || "*****@*****.**".equals(recipient)
             || "*****@*****.**".equals(recipient)
             || "*****@*****.**".equals(recipient)
             || "*****@*****.**".equals(recipient));
     assertEquals(message.getSummary(), data.getMessage());
     String url = (String) data.getTargetParam().get("URL");
     assertNotNull(url);
     assertEquals(
         "http://*****:*****@silverpeas.com", source);
   }
   checkSimpleEmail(
       "*****@*****.**",
       "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**",
       "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**", "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**",
       "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**", "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**", "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**",
       "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**", "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**",
       "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**",
       "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**",
       "[Liste de diffusion de test non modérée] : Simple Message");
   checkSimpleEmail(
       "*****@*****.**",
       "[Liste de diffusion de test non modérée] : Simple Message");
 }