01: package test;
02:
03: import junit.framework.TestCase;
04: import dalma.Engine;
05: import dalma.EngineFactory;
06: import dalma.EndPoint;
07: import dalma.endpoints.email.EmailEndPoint;
08: import dalma.helpers.ThreadPoolExecutor;
09:
10: import java.io.File;
11: import java.text.ParseException;
12:
13: /**
14: * Tests the endpoint configuration via a connection string.
15: * @author Kohsuke Kawaguchi
16: */
17: public class EndPointStringTest extends TestCase {
18: public void test1() throws Exception {
19: Engine engine = EngineFactory.newEngine(new File(
20: "target/endpoint-string-test"), getClass()
21: .getClassLoader(), new ThreadPoolExecutor(3));
22: EndPoint ep = engine.addEndPoint("mail",
23: "smtp://dalma-test1@kohsuke.org!maildir://.");
24: assertTrue(ep instanceof EmailEndPoint);
25:
26: try {
27: engine.addEndPoint("mail", "nosuchprotocol://foo/bar/zot");
28: fail();
29: } catch (ParseException e) {
30: e.printStackTrace();
31: }
32: }
33: }
|