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

Depocc/status #1481

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
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(client).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(client).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(client).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(client).isSuccess());

assertTrue(new CreateShareRemoteOperation(path,
ShareType.USER,
"user2",
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
.execute(client).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(client).isSuccess());

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

// verify
RemoteOperationResult result = new ReadFolderRemoteOperation(path).execute(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testCreatePublicShareSuccessful() {
"",
false,
"",
1).execute(client);
1).execute(client);
assertTrue(result.isSuccess());
}

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

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(client);
assertTrue(result.isSuccess());
}

Expand All @@ -97,7 +97,7 @@ public void testCreatePrivateShareWithUserNotExists() {
"no_exist",
false,
"",
31).execute(client);
31).execute(client);
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(client);
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(client);
assertTrue(result.isSuccess());
}

Expand All @@ -143,7 +143,7 @@ public void testCreatePrivateShareWithNonExistingGroupSharee() {
"no_exist",
false,
"",
31).execute(client);
31).execute(client);
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(client);
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(client);

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(client);
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(client);

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 @@ -36,15 +36,15 @@ public void testGetShares() {
"",
false,
"",
1).execute(client).isSuccess());
1).execute(client).isSuccess());

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

RemoteOperationResult<List<OCShare>> result = new GetSharesRemoteOperation().execute(client);
assertTrue(result.isSuccess());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testRemoveShare() throws IOException {
ShareType.PUBLIC_LINK,
"",
false,
"", 1).execute(client);
"", 1).execute(client);

assertTrue(result.isSuccess());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void favoriteFiles() throws IOException {
client.getUserId(),
false,
"",
31).execute(client2)
31).execute(client2)
.isSuccess()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,30 @@ public void searchSharedFiles() {

// share folder to user "admin"
assertTrue(new CreateShareRemoteOperation("/shareToAdmin/",
ShareType.USER,
"admin",
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(client).isSuccess());
ShareType.USER,
"admin",
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(client).isSuccess());

// share folder via public link
assertTrue(new CreateShareRemoteOperation("/shareViaLink/",
ShareType.PUBLIC_LINK,
"",
true,
"",
OCShare.READ_PERMISSION_FLAG)
.execute(client).isSuccess());
ShareType.PUBLIC_LINK,
"",
true,
"",
OCShare.READ_PERMISSION_FLAG)
.execute(client).isSuccess());

// share folder to group
assertTrue(new CreateShareRemoteOperation("/shareToGroup/",
ShareType.GROUP,
"users",
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());
ShareType.GROUP,
"users",
false,
"",
OCShare.NO_PERMISSION)
.execute(client).isSuccess());

// share folder to circle
// get share
Expand Down Expand Up @@ -169,12 +169,12 @@ public void sharedWithMe() {
// share folder to user "admin"
assertTrue(new CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
assertTrue(new CreateShareRemoteOperation("/shareToAdmin/",
ShareType.USER,
"admin",
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(client).isSuccess());
ShareType.USER,
"admin",
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(client).isSuccess());

// Expect one file shared by me, no file shared with me
result = sut.execute(client);
Expand All @@ -196,12 +196,12 @@ public void sharedWithMe() {
// share folder to previous user
assertTrue(new CreateFolderRemoteOperation("/shareToUser/", true).execute(clientUser1).isSuccess());
assertTrue(new CreateShareRemoteOperation("/shareToUser/",
ShareType.USER,
client.getCredentials().getUsername(),
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(clientUser1).isSuccess());
ShareType.USER,
client.getCredentials().getUsername(),
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(clientUser1).isSuccess());

// Expect one file shared by me, one file shared with me
result = sut.execute(client);
Expand All @@ -225,7 +225,7 @@ public void favorites() {
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER,
true)
.execute(client);
.execute(client);

assertTrue(createResult.isSuccess());

Expand All @@ -243,7 +243,7 @@ public void favorites() {
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER,
true)
.execute(client);
.execute(client);

assertTrue(createResult.isSuccess());

Expand All @@ -269,7 +269,7 @@ public void noFavorite() {
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER,
true)
.execute(client);
.execute(client);

assertTrue(createResult.isSuccess());

Expand Down Expand Up @@ -299,7 +299,7 @@ public void favorite() {
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER,
true)
.execute(client);
.execute(client);

assertTrue(createResult.isSuccess());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected RemoteOperationResult<Void> run(OwnCloudClient client) {
int status = client.executeMethod(deleteMethod, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);

result = new RemoteOperationResult<>(status == HttpStatus.SC_OK, deleteMethod);

client.exhaustResponse(deleteMethod.getResponseBodyAsStream());
} catch (Exception e) {
result = new RemoteOperationResult<>(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
* @author David A. Velasco
*/
public class ExistenceCheckRemoteOperation extends RemoteOperation {

/** Maximum time to wait for a response from the server in MILLISECONDs. */

/**
* Maximum time to wait for a response from the server in MILLISECONDs.
*/
public static final int TIMEOUT = 50000;

private static final String TAG = ExistenceCheckRemoteOperation.class.getSimpleName();

private String mPath;
private boolean mSuccessIfAbsent;

Expand Down Expand Up @@ -63,7 +65,7 @@ public ExistenceCheckRemoteOperation(String remotePath, Context context, boolean
}

@Override
protected RemoteOperationResult run(OwnCloudClient client) {
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = null;
HeadMethod head = null;
boolean previousFollowRedirects = client.isFollowRedirects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected RemoteOperationResult run(OwnCloudClient client) {

// check if a file with the new name already exists
RemoteOperationResult existenceResult = new ExistenceCheckRemoteOperation(mNewRemotePath, false)
.execute(client);
.execute(client);
if (existenceResult.isSuccess()) {
return new RemoteOperationResult(ResultCode.INVALID_OVERWRITE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected RemoteOperationResult<List<OCShare>> run(OwnCloudClient client) {
String response = post.getResponseBodyAsString();

ShareToRemoteOperationResultParser parser = new ShareToRemoteOperationResultParser(
new ShareXMLParser()
new ShareXMLParser()
);
parser.setOneOrMoreSharesRequired(true);
parser.setServerBaseUri(client.getBaseUri());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ protected RemoteOperationResult run(OwnCloudClient client) {
get.setQueryString(new NameValuePair[]{
new NameValuePair(PARAM_PATH, mRemoteFilePath),
new NameValuePair(PARAM_RESHARES, String.valueOf(mReshares)),
new NameValuePair(PARAM_SUBFILES, String.valueOf(mSubfiles)) //,
//new NameValuePair("shared_with_me", "true")
new NameValuePair(PARAM_SUBFILES, String.valueOf(mSubfiles)) //,
//new NameValuePair("shared_with_me", "true")
});

get.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
Expand Down
Loading
Loading