Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate OwncloudClient - Sharing #1294

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
5 changes: 4 additions & 1 deletion gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3639,7 +3639,10 @@
</component>
<component group="com.github.bitfireAT" name="dav4jvm" version="2.2.1">
<artifact name="dav4jvm-2.2.1.jar">
<sha256 value="5ce40389fc7ba0b630f07cbd2a573a507db616aed0ffdc744fb78000d8835815" origin="Generated by Gradle" reason="Artifact is not signed"/>
<sha256 value="5ce40389fc7ba0b630f07cbd2a573a507db616aed0ffdc744fb78000d8835815"
origin="Generated by Gradle" reason="Artifact is not signed">
<also-trust value="e6b8a9ff7ada0841198b18de2d6fd935f1f8754d3c84b8e8e3dc1840648d595d" />
</sha256>
</artifact>
<artifact name="dav4jvm-2.2.1.jar">
<sha256 value="e6b8a9ff7ada0841198b18de2d6fd935f1f8754d3c84b8e8e3dc1840648d595d"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public abstract class AbstractIT {
public static OwnCloudClient client;
public static OwnCloudClient client2;
protected static NextcloudClient nextcloudClient;
protected static NextcloudClient nextcloudClient2;
protected static Context context;
protected static Uri url;

Expand Down Expand Up @@ -109,6 +110,10 @@ public static void beforeAll() throws InterruptedException,
String credentials = Credentials.basic(loginName, password);
nextcloudClient = new NextcloudClient(url, userId, credentials, context);

String userId2 = loginName; // for test same as userId
String credentials2 = Credentials.basic(loginName2, password2);
nextcloudClient2 = new NextcloudClient(url, userId2, credentials2, context);

waitForServer(client, url);
testConnection();
}
Expand Down
14 changes: 7 additions & 7 deletions library/src/androidTest/java/com/owncloud/android/FileIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void testShareViaLinkSharees() {
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
.execute(nextcloudClient).isSuccess());

// verify
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
Expand Down Expand Up @@ -167,7 +167,7 @@ public void testShareToGroupSharees() {
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
.execute(nextcloudClient).isSuccess());

// verify
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
Expand Down Expand Up @@ -202,7 +202,7 @@ public void testOneSharees() {
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
.execute(nextcloudClient).isSuccess());

// verify
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
Expand Down Expand Up @@ -239,15 +239,15 @@ public void testTwoShareesOnParent() {
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
.execute(nextcloudClient).isSuccess());

assertTrue(new CreateShareRemoteOperation(path,
ShareType.USER,
"user2",
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
.execute(nextcloudClient).isSuccess());

// verify
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
Expand Down Expand Up @@ -287,15 +287,15 @@ public void testTwoSharees() {
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
.execute(nextcloudClient).isSuccess());

assertTrue(new CreateShareRemoteOperation(path,
ShareType.USER,
"user2",
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
.execute(nextcloudClient).isSuccess());

// verify
RemoteOperationResult result = new ReadFolderRemoteOperation(path).execute(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*/
package com.owncloud.android.lib.common.operations;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import com.owncloud.android.AbstractIT;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation;
Expand All @@ -22,6 +18,10 @@

import java.io.File;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
* Test create share
*/
Expand Down Expand Up @@ -56,7 +56,7 @@ public void testCreatePublicShareSuccessful() {
"",
false,
"",
1).execute(client);
1).execute(nextcloudClient);
assertTrue(result.isSuccess());
}

Expand All @@ -67,7 +67,7 @@ public void testCreatePublicShareFailure() {
"",
false,
"",
1).execute(client);
1).execute(nextcloudClient);

assertFalse(result.isSuccess());
assertEquals(ResultCode.FILE_NOT_FOUND, result.getCode());
Expand All @@ -83,7 +83,7 @@ public void testCreatePrivateShareWithUserSuccessful() {
"admin",
false,
"",
31).execute(client);
31).execute(nextcloudClient);
assertTrue(result.isSuccess());
}

Expand All @@ -97,7 +97,7 @@ public void testCreatePrivateShareWithUserNotExists() {
"no_exist",
false,
"",
31).execute(client);
31).execute(nextcloudClient);
assertFalse(result.isSuccess());

// TODO 404 is File not found, but actually it is "user not found"
Expand All @@ -114,7 +114,7 @@ public void testCreatePrivateShareWithFileNotExists() {
"admin",
false,
"",
31).execute(client);
31).execute(nextcloudClient);
assertFalse(result.isSuccess());
assertEquals(ResultCode.FILE_NOT_FOUND, result.getCode());
}
Expand All @@ -129,7 +129,7 @@ public void testCreatePrivateShareWithGroupSuccessful() {
"admin",
false,
"",
1).execute(client);
1).execute(nextcloudClient);
assertTrue(result.isSuccess());
}

