001: /**
002: * LibreSource
003: * Copyright (C) 2004-2008 Artenum SARL / INRIA
004: * http://www.libresource.org - contact@artenum.com
005: *
006: * This file is part of the LibreSource software,
007: * which can be used and distributed under license conditions.
008: * The license conditions are provided in the LICENSE.TXT file
009: * at the root path of the packaging that enclose this file.
010: * More information can be found at
011: * - http://dev.libresource.org/home/license
012: *
013: * Initial authors :
014: *
015: * Guillaume Bort / INRIA
016: * Francois Charoy / Universite Nancy 2
017: * Julien Forest / Artenum
018: * Claude Godart / Universite Henry Poincare
019: * Florent Jouille / INRIA
020: * Sebastien Jourdain / INRIA / Artenum
021: * Yves Lerumeur / Artenum
022: * Pascal Molli / Universite Henry Poincare
023: * Gerald Oster / INRIA
024: * Mariarosa Penzi / Artenum
025: * Gerard Sookahet / Artenum
026: * Raphael Tani / INRIA
027: *
028: * Contributors :
029: *
030: * Stephane Bagnier / Artenum
031: * Amadou Dia / Artenum-IUP Blois
032: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
033: */package org.libresource.mailing.test;
034:
035: import junit.framework.TestCase;
036: import junit.framework.TestSuite;
037:
038: import org.libresource.Libresource;
039:
040: import org.libresource.kernel.interfaces.KernelService;
041:
042: import org.libresource.mailing.interfaces.LibresourceMailingService;
043:
044: import java.net.URI;
045:
046: import java.util.Iterator;
047: import java.util.Vector;
048:
049: import javax.security.auth.callback.CallbackHandler;
050: import javax.security.auth.login.LoginContext;
051:
052: /**
053: * LibreSource
054: * @author <a href="mailto:jouille@loria.fr">Florent Jouille </a>
055: */
056: public class MailingListTest extends TestCase {
057: LoginContext loginContext;
058: KernelService kernelService;
059: String rootNode;
060:
061: public MailingListTest(String arg0) {
062: super (arg0);
063: }
064:
065: protected void setUp() throws Exception {
066: //LibresourceJAAS.loadDefaultJAASConfiguration("jonas");
067: CallbackHandler handler = Libresource.buildCallBackHandler(
068: System.getProperty("user"), System
069: .getProperty("password"));
070: loginContext = new LoginContext("libresource", handler);
071: loginContext.login();
072: kernelService = (KernelService) Libresource
073: .getService("Kernel");
074: rootNode = System.getProperty("rootNode");
075: }
076:
077: protected void tearDown() throws Exception {
078: loginContext.logout();
079: }
080:
081: public void testJames() throws Exception {
082: URI uri = new URI(rootNode + "/test/mailing");
083: LibresourceMailingService mailingService = (LibresourceMailingService) Libresource
084: .getService("LibresourceMailing");
085:
086: //mailingService.sendMessage(uri, "libresource", "jouille", "essai",
087: // "essai");
088: //String text = new String("1254azaz");
089: //System.out.print(text+" -> "+text.matches("[0-9a-zA-Z]"));
090: //kernelService.deleteURI(uri);
091: }
092:
093: public void test() throws Exception {
094: URI uri = new URI(rootNode + "/projects/mailing");
095: LibresourceMailingService mailingService = (LibresourceMailingService) Libresource
096: .getService("LibresourceMailing");
097:
098: Vector mails = mailingService.getSubscribersMails(uri);
099: System.out.println("size : " + mails.size());
100:
101: for (Iterator i = mails.iterator(); i.hasNext();)
102: System.out.println((String) i.next());
103: }
104:
105: public static TestSuite suite() {
106: TestSuite suite = new TestSuite();
107:
108: //suite.addTest(new MailingListTest("testCreate"));
109: //suite.addTest(new MailingListTest("testGet"));
110: //suite.addTest(new BugTrackerTest("testListAt"));
111: //suite.addTest(new MailingListTest("testJames"));
112: suite.addTest(new MailingListTest("test"));
113:
114: return suite;
115: }
116: }
|