1   /*
2    * $Id: Pop3NamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.transport.email.config;
11  
12  import org.mule.api.MuleException;
13  import org.mule.transport.email.Pop3Connector;
14  import org.mule.transport.email.Pop3sConnector;
15  
16  /**
17   * TODO
18   */
19  public class Pop3NamespaceHandlerTestCase extends AbstractEmailNamespaceHandlerTestCase
20  {
21      protected String getConfigResources()
22      {
23          return "pop3-namespace-config.xml";
24      }
25  
26      public void testConfig() throws Exception
27      {
28          Pop3Connector c = (Pop3Connector)muleContext.getRegistry().lookupConnector("pop3Connector");
29          assertNotNull(c);
30  
31          assertTrue(c.isBackupEnabled());
32          assertEquals("newBackup", c.getBackupFolder());
33          assertEquals(1234, c.getCheckFrequency());
34          assertEquals("newMailbox", c.getMailboxFolder());
35          assertEquals(false, c.isDeleteReadMessages());
36  
37          // authenticator?
38  
39          assertTrue(c.isConnected());
40          assertTrue(c.isStarted());
41  
42      }
43  
44      public void testSecureConfig() throws Exception
45      {
46          Pop3sConnector c = (Pop3sConnector)muleContext.getRegistry().lookupConnector("pop3sConnector");
47          assertNotNull(c);
48  
49          assertTrue(c.isBackupEnabled());
50          assertEquals("newBackup", c.getBackupFolder());
51          assertEquals(1234, c.getCheckFrequency());
52          assertEquals("newMailbox", c.getMailboxFolder());
53          assertEquals(false, c.isDeleteReadMessages());
54  
55          // authenticator?
56  
57          //The full path gets resolved, we're just checkng that the property got set
58          assertTrue(c.getClientKeyStore().endsWith("/greenmail-truststore"));
59          assertEquals("password", c.getClientKeyStorePassword());
60          //The full path gets resolved, we're just checkng that the property got set
61          assertTrue(c.getTrustStore().endsWith("/greenmail-truststore"));
62          assertEquals("password", c.getTrustStorePassword());
63  
64          assertTrue(c.isConnected());
65          assertTrue(c.isStarted());
66      }
67  
68      public void testEndpoint() throws MuleException
69      {
70          testEndpoint("global1", Pop3Connector.POP3);
71          testEndpoint("global2", Pop3Connector.POP3);
72          testEndpoint("global1s", Pop3sConnector.POP3S);
73          testEndpoint("global2s", Pop3sConnector.POP3S);
74      }
75  
76  }