EndToEndRandomIT.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. /*
  2. *
  3. * Nextcloud Android client application
  4. *
  5. * @author Tobias Kaminsky
  6. * Copyright (C) 2020 Tobias Kaminsky
  7. * Copyright (C) 2020 Nextcloud GmbH
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. */
  22. package com.nextcloud.client;
  23. import android.accounts.AccountManager;
  24. import com.owncloud.android.AbstractOnServerIT;
  25. import com.owncloud.android.datamodel.ArbitraryDataProvider;
  26. import com.owncloud.android.datamodel.OCFile;
  27. import com.owncloud.android.db.OCUpload;
  28. import com.owncloud.android.files.services.FileUploader;
  29. import com.owncloud.android.lib.common.accounts.AccountUtils;
  30. import com.owncloud.android.lib.common.operations.RemoteOperationResult;
  31. import com.owncloud.android.lib.common.utils.Log_OC;
  32. import com.owncloud.android.lib.ocs.responses.PrivateKey;
  33. import com.owncloud.android.lib.resources.e2ee.ToggleEncryptionRemoteOperation;
  34. import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation;
  35. import com.owncloud.android.lib.resources.status.OCCapability;
  36. import com.owncloud.android.lib.resources.status.OwnCloudVersion;
  37. import com.owncloud.android.lib.resources.users.GetPrivateKeyOperation;
  38. import com.owncloud.android.lib.resources.users.GetPublicKeyOperation;
  39. import com.owncloud.android.lib.resources.users.SendCSROperation;
  40. import com.owncloud.android.lib.resources.users.StorePrivateKeyOperation;
  41. import com.owncloud.android.operations.DownloadFileOperation;
  42. import com.owncloud.android.operations.GetCapabilitiesOperation;
  43. import com.owncloud.android.operations.RemoveFileOperation;
  44. import com.owncloud.android.utils.CsrHelper;
  45. import com.owncloud.android.utils.EncryptionUtils;
  46. import com.owncloud.android.utils.FileStorageUtils;
  47. import net.bytebuddy.utility.RandomString;
  48. import org.junit.Before;
  49. import org.junit.BeforeClass;
  50. import org.junit.Test;
  51. import java.io.File;
  52. import java.io.IOException;
  53. import java.security.KeyPair;
  54. import java.util.ArrayList;
  55. import java.util.List;
  56. import java.util.Random;
  57. import static com.owncloud.android.lib.resources.status.OwnCloudVersion.nextcloud_19;
  58. import static junit.framework.TestCase.assertEquals;
  59. import static junit.framework.TestCase.assertFalse;
  60. import static junit.framework.TestCase.assertNotNull;
  61. import static junit.framework.TestCase.assertTrue;
  62. import static org.junit.Assume.assumeTrue;
  63. public class EndToEndRandomIT extends AbstractOnServerIT {
  64. public enum Action {
  65. CREATE_FOLDER,
  66. GO_INTO_FOLDER,
  67. GO_UP,
  68. UPLOAD_FILE,
  69. DOWNLOAD_FILE,
  70. DELETE_FILE,
  71. }
  72. private static ArbitraryDataProvider arbitraryDataProvider;
  73. private OCFile currentFolder;
  74. private int actionCount = 20;
  75. private String rootEncFolder = "/e/";
  76. @BeforeClass
  77. public static void initClass() {
  78. arbitraryDataProvider = new ArbitraryDataProvider(targetContext.getContentResolver());
  79. }
  80. @Before
  81. public void before() throws IOException {
  82. OCCapability capability = getStorageManager().getCapability(account.name);
  83. if (capability.getVersion().equals(new OwnCloudVersion("0.0.0"))) {
  84. // fetch new one
  85. assertTrue(new GetCapabilitiesOperation().execute(client, getStorageManager()).isSuccess());
  86. }
  87. // tests only for NC19+
  88. assumeTrue(getStorageManager()
  89. .getCapability(account.name)
  90. .getVersion()
  91. .isNewerOrEqual(nextcloud_19)
  92. );
  93. // make sure that every file is available, even after tests that remove source file
  94. createDummyFiles();
  95. }
  96. @Test
  97. public void run() throws Exception {
  98. init();
  99. for (int i = 0; i < actionCount; i++) {
  100. Action nextAction = Action.values()[new Random().nextInt(Action.values().length)];
  101. switch (nextAction) {
  102. case CREATE_FOLDER:
  103. createFolder(i);
  104. break;
  105. case GO_INTO_FOLDER:
  106. goIntoFolder(i);
  107. break;
  108. case GO_UP:
  109. goUp(i);
  110. break;
  111. case UPLOAD_FILE:
  112. uploadFile(i);
  113. break;
  114. case DOWNLOAD_FILE:
  115. downloadFile(i);
  116. break;
  117. case DELETE_FILE:
  118. deleteFile(i);
  119. break;
  120. default:
  121. Log_OC.d(this, "[" + i + "/" + actionCount + "]" + " Unknown action: " + nextAction);
  122. break;
  123. }
  124. }
  125. }
  126. @Test
  127. public void uploadOneFile() throws Exception {
  128. init();
  129. uploadFile(0);
  130. }
  131. @Test
  132. public void createFolder() throws Exception {
  133. init();
  134. currentFolder = createFolder(0);
  135. assertNotNull(currentFolder);
  136. }
  137. @Test
  138. public void createSubFolders() throws Exception {
  139. init();
  140. currentFolder = createFolder(0);
  141. assertNotNull(currentFolder);
  142. currentFolder = createFolder(1);
  143. assertNotNull(currentFolder);
  144. currentFolder = createFolder(2);
  145. assertNotNull(currentFolder);
  146. }
  147. @Test
  148. public void createSubFoldersWithFiles() throws Exception {
  149. init();
  150. currentFolder = createFolder(0);
  151. assertNotNull(currentFolder);
  152. uploadFile(1);
  153. uploadFile(1);
  154. uploadFile(2);
  155. currentFolder = createFolder(1);
  156. assertNotNull(currentFolder);
  157. uploadFile(11);
  158. uploadFile(12);
  159. uploadFile(13);
  160. currentFolder = createFolder(2);
  161. assertNotNull(currentFolder);
  162. uploadFile(21);
  163. uploadFile(22);
  164. uploadFile(23);
  165. }
  166. @Test
  167. public void pseudoRandom() throws Exception {
  168. init();
  169. uploadFile(1);
  170. createFolder(2);
  171. goIntoFolder(3);
  172. goUp(4);
  173. createFolder(5);
  174. uploadFile(6);
  175. goUp(7);
  176. goIntoFolder(8);
  177. goIntoFolder(9);
  178. uploadFile(10);
  179. }
  180. @Test
  181. public void deleteFile() throws Exception {
  182. init();
  183. uploadFile(1);
  184. deleteFile(1);
  185. }
  186. @Test
  187. public void downloadFile() throws Exception {
  188. init();
  189. uploadFile(1);
  190. downloadFile(1);
  191. }
  192. private void init() throws Exception {
  193. // create folder
  194. createFolder(rootEncFolder);
  195. OCFile encFolder = createFolder(rootEncFolder + RandomString.make(5) + "/");
  196. // encrypt it
  197. assertTrue(new ToggleEncryptionRemoteOperation(encFolder.getLocalId(),
  198. encFolder.getRemotePath(),
  199. true)
  200. .execute(client).isSuccess());
  201. encFolder.setEncrypted(true);
  202. getStorageManager().saveFolder(encFolder, new ArrayList<>(), new ArrayList<>());
  203. useExistingKeys();
  204. rootEncFolder = encFolder.getDecryptedRemotePath();
  205. currentFolder = encFolder;
  206. }
  207. private OCFile createFolder(int i) {
  208. String path = currentFolder.getDecryptedRemotePath() + RandomString.make(5) + "/";
  209. Log_OC.d(this, "[" + i + "/" + actionCount + "] " + "Create folder: " + path);
  210. return createFolder(path);
  211. }
  212. private void goIntoFolder(int i) {
  213. ArrayList<OCFile> folders = new ArrayList<>();
  214. for (OCFile file : getStorageManager().getFolderContent(currentFolder, false)) {
  215. if (file.isFolder()) {
  216. folders.add(file);
  217. }
  218. }
  219. if (folders.isEmpty()) {
  220. Log_OC.d(this, "[" + i + "/" + actionCount + "] " + "Go into folder: No folders");
  221. return;
  222. }
  223. currentFolder = folders.get(new Random().nextInt(folders.size()));
  224. Log_OC.d(this,
  225. "[" + i + "/" + actionCount + "] " + "Go into folder: " + currentFolder.getDecryptedRemotePath());
  226. }
  227. private void goUp(int i) {
  228. if (currentFolder.getRemotePath().equals(rootEncFolder)) {
  229. Log_OC.d(this,
  230. "[" + i + "/" + actionCount + "] " + "Go up to folder: " + currentFolder.getDecryptedRemotePath());
  231. return;
  232. }
  233. currentFolder = getStorageManager().getFileById(currentFolder.getParentId());
  234. if (currentFolder == null) {
  235. throw new RuntimeException("Current folder is null");
  236. }
  237. Log_OC.d(this,
  238. "[" + i + "/" + actionCount + "] " + "Go up to folder: " + currentFolder.getDecryptedRemotePath());
  239. }
  240. private void uploadFile(int i) throws IOException {
  241. String fileName = RandomString.make(5) + ".txt";
  242. File file;
  243. if (new Random().nextBoolean()) {
  244. file = createFile(fileName, new Random().nextInt(50000));
  245. } else {
  246. file = createFile(fileName, 500000 + new Random().nextInt(50000));
  247. }
  248. String remotePath = currentFolder.getRemotePath() + fileName;
  249. Log_OC.d(this,
  250. "[" + i + "/" + actionCount + "] " +
  251. "Upload file to: " + currentFolder.getDecryptedRemotePath() + fileName);
  252. OCUpload ocUpload = new OCUpload(file.getAbsolutePath(),
  253. remotePath,
  254. account.name);
  255. uploadOCUpload(ocUpload);
  256. shortSleep();
  257. OCFile parentFolder = getStorageManager()
  258. .getFileByEncryptedRemotePath(new File(ocUpload.getRemotePath()).getParent() + "/");
  259. String uploadedFileName = new File(ocUpload.getRemotePath()).getName();
  260. String decryptedPath = parentFolder.getDecryptedRemotePath() + uploadedFileName;
  261. OCFile uploadedFile = getStorageManager().getFileByDecryptedRemotePath(decryptedPath);
  262. verifyStoragePath(uploadedFile);
  263. // verify storage path
  264. refreshFolder(currentFolder.getRemotePath());
  265. uploadedFile = getStorageManager().getFileByDecryptedRemotePath(decryptedPath);
  266. verifyStoragePath(uploadedFile);
  267. // verify that encrypted file is on server
  268. assertTrue(new ReadFileRemoteOperation(currentFolder.getRemotePath() + uploadedFile.getEncryptedFileName())
  269. .execute(client)
  270. .isSuccess());
  271. // verify that unencrypted file is not on server
  272. assertFalse(new ReadFileRemoteOperation(currentFolder.getDecryptedRemotePath() + fileName)
  273. .execute(client)
  274. .isSuccess());
  275. }
  276. private void downloadFile(int i) {
  277. ArrayList<OCFile> files = new ArrayList<>();
  278. for (OCFile file : getStorageManager().getFolderContent(currentFolder, false)) {
  279. if (!file.isFolder()) {
  280. files.add(file);
  281. }
  282. }
  283. if (files.isEmpty()) {
  284. Log_OC.d(this, "[" + i + "/" + actionCount + "] No files in: " + currentFolder.getDecryptedRemotePath());
  285. return;
  286. }
  287. OCFile fileToDownload = files.get(new Random().nextInt(files.size()));
  288. assertNotNull(fileToDownload.getRemoteId());
  289. Log_OC.d(this,
  290. "[" + i + "/" + actionCount + "] " + "Download file: " +
  291. currentFolder.getDecryptedRemotePath() + fileToDownload.getDecryptedFileName());
  292. assertTrue(new DownloadFileOperation(account, fileToDownload, targetContext)
  293. .execute(client)
  294. .isSuccess());
  295. assertTrue(new File(fileToDownload.getStoragePath()).exists());
  296. verifyStoragePath(fileToDownload);
  297. }
  298. @Test
  299. public void testUploadWithCopy() throws Exception {
  300. init();
  301. OCUpload ocUpload = new OCUpload(FileStorageUtils.getTemporalPath(account.name) + "/nonEmpty.txt",
  302. currentFolder.getRemotePath() + "nonEmpty.txt",
  303. account.name);
  304. uploadOCUpload(ocUpload, FileUploader.LOCAL_BEHAVIOUR_COPY);
  305. File originalFile = new File(FileStorageUtils.getTemporalPath(account.name) + "/nonEmpty.txt");
  306. OCFile uploadedFile = fileDataStorageManager.getFileByDecryptedRemotePath(currentFolder.getRemotePath() +
  307. "nonEmpty.txt");
  308. assertTrue(originalFile.exists());
  309. assertTrue(new File(uploadedFile.getStoragePath()).exists());
  310. }
  311. @Test
  312. public void testUploadWithMove() throws Exception {
  313. init();
  314. OCUpload ocUpload = new OCUpload(FileStorageUtils.getTemporalPath(account.name) + "/nonEmpty.txt",
  315. currentFolder.getRemotePath() + "nonEmpty.txt",
  316. account.name);
  317. uploadOCUpload(ocUpload, FileUploader.LOCAL_BEHAVIOUR_MOVE);
  318. File originalFile = new File(FileStorageUtils.getTemporalPath(account.name) + "/nonEmpty.txt");
  319. OCFile uploadedFile = fileDataStorageManager.getFileByDecryptedRemotePath(currentFolder.getRemotePath() +
  320. "nonEmpty.txt");
  321. assertFalse(originalFile.exists());
  322. assertTrue(new File(uploadedFile.getStoragePath()).exists());
  323. }
  324. @Test
  325. public void testUploadWithForget() throws Exception {
  326. init();
  327. OCUpload ocUpload = new OCUpload(FileStorageUtils.getTemporalPath(account.name) + "/nonEmpty.txt",
  328. currentFolder.getRemotePath() + "nonEmpty.txt",
  329. account.name);
  330. uploadOCUpload(ocUpload, FileUploader.LOCAL_BEHAVIOUR_FORGET);
  331. File originalFile = new File(FileStorageUtils.getTemporalPath(account.name) + "/nonEmpty.txt");
  332. OCFile uploadedFile = fileDataStorageManager.getFileByDecryptedRemotePath(currentFolder.getRemotePath() +
  333. "nonEmpty.txt");
  334. assertTrue(originalFile.exists());
  335. assertFalse(new File(uploadedFile.getStoragePath()).exists());
  336. }
  337. @Test
  338. public void testUploadWithDelete() throws Exception {
  339. init();
  340. OCUpload ocUpload = new OCUpload(FileStorageUtils.getTemporalPath(account.name) + "/nonEmpty.txt",
  341. currentFolder.getRemotePath() + "nonEmpty.txt",
  342. account.name);
  343. uploadOCUpload(ocUpload, FileUploader.LOCAL_BEHAVIOUR_DELETE);
  344. File originalFile = new File(FileStorageUtils.getTemporalPath(account.name) + "/nonEmpty.txt");
  345. OCFile uploadedFile = fileDataStorageManager.getFileByDecryptedRemotePath(currentFolder.getRemotePath() +
  346. "nonEmpty.txt");
  347. assertFalse(originalFile.exists());
  348. assertFalse(new File(uploadedFile.getStoragePath()).exists());
  349. }
  350. private void deleteFile(int i) {
  351. ArrayList<OCFile> files = new ArrayList<>();
  352. for (OCFile file : getStorageManager().getFolderContent(currentFolder, false)) {
  353. if (!file.isFolder()) {
  354. files.add(file);
  355. }
  356. }
  357. if (files.isEmpty()) {
  358. Log_OC.d(this, "[" + i + "/" + actionCount + "] No files in: " + currentFolder.getDecryptedRemotePath());
  359. return;
  360. }
  361. OCFile fileToDelete = files.get(new Random().nextInt(files.size()));
  362. assertNotNull(fileToDelete.getRemoteId());
  363. Log_OC.d(this,
  364. "[" + i + "/" + actionCount + "] " +
  365. "Delete file: " + currentFolder.getDecryptedRemotePath() + fileToDelete.getDecryptedFileName());
  366. assertTrue(new RemoveFileOperation(fileToDelete,
  367. false,
  368. account,
  369. false,
  370. targetContext)
  371. .execute(client, getStorageManager())
  372. .isSuccess());
  373. }
  374. @Test
  375. public void reInit() throws Exception {
  376. // create folder
  377. OCFile encFolder = createFolder(rootEncFolder);
  378. // encrypt it
  379. assertTrue(new ToggleEncryptionRemoteOperation(encFolder.getLocalId(),
  380. encFolder.getRemotePath(),
  381. true)
  382. .execute(client).isSuccess());
  383. encFolder.setEncrypted(true);
  384. getStorageManager().saveFolder(encFolder, new ArrayList<>(), new ArrayList<>());
  385. createKeys();
  386. // delete keys
  387. arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.PRIVATE_KEY);
  388. arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.PUBLIC_KEY);
  389. arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.MNEMONIC);
  390. useExistingKeys();
  391. }
  392. private void useExistingKeys() throws Exception {
  393. // download them from server
  394. GetPublicKeyOperation publicKeyOperation = new GetPublicKeyOperation();
  395. RemoteOperationResult publicKeyResult = publicKeyOperation.execute(account, targetContext);
  396. assertTrue(publicKeyResult.isSuccess());
  397. String publicKeyFromServer = (String) publicKeyResult.getData().get(0);
  398. arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
  399. EncryptionUtils.PUBLIC_KEY,
  400. publicKeyFromServer);
  401. RemoteOperationResult<PrivateKey> privateKeyResult = new GetPrivateKeyOperation().execute(account,
  402. targetContext);
  403. assertTrue(privateKeyResult.isSuccess());
  404. PrivateKey privateKey = privateKeyResult.getResultData();
  405. String mnemonic = generateMnemonicString();
  406. String decryptedPrivateKey = EncryptionUtils.decryptPrivateKey(privateKey.getKey(), mnemonic);
  407. arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
  408. EncryptionUtils.PRIVATE_KEY, decryptedPrivateKey);
  409. Log_OC.d(this, "Private key successfully decrypted and stored");
  410. arbitraryDataProvider.storeOrUpdateKeyValue(account.name, EncryptionUtils.MNEMONIC, mnemonic);
  411. }
  412. /*
  413. TODO do not c&p code
  414. */
  415. private void createKeys() throws Exception {
  416. String publicKey;
  417. // Create public/private key pair
  418. KeyPair keyPair = EncryptionUtils.generateKeyPair();
  419. // create CSR
  420. AccountManager accountManager = AccountManager.get(targetContext);
  421. String userId = accountManager.getUserData(account, AccountUtils.Constants.KEY_USER_ID);
  422. String urlEncoded = CsrHelper.generateCsrPemEncodedString(keyPair, userId);
  423. SendCSROperation operation = new SendCSROperation(urlEncoded);
  424. RemoteOperationResult result = operation.execute(account, targetContext);
  425. if (result.isSuccess()) {
  426. publicKey = (String) result.getData().get(0);
  427. } else {
  428. throw new Exception("failed to send CSR", result.getException());
  429. }
  430. java.security.PrivateKey privateKey = keyPair.getPrivate();
  431. String privateKeyString = EncryptionUtils.encodeBytesToBase64String(privateKey.getEncoded());
  432. String privatePemKeyString = EncryptionUtils.privateKeyToPEM(privateKey);
  433. String encryptedPrivateKey = EncryptionUtils.encryptPrivateKey(privatePemKeyString,
  434. generateMnemonicString());
  435. // upload encryptedPrivateKey
  436. StorePrivateKeyOperation storePrivateKeyOperation = new StorePrivateKeyOperation(encryptedPrivateKey);
  437. RemoteOperationResult storePrivateKeyResult = storePrivateKeyOperation.execute(account, targetContext);
  438. if (storePrivateKeyResult.isSuccess()) {
  439. arbitraryDataProvider.storeOrUpdateKeyValue(account.name, EncryptionUtils.PRIVATE_KEY,
  440. privateKeyString);
  441. arbitraryDataProvider.storeOrUpdateKeyValue(account.name, EncryptionUtils.PUBLIC_KEY, publicKey);
  442. arbitraryDataProvider.storeOrUpdateKeyValue(account.name, EncryptionUtils.MNEMONIC,
  443. generateMnemonicString());
  444. } else {
  445. throw new RuntimeException("Error uploading private key!");
  446. }
  447. }
  448. private String generateMnemonicString() {
  449. return "1 2 3 4 5 6";
  450. }
  451. public void after() {
  452. // remove all encrypted files
  453. OCFile root = fileDataStorageManager.getFileByDecryptedRemotePath("/");
  454. removeFolder(root);
  455. // List<OCFile> files = fileDataStorageManager.getFolderContent(root, false);
  456. //
  457. // for (OCFile child : files) {
  458. // removeFolder(child);
  459. // }
  460. assertEquals(0, fileDataStorageManager.getFolderContent(root, false).size());
  461. super.after();
  462. }
  463. private void removeFolder(OCFile folder) {
  464. Log_OC.d(this, "Start removing content of folder: " + folder.getDecryptedRemotePath());
  465. List<OCFile> children = fileDataStorageManager.getFolderContent(folder, false);
  466. // remove children
  467. for (OCFile child : children) {
  468. if (child.isFolder()) {
  469. removeFolder(child);
  470. // remove folder
  471. Log_OC.d(this, "Remove folder: " + child.getDecryptedRemotePath());
  472. if (!folder.isEncrypted() && child.isEncrypted()) {
  473. assertTrue(new ToggleEncryptionRemoteOperation(child.getLocalId(),
  474. child.getRemotePath(),
  475. false)
  476. .execute(client)
  477. .isSuccess());
  478. OCFile f = getStorageManager().getFileByEncryptedRemotePath(child.getRemotePath());
  479. f.setEncrypted(false);
  480. getStorageManager().saveFile(f);
  481. child.setEncrypted(false);
  482. }
  483. } else {
  484. Log_OC.d(this, "Remove file: " + child.getDecryptedRemotePath());
  485. }
  486. assertTrue(new RemoveFileOperation(child, false, account, false, targetContext)
  487. .execute(client, getStorageManager())
  488. .isSuccess()
  489. );
  490. }
  491. Log_OC.d(this, "Finished removing content of folder: " + folder.getDecryptedRemotePath());
  492. }
  493. private void verifyStoragePath(OCFile file) {
  494. assertEquals(FileStorageUtils.getSavePath(account.name) +
  495. currentFolder.getDecryptedRemotePath() +
  496. file.getDecryptedFileName(),
  497. file.getStoragePath());
  498. }
  499. }