Source Code Cross Referenced for AddMessageFolderTest.java in  » Mail-Clients » columba-1.4 » org » columba » mail » folder » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Mail Clients » columba 1.4 » org.columba.mail.folder 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //The contents of this file are subject to the Mozilla Public License Version 1.1
002:        //(the "License"); you may not use this file except in compliance with the
003:        //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
004:        //
005:        //Software distributed under the License is distributed on an "AS IS" basis,
006:        //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
007:        //for the specific language governing rights and
008:        //limitations under the License.
009:        //
010:        //The Original Code is "The Columba Project"
011:        //
012:        //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
013:        //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
014:        //
015:        //All Rights Reserved.
016:        package org.columba.mail.folder;
017:
018:        import java.io.ByteArrayInputStream;
019:        import java.io.InputStream;
020:
021:        import org.columba.mail.folder.command.MarkMessageCommand;
022:        import org.columba.ristretto.message.MailboxInfo;
023:
024:        /**
025:         * Add message to folder testcase.
026:         *
027:         * @author fdietz
028:         */
029:        public class AddMessageFolderTest extends AbstractFolderTst {
030:
031:            public AddMessageFolderTest(String arg0) {
032:                super (arg0);
033:            }
034:
035:            /**
036:             * Constructor for CachedMHFolderTest.
037:             *
038:             * @param arg0
039:             */
040:            public AddMessageFolderTest(MailboxTstFactory factory, String arg0) {
041:                super (factory, arg0);
042:            }
043:
044:            /**
045:             * Add a message as InputStream to MHCachedFolder.
046:             * <p>
047:             * Check if message in folder is identical.
048:             * <p>
049:             * Check if total message count of folder was incremented correctly.
050:             *
051:             * @throws Exception
052:             */
053:            public void testAddMessage() throws Exception {
054:
055:                Object[] uids1 = getSourceFolder().getUids();
056:                assertEquals("starting with empty folder", 0, uids1.length);
057:
058:                IMailboxInfo info1 = getSourceFolder().getMessageFolderInfo();
059:                assertEquals("starting with empty folder", 0, info1.getExists());
060:
061:                // add message "0.eml" as inputstream to folder
062:                String input = FolderTstHelper.getString(0);
063:                System.out.println("input=" + input);
064:
065:                // create stream from string
066:                ByteArrayInputStream inputStream = FolderTstHelper
067:                        .getByteArrayInputStream(input);
068:
069:                // add stream to folder
070:                Object uid = getSourceFolder().addMessage(inputStream);
071:
072:                // get inputstream of this message from folder
073:                InputStream outputStream = sourceFolder
074:                        .getMessageSourceStream(uid);
075:
076:                // create string from inputstream
077:                String output = FolderTstHelper
078:                        .getStringFromInputStream(outputStream);
079:
080:                // compare both messages
081:                assertEquals("message source should be equal", input, output);
082:
083:                Object[] uids = getSourceFolder().getUids();
084:                assertEquals("one message should be in this folder", 1,
085:                        uids.length);
086:
087:                IMailboxInfo info = getSourceFolder().getMessageFolderInfo();
088:                assertEquals("message-folderinfo exists", 1, info.getExists());
089:
090:                // close streams
091:                inputStream.close();
092:                outputStream.close();
093:            }
094:
095:            /**
096:             * Check if MailFolderInfo is properly set based on message attributes.
097:             * <p>
098:             */
099:            public void testAddAttributesTest() throws Exception {
100:
101:                Object[] uids1 = getSourceFolder().getUids();
102:                assertEquals("starting with empty folder", 0, uids1.length);
103:
104:                IMailboxInfo info1 = getSourceFolder().getMessageFolderInfo();
105:                assertEquals("starting with empty folder", 0, info1.getExists());
106:
107:                //		 add message "0.eml" as inputstream to folder
108:                String input = FolderTstHelper.getString(0);
109:                System.out.println("input=" + input);
110:
111:                // create stream from string
112:                ByteArrayInputStream inputStream = FolderTstHelper
113:                        .getByteArrayInputStream(input);
114:
115:                // add stream to folder
116:                Object uid = getSourceFolder().addMessage(inputStream);
117:                // mark message as read
118:                getSourceFolder().markMessage(new Object[] { uid },
119:                        MarkMessageCommand.MARK_AS_READ);
120:
121:                IMailboxInfo info = getSourceFolder().getMessageFolderInfo();
122:
123:                assertEquals("message-folderinfo exists", 1, info.getExists());
124:                assertEquals("Number of unseen messages in folder", 0, info
125:                        .getUnseen());
126:
127:                // close streams
128:                inputStream.close();
129:            }
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.