diff --git a/.travis.yml b/.travis.yml
index 4fae7ec7..d0bca7a2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,25 +17,14 @@ install:
- yes | sdkmanager --list
# After Travis updated image with Android base environment, building via ant is not possible anymore.
-# Library tests are old-style tests, and trust on legacy Android ant environment.
-# Need to disable tests until they are ported to JUnit 4 and gradle build.
-#- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 20M
-#- emulator -avd test -no-window &
+# Port library tests to new-style with JUnit 4 and gradle build.
- rm pom.xml
-#- android update project -p .
-#- chmod +x ./wait_for_emulator.sh
-#- ./wait_for_emulator.sh
-#
+
# On the other hand, Travis still uses 'android' command behind the 'components' section update.
# That command is obsolete and cannot update Android SDK Tools after 25.2.5.
# Let's solve it here with the new command 'sdkmanager'
- yes | sdkmanager --verbose tools
script:
-#- ant clean
-#- ant debug
-#- cd test_client/tests
-#- ant acceptance-test
-#- cd ../..
- ./gradlew clean build
env:
global:
diff --git a/settings.gradle b/settings.gradle
index 3f42d192..7cf73a38 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1,2 @@
include ':'
-include ':sample_client'
-include ':test_client'
\ No newline at end of file
+include ':sample_client'
\ No newline at end of file
diff --git a/test_client/.classpath b/test_client/.classpath
deleted file mode 100644
index 7bc01d9a..00000000
--- a/test_client/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/test_client/.project b/test_client/.project
deleted file mode 100644
index 30c2462f..00000000
--- a/test_client/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- ownCloud Android library test project
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/test_client/.settings/org.eclipse.jdt.core.prefs b/test_client/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b080d2dd..00000000
--- a/test_client/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/test_client/AndroidManifest.xml b/test_client/AndroidManifest.xml
deleted file mode 100644
index 14de3eab..00000000
--- a/test_client/AndroidManifest.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test_client/assets/imageFile.png b/test_client/assets/imageFile.png
deleted file mode 100644
index 915ec22c..00000000
Binary files a/test_client/assets/imageFile.png and /dev/null differ
diff --git a/test_client/assets/textFile.txt b/test_client/assets/textFile.txt
deleted file mode 100644
index f53eb8b4..00000000
--- a/test_client/assets/textFile.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This is a simple text file.
-
-To make some tests.
diff --git a/test_client/assets/videoFile.MP4 b/test_client/assets/videoFile.MP4
deleted file mode 100644
index 2422025e..00000000
Binary files a/test_client/assets/videoFile.MP4 and /dev/null differ
diff --git a/test_client/build.gradle b/test_client/build.gradle
deleted file mode 100644
index f78ec71a..00000000
--- a/test_client/build.gradle
+++ /dev/null
@@ -1,50 +0,0 @@
-apply plugin: 'com.android.application'
-
-
-repositories {
- jcenter()
-}
-
-dependencies {
- implementation project(':')
-}
-
-android {
- compileSdkVersion 26
-
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- resources.srcDirs = ['src']
- aidl.srcDirs = ['src']
- renderscript.srcDirs = ['src']
- res.srcDirs = ['res']
- assets.srcDirs = ['assets']
- }
-
- // Move the tests to tests/java, tests/res, etc...
- androidTest.setRoot('tests')
-
- // Move the build types to build-types/
- // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
- // This moves them out of them default location under src//... which would
- // conflict with src/ being used by the main source set.
- // Adding new build types or product flavors should be accompanied
- // by a similar customization.
- debug.setRoot('build-types/debug')
- release.setRoot('build-types/release')
- }
-
- lintOptions {
- abortOnError false
- }
-
- packagingOptions {
- exclude 'META-INF/LICENSE.txt'
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
diff --git a/test_client/build.xml b/test_client/build.xml
deleted file mode 100644
index 1be67e32..00000000
--- a/test_client/build.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test_client/custom_rules.xml b/test_client/custom_rules.xml
deleted file mode 100644
index 669f008f..00000000
--- a/test_client/custom_rules.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Setting username ${env.OCTEST_USERNAME}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test_client/gradle/wrapper/gradle-wrapper.jar b/test_client/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 13372aef..00000000
Binary files a/test_client/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/test_client/gradle/wrapper/gradle-wrapper.properties b/test_client/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index fc5d4423..00000000
--- a/test_client/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Mon Dec 28 10:00:20 PST 2015
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
\ No newline at end of file
diff --git a/test_client/gradlew b/test_client/gradlew
deleted file mode 100755
index 91a7e269..00000000
--- a/test_client/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/test_client/gradlew.bat b/test_client/gradlew.bat
deleted file mode 100644
index aec99730..00000000
--- a/test_client/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/test_client/ic_launcher-web.png b/test_client/ic_launcher-web.png
deleted file mode 100644
index a18cbb48..00000000
Binary files a/test_client/ic_launcher-web.png and /dev/null differ
diff --git a/test_client/libs/android-support-v4.jar b/test_client/libs/android-support-v4.jar
deleted file mode 100644
index feaf44f8..00000000
Binary files a/test_client/libs/android-support-v4.jar and /dev/null differ
diff --git a/test_client/project.properties b/test_client/project.properties
deleted file mode 100644
index 07afc2f8..00000000
--- a/test_client/project.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-24
-android.library.reference.1=..
diff --git a/test_client/res/drawable-hdpi/ic_launcher.png b/test_client/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 288b6655..00000000
Binary files a/test_client/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/test_client/res/drawable-mdpi/ic_launcher.png b/test_client/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 6ae570b4..00000000
Binary files a/test_client/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/test_client/res/drawable-xhdpi/ic_launcher.png b/test_client/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index d4fb7cd9..00000000
Binary files a/test_client/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/test_client/res/drawable-xxhdpi/ic_launcher.png b/test_client/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 85a60815..00000000
Binary files a/test_client/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/test_client/res/layout/activity_test.xml b/test_client/res/layout/activity_test.xml
deleted file mode 100644
index b4ff20f3..00000000
--- a/test_client/res/layout/activity_test.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
diff --git a/test_client/res/menu/test.xml b/test_client/res/menu/test.xml
deleted file mode 100644
index 0d512270..00000000
--- a/test_client/res/menu/test.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
diff --git a/test_client/res/values-sw600dp/dimens.xml b/test_client/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 01992a47..00000000
--- a/test_client/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
diff --git a/test_client/res/values-sw720dp-land/dimens.xml b/test_client/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 403f038f..00000000
--- a/test_client/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
- 128dp
-
-
diff --git a/test_client/res/values-v11/styles.xml b/test_client/res/values-v11/styles.xml
deleted file mode 100644
index 26513a6b..00000000
--- a/test_client/res/values-v11/styles.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/test_client/res/values-v14/styles.xml b/test_client/res/values-v14/styles.xml
deleted file mode 100644
index b6097989..00000000
--- a/test_client/res/values-v14/styles.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/test_client/res/values/dimens.xml b/test_client/res/values/dimens.xml
deleted file mode 100644
index a93fed9e..00000000
--- a/test_client/res/values/dimens.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
- 16dp
- 16dp
-
-
diff --git a/test_client/res/values/setup.xml b/test_client/res/values/setup.xml
deleted file mode 100644
index 3fc22fe1..00000000
--- a/test_client/res/values/setup.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
- https://qa.oc.solidgear.es
- https://qa2.oc.solidgear.es
- android-library-test
- letitgo,letitgo,thatperfectappisgone
- Mozilla/5.0 (Android) ownCloud test project
-
diff --git a/test_client/res/values/strings.xml b/test_client/res/values/strings.xml
deleted file mode 100644
index 2f986d8a..00000000
--- a/test_client/res/values/strings.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
- oc_framework-test-project
- Settings
- Hello world!
- The test account %1$s could not be found in the device
-
-
diff --git a/test_client/res/values/styles.xml b/test_client/res/values/styles.xml
deleted file mode 100644
index 7146f7a6..00000000
--- a/test_client/res/values/styles.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/test_client/settings.gradle b/test_client/settings.gradle
deleted file mode 100644
index 175989c3..00000000
--- a/test_client/settings.gradle
+++ /dev/null
@@ -1,2 +0,0 @@
-include ':tests'
-include ':'
diff --git a/test_client/src/com/owncloud/android/lib/test_project/TestActivity.java b/test_client/src/com/owncloud/android/lib/test_project/TestActivity.java
deleted file mode 100644
index f6f6ef38..00000000
--- a/test_client/src/com/owncloud/android/lib/test_project/TestActivity.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2018 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.test_project;
-
-import android.app.Activity;
-import android.content.Context;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.Menu;
-
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.resources.files.CreateRemoteFolderOperation;
-import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
-import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
-import com.owncloud.android.lib.resources.files.RemoteFile;
-import com.owncloud.android.lib.resources.files.RemoveRemoteFileOperation;
-import com.owncloud.android.lib.resources.files.RenameRemoteFileOperation;
-import com.owncloud.android.lib.resources.files.UploadRemoteFileOperation;
-import com.owncloud.android.lib.resources.files.chunks.ChunkedUploadRemoteFileOperation;
-import com.owncloud.android.lib.resources.shares.CreateRemoteShareOperation;
-import com.owncloud.android.lib.resources.shares.GetRemoteSharesOperation;
-import com.owncloud.android.lib.resources.shares.RemoveRemoteShareOperation;
-import com.owncloud.android.lib.resources.shares.ShareType;
-import com.owncloud.android.lib.resources.users.GetRemoteUserAvatarOperation;
-import com.owncloud.android.lib.resources.users.GetRemoteUserQuotaOperation;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Activity to test OC framework
- * @author masensio
- * @author David A. Velasco
- * @author David González Verdugo
- */
-
-public class TestActivity extends Activity {
-
- private static final String TAG = null;
- // This account must exists on the server side
- private String mServerUri;
- private String mUser;
- private String mPass;
-
- private static final int BUFFER_SIZE = 1024;
-
- public static final String ASSETS__TEXT_FILE_NAME = "textFile.txt";
- public static final String ASSETS__IMAGE_FILE_NAME = "imageFile.png";
- public static final String ASSETS__VIDEO_FILE_NAME = "videoFile.MP4";
-
- //private Account mAccount = null;
- private OwnCloudClient mClient;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_test);
-
- mServerUri = getString(R.string.server_base_url);
- mUser = getString(R.string.username);
- mPass = getString(R.string.password);
-
- mClient = new OwnCloudClient(Uri.parse(mServerUri));
- mClient.setFollowRedirects(true);
- mClient.setCredentials(
- OwnCloudCredentialsFactory.newBasicCredentials(
- mUser,
- mPass
- )
- );
- mClient.setBaseUri(Uri.parse(mServerUri));
-
- Log.v(TAG, "onCreate finished, ownCloud client ready");
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.test, menu);
- return true;
- }
-
- /**
- * Access to the library method to Create a Folder
- * @param remotePath Full path to the new directory to create in the remote server.
- * @param createFullPath 'True' means that all the ancestor folders should be created if
- * don't exist yet.
- *
- * @return
- */
- public RemoteOperationResult createFolder(String remotePath, boolean createFullPath) {
-
- return TestActivity.createFolder(remotePath, createFullPath, mClient);
- }
-
- /**
- * Access to the library method to Create a Folder
- * @param remotePath Full path to the new directory to create in the remote server.
- * @param createFullPath 'True' means that all the ancestor folders should be created if
- * don't exist yet.
- * @param client Client instance configured to access the target OC server.
- *
- * @return Result of the operation
- */
- public static RemoteOperationResult createFolder(
- String remotePath, boolean createFullPath, OwnCloudClient client
- ) {
-
- CreateRemoteFolderOperation createOperation =
- new CreateRemoteFolderOperation(remotePath, createFullPath);
- RemoteOperationResult result = createOperation.execute(client);
-
- return result;
- }
-
- /**
- * Access to the library method to Rename a File or Folder
- * @param oldName Old name of the file.
- * @param oldRemotePath Old remote path of the file. For folders it starts and ends by "/"
- * @param newName New name to set as the name of file.
- * @param isFolder 'true' for folder and 'false' for files
- *
- * @return
- */
-
- public RemoteOperationResult renameFile(String oldName, String oldRemotePath, String newName, boolean isFolder) {
-
- RenameRemoteFileOperation renameOperation = new RenameRemoteFileOperation(oldName, oldRemotePath, newName, isFolder);
- RemoteOperationResult result = renameOperation.execute(mClient);
-
- return result;
- }
-
- /**
- * Access to the library method to Remove a File or Folder
- *
- * @param remotePath Remote path of the file or folder in the server.
- * @return
- */
- public RemoteOperationResult removeFile(String remotePath) {
- RemoveRemoteFileOperation removeOperation = new RemoveRemoteFileOperation(remotePath);
- RemoteOperationResult result = removeOperation.execute(mClient);
- return result;
- }
-
- /**
- * Access to the library method to Remove a File or Folder
- *
- * @param remotePath Remote path of the file or folder in the server.
- * @return
- */
- public static RemoteOperationResult removeFile(String remotePath, OwnCloudClient client) {
- RemoveRemoteFileOperation removeOperation = new RemoveRemoteFileOperation(remotePath);
- RemoteOperationResult result = removeOperation.execute(client);
- return result;
- }
-
-
- /**
- * Access to the library method to Read a Folder (PROPFIND DEPTH 1)
- * @param remotePath
- *
- * @return
- */
- public RemoteOperationResult readFile(String remotePath) {
-
- ReadRemoteFolderOperation readOperation= new ReadRemoteFolderOperation(remotePath);
- RemoteOperationResult result = readOperation.execute(mClient);
-
- return result;
- }
-
- /**
- * Access to the library method to Download a File
- * @param remotePath
- *
- * @return
- */
- public RemoteOperationResult downloadFile(RemoteFile remoteFile, String temporalFolder) {
- // Create folder
- String path = "/owncloud/tmp/" + temporalFolder;
- File privateFolder = getFilesDir();
- File folder = new File(privateFolder.getAbsolutePath() + "/" + path);
- folder.mkdirs();
-
- DownloadRemoteFileOperation downloadOperation = new DownloadRemoteFileOperation(remoteFile.getRemotePath(), folder.getAbsolutePath());
- RemoteOperationResult result = downloadOperation.execute(mClient);
-
- return result;
- }
-
- /** Access to the library method to Upload a File
- * @param storagePath
- * @param remotePath
- * @param mimeType
- *
- * @return
- */
- public RemoteOperationResult uploadFile(
- String storagePath, String remotePath, String mimeType
- ) {
-
- return TestActivity.uploadFile(storagePath, remotePath, mimeType, mClient);
- }
-
- /** Access to the library method to Upload a File
- * @param storagePath
- * @param remotePath
- * @param mimeType
- * @param client Client instance configured to access the target OC server.
- *
- * @return
- */
- public static RemoteOperationResult uploadFile(
- String storagePath, String remotePath, String mimeType, OwnCloudClient client
- ) {
-
- String fileLastModifTimestamp = getFileLastModifTimeStamp(storagePath);
-
- UploadRemoteFileOperation uploadOperation;
-
- if ((new File(storagePath)).length() > ChunkedUploadRemoteFileOperation.CHUNK_SIZE ) {
- uploadOperation = new ChunkedUploadRemoteFileOperation("1",
- storagePath, remotePath, mimeType, TAG, fileLastModifTimestamp
- );
- } else {
- uploadOperation = new UploadRemoteFileOperation(
- storagePath, remotePath, mimeType, fileLastModifTimestamp
- );
- }
-
- RemoteOperationResult result = uploadOperation.execute(client);
- return result;
- }
-
- /** Access to the library method to Get Shares
- *
- * @return
- */
- public RemoteOperationResult getShares(){
-
- GetRemoteSharesOperation getOperation = new GetRemoteSharesOperation();
- RemoteOperationResult result = getOperation.execute(mClient);
-
- return result;
- }
-
- /** Access to the library method to Create Share
- * @param path Full path of the file/folder being shared. Mandatory argument
- * @param shareType 0 = user, 1 = group, 3 = Public link. Mandatory argument
- * @param shareWith User/group ID with who the file should be shared. This is mandatory for shareType of 0 or 1
- * @param publicUpload If false (default) public cannot upload to a public shared folder.
- * If true public can upload to a shared folder. Only available for public link shares
- * @param password Password to protect a public link share. Only available for public link shares
- * @param permissions 1 - Read only Default for public shares
- * 2 - Update
- * 4 - Create
- * 8 - Delete
- * 16- Re-share
- * 31- All above Default for private shares
- * For user or group shares.
- * To obtain combinations, add the desired values together.
- * For instance, for Re-Share, delete, read, update add 16+8+2+1 = 27.
- *
- * @return
- */
- public RemoteOperationResult createShare(String path, ShareType shareType, String shareWith, boolean publicUpload,
- String password, int permissions){
-
- CreateRemoteShareOperation createOperation = new CreateRemoteShareOperation(path, shareType, shareWith, publicUpload, password, permissions);
- RemoteOperationResult result = createOperation.execute(mClient);
-
- return result;
- }
-
-
- /**
- * Access to the library method to Remove Share
- *
- * @param idShare Share ID
- */
-
- public RemoteOperationResult removeShare(int idShare) {
- RemoveRemoteShareOperation removeOperation = new RemoveRemoteShareOperation(idShare);
- RemoteOperationResult result = removeOperation.execute(mClient);
-
- return result;
-
- }
-
- public RemoteOperationResult getQuota(String remotePath) {
- GetRemoteUserQuotaOperation getUserQuotaOperation = new GetRemoteUserQuotaOperation(remotePath);
- return getUserQuotaOperation.execute(mClient);
- }
-
-
- public RemoteOperationResult getUserAvatar(int dimension, String etag) {
- GetRemoteUserAvatarOperation getUserAvatarOperation = new GetRemoteUserAvatarOperation(dimension, etag);
- return getUserAvatarOperation.execute(mClient);
- }
-
- /**
- * Extracts file from AssetManager to cache folder.
- *
- * @param fileName Name of the asset file to extract.
- * @return File instance of the extracted file.
- */
- public File extractAsset(String fileName) throws IOException {
- return TestActivity.extractAsset(fileName, this);
- }
-
- /**
- * Extracts file from AssetManager to cache folder.
- *
- * @param fileName Name of the asset file to extract.
- * @param context Android context to access assets and file system.
- * @return File instance of the extracted file.
- */
- public static File extractAsset(String fileName, Context context) throws IOException {
- File extractedFile = new File(context.getCacheDir() + File.separator + fileName);
- if (!extractedFile.exists()) {
- InputStream in = null;
- FileOutputStream out = null;
- in = context.getAssets().open(fileName);
- out = new FileOutputStream(extractedFile);
- byte[] buffer = new byte[BUFFER_SIZE];
- int readCount;
- while((readCount = in.read(buffer)) != -1){
- out.write(buffer, 0, readCount);
- }
- out.flush();
- out.close();
- in.close();
- }
- return extractedFile;
- }
-
- private static String getFileLastModifTimeStamp (String storagePath) {
- File file = new File(storagePath);
- Long timeStampLong = file.lastModified()/1000;
- return timeStampLong.toString();
- }
-}
\ No newline at end of file
diff --git a/test_client/tests/.classpath b/test_client/tests/.classpath
deleted file mode 100644
index d1c3047c..00000000
--- a/test_client/tests/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/test_client/tests/.project b/test_client/tests/.project
deleted file mode 100644
index f4fb0109..00000000
--- a/test_client/tests/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- ownCloud Android library test cases
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/test_client/tests/.settings/org.eclipse.jdt.core.prefs b/test_client/tests/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b080d2dd..00000000
--- a/test_client/tests/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/test_client/tests/AndroidManifest.xml b/test_client/tests/AndroidManifest.xml
deleted file mode 100644
index 92d36c4f..00000000
--- a/test_client/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test_client/tests/ant.properties b/test_client/tests/ant.properties
deleted file mode 100644
index 16244024..00000000
--- a/test_client/tests/ant.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# This file is used to override default values used by the Ant build system.
-#
-# This file must be checked into Version Control Systems, as it is
-# integral to the build system of your project.
-
-# This file is only used by the Ant script.
-
-# You can use this to override default values such as
-# 'source.dir' for the location of your java source folder and
-# 'out.dir' for the location of your output folder.
-
-# You can also use it define how the release builds are signed by declaring
-# the following properties:
-# 'key.store' for the location of your keystore and
-# 'key.alias' for the name of the key to use.
-# The password will be asked during the build when you use the 'release' target.
-
-tested.project.dir=..
diff --git a/test_client/tests/build.gradle b/test_client/tests/build.gradle
deleted file mode 100644
index 33b017fb..00000000
--- a/test_client/tests/build.gradle
+++ /dev/null
@@ -1,34 +0,0 @@
-apply plugin: 'com.android.application'
-
-dependencies {
- implementation fileTree(dir: 'libs', include: '*.jar')
- implementation project(':')
-}
-
-android {
- compileSdkVersion 26
-
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- resources.srcDirs = ['src']
- aidl.srcDirs = ['src']
- renderscript.srcDirs = ['src']
- res.srcDirs = ['res']
- assets.srcDirs = ['assets']
- }
-
- // Move the tests to tests/java, tests/res, etc...
- androidTest.setRoot('tests')
-
- // Move the build types to build-types/
- // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
- // This moves them out of them default location under src//... which would
- // conflict with src/ being used by the main source set.
- // Adding new build types or product flavors should be accompanied
- // by a similar customization.
- debug.setRoot('build-types/debug')
- release.setRoot('build-types/release')
- }
-}
diff --git a/test_client/tests/build.xml b/test_client/tests/build.xml
deleted file mode 100644
index b3a5cb6a..00000000
--- a/test_client/tests/build.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test_client/tests/custom_rules.xml b/test_client/tests/custom_rules.xml
deleted file mode 100644
index 1849940c..00000000
--- a/test_client/tests/custom_rules.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Checking for failures
-
-
-
-
-
- All tests passed.
-
-
-
\ No newline at end of file
diff --git a/test_client/tests/project.properties b/test_client/tests/project.properties
deleted file mode 100644
index fe3c64ae..00000000
--- a/test_client/tests/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target
-target=android-24
\ No newline at end of file
diff --git a/test_client/tests/res/drawable-hdpi/ic_launcher.png b/test_client/tests/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 96a442e5..00000000
Binary files a/test_client/tests/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/test_client/tests/res/drawable-ldpi/ic_launcher.png b/test_client/tests/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 99238729..00000000
Binary files a/test_client/tests/res/drawable-ldpi/ic_launcher.png and /dev/null differ
diff --git a/test_client/tests/res/drawable-mdpi/ic_launcher.png b/test_client/tests/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 359047df..00000000
Binary files a/test_client/tests/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/test_client/tests/res/drawable-xhdpi/ic_launcher.png b/test_client/tests/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 71c6d760..00000000
Binary files a/test_client/tests/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/test_client/tests/res/values/strings.xml b/test_client/tests/res/values/strings.xml
deleted file mode 100644
index 54e99265..00000000
--- a/test_client/tests/res/values/strings.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
- Oc_framework-testTest
-
-
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/CopyFileTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/CopyFileTest.java
deleted file mode 100644
index 289c7846..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/CopyFileTest.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2016 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.test_project.test;
-
-import android.content.Context;
-import android.net.Uri;
-import android.test.ActivityInstrumentationTestCase2;
-import android.util.Log;
-
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.OwnCloudClientFactory;
-import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory;
-import com.owncloud.android.lib.common.network.NetworkUtils;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.lib.resources.files.CopyRemoteFileOperation;
-import com.owncloud.android.lib.test_project.R;
-import com.owncloud.android.lib.test_project.TestActivity;
-
-import junit.framework.AssertionFailedError;
-
-
-
-
-
-import java.io.File;
-import java.security.GeneralSecurityException;
-
-//import android.test.AndroidTestCase;
-
-/**
- * Class to test CopyRemoteFileOperation
- *
- * With this TestCase we are experimenting a bit to improve the test suite design, in two aspects:
- *
- * - Reduce the dependency from the set of test cases on the "test project" needed to
- * have an instrumented APK to install in the device, as required by the testing framework
- * provided by Android. To get there, this class avoids calling TestActivity methods in the test
- * method.
- *
- * - Reduce the impact of creating a remote fixture over the Internet, while the structure of the
- * TestCase is kept easy to maintain. To get this, all the tests are done in a single test method,
- * granting this way that setUp and tearDown are run only once.
- *
- * @author David A. Velasco
- */
-
-//public class CopyFileTest extends AndroidTestCase {
-public class CopyFileTest extends ActivityInstrumentationTestCase2 {
-
- private static final String LOG_TAG = CopyFileTest.class.getCanonicalName();
-
-
- /// Paths to files and folders in fixture
-
- private static final String SRC_BASE_FOLDER = "/src/";
- private static final String TARGET_BASE_FOLDER = "/target/";
- private static final String NO_FILE = "nofile.txt";
- private static final String FILE1 = "file1.txt";
- private static final String FILE2 = "file2.txt";
- private static final String FILE3 = "file3.txt";
- private static final String FILE4 = "file4.txt";
- private static final String FILE5 = "file5.txt";
- private static final String FILE6 = "file6.txt";
- private static final String FILE7 = "file7.txt";
- private static final String EMPTY = "empty/";
- private static final String NO_FOLDER = "nofolder/";
- private static final String FOLDER1 = "folder1/";
- private static final String FOLDER2 = "folder2/";
- private static final String FOLDER3 = "folder3/";
- private static final String FOLDER4 = "folder4/";
-
- private static final String SRC_PATH_TO_FILE_1 = SRC_BASE_FOLDER + FILE1;
- private static final String TARGET_PATH_TO_FILE_1 = TARGET_BASE_FOLDER + FILE1;
-
- private static final String SRC_PATH_TO_FILE_2 = SRC_BASE_FOLDER + FILE2;
- private static final String TARGET_PATH_TO_FILE_2_RENAMED =
- TARGET_BASE_FOLDER + "renamed_" + FILE2;
-
- private static final String SRC_PATH_TO_FILE_3 = SRC_BASE_FOLDER + FILE3;
- private static final String SRC_PATH_TO_FILE_3_RENAMED = SRC_BASE_FOLDER + "renamed_" + FILE3;
-
- private static final String SRC_PATH_TO_FILE_4 = SRC_BASE_FOLDER + FILE4;
-
- private static final String SRC_PATH_TO_FILE_5 = SRC_BASE_FOLDER + FILE5;
-
- private static final String SRC_PATH_TO_FILE_6 = SRC_BASE_FOLDER + FILE6;
-
- private static final String SRC_PATH_TO_NON_EXISTENT_FILE = SRC_BASE_FOLDER + NO_FILE;
-
- private static final String SRC_PATH_TO_EMPTY_FOLDER = SRC_BASE_FOLDER + EMPTY;
- private static final String TARGET_PATH_TO_EMPTY_FOLDER = TARGET_BASE_FOLDER + EMPTY;
-
- private static final String SRC_PATH_TO_FULL_FOLDER_1 = SRC_BASE_FOLDER + FOLDER1;
- private static final String TARGET_PATH_TO_FULL_FOLDER_1 = TARGET_BASE_FOLDER + FOLDER1;
-
- private static final String SRC_PATH_TO_FULL_FOLDER_2 = SRC_BASE_FOLDER + FOLDER2;
-
- private static final String TARGET_PATH_TO_FULL_FOLDER_2_RENAMED =
- TARGET_BASE_FOLDER + "renamed_" + FOLDER2;
-
- private static final String SRC_PATH_TO_FULL_FOLDER_3 = SRC_BASE_FOLDER + FOLDER3;
- private static final String SRC_PATH_TO_FULL_FOLDER_4 = SRC_BASE_FOLDER + FOLDER4;
-
- private static final String SRC_PATH_TO_FULL_FOLDER_3_RENAMED =
- SRC_BASE_FOLDER + "renamed_" + FOLDER3;
-
- private static final String TARGET_PATH_RENAMED_WITH_INVALID_CHARS =
- SRC_BASE_FOLDER + "renamed:??_" + FILE6;
-
- private static final String TARGET_PATH_TO_ALREADY_EXISTENT_EMPTY_FOLDER_4 = TARGET_BASE_FOLDER
- + FOLDER4;
-
- private static final String TARGET_PATH_TO_NON_EXISTENT_FILE = TARGET_BASE_FOLDER + NO_FILE;
-
- private static final String TARGET_PATH_TO_FILE_5_INTO_NON_EXISTENT_FOLDER =
- TARGET_BASE_FOLDER + NO_FOLDER + FILE5;
-
- private static final String TARGET_PATH_TO_ALREADY_EXISTENT_FILE_7 = TARGET_BASE_FOLDER + FILE7;
-
- private static final String[] FOLDERS_IN_FIXTURE = {
- SRC_PATH_TO_EMPTY_FOLDER,
-
- SRC_PATH_TO_FULL_FOLDER_1,
- SRC_PATH_TO_FULL_FOLDER_1 + FOLDER1,
- SRC_PATH_TO_FULL_FOLDER_1 + FOLDER2,
- SRC_PATH_TO_FULL_FOLDER_1 + FOLDER2 + FOLDER1,
- SRC_PATH_TO_FULL_FOLDER_1 + FOLDER2 + FOLDER2,
-
- SRC_PATH_TO_FULL_FOLDER_2,
- SRC_PATH_TO_FULL_FOLDER_2 + FOLDER1,
- SRC_PATH_TO_FULL_FOLDER_2 + FOLDER2,
- SRC_PATH_TO_FULL_FOLDER_2 + FOLDER2 + FOLDER1,
- SRC_PATH_TO_FULL_FOLDER_2 + FOLDER2 + FOLDER2,
-
- SRC_PATH_TO_FULL_FOLDER_3,
- SRC_PATH_TO_FULL_FOLDER_3 + FOLDER1,
- SRC_PATH_TO_FULL_FOLDER_3 + FOLDER2,
- SRC_PATH_TO_FULL_FOLDER_3 + FOLDER2 + FOLDER1,
- SRC_PATH_TO_FULL_FOLDER_3 + FOLDER2 + FOLDER2,
-
- SRC_PATH_TO_FULL_FOLDER_4,
- SRC_PATH_TO_FULL_FOLDER_4 + FOLDER1,
- SRC_PATH_TO_FULL_FOLDER_4 + FOLDER2,
- SRC_PATH_TO_FULL_FOLDER_4 + FOLDER2 + FOLDER1,
- SRC_PATH_TO_FULL_FOLDER_4 + FOLDER2 + FOLDER2,
-
- TARGET_BASE_FOLDER,
- TARGET_PATH_TO_ALREADY_EXISTENT_EMPTY_FOLDER_4
- };
-
- private static final String[] FILES_IN_FIXTURE = {
- SRC_PATH_TO_FILE_1,
- SRC_PATH_TO_FILE_2,
- SRC_PATH_TO_FILE_3,
- SRC_PATH_TO_FILE_4,
- SRC_PATH_TO_FILE_5,
-
- SRC_PATH_TO_FULL_FOLDER_1 + FILE1,
- SRC_PATH_TO_FULL_FOLDER_1 + FOLDER2 + FILE1,
- SRC_PATH_TO_FULL_FOLDER_1 + FOLDER2 + FILE2,
- SRC_PATH_TO_FULL_FOLDER_1 + FOLDER2 + FOLDER2 + FILE2,
-
- SRC_PATH_TO_FULL_FOLDER_2 + FILE1,
- SRC_PATH_TO_FULL_FOLDER_2 + FOLDER2 + FILE1,
- SRC_PATH_TO_FULL_FOLDER_2 + FOLDER2 + FILE2,
- SRC_PATH_TO_FULL_FOLDER_2 + FOLDER2 + FOLDER2 + FILE2,
-
- SRC_PATH_TO_FULL_FOLDER_3 + FILE1,
- SRC_PATH_TO_FULL_FOLDER_3 + FOLDER2 + FILE1,
- SRC_PATH_TO_FULL_FOLDER_3 + FOLDER2 + FILE2,
- SRC_PATH_TO_FULL_FOLDER_3 + FOLDER2 + FOLDER2 + FILE2,
-
- SRC_PATH_TO_FULL_FOLDER_4 + FILE1,
- SRC_PATH_TO_FULL_FOLDER_4 + FOLDER2 + FILE1,
- SRC_PATH_TO_FULL_FOLDER_4 + FOLDER2 + FILE2,
- SRC_PATH_TO_FULL_FOLDER_4 + FOLDER2 + FOLDER2 + FILE2,
-
- TARGET_PATH_TO_ALREADY_EXISTENT_FILE_7
- };
-
-
- String mServerUri, mUser, mPass;
- OwnCloudClient mClient = null;
-
- public CopyFileTest() {
- super(TestActivity.class);
-
- Protocol pr = Protocol.getProtocol("https");
- if (pr == null || !(pr.getSocketFactory() instanceof SelfSignedConfidentSslSocketFactory)) {
- try {
- ProtocolSocketFactory psf = new SelfSignedConfidentSslSocketFactory();
- Protocol.registerProtocol(
- "https",
- new Protocol("https", psf, 443));
-
- } catch (GeneralSecurityException e) {
- throw new AssertionFailedError(
- "Self-signed confident SSL context could not be loaded");
- }
- }
-
- }
-
-
- protected Context getContext() {
- return getActivity();
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- // Next initialization cannot be done in the constructor because getContext() is not
- // ready yet, returns NULL.
- initAccessToServer(getContext());
-
- Log.v(LOG_TAG, "Setting up the remote fixture...");
-
- RemoteOperationResult result = null;
- for (String folderPath : FOLDERS_IN_FIXTURE) {
- result = TestActivity.createFolder(folderPath, true, mClient);
- if (!result.isSuccess()) {
- Utils.logAndThrow(LOG_TAG, result);
- }
- }
-
- File txtFile = TestActivity.extractAsset(
- TestActivity.ASSETS__TEXT_FILE_NAME, getContext()
- );
- for (String filePath : FILES_IN_FIXTURE) {
- result = TestActivity.uploadFile(
- txtFile.getAbsolutePath(), filePath, "txt/plain", mClient
- );
- if (!result.isSuccess()) {
- Utils.logAndThrow(LOG_TAG, result);
- }
- }
-
- Log.v(LOG_TAG, "Remote fixture created.");
-
- }
-
-
- /**
- * Test copy folder
- */
- public void testCopyRemoteFileOperation() {
- Log.v(LOG_TAG, "testCopyFolder in");
-
- /// successful cases
-
- // copy file
- CopyRemoteFileOperation copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FILE_1,
- TARGET_PATH_TO_FILE_1,
- false
- );
- RemoteOperationResult result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
- // copy & rename file, different location
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FILE_2,
- TARGET_PATH_TO_FILE_2_RENAMED,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
- // copy & rename file, same location (rename file)
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FILE_3,
- SRC_PATH_TO_FILE_3_RENAMED,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
- // copy empty folder
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_EMPTY_FOLDER,
- TARGET_PATH_TO_EMPTY_FOLDER,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
- // copy non-empty folder
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FULL_FOLDER_1,
- TARGET_PATH_TO_FULL_FOLDER_1,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
- // copy & rename folder, different location
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FULL_FOLDER_2,
- TARGET_PATH_TO_FULL_FOLDER_2_RENAMED,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
- // copy & rename folder, same location (rename folder)
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FULL_FOLDER_3,
- SRC_PATH_TO_FULL_FOLDER_3_RENAMED,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
- // copy for nothing (success, but no interaction with network)
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FILE_4,
- SRC_PATH_TO_FILE_4,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
- // copy overwriting
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FULL_FOLDER_4,
- TARGET_PATH_TO_ALREADY_EXISTENT_EMPTY_FOLDER_4,
- true
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.isSuccess());
-
-
- /// Failed cases
-
- // file to copy does not exist
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_NON_EXISTENT_FILE,
- TARGET_PATH_TO_NON_EXISTENT_FILE,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.getCode() == ResultCode.FILE_NOT_FOUND);
-
- // folder to copy into does no exist
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FILE_5,
- TARGET_PATH_TO_FILE_5_INTO_NON_EXISTENT_FOLDER,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.getHttpCode() == HttpConstants.HTTP_CONFLICT);
-
- // target location (renaming) has invalid characters
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FILE_6,
- TARGET_PATH_RENAMED_WITH_INVALID_CHARS,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
-
- // name collision
- copyOperation = new CopyRemoteFileOperation(
- SRC_PATH_TO_FILE_1,
- TARGET_PATH_TO_ALREADY_EXISTENT_FILE_7,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.getCode() == ResultCode.INVALID_OVERWRITE);
-
- // copy a folder into a descendant
- copyOperation = new CopyRemoteFileOperation(
- SRC_BASE_FOLDER,
- SRC_PATH_TO_EMPTY_FOLDER,
- false
- );
- result = copyOperation.execute(mClient);
- assertTrue(result.getCode() == ResultCode.INVALID_COPY_INTO_DESCENDANT);
- }
-
- @Override
- protected void tearDown() throws Exception {
- Log.v(LOG_TAG, "Deleting remote fixture...");
-
- String[] mPathsToCleanUp = {
- SRC_BASE_FOLDER,
- TARGET_BASE_FOLDER
- };
-
- for (String path : mPathsToCleanUp) {
- RemoteOperationResult removeResult =
- TestActivity.removeFile(path, mClient);
- if (!removeResult.isSuccess() && removeResult.getCode() != ResultCode.TIMEOUT) {
- Utils.logAndThrow(LOG_TAG, removeResult);
- }
- }
-
- super.tearDown();
-
- Log.v(LOG_TAG, "Remote fixture delete.");
- }
-
-
- private void initAccessToServer(Context context) {
- Log.v(LOG_TAG, "Setting up client instance to access OC server...");
-
- mServerUri = context.getString(R.string.server_base_url);
- mUser = context.getString(R.string.username);
- mPass = context.getString(R.string.password);
-
- mClient = new OwnCloudClient(
- Uri.parse(mServerUri),
- NetworkUtils.getMultiThreadedConnManager()
- );
- mClient.setDefaultTimeouts(
- OwnCloudClientFactory.DEFAULT_DATA_TIMEOUT,
- OwnCloudClientFactory.DEFAULT_CONNECTION_TIMEOUT);
- mClient.setFollowRedirects(true);
- mClient.setCredentials(
- OwnCloudCredentialsFactory.newBasicCredentials(
- mUser,
- mPass
- )
- );
-
- Log.v(LOG_TAG, "Client instance set up.");
-
- }
-
-
-}
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/CreateFolderTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/CreateFolderTest.java
deleted file mode 100644
index a454a7cc..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/CreateFolderTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2016 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.test_project.test;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.lib.test_project.TestActivity;
-
-/**
- * Class to test Create Folder Operation
- * @author masensio
- * @author David A. Velasco
- *
- */
-public class CreateFolderTest extends RemoteTest {
-
-
- private static final String LOG_TAG = CreateFolderTest.class.getCanonicalName();
-
- private static final String FOLDER_PATH_BASE = "/testCreateFolder";
-
- private TestActivity mActivity;
- private List mCreatedFolderPaths;
- private String mFullPath2FolderBase;
-
- public CreateFolderTest() {
- super();
- mCreatedFolderPaths = new ArrayList();
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mActivity = getActivity();
- mCreatedFolderPaths.clear();
- mFullPath2FolderBase = mBaseFolderPath + FOLDER_PATH_BASE;
- }
-
- /**
- * Test Create Folder
- */
- public void testCreateFolder() {
- String remotePath = mFullPath2FolderBase;
- mCreatedFolderPaths.add(remotePath);
- RemoteOperationResult result = mActivity.createFolder(remotePath, true);
- assertTrue(result.isSuccess() || result.getCode() == ResultCode.TIMEOUT);
-
- // Create Subfolder
- remotePath = mFullPath2FolderBase + FOLDER_PATH_BASE;
- mCreatedFolderPaths.add(remotePath);
- result = mActivity.createFolder(remotePath, true);
- assertTrue(result.isSuccess() || result.getCode() == ResultCode.TIMEOUT);
- }
-
-
- /**
- * Test to Create Folder with special characters: / \ < > : " | ? *
- */
- public void testCreateFolderSpecialCharacters() {
-
- String remotePath = mFullPath2FolderBase + "_\\";
- RemoteOperationResult result = mActivity.createFolder(remotePath, true);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
-
- remotePath = mFullPath2FolderBase + "_<";
- result = mActivity.createFolder(remotePath, true);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
-
- remotePath = mFullPath2FolderBase + "_>";
- result = mActivity.createFolder(remotePath, true);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
-
- remotePath = mFullPath2FolderBase + "_:";
- result = mActivity.createFolder(remotePath, true);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
-
- remotePath = mFullPath2FolderBase + "_\"";
- result = mActivity.createFolder(remotePath, true);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
-
- remotePath = mFullPath2FolderBase + "_|";
- result = mActivity.createFolder(remotePath, true);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
-
- remotePath = mFullPath2FolderBase + "_?";
- result = mActivity.createFolder(remotePath, true);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
-
- remotePath = mFullPath2FolderBase + "_*";
- result = mActivity.createFolder(remotePath, true);
- assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
- }
-
-
- @Override
- protected void tearDown() throws Exception {
- Iterator it = mCreatedFolderPaths.iterator();
- RemoteOperationResult removeResult = null;
- while (it.hasNext()) {
- removeResult = mActivity.removeFile(it.next());
- if (!removeResult.isSuccess() && removeResult.getCode() != ResultCode.TIMEOUT) {
- Utils.logAndThrow(LOG_TAG, removeResult);
- }
- }
- super.tearDown();
- }
-
-}
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/CreateShareTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/CreateShareTest.java
deleted file mode 100644
index 6780e920..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/CreateShareTest.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2016 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.test_project.test;
-
-import java.io.File;
-
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.lib.resources.shares.ShareType;
-import com.owncloud.android.lib.test_project.R;
-import com.owncloud.android.lib.test_project.TestActivity;
-
-/**
- * Test Create Share: the server must support SHARE API
- */
-public class CreateShareTest extends RemoteTest {
-
- private static final String LOG_TAG = CreateShareTest.class.getCanonicalName();
-
- /* File to share.*/
- private static final String FILE_TO_SHARE = "/fileToShare.txt";
-
- /* Non-existent file*/
- private static final String NON_EXISTENT_FILE = "/nonExistentFile.txt";
-
- private TestActivity mActivity;
- private String mFullPath2FileToShare;
- private String mFullPath2NonExistentFile;
- private String mRemoteServer;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- setActivityInitialTouchMode(false);
- mActivity = getActivity();
- mFullPath2FileToShare = mBaseFolderPath + FILE_TO_SHARE;
- mFullPath2NonExistentFile = mBaseFolderPath + NON_EXISTENT_FILE;
- mRemoteServer = getActivity().getString(R.string.server_base_url_2);
-
- File textFile = mActivity.extractAsset(TestActivity.ASSETS__TEXT_FILE_NAME);
- RemoteOperationResult result = mActivity.uploadFile(
- textFile.getAbsolutePath(),
- mFullPath2FileToShare,
- "txt/plain");
- if (!result.isSuccess()) {
- Utils.logAndThrow(LOG_TAG, result);
- }
- }
-
- /**
- * Test creation of public shares
- */
- public void testCreatePublicShare() {
-
- /// Successful cases
- RemoteOperationResult result = mActivity.createShare(
- mFullPath2FileToShare,
- ShareType.PUBLIC_LINK,
- "",
- false,
- "",
- 1);
- assertTrue(result.isSuccess());
-
- /// Failed cases
-
- // file doesn't exist
- result = mActivity.createShare(
- mFullPath2NonExistentFile,
- ShareType.PUBLIC_LINK,
- "",
- false,
- "",
- 1);
- assertFalse(result.isSuccess());
- assertEquals(
- RemoteOperationResult.ResultCode.SHARE_NOT_FOUND,
- result.getCode()
- );
- assertTrue( // error message from server as part of the result
- result.getData().size() == 1 &&
- result.getData().get(0) instanceof String
- );
-
- }
-
-
- /**
- * Test creation of private shares with groups
- */
- public void testCreatePrivateShareWithUser() {
-
- /// Successful cases
- RemoteOperationResult result = mActivity.createShare(
- mFullPath2FileToShare,
- ShareType.USER,
- "admin",
- false,
- "",
- 31);
- assertTrue(result.isSuccess());
-
-
- /// Failed cases
-
- // sharee doesn't exist
- result = mActivity.createShare(
- mFullPath2FileToShare,
- ShareType.USER,
- "no_exist",
- false,
- "",
- 31);
- assertFalse(result.isSuccess());
- assertEquals(
- RemoteOperationResult.ResultCode.SHARE_FORBIDDEN,
- result.getCode()
- );
- assertTrue( // error message from server as part of the result
- result.getData().size() == 1 &&
- result.getData().get(0) instanceof String
- );
-
- // file doesn't exist
- result = mActivity.createShare(
- mFullPath2NonExistentFile,
- ShareType.USER,
- "admin",
- false,
- "",
- 31);
- assertFalse(result.isSuccess());
- assertEquals(
- RemoteOperationResult.ResultCode.SHARE_NOT_FOUND,
- result.getCode()
- );
- assertTrue( // error message from server as part of the result
- result.getData().size() == 1 &&
- result.getData().get(0) instanceof String
- );
-
- }
-
-
- /**
- * Test creation of private shares with groups
- */
- public void testCreatePrivateShareWithGroup() {
-
- /// Successful cases
- RemoteOperationResult result = mActivity.createShare(
- mFullPath2FileToShare,
- ShareType.GROUP,
- "admin",
- false,
- "",
- 1);
- assertTrue(result.isSuccess());
-
-
- /// Failed cases
-
- // sharee doesn't exist
- result = mActivity.createShare(
- mFullPath2FileToShare,
- ShareType.GROUP,
- "no_exist",
- false,
- "",
- 31);
- assertFalse(result.isSuccess());
- assertEquals(
- RemoteOperationResult.ResultCode.SHARE_FORBIDDEN,
- result.getCode()
- );
- assertTrue( // error message from server as part of the result
- result.getData().size() == 1 &&
- result.getData().get(0) instanceof String
- );
-
- // file doesn't exist
- result = mActivity.createShare(
- mFullPath2NonExistentFile,
- ShareType.GROUP,
- "admin",
- false,
- "",
- 31);
- assertFalse(result.isSuccess());
- assertEquals(
- RemoteOperationResult.ResultCode.SHARE_NOT_FOUND,
- result.getCode()
- );
- assertTrue( // error message from server as part of the result
- result.getData().size() == 1 &&
- result.getData().get(0) instanceof String
- );
-
- }
-
- /**
- * Test creation of federated shares with remote users
- */
- public void testCreateFederatedShareWithUser() {
-
- String remoteDomain = mRemoteServer.split("//")[1];
-
- /// Successful cases
- RemoteOperationResult result = mActivity.createShare(
- mFullPath2FileToShare,
- ShareType.FEDERATED,
- "admin@" + remoteDomain,
- false,
- "",
- 1);
- assertTrue(result.isSuccess());
-
-
- /// Failed cases
-
- // sharee doesn't exist in an existing remote server
- result = mActivity.createShare(
- mFullPath2FileToShare,
- ShareType.FEDERATED,
- "no_exist@" + remoteDomain,
- false,
- "",
- 31);
- assertFalse(result.isSuccess());
- assertEquals(
- RemoteOperationResult.ResultCode.SHARE_FORBIDDEN,
- result.getCode()
- );
- assertTrue( // error message from server as part of the result
- result.getData().size() == 1 &&
- result.getData().get(0) instanceof String
- );
-
- // remote server doesn't exist
- result = mActivity.createShare(
- mFullPath2FileToShare,
- ShareType.FEDERATED,
- "no_exist",
- false,
- "",
- 31);
- assertFalse(result.isSuccess());
- assertEquals(
- RemoteOperationResult.ResultCode.SHARE_WRONG_PARAMETER,
- result.getCode()
- );
- assertTrue( // error message from server as part of the result
- result.getData().size() == 1 &&
- result.getData().get(0) instanceof String
- );
-
- // file doesn't exist
- result = mActivity.createShare(
- mFullPath2NonExistentFile,
- ShareType.FEDERATED,
- "admin@" + remoteDomain,
- false,
- "",
- 31);
- assertFalse(result.isSuccess());
- assertEquals(
- RemoteOperationResult.ResultCode.SHARE_NOT_FOUND,
- result.getCode()
- );
- assertTrue( // error message from server as part of the result
- result.getData().size() == 1 &&
- result.getData().get(0) instanceof String
- );
-
- }
-
-
- @Override
- protected void tearDown() throws Exception {
- RemoteOperationResult removeResult = mActivity.removeFile(mFullPath2FileToShare);
- if (!removeResult.isSuccess() && removeResult.getCode() != ResultCode.TIMEOUT) {
- Utils.logAndThrow(LOG_TAG, removeResult);
- }
- super.tearDown();
- }
-
-
-}
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/DeleteFileTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/DeleteFileTest.java
deleted file mode 100644
index 4a93a99e..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/DeleteFileTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2016 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.test_project.test;
-
-import java.io.File;
-
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.lib.test_project.TestActivity;
-
-/**
- * Class to test Delete a File Operation
- * @author masensio
- *
- */
-
-public class DeleteFileTest extends RemoteTest {
-
- private static final String LOG_TAG = DeleteFileTest.class.getCanonicalName();
-
- /* Folder data to delete. */
- private static final String FOLDER_PATH = "/folderToDelete";
-
- /* File to delete. */
- private static final String FILE_PATH = "/fileToDelete.txt";
-
- private TestActivity mActivity;
- private String mFullPath2Folder;
- private String mFullPath2File;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- setActivityInitialTouchMode(false);
- mActivity = getActivity();
- mFullPath2Folder = mBaseFolderPath + FOLDER_PATH;
- mFullPath2File = mBaseFolderPath + FILE_PATH;
-
- RemoteOperationResult result = mActivity.createFolder(mFullPath2Folder, true);
- if (!result.isSuccess() && result.getCode() != ResultCode.TIMEOUT) {
- Utils.logAndThrow(LOG_TAG, result);
- }
-
- File textFile = mActivity.extractAsset(TestActivity.ASSETS__TEXT_FILE_NAME);
- result = mActivity.uploadFile(
- textFile.getAbsolutePath(),
- mFullPath2File,
- "txt/plain");
- if (!result.isSuccess()) {
- Utils.logAndThrow(LOG_TAG, result);
- }
-
- }
-
- /**
- * Test Remove Folder
- */
- public void testRemoveFolder() {
-
- RemoteOperationResult result = mActivity.removeFile(mFullPath2Folder);
- assertTrue(result.isSuccess());
- }
-
- /**
- * Test Remove File
- */
- public void testRemoveFile() {
-
- RemoteOperationResult result = mActivity.removeFile(mFullPath2File);
- assertTrue(result.isSuccess());
- }
-
-
- @Override
- protected void tearDown() throws Exception {
- // nothing to do:
- // - if tests were fine, there is nothing to clean up in the server side
- // - if tests failed, there is nothing we can do to clean up the server side
- super.tearDown();
- }
-
-}
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/DownloadFileTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/DownloadFileTest.java
deleted file mode 100644
index 88190e4b..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/DownloadFileTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2016 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.test_project.test;
-
-import java.io.File;
-
-import com.owncloud.android.lib.resources.files.RemoteFile;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.lib.test_project.TestActivity;
-
-/**
- * Class to test Download File Operation
- * @author masensio
- * @author David A. Velasco
- */
-
-public class DownloadFileTest extends RemoteTest {
-
-
- private static final String LOG_TAG = DownloadFileTest.class.getCanonicalName();
-
- /* Files to download. These files must exist on the account */
- private static final String IMAGE_PATH = "/fileToDownload.png";
- private static final String IMAGE_PATH_WITH_SPECIAL_CHARS = "/@file@download.png";
- private static final String IMAGE_NOT_FOUND = "/fileNotFound.png";
-
- private String mFullPath2Image;
- private String mFullPath2ImageWitSpecialChars;
- private String mFullPath2ImageNotFound;
- private String mDownloadedFilePath;
- private TestActivity mActivity;
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- setActivityInitialTouchMode(false);
- mActivity = getActivity();
- mDownloadedFilePath = null;
- mFullPath2Image = mBaseFolderPath + IMAGE_PATH;
- mFullPath2ImageWitSpecialChars = mBaseFolderPath + IMAGE_PATH_WITH_SPECIAL_CHARS;
- mFullPath2ImageNotFound = mBaseFolderPath + IMAGE_NOT_FOUND;
-
- File imageFile = mActivity.extractAsset(TestActivity.ASSETS__IMAGE_FILE_NAME);
-
- RemoteOperationResult result = mActivity.uploadFile(
- imageFile.getAbsolutePath(),
- mFullPath2Image,
- "image/png");
- if (!result.isSuccess()) {
- Utils.logAndThrow(LOG_TAG, result);
- }
-
- result = mActivity.uploadFile(
- imageFile.getAbsolutePath(),
- mFullPath2ImageWitSpecialChars,
- "image/png");
- if (!result.isSuccess()) {
- Utils.logAndThrow(LOG_TAG, result);
- }
-
- result = mActivity.removeFile(mFullPath2ImageNotFound);
- if (!result.isSuccess() && result.getCode() != ResultCode.FILE_NOT_FOUND) {
- Utils.logAndThrow(LOG_TAG, result);
- }
-
- }
-
- /**
- * Test Download a File
- */
- public void testDownloadFile() {
- RemoteOperationResult result = mActivity.downloadFile(
- new RemoteFile(mFullPath2Image), ""
- );
- mDownloadedFilePath = mFullPath2Image;
- assertTrue(result.isSuccess());
- // TODO some checks involving the local file
- }
-
- /**
- * Test Download a File with special chars
- */
- public void testDownloadFileSpecialChars() {
- RemoteOperationResult result = mActivity.downloadFile(
- new RemoteFile(mFullPath2ImageWitSpecialChars), ""
- );
- mDownloadedFilePath = mFullPath2ImageWitSpecialChars;
- assertTrue(result.isSuccess());
- // TODO some checks involving the local file
- }
-
- /**
- * Test Download a Not Found File
- */
- public void testDownloadFileNotFound() {
- RemoteOperationResult result = mActivity.downloadFile(
- new RemoteFile(mFullPath2ImageNotFound), ""
- );
- assertFalse(result.isSuccess());
- }
-
-
- @Override
- protected void tearDown() throws Exception {
- if (mDownloadedFilePath != null) {
- RemoteOperationResult removeResult = mActivity.removeFile(mDownloadedFilePath);
- if (!removeResult.isSuccess() && removeResult.getCode() != ResultCode.TIMEOUT) {
- Utils.logAndThrow(LOG_TAG, removeResult);
- }
- }
- File[] files = mActivity.getFilesDir().listFiles();
- for (File file : files) {
- file.delete();
- }
- super.tearDown();
- }
-
-
-}
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetCapabilitiesTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetCapabilitiesTest.java
deleted file mode 100644
index 9150d8fb..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetCapabilitiesTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * @author masensio
- * Copyright (C) 2016 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.test_project.test;
-
-import java.security.GeneralSecurityException;
-
-import junit.framework.AssertionFailedError;
-
-
-
-
-import android.content.Context;
-import android.net.Uri;
-import android.util.Log;
-
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.OwnCloudClientFactory;
-import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory;
-import com.owncloud.android.lib.common.network.NetworkUtils;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.resources.status.GetRemoteCapabilitiesOperation;
-import com.owncloud.android.lib.test_project.R;
-
-/**
- * Class to test GetRemoteCapabilitiesOperation
- *
- */
-public class GetCapabilitiesTest extends RemoteTest {
- private static final String LOG_TAG = GetCapabilitiesTest.class.getCanonicalName();
-
- String mServerUri, mUser, mPass;
- OwnCloudClient mClient = null;
-
- public GetCapabilitiesTest() {
- super();
-
- Protocol pr = Protocol.getProtocol("https");
- if (pr == null || !(pr.getSocketFactory() instanceof SelfSignedConfidentSslSocketFactory)) {
- try {
- ProtocolSocketFactory psf = new SelfSignedConfidentSslSocketFactory();
- Protocol.registerProtocol(
- "https",
- new Protocol("https", psf, 443));
-
- } catch (GeneralSecurityException e) {
- throw new AssertionFailedError(
- "Self-signed confident SSL context could not be loaded");
- }
- }
-
- }
-
-
- protected Context getContext() {
- return getActivity();
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- // Next initialization cannot be done in the constructor because getContext() is not
- // ready yet, returns NULL.
- initAccessToServer(getContext());
-
- Log.v(LOG_TAG, "Setting up the remote fixture...");
-
- Log.v(LOG_TAG, "Remote fixture created.");
-
- }
-
-
- // Tests
- /**
- * Test get capabilities
- *
- * Requires OC server 8.1 or later
- */
- public void testGetRemoteCapabilitiesOperation() {
- // get capabilities
- GetRemoteCapabilitiesOperation getCapabilitiesOperation = new GetRemoteCapabilitiesOperation();
- RemoteOperationResult result = getCapabilitiesOperation.execute(mClient);
- assertTrue(result.isSuccess());
- assertTrue(result.getData() != null && result.getData().size() == 1);
-
- }
-
- @Override
- protected void tearDown() throws Exception {
- Log.v(LOG_TAG, "Deleting remote fixture...");
- super.tearDown();
- Log.v(LOG_TAG, "Remote fixture delete.");
- }
-
-
- private void initAccessToServer(Context context) {
- Log.v(LOG_TAG, "Setting up client instance to access OC server...");
-
- mServerUri = context.getString(R.string.server_base_url);
- mUser = context.getString(R.string.username);
- mPass = context.getString(R.string.password);
-
- mClient = new OwnCloudClient(
- Uri.parse(mServerUri),
- NetworkUtils.getMultiThreadedConnManager()
- );
- mClient.setDefaultTimeouts(
- OwnCloudClientFactory.DEFAULT_DATA_TIMEOUT,
- OwnCloudClientFactory.DEFAULT_CONNECTION_TIMEOUT);
- mClient.setFollowRedirects(true);
- mClient.setCredentials(
- OwnCloudCredentialsFactory.newBasicCredentials(
- mUser,
- mPass
- )
- );
-
- Log.v(LOG_TAG, "Client instance set up.");
-
- }
-}
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetShareesTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetShareesTest.java
deleted file mode 100644
index 7140cb45..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetShareesTest.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * @author David A. Velasco
- * Copyright (C) 2016 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.test_project.test;
-
-import java.security.GeneralSecurityException;
-
-import junit.framework.AssertionFailedError;
-
-
-
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.OwnCloudClientFactory;
-import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory;
-import com.owncloud.android.lib.common.network.NetworkUtils;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.resources.shares.GetRemoteShareesOperation;
-import com.owncloud.android.lib.resources.shares.ShareType;
-import com.owncloud.android.lib.test_project.R;
-
-import android.content.Context;
-import android.net.Uri;
-import android.util.Log;
-
-/**
- * Class to test GetRemoteShareesOperation
- *
- * With this TestCase we are experimenting a bit to improve the test suite design, in two aspects:
- *
- * - Reduce the dependency from the set of test cases on the "test project" needed to
- * have an instrumented APK to install in the device, as required by the testing framework
- * provided by Android. To get there, this class avoids calling TestActivity methods in the test
- * method.
- *
- * - Reduce the impact of creating a remote fixture over the Internet, while the structure of the
- * TestCase is kept easy to maintain. To get this, all the tests are done in a single test method,
- * granting this way that setUp and tearDown are run only once.
- *
- */
-
-public class GetShareesTest extends RemoteTest {
-
- private static final String LOG_TAG = GetShareesTest.class.getCanonicalName();
-
- String mServerUri, mUser, mPass, mServerUri2;
- OwnCloudClient mClient = null;
-
- public GetShareesTest() {
- super();
-
- Protocol pr = Protocol.getProtocol("https");
- if (pr == null || !(pr.getSocketFactory() instanceof SelfSignedConfidentSslSocketFactory)) {
- try {
- ProtocolSocketFactory psf = new SelfSignedConfidentSslSocketFactory();
- Protocol.registerProtocol(
- "https",
- new Protocol("https", psf, 443));
-
- } catch (GeneralSecurityException e) {
- throw new AssertionFailedError(
- "Self-signed confident SSL context could not be loaded");
- }
- }
-
- }
-
-
- protected Context getContext() {
- return getActivity();
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- // Next initialization cannot be done in the constructor because getContext() is not
- // ready yet, returns NULL.
- initAccessToServer(getContext());
-
- Log.v(LOG_TAG, "Setting up the remote fixture...");
-
- Log.v(LOG_TAG, "Remote fixture created.");
-
- }
-
-
- /**
- * Test get sharees
- *
- * Requires OC server 8.2 or later
- */
- public void testGetRemoteShareesOperation() {
- Log.v(LOG_TAG, "testGetRemoteSharees in");
-
- /// successful cases
-
- // search for sharees including "a"
- GetRemoteShareesOperation getShareesOperation = new GetRemoteShareesOperation("a", 1, 50);
- RemoteOperationResult result = getShareesOperation.execute(mClient);
- JSONObject resultItem;
- JSONObject value;
- int type;
- int userCount = 0, groupCount = 0;
- assertTrue(result.isSuccess() && result.getData().size() > 0);
- try {
- for (int i=0; i 0);
- assertTrue(groupCount > 0);
- } catch (JSONException e) {
- AssertionFailedError afe = new AssertionFailedError(e.getLocalizedMessage());
- afe.setStackTrace(e.getStackTrace());
- throw afe;
- }
-
- // search for sharees including "ad" - expecting user "admin" & group "admin"
- getShareesOperation = new GetRemoteShareesOperation("ad", 1, 50);
- result = getShareesOperation.execute(mClient);
- assertTrue(result.isSuccess() && result.getData().size() == 2);
- userCount = 0; groupCount = 0;
- try {
- for (int i=0; i<2; i++) {
- resultItem = (JSONObject) result.getData().get(i);
- value = resultItem.getJSONObject(GetRemoteShareesOperation.NODE_VALUE);
- type = value.getInt(GetRemoteShareesOperation.PROPERTY_SHARE_TYPE);
- if (type == ShareType.GROUP.getValue()) {
- groupCount++;
- } else {
- userCount++;
- }
- }
- assertEquals(userCount, 1);
- assertEquals(groupCount, 1);
- } catch (JSONException e) {
- AssertionFailedError afe = new AssertionFailedError(e.getLocalizedMessage());
- afe.setStackTrace(e.getStackTrace());
- throw afe;
- }
-
-
- // search for sharees including "bd" - expecting 0 results
- getShareesOperation = new GetRemoteShareesOperation("bd", 1, 50);
- result = getShareesOperation.execute(mClient);
- assertTrue(result.isSuccess() && result.getData().size() == 0);
-
-
- /// failed cases
-
- // search for sharees including wrong page values
- getShareesOperation = new GetRemoteShareesOperation("a", 0, 50);
- result = getShareesOperation.execute(mClient);
- assertTrue(!result.isSuccess() && result.getHttpCode() == HttpConstants.HTTP_BAD_REQUEST);
-
- getShareesOperation = new GetRemoteShareesOperation("a", 1, 0);
- result = getShareesOperation.execute(mClient);
- assertTrue(!result.isSuccess() && result.getHttpCode() == HttpConstants.HTTP_BAD_REQUEST);
- }
-
- /**
- * Test get federated sharees
- *
- * Requires OC server 8.2 or later
- */
- public void testGetFederatedShareesOperation() {
- Log.v(LOG_TAG, "testGetFederatedSharees in");
-
- /// successful cases
-
- // search for sharees including "@"
- GetRemoteShareesOperation getShareesOperation = new GetRemoteShareesOperation("@", 1, 50);
- RemoteOperationResult result = getShareesOperation.execute(mClient);
- JSONObject resultItem;
- JSONObject value;
- int type;
- int fedCount = 0;
- assertTrue(result.isSuccess() && result.getData().size() > 0);
- try {
- for (int i=0; i 0);
- } catch (JSONException e) {
- AssertionFailedError afe = new AssertionFailedError(e.getLocalizedMessage());
- afe.setStackTrace(e.getStackTrace());
- throw afe;
- }
-
- // search for 'admin' sharee from external server - expecting at least 1 result
- String remoteSharee = "admin@" + mServerUri2.split("//")[1];
- getShareesOperation = new GetRemoteShareesOperation(remoteSharee, 1, 50);
- result = getShareesOperation.execute(mClient);
- assertTrue(result.isSuccess() && result.getData().size() > 0);
-
-
- /// failed cases
-
- // search for sharees including wrong page values
- getShareesOperation = new GetRemoteShareesOperation("@", 0, 50);
- result = getShareesOperation.execute(mClient);
- assertTrue(!result.isSuccess() && result.getHttpCode() == HttpConstants.HTTP_BAD_REQUEST);
-
- getShareesOperation = new GetRemoteShareesOperation("@", 1, 0);
- result = getShareesOperation.execute(mClient);
- assertTrue(!result.isSuccess() && result.getHttpCode() == HttpConstants.HTTP_BAD_REQUEST);
- }
-
- @Override
- protected void tearDown() throws Exception {
- Log.v(LOG_TAG, "Deleting remote fixture...");
- super.tearDown();
- Log.v(LOG_TAG, "Remote fixture delete.");
- }
-
-
- private void initAccessToServer(Context context) {
- Log.v(LOG_TAG, "Setting up client instance to access OC server...");
-
- mServerUri = context.getString(R.string.server_base_url);
- mServerUri2 = context.getString(R.string.server_base_url_2);
- mUser = context.getString(R.string.username);
- mPass = context.getString(R.string.password);
-
- mClient = new OwnCloudClient(
- Uri.parse(mServerUri),
- NetworkUtils.getMultiThreadedConnManager()
- );
- mClient.setDefaultTimeouts(
- OwnCloudClientFactory.DEFAULT_DATA_TIMEOUT,
- OwnCloudClientFactory.DEFAULT_CONNECTION_TIMEOUT);
- mClient.setFollowRedirects(true);
- mClient.setCredentials(
- OwnCloudCredentialsFactory.newBasicCredentials(
- mUser,
- mPass
- )
- );
-
- Log.v(LOG_TAG, "Client instance set up.");
-
- }
-
-
-}
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetSharesTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetSharesTest.java
deleted file mode 100644
index ded74c53..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetSharesTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2016 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.test_project.test;
-
-import java.io.File;
-
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.lib.resources.shares.ShareType;
-import com.owncloud.android.lib.test_project.TestActivity;
-
-/**
- * Class to test Get Shares Operation
- *
- * @author masensio
- *
- */
-
-public class GetSharesTest extends RemoteTest {
-
- private static final String LOG_TAG = GetSharesTest.class.getCanonicalName();
-
- private static final String SHARED_FILE = "/sharedFileToGet.txt";
-
- private TestActivity mActivity;
- private String mFullPath2SharedFile;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- setActivityInitialTouchMode(false);
- mActivity = getActivity();
- mFullPath2SharedFile = mBaseFolderPath + SHARED_FILE;
-
- File textFile = mActivity.extractAsset(TestActivity.ASSETS__TEXT_FILE_NAME);
- RemoteOperationResult result = mActivity.uploadFile(
- textFile.getAbsolutePath(),
- mFullPath2SharedFile,
- "txt/plain");
- if (!result.isSuccess()) {
- Utils.logAndThrow(LOG_TAG, result);
- }
-
- result = mActivity.createShare(mFullPath2SharedFile, ShareType.PUBLIC_LINK, "", false, "", 1);
- if (!result.isSuccess() && result.getCode() != ResultCode.TIMEOUT) {
- Utils.logAndThrow(LOG_TAG, result);
- }
-
- }
-
- /**
- * Test Get Shares: the server must support SHARE API
- */
- public void testGetShares() {
- RemoteOperationResult result = mActivity.getShares();
- assertTrue(result.isSuccess());
- assertTrue(result.getData() != null && result.getData().size() == 1);
- }
-
-
- @Override
- protected void tearDown() throws Exception {
- RemoteOperationResult removeResult = mActivity.removeFile(mFullPath2SharedFile);
- if (!removeResult.isSuccess() && removeResult.getCode() != ResultCode.TIMEOUT) {
- Utils.logAndThrow(LOG_TAG, removeResult);
- }
- super.tearDown();
- }
-
-
-}
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetUserAvatarTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetUserAvatarTest.java
deleted file mode 100644
index 46dfe8a8..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetUserAvatarTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- *
- * Copyright (C) 2016 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.test_project.test;
-
-import java.util.*;
-
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.resources.users.GetRemoteUserAvatarOperation.ResultData;
-import com.owncloud.android.lib.test_project.TestActivity;
-
-
-
-/**
- * Class to test {@link GetRemoteUserAvatarOperation}
- *
- * @author David A. Velasco
- */
-public class GetUserAvatarTest extends RemoteTest {
-
-
- private static final String LOG_TAG = GetUserAvatarTest.class.getCanonicalName();
-
- private static final int AVATAR_DIMENSION = 256;
-
- private TestActivity mActivity;
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mActivity = getActivity();
- }
-
- /**
- * Test get user avatar (succesful)
- */
- public void testGetUserAvatar() {
- RemoteOperationResult result = mActivity.getUserAvatar(AVATAR_DIMENSION, null);
- assertTrue(result.isSuccess());
- ResultData userAvatar = (ResultData) result.getData().get(0);
- assertTrue(userAvatar.getEtag() != null && userAvatar.getEtag().length() > 0);
- assertTrue(userAvatar.getMimeType() != null && userAvatar.getMimeType().startsWith("image"));
- assertTrue(userAvatar.getAvatarData() != null && userAvatar.getAvatarData().length > 0);
- }
-
- /**
- * Test get user avatar only if changed, but wasn't changed
- *
- * DISABLED: conditioned call has been disabled due to problems with the network stack;
- * see comment in src/com/owncloud/android/lib/resources/users/GetRemoteUserAvatarOperation.java#87
- */
- /*
- public void testGetUserAvatarOnlyIfChangedAfterUnchanged() {
- RemoteOperationResult result = mActivity.getUserAvatar(AVATAR_DIMENSION, null);
- ResultData userAvatar = (ResultData) result.getData().get(0);
- String etag = userAvatar.getEtag();
-
- // request again, with the just received etag
- result = mActivity.getUserAvatar(AVATAR_DIMENSION, etag);
- assertFalse(result.isSuccess());
- assertTrue(result.getHttpCode() == HttpConstants.HTTP_NOT_MODIFIED);
- }
- */
-
- /**
- * Test get user avatar only if changed, and was changed
- */
- public void testGetUserAvatarOnlyIfChangedAfterChanged() {
- // TODO can't test this without provisioning API or mocking the server
- }
-
- /**
- * Test get user avatar not found
- */
- public void testGetUserAvatarNofFound() {
- // TODO can't test this without provisioning API, mocking the server or another set of credentials
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
-}
\ No newline at end of file
diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetUserQuotaTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetUserQuotaTest.java
deleted file mode 100644
index 8d4f41a8..00000000
--- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/GetUserQuotaTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- *
- * Copyright (C) 2018 ownCloud Inc.
- * Copyright (C) 2015 Bartosz Przybylski
- *
- * 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.test_project.test;
-
-import java.util.*;
-
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.resources.users.GetRemoteUserQuotaOperation.Quota;
-import com.owncloud.android.lib.test_project.TestActivity;
-
-
-/**
- * Class to test Get User Quota
- *
- * @author Bartosz Przybylski
- * @author David A. Velasco
- * @author David González Verdugo
- */
-public class GetUserQuotaTest extends RemoteTest {
-
-
- private static final String LOG_TAG = GetUserQuotaTest.class.getCanonicalName();
-
- private TestActivity mActivity;
- private String mFullPath2Root;
- private String ROOT_PATH = "/";
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- setActivityInitialTouchMode(false);
- mActivity = getActivity();
- mFullPath2Root = mBaseFolderPath + ROOT_PATH;
- }
-
- /**
- * Test GetUserQuota
- */
- public void testGetUserQuota() {
- RemoteOperationResult result = mActivity.getQuota(mFullPath2Root);
- assertTrue(result.isSuccess());
- Quota quota = (Quota)((ArrayList