Skip to content
Open

Mkcol #2129

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GetRecommendationsRemoteOperationIT : AbstractIT() {
@Test
fun getRecommendations() {
testOnlyOnServer(NextcloudVersion.nextcloud_31)
assertTrue(CreateFolderRemoteOperation("/test/", true).execute(client).isSuccess)
assertTrue(CreateFolderRemoteOperation("/test/", true).execute(nextcloudClient).isSuccess)

val result = GetRecommendationsRemoteOperation().execute(nextcloudClient).resultData

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class UnifiedSearchRemoteOperationIT : AbstractIT() {
@Test
fun filesSearch() {
val remotePath = "/testFolder"
assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(client).isSuccess)
assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient).isSuccess)
val remoteFile =
ReadFileRemoteOperation(remotePath)
.execute(nextcloudClient)
Expand All @@ -70,7 +70,7 @@ class UnifiedSearchRemoteOperationIT : AbstractIT() {

@Test
fun filesSearchWhitespace() {
assertTrue(CreateFolderRemoteOperation("/test Folder/", true).execute(client).isSuccess)
assertTrue(CreateFolderRemoteOperation("/test Folder/", true).execute(nextcloudClient).isSuccess)

val result = UnifiedSearchRemoteOperation("files", "test").execute(nextcloudClient)
assertTrue(result.isSuccess)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void getEditLinkForRoot() {
public void getEditLinkForFolder() {
String path = "/workspace/sub1/";

assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());

RemoteOperationResult result = new RichWorkspaceDirectEditingRemoteOperation(path).execute(client);
assertTrue(result.isSuccess());
Expand All @@ -56,7 +56,7 @@ public void reuseExistingFile() throws IOException {
String filePath = folder + "Readme.md";
File txtFile = getFile(ASSETS__TEXT_FILE_NAME);

assertTrue(new CreateFolderRemoteOperation(folder, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(folder, true).execute(nextcloudClient).isSuccess());

RemoteOperationResult uploadResult = new UploadFileRemoteOperation(
txtFile.getAbsolutePath(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GetActivitiesRemoteOperationIT : AbstractIT() {
@Test
fun getActivities() {
// set-up, create a folder so there is an activity
assertTrue(CreateFolderRemoteOperation("/test/123/1", true).execute(client).isSuccess)
assertTrue(CreateFolderRemoteOperation("/test/123/1", true).execute(nextcloudClient).isSuccess)

val result = nextcloudClient.execute(GetActivitiesRemoteOperation())
assertTrue(result.isSuccess)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static void beforeAll() throws InterruptedException,
client2.setUserId(loginName2); // for test same as userId

String credentials2 = Credentials.basic(loginName2, password2);
nextcloudClient = new NextcloudClient(url, loginName2, credentials2, context);
nextcloudClient2 = new NextcloudClient(url, loginName2, credentials2, context);

waitForServer(client, url);
testConnection();
Expand Down Expand Up @@ -269,11 +269,11 @@ public static File extractAsset(String fileName, Context context) throws IOExcep

@After
public void after() {
removeOnClient(nextcloudClient);
removeOnClient(nextcloudClient2);
removeOnClient(client, nextcloudClient);
removeOnClient(client2, nextcloudClient2);
}

private void removeOnClient(NextcloudClient nextcloudClient) {
private void removeOnClient(OwnCloudClient ownCloudClient, NextcloudClient nextcloudClient) {
final var result = new ReadFolderRemoteOperation("/").execute(nextcloudClient);
assertTrue(result.getLogMessage(context), result.isSuccess());

Expand All @@ -298,7 +298,7 @@ private void removeOnClient(NextcloudClient nextcloudClient) {
unlockRemoteFile(remotePath);
}

boolean isRemoteFileRemoved = removeRemoteFile(remotePath);
boolean isRemoteFileRemoved = removeRemoteFile(ownCloudClient, remotePath);
assertTrue("Failed to remove " + remotePath, isRemoteFileRemoved);
}

Expand All @@ -320,7 +320,7 @@ private void unlockRemoteFile(String path) {
}
}

private boolean removeRemoteFile(String path) {
private boolean removeRemoteFile(OwnCloudClient client, String path) {
final var operation = new RemoveFileRemoteOperation(path);
final var result = operation.execute(client);
return result.isSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void createFixtures() throws Exception {

RemoteOperationResult result;
for (String folderPath : FOLDERS_IN_FIXTURE) {
result = new CreateFolderRemoteOperation(folderPath, true).execute(client);
result = new CreateFolderRemoteOperation(folderPath, true).execute(nextcloudClient);

assertTrue("Error creating folder" + folderPath + ": " + result, result.isSuccess());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public void setUp() {
public void testCreateFolder() {
String remotePath = mFullPath2FolderBase;
mCreatedFolderPaths.add(remotePath);
RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue(result.isSuccess());

// Create Subfolder
remotePath = mFullPath2FolderBase + FOLDER_PATH_BASE;
mCreatedFolderPaths.add(remotePath);
result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue(result.isSuccess());
}

Expand All @@ -75,12 +75,12 @@ public void testCreateFolder() {
public void testCreateDuplicateFolder() {
String remotePath = mFullPath2FolderBase + "duplicateFolder";
mCreatedFolderPaths.add(remotePath);
RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue(result.isSuccess());

// Create folder again
mCreatedFolderPaths.add(remotePath);
result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertFalse(result.isSuccess());
assertEquals(FOLDER_ALREADY_EXISTS, result.getCode());
}
Expand All @@ -89,7 +89,7 @@ public void testCreateDuplicateFolder() {
public void testFileID() {
String remotePath = mFullPath2FolderBase + "/" + RandomStringGenerator.make(TAG_LENGTH);
mCreatedFolderPaths.add(remotePath);
RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue(result.isSuccess());

RemoteOperationResult<RemoteFile> readResult = new ReadFileRemoteOperation(remotePath).execute(nextcloudClient);
Expand All @@ -106,31 +106,31 @@ public void testFileID() {
@Test
public void testCreateFolderSpecialCharactersOnNewVersion() {
String remotePath = mFullPath2FolderBase + "_<";
RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue("Remote path: " + remotePath, result.isSuccess());

remotePath = mFullPath2FolderBase + "_>";
result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue("Remote path: " + remotePath, result.isSuccess());

remotePath = mFullPath2FolderBase + "_:";
result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue("Remote path: " + remotePath, result.isSuccess());

remotePath = mFullPath2FolderBase + "_\"";
result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue("Remote path: " + remotePath, result.isSuccess());

remotePath = mFullPath2FolderBase + "_|";
result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue("Remote path: " + remotePath, result.isSuccess());

remotePath = mFullPath2FolderBase + "_?";
result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue("Remote path: " + remotePath, result.isSuccess());

remotePath = mFullPath2FolderBase + "_*";
result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
result = new CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient);
assertTrue("Remote path: " + remotePath, result.isSuccess());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void setUp() throws Exception {
mFullPath2Folder = baseFolderPath + FOLDER_PATH;
mFullPath2File = baseFolderPath + FILE_PATH;

RemoteOperationResult result = new CreateFolderRemoteOperation(mFullPath2Folder, true).execute(client);
RemoteOperationResult result = new CreateFolderRemoteOperation(mFullPath2Folder, true).execute(nextcloudClient);
assertTrue("Error creating folder" + mFullPath2Folder + ": " + result, result.isSuccess());

File textFile = getFile(ASSETS__TEXT_FILE_NAME);
Expand Down
24 changes: 12 additions & 12 deletions library/src/androidTest/java/com/owncloud/android/FileIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void testCreateFolderSuccess() {
String path = "/testFolder/";

// create folder
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());

// verify folder
assertTrue(new ReadFolderRemoteOperation(path).execute(nextcloudClient).isSuccess());
Expand All @@ -55,10 +55,10 @@ public void testCreateFolderFailure() {
String path = "/testFolder/";

// create folder
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());

// create folder a second time will fail
assertFalse(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertFalse(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());

// remove folder
assertTrue(new RemoveFileRemoteOperation(path).execute(client).isSuccess());
Expand All @@ -69,7 +69,7 @@ public void testCreateNonExistingSubFolder() {
String path = "/testFolder/1/2/3/4/5/";
String top = "/testFolder/";

assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());

// verify folder
assertTrue(new ReadFolderRemoteOperation(path).execute(nextcloudClient).isSuccess());
Expand All @@ -85,7 +85,7 @@ public void testCreateFolderWithWrongURL() {
client.setBaseUri(Uri.parse(uri.toString() + "/remote.php/dav/files/"));

// create folder
assertFalse(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertFalse(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());

client.setBaseUri(uri);
}
Expand All @@ -94,7 +94,7 @@ public void testCreateFolderWithWrongURL() {
public void testZeroSharees() {
// create & verify folder
String path = "/testFolder/";
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());
assertTrue(new ReadFolderRemoteOperation(path).execute(nextcloudClient).isSuccess());

// verify
Expand All @@ -117,7 +117,7 @@ public void testZeroSharees() {
public void testShareViaLinkSharees() {
// create & verify folder
String path = "/testFolder/";
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());
assertTrue(new ReadFolderRemoteOperation(path).execute(nextcloudClient).isSuccess());

// share folder
Expand Down Expand Up @@ -149,7 +149,7 @@ public void testShareViaLinkSharees() {
public void testShareToGroupSharees() {
// create & verify folder
String path = "/testFolder/";
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());
assertTrue(new ReadFolderRemoteOperation(path).execute(nextcloudClient).isSuccess());

ShareeUser sharee = new ShareeUser("users", "", ShareType.GROUP);
Expand Down Expand Up @@ -190,7 +190,7 @@ public void testShareToGroupSharees() {
public void testOneSharees() {
// create & verify folder
String path = "/testFolder/";
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());
assertTrue(new ReadFolderRemoteOperation(path).execute(nextcloudClient).isSuccess());

ShareeUser sharee = new ShareeUser("user1", "User One", ShareType.USER);
Expand Down Expand Up @@ -225,7 +225,7 @@ public void testOneSharees() {
public void testTwoShareesOnParent() {
// create & verify folder
String path = "/testFolder/";
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());
assertTrue(new ReadFolderRemoteOperation(path).execute(nextcloudClient).isSuccess());

List<ShareeUser> sharees = new ArrayList<>();
Expand Down Expand Up @@ -273,7 +273,7 @@ public void testTwoShareesOnParent() {
public void testTwoSharees() {
// create & verify folder
String path = "/testFolder/";
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());
assertTrue(new ReadFolderRemoteOperation(path).execute(nextcloudClient).isSuccess());

List<ShareeUser> sharees = new ArrayList<>();
Expand Down Expand Up @@ -314,7 +314,7 @@ public void testTwoSharees() {
public void testLocalID() {
// create & verify folder
String path = "/testFolder/";
assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation(path, true).execute(nextcloudClient).isSuccess());

RemoteOperationResult result = new ReadFolderRemoteOperation(path).execute(nextcloudClient);
assertTrue(result.isSuccess());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
public class GetSharesIT extends AbstractIT {
@Test
public void testGetShares() {
assertTrue(new CreateFolderRemoteOperation("/1/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/1/", true).execute(nextcloudClient).isSuccess());
assertTrue(new CreateShareRemoteOperation("/1/",
ShareType.PUBLIC_LINK,
"",
false,
"",
1).execute(client).isSuccess());

assertTrue(new CreateFolderRemoteOperation("/2/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/2/", true).execute(nextcloudClient).isSuccess());
assertTrue(new CreateShareRemoteOperation("/2/",
ShareType.PUBLIC_LINK,
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UpdateMetadataRemoteOperationIT : AbstractIT() {

// create folder
val folder = "/" + make(20) + "/"
TestCase.assertTrue(CreateFolderRemoteOperation(folder, true).execute(client).isSuccess)
TestCase.assertTrue(CreateFolderRemoteOperation(folder, true).execute(nextcloudClient).isSuccess)
val remoteFolder = ReadFileRemoteOperation(folder).execute(nextcloudClient).resultData

TestCase.assertNotNull(remoteFolder)
Expand Down Expand Up @@ -114,7 +114,7 @@ class UpdateMetadataRemoteOperationIT : AbstractIT() {

// create folder
val folder = "/" + make(20) + "/"
TestCase.assertTrue(CreateFolderRemoteOperation(folder, true).execute(client).isSuccess)
TestCase.assertTrue(CreateFolderRemoteOperation(folder, true).execute(nextcloudClient).isSuccess)
val remoteFolder = ReadFileRemoteOperation(folder).execute(nextcloudClient).resultData

TestCase.assertNotNull(remoteFolder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ReadFileRemoteOperationIT : AbstractIT() {
fun readRemoteFolder() {
val remotePath = "/folder/"

assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(client).isSuccess)
assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient).isSuccess)

// use ownCloud client for reference
var result = ReadFileRemoteOperation(remotePath).execute(client)
Expand Down Expand Up @@ -151,7 +151,7 @@ class ReadFileRemoteOperationIT : AbstractIT() {
@Test
fun readEncryptedState() {
val remotePath = "/testEncryptedFolder/"
assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(client).isSuccess)
assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient).isSuccess)

var result = ReadFileRemoteOperation(remotePath).execute(nextcloudClient)
val remoteFile = result.resultData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ReadFolderRemoteOperationIT : AbstractIT() {
fun readRemoteFolderWithContent() {
val remotePath = "/test/"

assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(client).isSuccess)
assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(nextcloudClient).isSuccess)

// create file
val filePath = createFile("text")
Expand Down
Loading