|
@@ -21,18 +21,45 @@ import static junit.framework.TestCase.assertTrue;
|
|
|
public class UploadIT extends AbstractIT {
|
|
|
|
|
|
@Test
|
|
|
- public void testSimpleUpload() {
|
|
|
- OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/123.txt",
|
|
|
- "/testUpload/1.txt", account.name);
|
|
|
+ public void testEmptyUpload() {
|
|
|
+ OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/empty.txt",
|
|
|
+ "/testUpload/empty.txt", account.name);
|
|
|
+
|
|
|
+ RemoteOperationResult result = testUpload(ocUpload);
|
|
|
+
|
|
|
+ assertTrue(result.isSuccess());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testNonEmptyUpload() {
|
|
|
+ OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
|
|
|
+ "/testUpload/nonEmpty.txt", account.name);
|
|
|
+
|
|
|
+ RemoteOperationResult result = testUpload(ocUpload);
|
|
|
+
|
|
|
+ assertTrue(result.isSuccess());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testChunkedUpload() {
|
|
|
+ OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/chunkedFile.txt",
|
|
|
+ "/testUpload/chunkedFile.txt", account.name);
|
|
|
+
|
|
|
+ RemoteOperationResult result = testUpload(ocUpload);
|
|
|
+
|
|
|
+ assertTrue(result.isSuccess());
|
|
|
+ }
|
|
|
+
|
|
|
+ public RemoteOperationResult testUpload(OCUpload ocUpload) {
|
|
|
UploadFileOperation newUpload = new UploadFileOperation(
|
|
|
- account,
|
|
|
- null,
|
|
|
- ocUpload,
|
|
|
- false,
|
|
|
- FileUploader.LOCAL_BEHAVIOUR_COPY,
|
|
|
- context,
|
|
|
- false,
|
|
|
- false
|
|
|
+ account,
|
|
|
+ null,
|
|
|
+ ocUpload,
|
|
|
+ false,
|
|
|
+ FileUploader.LOCAL_BEHAVIOUR_COPY,
|
|
|
+ context,
|
|
|
+ false,
|
|
|
+ false
|
|
|
);
|
|
|
newUpload.addRenameUploadListener(() -> {
|
|
|
// dummy
|
|
@@ -40,13 +67,12 @@ public class UploadIT extends AbstractIT {
|
|
|
|
|
|
newUpload.setRemoteFolderToBeCreated();
|
|
|
|
|
|
- RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
|
|
- assertTrue(result.isSuccess());
|
|
|
+ return newUpload.execute(client, getStorageManager());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void testUploadInNonExistingFolder() {
|
|
|
- OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/123.txt",
|
|
|
+ OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/empty.txt",
|
|
|
"/testUpload/2/3/4/1.txt", account.name);
|
|
|
UploadFileOperation newUpload = new UploadFileOperation(
|
|
|
account,
|