diff --git a/owncloudComLibrary/build.gradle b/owncloudComLibrary/build.gradle index 2ac7adea..5537f94e 100644 --- a/owncloudComLibrary/build.gradle +++ b/owncloudComLibrary/build.gradle @@ -16,12 +16,6 @@ dependencies { kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion" testImplementation 'junit:junit:4.13' - testImplementation 'org.robolectric:robolectric:4.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - androidTestImplementation 'androidx.test:runner:1.3.0' - androidTestImplementation 'androidx.test:core:1.3.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test:rules:1.3.0' } android { @@ -48,10 +42,4 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } - - testOptions { - unitTests { - includeAndroidResources = true - } - } } diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/GetRemoteShareesOperation.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/GetRemoteShareesOperation.kt index 6fb57223..91271f0a 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/GetRemoteShareesOperation.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/GetRemoteShareesOperation.kt @@ -121,18 +121,6 @@ class GetRemoteShareesOperation return RemoteOperationResult(method) } - private fun flattenResultData(jsonResults: Array):ArrayList { - val data = ArrayList() // For result data - for (i in 0..jsonResults.size) { - for (j in 0 until jsonResults[i].length()) { - val jsonResult = jsonResults[i].getJSONObject(j) - data.add(jsonResult) - Timber.d("*** Added item: ${jsonResult.getString(PROPERTY_LABEL)}") - } - } - return data - } - private fun onRequestSuccessful(response: String?): RemoteOperationResult { val result = RemoteOperationResult(OK) Timber.d("Successful response: $response") diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/responses/ShareeResponse.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/responses/ShareeResponse.kt index f372747e..0cd0162a 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/responses/ShareeResponse.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/responses/ShareeResponse.kt @@ -32,13 +32,9 @@ import com.squareup.moshi.JsonClass */ @JsonClass(generateAdapter = true) data class ShareeOcsResponse( - @Json(name = "exact") val exact: ExactSharees?, - @Json(name = "groups") val groups: List, - @Json(name = "remotes") val remotes: List, - @Json(name = "users") val users: List ) { fun getFlatRepresentationWithoutExact() = ArrayList().apply { @@ -50,11 +46,8 @@ data class ShareeOcsResponse( @JsonClass(generateAdapter = true) data class ExactSharees( - @Json(name = "groups") val groups: List, - @Json(name = "remotes") val remotes: List, - @Json(name = "users") val users: List ) { fun getFlatRepresentation() = ArrayList().apply { @@ -66,17 +59,13 @@ data class ExactSharees( @JsonClass(generateAdapter = true) data class ShareeItem( - @Json(name = "label") val label: String, - @Json(name = "value") val value: ShareeValue ) @JsonClass(generateAdapter = true) data class ShareeValue( - @Json(name = "shareType") val shareType: Int, - @Json(name = "shareWith") val shareWith: String, @Json(name = "shareWithAdditionalInfo") val additionalInfo: String? diff --git a/owncloudComLibrary/src/test/java/com/owncloud/android/lib/ShareeResponseTest.kt b/owncloudComLibrary/src/test/java/com/owncloud/android/lib/resources/shares/responses/ShareeResponseTest.kt similarity index 75% rename from owncloudComLibrary/src/test/java/com/owncloud/android/lib/ShareeResponseTest.kt rename to owncloudComLibrary/src/test/java/com/owncloud/android/lib/resources/shares/responses/ShareeResponseTest.kt index a1646b67..5c27f8ad 100644 --- a/owncloudComLibrary/src/test/java/com/owncloud/android/lib/ShareeResponseTest.kt +++ b/owncloudComLibrary/src/test/java/com/owncloud/android/lib/resources/shares/responses/ShareeResponseTest.kt @@ -1,12 +1,35 @@ -package com.owncloud.android.lib +/* ownCloud Android Library is available under MIT license + * Copyright (C) 2020 ownCloud GmbH. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +package com.owncloud.android.lib.resources.shares.responses import com.owncloud.android.lib.resources.CommonOcsResponse -import com.owncloud.android.lib.resources.shares.responses.ShareeOcsResponse import com.squareup.moshi.JsonAdapter import com.squareup.moshi.Moshi import com.squareup.moshi.Types -import junit.framework.Assert.assertEquals -import junit.framework.Assert.assertTrue +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue import org.junit.Assert.assertNotEquals import org.junit.Before import org.junit.Test