View Javadoc
1   //
2   // $Id$
3   //
4   // jupload - A file upload applet.
5   //
6   // Copyright 2010 The JUpload Team
7   //
8   // Created: 3 fevr. 2010
9   // Creator: etienne_sf
10  // Last modified: $Date$
11  //
12  // This program is free software; you can redistribute it and/or modify
13  // it under the terms of the GNU General Public License as published by
14  // the Free Software Foundation; either version 2 of the License, or
15  // (at your option) any later version.
16  //
17  // This program is distributed in the hope that it will be useful,
18  // but WITHOUT ANY WARRANTY; without even the implied warranty of
19  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  // GNU General Public License for more details.
21  //
22  // You should have received a copy of the GNU General Public License
23  // along with this program; if not, write to the Free Software
24  // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  
26  package wjhk.jupload2.testhelpers;
27  
28  import wjhk.jupload2.exception.JUploadException;
29  import wjhk.jupload2.upload.FileUploadManagerThread;
30  import wjhk.jupload2.upload.UploadFileData;
31  import wjhk.jupload2.upload.UploadFilePacket;
32  
33  /**
34   * @author etienne_sf
35   * 
36   */
37  public class FileUploadManagerThreadTestHelper extends Thread implements
38  		FileUploadManagerThread {
39  
40  	/**  */
41  	public JUploadException uploadException = new JUploadException(
42  			new UnsupportedOperationException(this.getClass()
43  					+ ": uploadException is not supported in tests cases"));
44  
45  	/** We need this status here, for all test on other threads */
46  	boolean uploadFinished = false;
47  
48  	/**
49  	 * @see wjhk.jupload2.upload.FileUploadManagerThread#anotherFileHasBeenSent(wjhk.jupload2.upload.UploadFilePacket,
50  	 *      wjhk.jupload2.upload.UploadFileData)
51  	 */
52  	public void anotherFileHasBeenSent(UploadFilePacket uploadFilePacket,
53  			UploadFileData newlyUploadedFileData) throws JUploadException {
54  		throw new UnsupportedOperationException(this.getClass()
55  				+ ".anotherFileHasBeenSent() is not implemented in tests cases");
56  	}
57  
58  	/**
59  	 * @see wjhk.jupload2.upload.FileUploadManagerThread#currentRequestIsFinished(wjhk.jupload2.upload.UploadFilePacket)
60  	 */
61  	public void currentRequestIsFinished(UploadFilePacket packet)
62  			throws JUploadException {
63  		throw new UnsupportedOperationException(
64  				this.getClass()
65  						+ ".currentRequestIsFinished() is not implemented in tests cases");
66  	}
67  
68  	/**
69  	 * @see wjhk.jupload2.upload.FileUploadManagerThread#getUploadException()
70  	 */
71  	public JUploadException getUploadException() {
72  		return this.uploadException;
73  	}
74  
75  	/**
76  	 * Needs to be implemented, as the return for thie method is used in all
77  	 * other threads.
78  	 * 
79  	 * @see wjhk.jupload2.upload.FileUploadManagerThread#isUploadFinished()
80  	 */
81  	public boolean isUploadFinished() {
82  		return this.uploadFinished;
83  	}
84  
85  	/**
86  	 * Always return false.
87  	 * 
88  	 * @return true, if stopped by the 'user'.
89  	 */
90  	public boolean isUploadStopped() {
91  		return false;
92  	}
93  
94  	/**
95  	 * @see wjhk.jupload2.upload.FileUploadManagerThread#nbBytesUploaded(long,
96  	 *      UploadFileData)
97  	 */
98  	public void nbBytesUploaded(long nbBytes, UploadFileData uploadFileData)
99  			throws JUploadException {
100 		throw new UnsupportedOperationException(this.getClass()
101 				+ ".nbBytesUploaded() is not implemented in tests cases");
102 	}
103 
104 	/**
105 	 * @see wjhk.jupload2.upload.FileUploadManagerThread#run()
106 	 */
107 	@Override
108 	public void run() {
109 		throw new UnsupportedOperationException(this.getClass()
110 				+ ".run() is not implemented in tests cases");
111 	}
112 
113 	/**
114 	 * @see wjhk.jupload2.upload.FileUploadManagerThread#setUploadException(wjhk.jupload2.exception.JUploadException)
115 	 */
116 	public void setUploadException(JUploadException uploadException) {
117 		this.uploadException = uploadException;
118 	}
119 
120 	/**
121 	 * @see wjhk.jupload2.upload.FileUploadManagerThread#setUploadStatus(wjhk.jupload2.upload.UploadFilePacket,
122 	 *      wjhk.jupload2.upload.UploadFileData, int)
123 	 */
124 	public void setUploadStatus(UploadFilePacket uploadFilePacket,
125 			UploadFileData uploadFileData, int uploadStatus)
126 			throws JUploadException {
127 		throw new UnsupportedOperationException(this.getClass()
128 				+ ".setUploadStatus() is not implemented in tests cases");
129 	}
130 
131 	/**
132 	 * @see wjhk.jupload2.upload.FileUploadManagerThread#stopUpload()
133 	 */
134 	public void stopUpload() {
135 		throw new UnsupportedOperationException(this.getClass()
136 				+ ".stopUpload() is not implemented in tests cases");
137 	}
138 }