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

Hard seperation of client / library #3150

Closed
Tracked by #3145
tobiasKaminsky opened this issue Oct 15, 2018 · 6 comments
Closed
Tracked by #3145

Hard seperation of client / library #3150

tobiasKaminsky opened this issue Oct 15, 2018 · 6 comments

Comments

@tobiasKaminsky
Copy link
Member

Currently most of the server manipulation tasks are in serve, but e.g. RestoreTrashbinFileOperation is in client.

This is wrong for multiple reasons

  • no other app can use it
  • testing library cannot test this operation
  • testing on client side is also harder

(I guess that I did this out of lazyness /hide)

So the idea is to have

  • in library: all server related tasks, actually manipulation is done here
  • in client: call library tasks and parse results

With this, we could (at some point) mock the complete library and test the complete app without any real server/library usage.

@nextcloud-android-bot

This comment has been minimized.

@tobiasKaminsky
Copy link
Member Author

@AndyScherzinger @ezaquarii can you recheck if everything is splitted / moved accordingly?
Then we could close this…

@tobiasKaminsky
Copy link
Member Author

All things in library should be end with "RemoteOperation", e.g.
CreateFolderOperation (in files app)
CreateFolderRemoteOperation (in library)

@ezaquarii
Copy link
Collaborator

Get list of all operations implemented in library:

$ for i in `find ./ -name '*Operation.java'`; do
echo ${${i##*/}%RemoteOperation.java} >> ~/lib-operations.txt
done

Same for ops still in app:

$ cd ./nextcloud-android/src/main/java/com/owncloud/android/operations
for i in *.java; do
echo ${i%Operation.java} >> ~/app-operations.txt
done

Ops still not moved to library:

grep -Fxv -f lib-list.txt app-list.txt
CheckCurrentCredentials
CreateShareViaLink
CreateShareWithSharee
DetectAuthenticationMethod
GetCapabilities
GetServerInfo
GetSharesForFile
GetUserProfile
RefreshFolder
RemoveRemoteEncryptedFile
RichDocumentsCreateAsset
RichDocumentsUrl
SynchronizeFile
SynchronizeFolder
Unshare
UpdateNoteForShare
UpdateOCVersion
UpdateSharePermissions
UpdateShareViaLink

Ops already moved to library:

$ grep -Fx -f app-list.txt lib-list.txt                            
CommentFile
CopyFile
RenameFile
DownloadFile
RemoveFile
UploadFile
MoveFile
CreateFolder

Looks like a lot of work to do...

@tobiasKaminsky
Copy link
Member Author

I fear it is not that easy, as most in the first list are a client wrapper to the remote call, e.g.

public class GetCapabilitiesOperation extends SyncOperation {
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
GetRemoteCapabilitiesOperation getCapabilities = new GetRemoteCapabilitiesOperation();
RemoteOperationResult result = getCapabilities.execute(client);
if (result.isSuccess()

But I went through the list and found this:

to move:
/

to rename in library:
GetRemoteSharesForFileOperation -> GetSharesForFileRemoteOperation
CreateRemoteShareOperation -> CreateShareRemoteOperation
GetRemoteStatusOperation -> GetStatusRemoteOperation
GetRemoteUserInfoOperation -> GetUserInfoRemoteOperation
RemoveRemoteShareOperation -> RemoveShareRemoteOperation
UpdateRemoteShareOperation -> UpdateShareRemoteOperation

@tobiasKaminsky
Copy link
Member Author

This is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants