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

New arch/shares #2487

Merged
merged 229 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
229 commits
Select commit Hold shift + click to select a range
850fd13
Include needed dependencies: Kotlin, room, lifecycle, testing...
davigonz Dec 19, 2018
a828935
Include Share entity, ShareDao with query to get public shares for a …
davigonz Dec 19, 2018
40193de
Implement Room database
davigonz Dec 19, 2018
9264d2f
Move new classes to the proper app module
davigonz Dec 19, 2018
2b9f2f5
Implement ShareRepository
davigonz Jan 3, 2019
bfae8aa
Fix some build errors
davigonz Jan 4, 2019
fe33525
Create ShareViewModel
davigonz Jan 4, 2019
22bd7e4
Create viewModelFactory to pass extra parameters to ShareViewModel
davigonz Jan 8, 2019
1dad961
Connect SharesFragment with ViewModel to retrieve automatically the p…
davigonz Jan 9, 2019
64cb2fa
First approach to handle resources and errors from server
davigonz Jan 11, 2019
f1d2681
Usa MediatorLiveData to observe both shares Room LiveData and remote …
davigonz Jan 16, 2019
f888537
Fix share ids issue
davigonz Jan 16, 2019
5b09ac1
Polish MediatorLiveData by using NetworkBoundResource
davigonz Jan 16, 2019
5608c07
Error handling
davigonz Jan 17, 2019
55893d3
Expose shares stored in room by using Content Provider and add some t…
davigonz Jan 21, 2019
475db7a
Fix tiny bug in ErrorMessageAdapter
davigonz Jan 24, 2019
66b2c28
Initial tests for OCShareDao and OCLocalSharesDataSource and some ren…
davigonz Jan 24, 2019
58421fd
Include OCShareDaoTest
davigonz Jan 30, 2019
6f6310a
Add some tests to OCLocalShareDataSourceTest and create test common u…
davigonz Jan 30, 2019
86ea266
Finish OCLocalShareDataSourceTest
davigonz Jan 31, 2019
2214b16
Add additional state (LOADING) to show loading dialog
davigonz Jan 31, 2019
2141844
Include tests for OCShareViewModel and OCRemoteSharesDataSource
davigonz Feb 6, 2019
c8df6dc
Fix OCShareViewModel tests
davigonz Feb 6, 2019
ac01847
Update shares in view with remote ones
davigonz Feb 6, 2019
5206506
Migrate shares table from SQLite to Room
davigonz Feb 6, 2019
1bef0e4
Include some OCShareRepository tests [WIP]
davigonz Feb 12, 2019
4b4d490
Finish tests for OCShareRepository
davigonz Feb 13, 2019
bb9c9a1
Add missing InstantAppExecutors
davigonz Feb 13, 2019
4084639
Include tests for NetworkBoundResource
davigonz Feb 13, 2019
62615e5
More NetworkBoundResourceTest
davigonz Feb 13, 2019
f86d4c7
Initial commit for sharing UI tests
davigonz Feb 15, 2019
9db91cd
Fix some unit tests
davigonz Feb 15, 2019
2d8300b
Rebase with master and migrate pending arch dependencies to Android X
davigonz Feb 18, 2019
6077614
Fix tests after Android X migration
davigonz Feb 18, 2019
cd90c2c
Prepare ShareFileFragment for testing and include some UI tests
davigonz Feb 19, 2019
79b3124
Include more ShareFileFragment tests
davigonz Feb 19, 2019
5bb5e8d
Avoid login when executing sharing UI tests
davigonz Feb 20, 2019
8e48732
add test to check size visiblility depending on mimetype
jesmrec Feb 20, 2019
d46b66c
add res/values for debug variant with disabled wizard
jesmrec Feb 20, 2019
88aab6f
add OpenForTesting file annotation, to make compile the app in releas…
jesmrec Feb 20, 2019
88a63f4
add tests about private link visibility
jesmrec Feb 20, 2019
adeac34
Fix problem with database after rebasing with master and polish the c…
davigonz Feb 21, 2019
f8c90aa
Solve conflicts with master
davigonz Feb 27, 2019
04b0ab9
Fix test utils
davigonz Feb 27, 2019
251cd55
Solve rebase conflicts after applying CodeStyle
davigonz Mar 1, 2019
67dde98
Adapt app for library Kotlin classes
davigonz Mar 1, 2019
209eaf2
Fix library build and clean up dependencies
davigonz Mar 1, 2019
3edf726
Apply changes in library code review
davigonz Mar 5, 2019
221756e
2n code review in library
davigonz Mar 5, 2019
3655251
Fix build and tests
davigonz Mar 5, 2019
7c14c89
Apply CR changes
davigonz Mar 7, 2019
b49202e
Implement create share operation in different layers of the new archi…
davigonz Feb 25, 2019
1a05852
Error handling when creating new public link and insertion after succ…
davigonz Feb 28, 2019
c8f4299
Fix tests by using additionalInfo field in shares and new replace method
davigonz Feb 28, 2019
3ed086e
Solve conflicts with get shares branch
davigonz Mar 6, 2019
be8942c
Refactor NetworkBoundResource, making it cleaner
davigonz Mar 6, 2019
2767e56
Move share activity and fragments to shares package and fix tests
davigonz Mar 18, 2019
6a41470
Apply style to some files, add tests to remote shares datasource
davigonz Mar 18, 2019
1aed96e
Add tests for insert shares in OCShareRepository and clean up some of…
davigonz Mar 19, 2019
d156002
Reformat code and keep woring on OCShareViewModel tests
davigonz Mar 19, 2019
d0c22c8
Solve OCShareViewModel tests
davigonz Mar 19, 2019
f84b997
Add tests for PublicShareDialogFragmentTest
davigonz Mar 20, 2019
bffc23e
extend UI tests for public share creation
jesmrec Mar 21, 2019
94d0115
Apply changes requested
davigonz Mar 21, 2019
061ef72
Apply CR changes
davigonz Mar 27, 2019
e64e85e
Create OCCapability entity, DAO and datasources
davigonz Apr 2, 2019
67389f2
Create OCCapabilityRepository
davigonz Apr 5, 2019
9ea59e9
Include OCCapabilityViewModel
davigonz Apr 5, 2019
cb72dd0
Load capabilities from ShareFileFragment [WIP]
davigonz Apr 5, 2019
19d92f9
Use capabilities from ShareFileFragment
davigonz Apr 8, 2019
4d1adbe
Accept pending licenses
davigonz Apr 8, 2019
b2e5859
Get and insert capabilities when needed
davigonz Apr 10, 2019
f29581b
Include tests for CapabilityContentProvider
davigonz Apr 10, 2019
e5f6a14
Fix share unit tests
davigonz Apr 11, 2019
36af446
OCCapabilityViewModel tests
davigonz Apr 11, 2019
e89d132
Include capability datasources tests
davigonz Apr 11, 2019
33a3238
Include tests in OCCapabilityRepository
davigonz Apr 11, 2019
42917f4
Include OCCapabilityDao tests, revert capability changes in file cont…
davigonz Apr 12, 2019
9c6b261
Fix some public share tests and prepare the code to inject capabiliti…
davigonz Apr 12, 2019
9fd4145
Add more UI tests for capabilities
davigonz Apr 12, 2019
994d746
Add expiration date UI tests to cover public share creation with capa…
davigonz Apr 15, 2019
8a0a04c
extend capabilities tests
jesmrec Apr 16, 2019
375f66c
add capability ViewModel to shareFragment in ShareFolderFragmentTest
jesmrec Apr 16, 2019
aebec3d
Apply CR changes
davigonz Apr 26, 2019
d7d7778
create OCSettingsCameraUploads suite with first tests and support to …
jesmrec Apr 11, 2019
adb6db9
add tests to cover video uploads enabling
jesmrec Apr 11, 2019
1450b6b
add UI tests for enabing options in camera uploads
jesmrec Apr 11, 2019
d3a2365
separate tests depending on precondition
jesmrec Apr 12, 2019
7575fa4
More CR changes
davigonz Apr 29, 2019
adb34e3
create suite for folder picker. Adjust preconditions in every suite
jesmrec Apr 17, 2019
d422bb0
Fix capabilities not refreshed
davigonz May 2, 2019
80fa82f
Fix Allow users to share via link not refreshed the first time
davigonz May 3, 2019
93ae4b1
use actions to reset some scenarios
jesmrec May 6, 2019
759b05f
reorder tests, adding methods to restablish inital status
jesmrec May 6, 2019
75efba6
merge tests in two suites: camera uploads and folder picker
jesmrec May 6, 2019
868ecd8
code polished
jesmrec May 6, 2019
2cfaee7
get rid of some test to avoid flakiness
jesmrec May 7, 2019
59ac9a0
some changes after code review
jesmrec May 7, 2019
ea4ccb3
rename pre and post methods to be more clear
jesmrec May 9, 2019
d694e93
Include update share query in OCShareDao and in OCLocalDataSource
davigonz Apr 16, 2019
5d2f11f
Include update share operation OCRemoteDataSource
davigonz Apr 17, 2019
c075fa4
Include update share operation in OCShareRepository
davigonz Apr 17, 2019
b94505f
Include update public share function in OCShareViewmodel
davigonz Apr 17, 2019
eca7847
Connect PublicShareDialogFragment with OCShareViewmodel to update shares
davigonz Apr 17, 2019
f0e5106
Fix some tests and UI password/date issues
davigonz Apr 17, 2019
7b0b9be
Update gradle version
davigonz Apr 25, 2019
f38ce31
Fix crash when using empty password to share a file via link
davigonz Apr 25, 2019
0532393
Add update shares to content provider + tests and fix password issue
davigonz Apr 25, 2019
852900c
Include tests for OCLocalDataSource
davigonz Apr 26, 2019
8a4f500
Include tests for OCRemoteShareDataSourceTest
davigonz Apr 26, 2019
b02103f
Include tests for OCShareRepositoryTest
davigonz Apr 26, 2019
891ee4f
Include tests for OCShareViewModel
davigonz Apr 26, 2019
26c30f0
Include tests for OCShareDaoTest
davigonz Apr 26, 2019
d7a06d6
Clean up old code
davigonz Apr 26, 2019
11c7919
UI tests for public share edition
davigonz Apr 29, 2019
acc8353
Update distributionSha256Sum for Gradle
davigonz May 9, 2019
9cefe96
Test expirationDate
davigonz May 9, 2019
984d2cd
Apply CR changes
davigonz May 14, 2019
04cde2a
add ui tests over more section in settings view
jesmrec May 8, 2019
c5c25c1
add suite to test log view
jesmrec May 10, 2019
da9468d
add test to check send history in log view
jesmrec May 15, 2019
a6ba428
add suite to check privacy policy activity
jesmrec May 15, 2019
fc3f174
prepare end of files
jesmrec May 15, 2019
7b9ef59
changes requested in code review
jesmrec May 16, 2019
86511cf
Include delete share operation in dao and datasources
davigonz May 9, 2019
915a4eb
Convert RemoveShareDialogFragment into Kotlin and include some more c…
davigonz May 9, 2019
f24bcbc
Use listeners to properly show remove share fragment
davigonz May 10, 2019
fd5f10f
Delete share from ShareActivity
davigonz May 14, 2019
71ecc57
Clean up some dependencies when getting public shares and capabilities
davigonz May 14, 2019
7cf6181
Clean up dependencies when creating/editing shares
davigonz May 15, 2019
39a492d
Dismiss dialog to edit shares
davigonz May 15, 2019
acba6dd
Get rid of account dependency in PublicShareDialogFragment
davigonz May 15, 2019
33d5e96
Fix unit tests
davigonz May 15, 2019
18b74fe
Fixing UI tests after some dependencies cleanup[WIP]
davigonz May 15, 2019
71dea5f
Fix ShareFileFragmentTest UI tests
davigonz May 16, 2019
6dd23dd
Fix crash when getting shares the first time
davigonz May 16, 2019
efcd437
Fix PublicShareCreationDialogFragmentTest UI tests
davigonz May 17, 2019
8831b32
Fix UI tests in PublicShareEditionDialogFragmentTest and ShareFolderF…
davigonz May 17, 2019
ea514f8
Use room implementation in Content Provider to delete shares + test f…
davigonz May 17, 2019
852b885
Refactor share repository tests
davigonz May 20, 2019
572879d
Include tests for public sharing deletion in repository
davigonz May 20, 2019
f5bacb7
Move filePath and account variables to ShareRepository creation
davigonz May 20, 2019
f00c082
Tests for sharing deletion within OCShareViewmodel and OCShareDao
davigonz May 20, 2019
f480597
Swap expected and actual parameters for every assertEquals call
davigonz May 20, 2019
941d6b5
Delete unused list
davigonz May 27, 2019
2ec1e37
Apply CR changes
davigonz May 30, 2019
219334d
Apply additional changes requested in CR
davigonz May 30, 2019
6d5ad66
Use Koin to inject viewmodel dependencies on ShareActivity
davigonz May 28, 2019
c4ad969
First tests using Koin and account creation to make flow tests possible
davigonz May 29, 2019
27a5f2c
Include createPublicShareWithNoPublicSharesYet and createPublicShareW…
davigonz May 29, 2019
1134672
Finish share creation tests
davigonz May 29, 2019
648795a
Share edition tests (files)
davigonz May 29, 2019
36d1e69
extend use cases UI tests in public sharing
jesmrec May 31, 2019
c005d23
add loading tests to every operation on public shares
jesmrec May 31, 2019
8a36e60
Remove loading tests
davigonz Jun 3, 2019
f39f1b2
Use just one livedata with shares
davigonz Jun 6, 2019
df73e5c
Decouple livedatas between get shares operation and other ones
davigonz Jun 7, 2019
c8c2fac
Fix unit tests
davigonz Jun 7, 2019
3b66875
Fix UI tests [WIP]
davigonz Jun 7, 2019
6967175
Fix share creation UI tests using idling resources
davigonz Jun 10, 2019
c889932
Fix UI tests (todo - get rid of Thread.sleep)
davigonz Jun 10, 2019
210eea4
Fix UI tests
davigonz Jun 10, 2019
d0787f8
Delete unused idling resource
davigonz Jun 10, 2019
3d8bd38
Uncomment deletPublicLink test
davigonz Jun 10, 2019
3300b44
Fix addExpirationDate() test, included in share edition suite
davigonz Jun 11, 2019
d421597
Apply CR changes
davigonz Jun 11, 2019
e30683a
Polish addExpirationDate test
davigonz Jun 11, 2019
69ae702
Loading and error tests when creating, editing and deleting shares
davigonz Jun 11, 2019
0f52dd9
Remove no longer needed idling resources
davigonz Jun 11, 2019
7729e93
Apply CR changes
davigonz Jun 14, 2019
0964757
Create koin_version constant
davigonz Jun 17, 2019
dc68ecc
add a scrollTo in order to be safe, in case the Save button is not re…
jesmrec Jun 17, 2019
41819af
Solve conflicts when rebasing with master
davigonz Jun 19, 2019
0c80911
Implement get private shares
davigonz Jun 19, 2019
577a8e1
Show private shares in search view
davigonz Jun 20, 2019
a04ca04
Show private shares in search view and split up private and public sh…
davigonz Jun 20, 2019
9bc7fea
Fix unit tests (not instrumented)
davigonz Jun 21, 2019
beab2e5
Complete unit tests (insrumented)
davigonz Jun 24, 2019
d74190e
Include private shares tests in ShareFileFragmentTest and reorder cod…
davigonz Jun 24, 2019
0b2e2df
Fix previous UI tests
davigonz Jun 24, 2019
23a5ecd
UI tests for showing private shares in SearchShareesFragment
davigonz Jun 25, 2019
0d220ff
Create sharees datasources, repository and reorder the classes in layers
davigonz Jun 25, 2019
35887af
Get sharees from server using viewmodel, repository and datasources
davigonz Jun 26, 2019
3517903
Reorder test classes
davigonz Jun 26, 2019
eccbce0
first security tests
jesmrec May 21, 2019
c45a506
expand tests over the security section of settings view
jesmrec May 22, 2019
4fc00f2
create suite for Passcode Activity
jesmrec Jun 20, 2019
0b6a9c3
complete test suite for passcode activity
jesmrec Jun 20, 2019
d42c729
enforce assertion when correct passcode is returned to Preferences ac…
jesmrec Jun 20, 2019
3ff308b
add tests over passcode lock activity
jesmrec Jun 24, 2019
eac8f6d
improve tests in camera upload settings by reseting by code. Enforce …
jesmrec Jun 24, 2019
3562824
Unit tests for RemoteShareesDataSource
davigonz Jun 26, 2019
922585a
Unit tests
davigonz Jun 27, 2019
43d70ba
UI tests to show private shares
davigonz Jun 28, 2019
b4b7447
Implement private shares creation
davigonz Jun 28, 2019
0f8a1d6
add changes after code review
jesmrec Jul 1, 2019
9ed2dc3
Unit tests for private shares creation
davigonz Jul 1, 2019
6ebd232
constantize some values
jesmrec Jul 1, 2019
5deaf59
add Test to the suites name and modify class names
jesmrec Jul 1, 2019
b3f3c08
Separate private and public shares in OCLocalShareDataSourceTest
davigonz Jul 2, 2019
0f93be8
Apply CR changes
davigonz Jul 4, 2019
dc5c42b
Initial commit
davigonz Jul 2, 2019
ac75275
Show permissions and edit [WIP]
davigonz Jul 8, 2019
e25cfc6
Fix UI glitch when refreshing share list
davigonz Jul 9, 2019
68622f6
Implement private shares deletion
davigonz Jul 9, 2019
08ef1b2
Unit tests and part of instrumented tests to update and delete privat…
davigonz Jul 9, 2019
b39aef2
UI tests for EditPrivateShareFragment
davigonz Jul 9, 2019
f9c1d81
UI tests for private shares loading and errors
davigonz Jul 9, 2019
089eea5
UI tests for deleting private shares
davigonz Jul 10, 2019
3b04cd2
Apply CR changes
davigonz Jul 12, 2019
57608b7
Fix loading dialog stuck when trying to create an already existing pr…
davigonz Jul 15, 2019
1e3d680
Fix glitch when editing folder permissions in public links
davigonz Jul 29, 2019
9bd6082
Show public share icon in filelist
davigonz Jul 31, 2019
e44b65c
Show private share icon in filelist
davigonz Jul 31, 2019
5e28a78
Show share icons when refreshing filelist
davigonz Aug 1, 2019
5afc589
Fix some comments
davigonz Aug 1, 2019
c53d0be
Use more Kotlin in FileDisplayActivity
davigonz Aug 1, 2019
d7350ca
Apply changes requested in code review
davigonz Aug 2, 2019
b773d19
Fix Remove sharing from web UI does not hide the icon in app and Remo…
davigonz Aug 2, 2019
bb57698
Fix private link not accessible when disable share API
davigonz Aug 1, 2019
483890f
Apply changes requested in CR
davigonz Aug 5, 2019
83625b4
Fix some tests
davigonz Aug 5, 2019
90eb208
Fix build
davigonz Aug 6, 2019
3a67a8f
Fix file thumbnail not visible
davigonz Aug 6, 2019
0884552
Fix Permissions not granted in reshares do not show correct error
davigonz Aug 6, 2019
9d81076
Fix Change of password enforcing does not work as expected
davigonz Aug 6, 2019
35f0e0f
Fix Error message after not increasing permissions
davigonz Aug 6, 2019
a4feacf
Update gradle version in library to fix build
davigonz Aug 6, 2019
aa54094
Fix Error message after switching permissions in folder public link c…
davigonz Aug 7, 2019
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
25 changes: 22 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
buildscript {
ext.kotlin_version = '1.3.11'
ext {
// Android jetpack
archLifecycleVersion = '2.0.0'
roomVersion = '2.0.0'

// Kotlin
kotlinVersion = '1.3.21'

// Koin
koinVersion = '2.0.1'

// Testing
junitVersion = "4.12"
mockitoVersion = "2.24.0"

// Extensions
ktxVersion = "1.0.0"
}

repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
}
}

Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Mon May 07 09:46:04 CEST 2018
#Thu Apr 25 08:58:52 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionSha256Sum=b7aedd369a26b177147bcb715f8b1fc4fe32b0a6ade0d7fd8ee5ed0c6f731f2c
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionSha256Sum=53b71812f18cdb2777e9f1b2a0f2038683907c90bdc406bc64d8b400e1fb2c3b
2 changes: 1 addition & 1 deletion owncloud-android-library
Submodule owncloud-android-library updated 32 files
+8 −1 build.gradle
+1 −1 gradle/wrapper/gradle-wrapper.properties
+10 −1 owncloudComLibrary/build.gradle
+31 −0 owncloudComLibrary/src/debug/java/com/owncloud/android/lib/testing/OpenForTesting.kt
+2 −2 owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/interceptors/HttpInterceptor.java
+4 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java
+0 −269 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/CreateRemoteShareOperation.java
+174 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/CreateRemoteShareOperation.kt
+0 −199 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/GetRemoteShareesOperation.java
+197 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/GetRemoteShareesOperation.kt
+0 −124 ...loudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java
+115 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.kt
+0 −356 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/OCShare.java
+198 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/RemoteShare.kt
+40 −50 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/RemoveRemoteShareOperation.kt
+2 −20 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareParserResult.kt
+21 −25 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/SharePermissionsBuilder.kt
+0 −140 ...dComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareToRemoteOperationResultParser.java
+122 −0 ...oudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareToRemoteOperationResultParser.kt
+17 −30 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareType.kt
+0 −452 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareXMLParser.java
+433 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/ShareXMLParser.kt
+0 −233 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/UpdateRemoteShareOperation.java
+207 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/UpdateRemoteShareOperation.kt
+26 −41 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/CapabilityBooleanType.kt
+0 −316 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.java
+326 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/GetRemoteCapabilitiesOperation.kt
+0 −339 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.java
+0 −199 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/OwnCloudVersion.java
+214 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/OwnCloudVersion.kt
+101 −0 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/RemoteCapability.kt
+31 −0 owncloudComLibrary/src/release/java/com/owncloud/android/lib/testing/OpenForTesting.kt
59 changes: 54 additions & 5 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-allopen'
apply plugin: 'kotlin-android-extensions'

