Source Code Cross Referenced for TestBigTransfer.java in  » Net » edtftpj » com » enterprisedt » net » ftp » test » 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 » Net » edtftpj » com.enterprisedt.net.ftp.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *
003:         *  edtFTPj
004:         *
005:         *  Copyright (C) 2005  Enterprise Distributed Technologies Ltd
006:         *
007:         *  www.enterprisedt.com
008:         *
009:         *  This library is free software; you can redistribute it and/or
010:         *  modify it under the terms of the GNU Lesser General Public
011:         *  License as published by the Free Software Foundation; either
012:         *  version 2.1 of the License, or (at your option) any later version.
013:         *
014:         *  This library is distributed in the hope that it will be useful,
015:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         *  Lesser General Public License for more details.
018:         *
019:         *  You should have received a copy of the GNU Lesser General Public
020:         *  License along with this library; if not, write to the Free Software
021:         *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
022:         *
023:         *  Bug fixes, suggestions and comments should posted on the EDT forums at
024:         *  http://www.enterprisedt.com/forums/index.php
025:         *
026:         *  Change Log:
027:         *
028:         *        $Log: TestBigTransfer.java,v $
029:         *        Revision 1.2  2005/07/15 17:30:06  bruceb
030:         *        rework of unit testing structure
031:         *
032:         *        Revision 1.1  2005/03/18 13:42:06  bruceb
033:         *        tests big files
034:         *
035:         *        Revision 1.1  2005/01/14 18:07:37  bruceb
036:         *        bulk test2 TestBulkTransfer.java
037:         *
038:         *
039:         */package com.enterprisedt.net.ftp.test;
040:
041:        import java.io.File;
042:
043:        import junit.framework.Test;
044:        import junit.framework.TestSuite;
045:
046:        import com.enterprisedt.net.ftp.FTPProgressMonitor;
047:        import com.enterprisedt.net.ftp.FTPTransferType;
048:
049:        /**
050:         * Test get'ing and put'ing of a big file
051:         * 
052:         * @author Bruce Blackshaw
053:         * @version $Revision: 1.2 $
054:         */
055:        public class TestBigTransfer extends FTPTestCase {
056:
057:            /**
058:             * Revision control id
059:             */
060:            public static String cvsId = "@(#)$Id: TestBigTransfer.java,v 1.2 2005/07/15 17:30:06 bruceb Exp $";
061:
062:            /**
063:             * Interval between reporting progress
064:             */
065:            private static int PROGRESS_INTERVAL = 1048575;
066:
067:            /**
068:             * get name of log file
069:             * 
070:             * @return name of file to log to
071:             */
072:            protected String getLogName() {
073:                return "TestTransferLarge.log";
074:            }
075:
076:            /**
077:             * Test transfering a binary file
078:             */
079:            public void testTransferLarge() throws Exception {
080:                log.debug("TransferLarge()");
081:
082:                connect();
083:
084:                // move to test directory
085:                ftp.chdir(testdir);
086:                ftp.setType(FTPTransferType.BINARY);
087:
088:                ftp.setProgressMonitor(new TestProgressMonitor(),
089:                        PROGRESS_INTERVAL);
090:
091:                bigTransfer(localBigFile);
092:
093:                ftp.quit();
094:            }
095:
096:            /**
097:             * Transfer back and forth multiple times
098:             */
099:            private void bigTransfer(String bigFile) throws Exception {
100:
101:                ftp.put(localDataDir + bigFile, bigFile);
102:
103:                ftp.get(localDataDir + bigFile + ".copy", bigFile);
104:
105:                // delete remote file
106:                ftp.delete(bigFile);
107:
108:                // check equality of local files
109:                assertIdentical(localDataDir + bigFile + ".copy", localDataDir
110:                        + bigFile);
111:
112:                // and delete local file
113:                File local = new File(localDataDir + bigFile + ".copy");
114:                local.delete();
115:            }
116:
117:            /**
118:             *  Automatic test suite construction
119:             *
120:             *  @return  suite of tests for this class
121:             */
122:            public static Test suite() {
123:                return new TestSuite(TestBigTransfer.class);
124:            }
125:
126:            /**
127:             *  Enable our class to be run, doing the
128:             *  tests
129:             */
130:            public static void main(String[] args) {
131:                junit.textui.TestRunner.run(suite());
132:            }
133:
134:            /**
135:             *  As soon it receives notification of bytes transferred, it
136:             *  cancels the transfer    
137:             */
138:            class TestProgressMonitor implements  FTPProgressMonitor {
139:
140:                /* (non-Javadoc)
141:                 * @see com.enterprisedt.net.ftp.FTPProgressMonitor#bytesTransferred(long)
142:                 */
143:                public void bytesTransferred(long bytes) {
144:                    log.debug(bytes + " transferred");
145:                }
146:            }
147:
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.