summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/upload/TestFileUpload.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/uitest/src/com/vaadin/tests/components/upload/TestFileUpload.java b/uitest/src/com/vaadin/tests/components/upload/TestFileUpload.java
index ad86d0f593..b57c236b20 100644
--- a/uitest/src/com/vaadin/tests/components/upload/TestFileUpload.java
+++ b/uitest/src/com/vaadin/tests/components/upload/TestFileUpload.java
@@ -8,8 +8,11 @@ import org.apache.commons.codec.digest.DigestUtils;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Upload;
-import com.vaadin.ui.Upload.FinishedEvent;
+import com.vaadin.ui.Upload.FailedEvent;
+import com.vaadin.ui.Upload.FailedListener;
import com.vaadin.ui.Upload.Receiver;
+import com.vaadin.ui.Upload.SucceededEvent;
+import com.vaadin.ui.Upload.SucceededListener;
public class TestFileUpload extends TestBase implements Receiver {
@@ -27,10 +30,22 @@ public class TestFileUpload extends TestBase implements Receiver {
}
});
u.setId("UPL");
- u.addListener(new Upload.FinishedListener() {
+ u.addFailedListener(new FailedListener() {
@Override
- public void uploadFinished(FinishedEvent event) {
+ public void uploadFailed(FailedEvent event) {
+ String hash = DigestUtils.md5Hex(baos.toByteArray());
+
+ log.log("<span style=\"color: red;\">Upload failed. Name: "
+ + event.getFilename() + ", Size: " + baos.size()
+ + ", md5: " + hash + "</span>");
+ baos.reset();
+ }
+ });
+ u.addSucceededListener(new SucceededListener() {
+
+ @Override
+ public void uploadSucceeded(SucceededEvent event) {
String hash = DigestUtils.md5Hex(baos.toByteArray());
log.log("Upload finished. Name: " + event.getFilename()
+ ", Size: " + baos.size() + ", md5: " + hash);