def commitSHA1 = 'COMMIT_SHA1'
def gitRemote = 'GIT_REMOTE'

dependencies {
/// dependencies for app building
implementation project(':owncloud-android-library:owncloudComLibrary')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.legacy:legacy-support-v4:$androidX"
implementation "androidx.annotation:annotation:1.0.1"
implementation 'com.google.android.material:material:1.0.0'
Expand All @@ -19,32 +21,64 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.browser:browser:$androidX"
implementation 'commons-io:commons-io:2.6'
/// dependencies for local unit tests
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.19.0'
/// dependencies for instrumented tests

// Dependencies for unit tests
testImplementation "junit:junit:$junitVersion"
testImplementation "androidx.arch.core:core-testing:$archLifecycleVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"

// Dependencies for instrumented tests
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
// JUnit4 Rules
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
// Android JUnit Runner
androidTestImplementation 'androidx.test:runner:1.1.1'
// Espresso core
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
// Espresso contrib
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
// Espresso intents
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.1'
// Espresso web
androidTestImplementation 'androidx.test.espresso:espresso-web:3.1.1'
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
androidTestImplementation 'androidx.annotation:annotation:1.0.1'
androidTestImplementation "androidx.room:room-testing:$roomVersion"
androidTestImplementation "androidx.arch.core:core-testing:$archLifecycleVersion"
androidTestImplementation "org.mockito:mockito-android:$mockitoVersion"
androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"

// Image loading
implementation('com.github.bumptech.glide:glide:4.6.1') {
exclude group: "com.android.support"
}

//Zooming Android ImageView.
implementation 'com.github.chrisbanes:PhotoView:2.1.4'

// Convert Java Objects into JSON and back
implementation 'com.google.code.gson:gson:2.8.5'

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"

// Architecture lifecycle components
implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel:$archLifecycleVersion"
kapt "androidx.lifecycle:lifecycle-compiler:$archLifecycleVersion"

// Room
implementation "androidx.room:room-runtime:$roomVersion"
kapt "androidx.room:room-compiler:$roomVersion"

// Koin dependency injector
implementation "org.koin:koin-androidx-viewmodel:$koinVersion"

// Kotlin extensions
implementation "androidx.core:core-ktx:$ktxVersion"
}

