mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 10:27:45 +00:00 
			
		
		
		
	Let the setup() - testXXX() - tearDown() flow normally
This commit is contained in:
		
							parent
							
								
									fcf3bd2769
								
							
						
					
					
						commit
						a5a2b2890f
					
				| @ -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.common.operations.RemoteOperationResult.ResultCode; | ||||||
| import com.owncloud.android.lib.test_project.TestActivity; | import com.owncloud.android.lib.test_project.TestActivity; | ||||||
| 
 | 
 | ||||||
| import android.util.Log; |  | ||||||
| 
 |  | ||||||
| /** | /** | ||||||
|  * Class to test Delete a File Operation |  * Class to test Delete a File Operation | ||||||
|  * @author masensio |  * @author masensio | ||||||
| @ -48,8 +46,6 @@ public class DeleteFileTest extends RemoteTest { | |||||||
| 	/* File to delete. */ | 	/* File to delete. */ | ||||||
| 	private static final String FILE_PATH = "/fileToDelete.txt"; | 	private static final String FILE_PATH = "/fileToDelete.txt"; | ||||||
| 
 | 
 | ||||||
| 	private static boolean mGlobalSetupDone = false; |  | ||||||
| 	 |  | ||||||
| 	private TestActivity mActivity; | 	private TestActivity mActivity; | ||||||
| 	private String mFullPath2Folder;  | 	private String mFullPath2Folder;  | ||||||
| 	private String mFullPath2File;  | 	private String mFullPath2File;  | ||||||
| @ -62,9 +58,6 @@ public class DeleteFileTest extends RemoteTest { | |||||||
| 		mFullPath2Folder = mBaseFolderPath + FOLDER_PATH;  | 		mFullPath2Folder = mBaseFolderPath + FOLDER_PATH;  | ||||||
| 		mFullPath2File = mBaseFolderPath + FILE_PATH; | 		mFullPath2File = mBaseFolderPath + FILE_PATH; | ||||||
| 	     | 	     | ||||||
| 	    if (!mGlobalSetupDone) { |  | ||||||
| 	    	 |  | ||||||
| 			Log.v(LOG_TAG, "Starting global set up"); |  | ||||||
| 		RemoteOperationResult result = mActivity.createFolder(mFullPath2Folder, true); | 		RemoteOperationResult result = mActivity.createFolder(mFullPath2Folder, true); | ||||||
| 		if (!result.isSuccess()  && result.getCode() != ResultCode.TIMEOUT) { | 		if (!result.isSuccess()  && result.getCode() != ResultCode.TIMEOUT) { | ||||||
| 			Utils.logAndThrow(LOG_TAG, result); | 			Utils.logAndThrow(LOG_TAG, result); | ||||||
| @ -79,10 +72,6 @@ public class DeleteFileTest extends RemoteTest { | |||||||
| 			Utils.logAndThrow(LOG_TAG, result); | 			Utils.logAndThrow(LOG_TAG, result); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 			Log.v(LOG_TAG, "Global set up done"); |  | ||||||
| 		    mGlobalSetupDone = true; |  | ||||||
| 	    } |  | ||||||
| 		 |  | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	/** | 	/** | ||||||
|  | |||||||
| @ -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.common.operations.RemoteOperationResult.ResultCode; | ||||||
| import com.owncloud.android.lib.test_project.TestActivity; | import com.owncloud.android.lib.test_project.TestActivity; | ||||||
| 
 | 
 | ||||||
| import android.util.Log; |  | ||||||
| 
 |  | ||||||
| /** | /** | ||||||
|  * Class to test Download File Operation |  * Class to test Download File Operation | ||||||
|  * @author masensio |  * @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_PATH_WITH_SPECIAL_CHARS = "/@file@download.png"; | ||||||
| 	private static final String IMAGE_NOT_FOUND = "/fileNotFound.png"; | 	private static final String IMAGE_NOT_FOUND = "/fileNotFound.png"; | ||||||
| 	 | 	 | ||||||
| 	private static boolean mGlobalSetupDone = false; |  | ||||||
| 	 |  | ||||||
| 	private String mFullPath2Image; | 	private String mFullPath2Image; | ||||||
| 	private String mFullPath2ImageWitSpecialChars; | 	private String mFullPath2ImageWitSpecialChars; | ||||||
| 	private String mFullPath2ImageNotFound; | 	private String mFullPath2ImageNotFound; | ||||||
| @ -68,8 +64,6 @@ public class DownloadFileTest extends RemoteTest { | |||||||
|     	mFullPath2ImageWitSpecialChars = mBaseFolderPath + IMAGE_PATH_WITH_SPECIAL_CHARS; |     	mFullPath2ImageWitSpecialChars = mBaseFolderPath + IMAGE_PATH_WITH_SPECIAL_CHARS; | ||||||
|     	mFullPath2ImageNotFound = mBaseFolderPath + IMAGE_NOT_FOUND; |     	mFullPath2ImageNotFound = mBaseFolderPath + IMAGE_NOT_FOUND; | ||||||
| 	     | 	     | ||||||
| 	    if (!mGlobalSetupDone) { |  | ||||||
| 	    	 |  | ||||||
| 		File imageFile = mActivity.extractAsset(TestActivity.ASSETS__IMAGE_FILE_NAME); | 		File imageFile = mActivity.extractAsset(TestActivity.ASSETS__IMAGE_FILE_NAME); | ||||||
| 
 | 
 | ||||||
|     	RemoteOperationResult result = mActivity.uploadFile( |     	RemoteOperationResult result = mActivity.uploadFile( | ||||||
| @ -93,10 +87,6 @@ public class DownloadFileTest extends RemoteTest { | |||||||
| 			Utils.logAndThrow(LOG_TAG, result); | 			Utils.logAndThrow(LOG_TAG, result); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 			Log.v(LOG_TAG, "Global set up done"); |  | ||||||
| 		    mGlobalSetupDone = true; |  | ||||||
| 	    } |  | ||||||
| 	     |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
|  | |||||||
| @ -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.resources.files.FileUtils; | ||||||
| import com.owncloud.android.lib.test_project.TestActivity; | import com.owncloud.android.lib.test_project.TestActivity; | ||||||
| 
 | 
 | ||||||
| import android.util.Log; |  | ||||||
| 
 |  | ||||||
| /** | /** | ||||||
|  * Class to test Rename File Operation |  * Class to test Rename File Operation | ||||||
|  * @author masensio |  * @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 final String NEW_FILE_PATH = FileUtils.PATH_SEPARATOR + NEW_FILE_NAME; | ||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
| 	private static boolean mGlobalSetupDone = false; |  | ||||||
| 	 |  | ||||||
| 	private String mToCleanUpInServer; | 	private String mToCleanUpInServer; | ||||||
| 	private TestActivity mActivity; | 	private TestActivity mActivity; | ||||||
| 	private String mFullPath2OldFolder; | 	private String mFullPath2OldFolder; | ||||||
| @ -75,10 +71,6 @@ public class RenameFileTest extends RemoteTest { | |||||||
|     	mFullPath2OldFile = mBaseFolderPath + OLD_FILE_PATH; |     	mFullPath2OldFile = mBaseFolderPath + OLD_FILE_PATH; | ||||||
|     	mFullPath2NewFile = mBaseFolderPath + NEW_FILE_PATH; |     	mFullPath2NewFile = mBaseFolderPath + NEW_FILE_PATH; | ||||||
| 	     | 	     | ||||||
| 	     |  | ||||||
| 	    if (!mGlobalSetupDone) { |  | ||||||
| 	    	 |  | ||||||
| 			Log.v(LOG_TAG, "Starting global set up"); |  | ||||||
| 		RemoteOperationResult result = mActivity.createFolder(mFullPath2OldFolder, true); | 		RemoteOperationResult result = mActivity.createFolder(mFullPath2OldFolder, true); | ||||||
| 		if (!result.isSuccess() && result.getCode() != ResultCode.TIMEOUT) { | 		if (!result.isSuccess() && result.getCode() != ResultCode.TIMEOUT) { | ||||||
| 			Utils.logAndThrow(LOG_TAG, result); | 			Utils.logAndThrow(LOG_TAG, result); | ||||||
| @ -93,10 +85,6 @@ public class RenameFileTest extends RemoteTest { | |||||||
| 			Utils.logAndThrow(LOG_TAG, result); | 			Utils.logAndThrow(LOG_TAG, result); | ||||||
| 		} | 		} | ||||||
| 	     | 	     | ||||||
| 			Log.v(LOG_TAG, "Global set up done"); |  | ||||||
| 		    mGlobalSetupDone = true; |  | ||||||
| 	    } |  | ||||||
| 	     |  | ||||||
| 		mToCleanUpInServer = null; | 		mToCleanUpInServer = null; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| @ -232,14 +220,12 @@ public class RenameFileTest extends RemoteTest { | |||||||
| 	 | 	 | ||||||
| 	@Override | 	@Override | ||||||
| 	protected void tearDown() throws Exception { | 	protected void tearDown() throws Exception { | ||||||
| 		/* |  | ||||||
| 		if (mToCleanUpInServer != null) { | 		if (mToCleanUpInServer != null) { | ||||||
| 			RemoteOperationResult removeResult = mActivity.removeFile(mToCleanUpInServer); | 			RemoteOperationResult removeResult = mActivity.removeFile(mToCleanUpInServer); | ||||||
| 			if (!removeResult.isSuccess()) { | 			if (!removeResult.isSuccess()) { | ||||||
| 				Utils.logAndThrow(LOG_TAG, removeResult); | 				Utils.logAndThrow(LOG_TAG, removeResult); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		*/ |  | ||||||
| 		super.tearDown(); | 		super.tearDown(); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user