1
2
3
4
5
6
7
8
9
10 package org.mule.transport.email.config;
11
12 import org.mule.api.MuleException;
13 import org.mule.transport.email.ImapConnector;
14 import org.mule.transport.email.ImapsConnector;
15
16 public class ImapNamespaceHandlerTestCase extends AbstractEmailNamespaceHandlerTestCase
17 {
18 protected String getConfigResources()
19 {
20 return "imap-namespace-config.xml";
21 }
22
23 public void testConfig() throws Exception
24 {
25 ImapConnector c = (ImapConnector)muleContext.getRegistry().lookupConnector("imapConnector");
26 assertNotNull(c);
27
28 assertTrue(c.isBackupEnabled());
29 assertEquals("newBackup", c.getBackupFolder());
30 assertEquals(1234, c.getCheckFrequency());
31 assertEquals("newMailbox", c.getMailboxFolder());
32 assertEquals(false, c.isDeleteReadMessages());
33
34
35
36 assertTrue(c.isConnected());
37 assertTrue(c.isStarted());
38 }
39
40 public void testSecureConfig() throws Exception
41 {
42 ImapsConnector c = (ImapsConnector)muleContext.getRegistry().lookupConnector("imapsConnector");
43 assertNotNull(c);
44
45 assertFalse(c.isBackupEnabled());
46 assertEquals("newBackup", c.getBackupFolder());
47 assertEquals(1234, c.getCheckFrequency());
48 assertEquals("newMailbox", c.getMailboxFolder());
49 assertEquals(false, c.isDeleteReadMessages());
50
51
52
53
54 assertTrue(c.getClientKeyStore().endsWith("/greenmail-truststore"));
55 assertEquals("password", c.getClientKeyStorePassword());
56
57 assertTrue(c.getTrustStore().endsWith("/greenmail-truststore"));
58 assertEquals("password", c.getTrustStorePassword());
59
60 assertTrue(c.isConnected());
61 assertTrue(c.isStarted());
62 }
63
64 public void testEndpoint() throws MuleException
65 {
66 testEndpoint("global1", ImapConnector.IMAP);
67 testEndpoint("global2", ImapConnector.IMAP);
68 testEndpoint("global1s", ImapsConnector.IMAPS);
69 testEndpoint("global2s", ImapsConnector.IMAPS);
70 }
71
72 }