tasks.withType(Test) {
Expand All @@ -54,6 +88,11 @@ tasks.withType(Test) {
}
}

allOpen {
// allows mocking for classes w/o directly opening them for release builds
annotation 'com.owncloud.android.testing.OpenClass'
}

android {
compileSdkVersion 28

Expand Down Expand Up @@ -87,6 +126,11 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets {
androidTest.java.srcDirs += "src/test-common/java"
test.java.srcDirs += "src/test-common/java"
}

lintOptions {
abortOnError false
disable 'MissingTranslation'
Expand Down Expand Up @@ -128,6 +172,11 @@ android {
def appName = System.env.OC_APP_NAME
setOutputFileName(variant, appName, project)
}

testOptions {
unitTests.returnDefaultValues = true
animationsDisabled = true
}
}

// Updates output file names of a given variant to format
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/**
* ownCloud Android client application
*
* @author David González Verdugo
* Copyright (C) 2019 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.owncloud.android.capabilities.datasource

import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.MutableLiveData
import androidx.test.platform.app.InstrumentationRegistry
import com.owncloud.android.capabilities.db.OCCapability
import com.owncloud.android.capabilities.db.OCCapabilityDao
import com.owncloud.android.db.OwncloudDatabase
import com.owncloud.android.utils.LiveDataTestUtil.getValue
import com.owncloud.android.utils.TestUtil
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TestRule
import org.mockito.Mockito.`when`
import org.mockito.Mockito.mock

class OCLocalCapabilitiesDataSourceTest {
private lateinit var ocLocalCapabilitiesDataSource: OCLocalCapabilitiesDataSource
private val ocCapabilityDao = mock(OCCapabilityDao::class.java)

@Rule
@JvmField
var rule: TestRule = InstantTaskExecutorRule()

@Before
fun init() {
val db = mock(OwncloudDatabase::class.java)
`when`(db.capabilityDao()).thenReturn(ocCapabilityDao)

val capabilityAsLiveData: MutableLiveData<OCCapability> = MutableLiveData()
capabilityAsLiveData.value = TestUtil.createCapability(
"user@server1", 5, 4, 3
)

`when`(
ocCapabilityDao.getCapabilityForAccount(
"user@server1"
)
).thenReturn(
capabilityAsLiveData
)

val newCapabilityAsLiveData: MutableLiveData<OCCapability> = MutableLiveData()
newCapabilityAsLiveData.value = TestUtil.createCapability(
"user@server2", 2, 1, 0
)

`when`(
ocCapabilityDao.getCapabilityForAccount(
"user@server2"
)
).thenReturn(
newCapabilityAsLiveData
)

val context = InstrumentationRegistry.getInstrumentation().targetContext

ocLocalCapabilitiesDataSource = OCLocalCapabilitiesDataSource(context, ocCapabilityDao)
}

@Test
fun readLocalCapability() {
val capability = getValue(
ocLocalCapabilitiesDataSource.getCapabilityForAccountAsLiveData(
"user@server1"
)
)
assertEquals("user@server1", capability.accountName)
assertEquals(5, capability.versionMayor)
assertEquals(4, capability.versionMinor)
assertEquals(3, capability.versionMicro)
}

@Test
fun insertCapabilityAndRead() {
ocLocalCapabilitiesDataSource.insert(
listOf(
TestUtil.createCapability(
"user@server1", 7, 6, 5
),
TestUtil.createCapability(
"user@server2", 2, 1, 0
)
)
)

val capability = getValue(
ocLocalCapabilitiesDataSource.getCapabilityForAccountAsLiveData(
"user@server2"
)
)
assertEquals("user@server2", capability.accountName)
assertEquals(2, capability.versionMayor)
assertEquals(1, capability.versionMinor)
assertEquals(0, capability.versionMicro)
}
}
Loading