1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Let the setup() - testXXX() - tearDown() flow normally

This commit is contained in:
David A. Velasco 2014-11-17 12:34:17 +01:00
parent fcf3bd2769
commit a5a2b2890f
3 changed files with 48 additions and 83 deletions

View File

@ -30,8 +30,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.test_project.TestActivity;
import android.util.Log;
/**
* Class to test Delete a File Operation
* @author masensio
@ -48,8 +46,6 @@ public class DeleteFileTest extends RemoteTest {
/* File to delete. */
private static final String FILE_PATH = "/fileToDelete.txt";
private static boolean mGlobalSetupDone = false;
private TestActivity mActivity;
private String mFullPath2Folder;
private String mFullPath2File;
@ -62,9 +58,6 @@ public class DeleteFileTest extends RemoteTest {
mFullPath2Folder = mBaseFolderPath + FOLDER_PATH;
mFullPath2File = mBaseFolderPath + FILE_PATH;
if (!mGlobalSetupDone) {
Log.v(LOG_TAG, "Starting global set up");
RemoteOperationResult result = mActivity.createFolder(mFullPath2Folder, true);
if (!result.isSuccess() && result.getCode() != ResultCode.TIMEOUT) {
Utils.logAndThrow(LOG_TAG, result);
@ -79,10 +72,6 @@ public class DeleteFileTest extends RemoteTest {
Utils.logAndThrow(LOG_TAG, result);
}
Log.v(LOG_TAG, "Global set up done");
mGlobalSetupDone = true;
}
}
/**

View File

@ -31,8 +31,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.test_project.TestActivity;
import android.util.Log;
/**
* Class to test Download File Operation
* @author masensio
@ -49,8 +47,6 @@ public class DownloadFileTest extends RemoteTest {
private static final String IMAGE_PATH_WITH_SPECIAL_CHARS = "/@file@download.png";
private static final String IMAGE_NOT_FOUND = "/fileNotFound.png";
private static boolean mGlobalSetupDone = false;
private String mFullPath2Image;
private String mFullPath2ImageWitSpecialChars;
private String mFullPath2ImageNotFound;
@ -68,8 +64,6 @@ public class DownloadFileTest extends RemoteTest {
mFullPath2ImageWitSpecialChars = mBaseFolderPath + IMAGE_PATH_WITH_SPECIAL_CHARS;
mFullPath2ImageNotFound = mBaseFolderPath + IMAGE_NOT_FOUND;
if (!mGlobalSetupDone) {
File imageFile = mActivity.extractAsset(TestActivity.ASSETS__IMAGE_FILE_NAME);
RemoteOperationResult result = mActivity.uploadFile(
@ -93,10 +87,6 @@ public class DownloadFileTest extends RemoteTest {
Utils.logAndThrow(LOG_TAG, result);
}
Log.v(LOG_TAG, "Global set up done");
mGlobalSetupDone = true;
}
}
/**

View File

@ -31,8 +31,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.lib.test_project.TestActivity;
import android.util.Log;
/**
* Class to test Rename File Operation
* @author masensio
@ -56,8 +54,6 @@ public class RenameFileTest extends RemoteTest {
private static final String NEW_FILE_PATH = FileUtils.PATH_SEPARATOR + NEW_FILE_NAME;
private static boolean mGlobalSetupDone = false;
private String mToCleanUpInServer;
private TestActivity mActivity;
private String mFullPath2OldFolder;
@ -75,10 +71,6 @@ public class RenameFileTest extends RemoteTest {
mFullPath2OldFile = mBaseFolderPath + OLD_FILE_PATH;
mFullPath2NewFile = mBaseFolderPath + NEW_FILE_PATH;
if (!mGlobalSetupDone) {
Log.v(LOG_TAG, "Starting global set up");
RemoteOperationResult result = mActivity.createFolder(mFullPath2OldFolder, true);
if (!result.isSuccess() && result.getCode() != ResultCode.TIMEOUT) {
Utils.logAndThrow(LOG_TAG, result);
@ -93,10 +85,6 @@ public class RenameFileTest extends RemoteTest {
Utils.logAndThrow(LOG_TAG, result);
}
Log.v(LOG_TAG, "Global set up done");
mGlobalSetupDone = true;
}
mToCleanUpInServer = null;
}
@ -232,14 +220,12 @@ public class RenameFileTest extends RemoteTest {
@Override
protected void tearDown() throws Exception {
/*
if (mToCleanUpInServer != null) {
RemoteOperationResult removeResult = mActivity.removeFile(mToCleanUpInServer);
if (!removeResult.isSuccess()) {
Utils.logAndThrow(LOG_TAG, removeResult);
}
}
*/
super.tearDown();
}