1
0
mirror of https://github.com/owncloud/android-library.git synced 2026-08-12 00:42:58 +00:00

Updated test with needed params

This commit is contained in:
davigonz
2016-12-15 09:27:14 +01:00
parent 576231023b
commit b9492966a5
3 changed files with 21 additions and 9 deletions
@@ -249,10 +249,10 @@ public class TestActivity extends Activity {
public RemoteOperationResult uploadFile(
String storagePath, String remotePath, String mimeType
) {
return TestActivity.uploadFile(storagePath, remotePath, mimeType, mClient);
}
/** Access to the library method to Upload a File
* @param storagePath
* @param remotePath
@@ -264,14 +264,18 @@ public class TestActivity extends Activity {
public static RemoteOperationResult uploadFile(
String storagePath, String remotePath, String mimeType, OwnCloudClient client
) {
UploadRemoteFileOperation uploadOperation;
String fileLastModifTimestamp = getFileLastModifTimeStamp(storagePath);
UploadRemoteFileOperation uploadOperation;
if ((new File(storagePath)).length() > ChunkedUploadRemoteFileOperation.CHUNK_SIZE ) {
uploadOperation = new ChunkedUploadRemoteFileOperation(
storagePath, remotePath, mimeType
storagePath, remotePath, mimeType, fileLastModifTimestamp
);
} else {
uploadOperation = new UploadRemoteFileOperation(
storagePath, remotePath, mimeType
storagePath, remotePath, mimeType, fileLastModifTimestamp
);
}
@@ -381,5 +385,9 @@ public class TestActivity extends Activity {
return extractedFile;
}
private static String getFileLastModifTimeStamp (String storagePath) {
File file = new File(storagePath);
Long timeStampLong = file.lastModified()/1000;
return timeStampLong.toString();
}
}
@@ -69,7 +69,7 @@ public class UploadFileTest extends RemoteTest {
* Test Upload File without chunks
*/
public void testUploadFile() {
String fullPath2Upload = mBaseFolderPath + UPLOAD_PATH;
RemoteOperationResult result = mActivity.uploadFile(
mFileToUpload.getAbsolutePath(),
@@ -121,5 +121,4 @@ public class UploadFileTest extends RemoteTest {
}
super.tearDown();
}
}