1   /*
2    * Wallace IMAP Server
3    * Copyright (C) 2004  Robert Newson
4    *
5    * This program is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU General Public License
7    * as published by the Free Software Foundation; either version 2
8    * of the License, or (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with this program; if not, write to the Free Software
17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18   */
19  package net.sf.wallace.javamail;
20  
21  import java.util.HashMap;
22  import java.util.Map;
23  
24  import javax.mail.Flags;
25  import javax.mail.Folder;
26  import javax.mail.Message;
27  import javax.mail.MessagingException;
28  import javax.mail.Store;
29  
30  /***
31   * 
32   * 
33   * @author rnewson
34   */
35  public class MockFolder extends Folder {
36  
37      private Map<String, Folder> folders = new HashMap<String, Folder>();
38  
39      private boolean exists = false;
40  
41      private boolean isOpen = false;
42  
43      public MockFolder(final Store newStore) {
44          super(newStore);
45      }
46  
47      public String getName() {
48          return null;
49      }
50  
51      public String getFullName() {
52          return null;
53      }
54  
55      public Folder getParent() throws MessagingException {
56          return null;
57      }
58  
59      public void setExists(final boolean newExists) {
60          exists = newExists;
61      }
62  
63      public boolean exists() {
64          return exists;
65      }
66  
67      /***
68       * 
69       */
70  
71      public Folder[] list(String pattern) throws MessagingException {
72          return null;
73      }
74  
75      /***
76       * 
77       */
78  
79      public char getSeparator() throws MessagingException {
80          return 0;
81      }
82  
83      /***
84       * 
85       */
86  
87      public int getType() throws MessagingException {
88          return 0;
89      }
90  
91      /***
92       * 
93       */
94  
95      public boolean create(int type) throws MessagingException {
96          return false;
97      }
98  
99      /***
100      * 
101      */
102 
103     public boolean hasNewMessages() throws MessagingException {
104         return false;
105     }
106 
107     public void setFolder(final String name, final Folder folder) {
108         folders.put(name, folder);
109     }
110 
111     public Folder getFolder(String name) throws MessagingException {
112         return folders.get(name);
113     }
114 
115     /***
116      * 
117      */
118 
119     public boolean delete(boolean recurse) throws MessagingException {
120         return false;
121     }
122 
123     /***
124      * 
125      */
126 
127     public boolean renameTo(Folder folder) throws MessagingException {
128         return false;
129     }
130 
131     /***
132      * 
133      */
134 
135     public void open(int newMode) throws MessagingException {
136         isOpen = true;
137     }
138 
139     public void close(boolean expunge) throws MessagingException {
140         isOpen = false;
141     }
142 
143     /***
144      * 
145      */
146 
147     public boolean isOpen() {
148         return isOpen;
149     }
150 
151     /***
152      * 
153      */
154 
155     public Flags getPermanentFlags() {
156         return null;
157     }
158 
159     /***
160      * 
161      */
162 
163     public int getMessageCount() throws MessagingException {
164         return 0;
165     }
166 
167     /***
168      * 
169      */
170 
171     public Message getMessage(int msgnum) throws MessagingException {
172         return null;
173     }
174 
175     /***
176      * 
177      */
178 
179     public void appendMessages(Message[] msgs) throws MessagingException {
180     }
181 
182     /***
183      * 
184      */
185 
186     public Message[] expunge() throws MessagingException {
187         return null;
188     }
189 
190 }