Clover Coverage Report - Atlassian Mail
Coverage timestamp: Mon Sep 29 2008 21:26:36 CDT
10   65   7   2.5
6   47   0.7   4
4     1.75  
1    
 
 
  MockMailServerManager       Line # 28 10 7 100% 1.0
 
  (26)
 
1    /*
2    * Created by IntelliJ IDEA.
3    * User: owen
4    * Date: Nov 25, 2002
5    * Time: 10:45:16 AM
6    * CVS Revision: $Revision: 1.11 $
7    * Last CVS Commit: $Date: 2004/01/06 05:43:19 $
8    * Author of last CVS Commit: $Author: dloeng $
9    * To change this template use Options | File Templates.
10    */
11    package test.mock.mail.server;
12   
13    import alt.javax.mail.Session;
14    import com.atlassian.mail.server.managers.OFBizMailServerManager;
15    import com.atlassian.mail.server.MailServer;
16    import com.atlassian.mail.server.SMTPMailServer;
17    import com.atlassian.mail.server.impl.PopMailServerImpl;
18    import com.atlassian.mail.MailException;
19    import com.opensymphony.util.TextUtils;
20    import org.ofbiz.core.entity.GenericValue;
21   
22    import javax.mail.Authenticator;
23    import java.util.Map;
24    import java.util.Properties;
25   
26    import test.mock.mail.MockSession;
27   
 
28    public class MockMailServerManager extends OFBizMailServerManager
29    {
30    private MockSession mockSession = new MockSession();
31   
 
32  21 toggle public Map getMapFromColumns(MailServer mailServer) throws MailException
33    {
34  21 return super.getMapFromColumns(mailServer);
35    }
36   
 
37  10 toggle public GenericValue getMailServerGV(Long id) throws MailException
38    {
39  10 return super.getMailServerGV(id);
40    }
41   
 
42  33 toggle public MailServer constructMailServer(GenericValue gv)
43    {
44  33 if (SERVER_TYPES[0].equals(gv.getString("type")))
45  9 return new PopMailServerImpl(gv.getLong("id"), gv.getString("name"), gv.getString("description"), gv.getString("servername"), gv.getString("username"), gv.getString("password"));
46  24 else if (SERVER_TYPES[1].equals(gv.getString("type")))
47    {
48  22 if (TextUtils.stringSet(gv.getString("servername")))
49    {
50  20 return new MockSMTPMailServer(gv.getLong("id"), gv.getString("name"), gv.getString("description"), gv.getString("from"), gv.getString("prefix"), false, gv.getString("servername"), gv.getString("username"), gv.getString("password"));
51    }
52    else
53    {
54  2 return new MockSMTPMailServer(gv.getLong("id"), gv.getString("name"), gv.getString("description"), gv.getString("from"), gv.getString("prefix"), true, gv.getString("jndilocation"), gv.getString("username"), gv.getString("password"));
55    }
56    }
57    else
58  2 return null;
59    }
60   
 
61  1 toggle public Session getSession(Properties props, Authenticator auth)
62    {
63  1 return mockSession.getInstance(props, auth);
64    }
65    }