Expand All @@ -143,7 +143,7 @@ public void testCreatePrivateShareWithNonExistingGroupSharee() {
"no_exist",
false,
"",
31).execute(client);
31).execute(nextcloudClient);
assertFalse(result.isSuccess());

// TODO 404 is File not found, but actually it is "user not found"
Expand All @@ -160,7 +160,7 @@ public void testCreatePrivateShareWithNonExistingFile() {
"admin",
false,
"",
31).execute(client);
31).execute(nextcloudClient);
assertFalse(result.isSuccess());
assertEquals(ResultCode.FILE_NOT_FOUND, result.getCode());
}
Expand Down Expand Up @@ -189,7 +189,7 @@ public void testCreateFederatedShareWithNonExistingSharee() {
"no_exist@" + serverUri2,
false,
"",
31).execute(client);
31).execute(nextcloudClient);

assertFalse("sharee doesn't exist in an existing remote server", result.isSuccess());
assertEquals("sharee doesn't exist in an existing remote server, forbidden",
Expand All @@ -206,7 +206,7 @@ public void testCreateFederatedShareWithNonExistingRemoteServer() {
"no_exist",
false,
"",
31).execute(client);
31).execute(nextcloudClient);
assertFalse(result.isSuccess());
// TODO expected:<SHARE_WRONG_PARAMETER> but was:<SHARE_FORBIDDEN>
assertEquals("remote server doesn't exist", ResultCode.SHARE_FORBIDDEN, result.getCode());
Expand All @@ -222,7 +222,7 @@ public void testCreateFederatedShareWithNonExistingFile() {
"admin@" + serverUri2,
false,
"",
31).execute(client);
31).execute(nextcloudClient);

assertFalse("file doesn't exist", result.isSuccess());
assertEquals("file doesn't exist", ResultCode.FILE_NOT_FOUND, result.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
*/
package com.owncloud.android.lib.common.operations;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import com.owncloud.android.AbstractIT;
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation;
Expand All @@ -22,6 +19,9 @@

import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
* Class to test Get Shares Operation
*
Expand All @@ -36,17 +36,17 @@ public void testGetShares() {
"",
false,
"",
1).execute(client).isSuccess());
1).execute(nextcloudClient).isSuccess());

assertTrue(new CreateFolderRemoteOperation("/2/", true).execute(client).isSuccess());
assertTrue(new CreateShareRemoteOperation("/2/",
ShareType.PUBLIC_LINK,
"",
false,
"",
1).execute(client).isSuccess());
1).execute(nextcloudClient).isSuccess());

RemoteOperationResult<List<OCShare>> result = new GetSharesRemoteOperation().execute(client);
RemoteOperationResult<List<OCShare>> result = new GetSharesRemoteOperation().execute(nextcloudClient);
assertTrue(result.isSuccess());
assertEquals(2, result.getResultData().size());
assertEquals("/1/", result.getResultData().get(0).getPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*/
package com.owncloud.android.lib.common.operations;

import static org.junit.Assert.assertTrue;

import com.owncloud.android.AbstractIT;
import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation;
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation;
Expand All @@ -22,6 +20,8 @@
import java.io.IOException;
import java.util.List;

import static org.junit.Assert.assertTrue;

public class RemoveShareIT extends AbstractIT {
private static final String FILE_TO_UNSHARE = "/fileToUnshare.txt";

Expand All @@ -42,7 +42,7 @@ public void testRemoveShare() throws IOException {
ShareType.PUBLIC_LINK,
"",
false,
"", 1).execute(client);
"", 1).execute(nextcloudClient);

assertTrue(result.isSuccess());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@
*/
package com.owncloud.android.lib.resources.files;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;

import android.net.Uri;
import android.os.Bundle;

import androidx.test.platform.app.InstrumentationRegistry;

import com.owncloud.android.AbstractIT;
import com.owncloud.android.lib.common.OwnCloudBasicCredentials;
import com.owncloud.android.lib.common.OwnCloudClient;
Expand All @@ -32,6 +27,11 @@
import java.io.IOException;
import java.util.List;

import androidx.test.platform.app.InstrumentationRegistry;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;

public class SearchRemoteOperationIT extends AbstractIT {
private static OCCapability capability;

Expand Down Expand Up @@ -177,7 +177,7 @@ public void favoriteFiles() throws IOException {
client.getUserId(),
false,
"",
31).execute(client2)
31).execute(nextcloudClient2)
.isSuccess()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CreateShareRemoteOperationIT : AbstractIT() {
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER,
true,
note
).execute(client)
).execute(nextcloudClient)

junit.framework.Assert.assertTrue(sut.isSuccess)

Expand Down
Loading
Loading