@Test public void testCreateFolderSuccess() { String path = "/testFolder/"; // create folder assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); // verify folder assertTrue(new ReadFolderRemoteOperation(path).execute(client).isSuccess()); // remove folder assertTrue(new RemoveFileRemoteOperation(path).execute(client).isSuccess()); }
/** * Read the data retrieved from the server about the contents of the target folder * * @param remoteData Full response got from the server with the data of the target * folder and its direct children. * @param client Client instance to the remote server where the data were * retrieved. * @return */ private void readData(MultiStatus remoteData, OwnCloudClient client) { mFolderAndFiles = new ArrayList<>(); // parse data from remote folder WebdavEntry we = new WebdavEntry(remoteData.getResponses()[0], client.getWebdavUri().getPath()); mFolderAndFiles.add(fillOCFile(we)); // loop to update every child RemoteFile remoteFile; for (int i = 1; i < remoteData.getResponses().length; ++i) { /// new OCFile instance with the data from the server we = new WebdavEntry(remoteData.getResponses()[i], client.getWebdavUri().getPath()); remoteFile = fillOCFile(we); mFolderAndFiles.add(remoteFile); } }
readData(dataInServer, client);
@Test public void testCreateNonExistingSubFolder() { String path = "/testFolder/1/2/3/4/5/"; String top = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); // verify folder assertTrue(new ReadFolderRemoteOperation(path).execute(client).isSuccess()); // remove folder assertTrue(new RemoveFileRemoteOperation(top).execute(client).isSuccess()); } }
HttpMethodBase method = null; ReadFolderRemoteOperation remoteFolderOperation = new ReadFolderRemoteOperation(remotePath); RemoteOperationResult remoteFolderOperationResult = remoteFolderOperation.execute(client);