From de1a775b0d906c606fa38bc645044777b6bb62f5 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 Apr 2024 07:19:07 +0200 Subject: [PATCH 01/74] Garm Signed-off-by: tobiasKaminsky --- .github/workflows/analysis.yml | 77 ---------------- .github/workflows/assemble.yml | 36 -------- .github/workflows/autoApproveSync.yml | 40 --------- .github/workflows/check.yml | 41 --------- .github/workflows/codeql.yml | 60 ------------- .github/workflows/detectNewJavaFiles.yml | 43 --------- .github/workflows/detectSnaphost.yml | 22 ----- .github/workflows/garm.yml | 108 +++++++++++++++++++++++ .github/workflows/pr-feedback.yml | 55 ------------ .github/workflows/reuse.yml | 27 ------ .github/workflows/scorecard.yml | 47 ---------- .github/workflows/stale.yml | 35 -------- 12 files changed, 108 insertions(+), 483 deletions(-) delete mode 100644 .github/workflows/analysis.yml delete mode 100644 .github/workflows/assemble.yml delete mode 100644 .github/workflows/autoApproveSync.yml delete mode 100644 .github/workflows/check.yml delete mode 100644 .github/workflows/codeql.yml delete mode 100644 .github/workflows/detectNewJavaFiles.yml delete mode 100644 .github/workflows/detectSnaphost.yml create mode 100644 .github/workflows/garm.yml delete mode 100644 .github/workflows/pr-feedback.yml delete mode 100644 .github/workflows/reuse.yml delete mode 100644 .github/workflows/scorecard.yml delete mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml deleted file mode 100644 index 6c82b63769..0000000000 --- a/.github/workflows/analysis.yml +++ /dev/null @@ -1,77 +0,0 @@ -# synced from @nextcloud/android-config - -# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2025 Alper Ozturk -# SPDX-FileCopyrightText: 2023 Tobias Kaminsky -# SPDX-FileCopyrightText: 2023 Andy Scherzinger -# SPDX-FileCopyrightText: 2023 Josh Richards -# SPDX-FileCopyrightText: 2025 Marcel Hibbe -# SPDX-License-Identifier: GPL-3.0-or-later - -name: "Analysis" - -on: - pull_request: - branches: [ "master", "main", "stable-*" ] - push: - branches: [ "master", "main", "stable-*" ] - -permissions: - pull-requests: write - contents: write - -concurrency: - group: analysis-wrapper-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - analysis: - runs-on: ubuntu-latest - steps: - - name: Disabled on forks - if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} - run: | - echo 'Can not analyze PRs from forks' - exit 1 - - name: Setup variables # zizmor: ignore[template-injection] - id: get-vars - run: | - if [ -z "$GITHUB_HEAD_REF" ]; then - # push - { - echo "branch=$GITHUB_REF_NAME" - echo "pr=$GITHUB_RUN_ID" - echo "repo=${{ github.repository }}" - } >> "$GITHUB_OUTPUT" - else - # pull request - { - echo "branch=$GITHUB_HEAD_REF" - echo "pr=${{ github.event.pull_request.number }}" - echo "repo=${{ github.event.pull_request.head.repo.full_name }}" - } >> "$GITHUB_OUTPUT" - fi - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - repository: ${{ steps.get-vars.outputs.repo }} - ref: ${{ steps.get-vars.outputs.branch }} - - name: Set up JDK 21 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 - with: - distribution: "temurin" - java-version: 21 - - name: Install dependencies - run: | - sudo apt install python3-defusedxml - - name: Run analysis wrapper - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - mkdir -p "$HOME/.gradle" - { - echo "org.gradle.jvmargs=-Xmx1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" - echo "org.gradle.configureondemand=true" - echo "kapt.incremental.apt=true" - } > "$HOME/.gradle/gradle.properties" - scripts/analysis/analysis-wrapper.sh "${{ steps.get-vars.outputs.branch }}" "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" "$GITHUB_RUN_NUMBER" "${{ steps.get-vars.outputs.pr }}" diff --git a/.github/workflows/assemble.yml b/.github/workflows/assemble.yml deleted file mode 100644 index c3e569b3ee..0000000000 --- a/.github/workflows/assemble.yml +++ /dev/null @@ -1,36 +0,0 @@ -# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2023 Andy Scherzinger -# SPDX-FileCopyrightText: 2022 Tobias Kaminsky -# SPDX-FileCopyrightText: 2022 Álvaro Brey -# SPDX-License-Identifier: MIT - -name: Assemble - -on: - pull_request: - branches: [ master, stable-* ] - push: - branches: [ master, stable-* ] - -permissions: - contents: read - -jobs: - assemble: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Set up JDK 17 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 - with: - distribution: "temurin" - java-version: 17 - - uses: gradle/actions/wrapper-validation@f29f5a9d7b09a7c6b29859002d29d24e1674c884 # v5.0.1 - - name: Setup JVM options - run: | - mkdir -p "$HOME/.gradle" - echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties" - - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 # v5.0.1 - - name: Assemble - run: ./gradlew assemble diff --git a/.github/workflows/autoApproveSync.yml b/.github/workflows/autoApproveSync.yml deleted file mode 100644 index c215be0b3e..0000000000 --- a/.github/workflows/autoApproveSync.yml +++ /dev/null @@ -1,40 +0,0 @@ -# synced from @nextcloud/android-config - -# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2023 Álvaro Brey -# SPDX-License-Identifier: GPL-3.0-or-later - -name: Auto approve sync -on: - pull_request_target: # zizmor: ignore[dangerous-triggers] - branches: - - master - - main - types: - - opened - - reopened - - synchronize - - labeled - -concurrency: - group: sync-approve-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -permissions: - pull-requests: write - -jobs: - auto-approve: - name: Auto approve sync - runs-on: ubuntu-latest - if: ${{ contains(github.event.pull_request.labels.*.name, 'sync') && github.actor == 'nextcloud-android-bot' }} - steps: - - name: Disabled on forks - if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} - run: | - echo 'Can not approve PRs from forks' - exit 1 - - - uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml deleted file mode 100644 index 3ba50dd6dc..0000000000 --- a/.github/workflows/check.yml +++ /dev/null @@ -1,41 +0,0 @@ -# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2017 Tobias Kaminsky -# SPDX-License-Identifier: GPL-3.0-or-later -name: Check - -on: - pull_request: - branches: [ master, stable-* ] - push: - branches: [ master, stable-* ] - -permissions: - contents: read - -jobs: - check: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - task: [ detekt, spotlessKotlinCheck, lint ] - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Set up JDK 17 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 - with: - distribution: "temurin" - java-version: 17 - - name: Setup JVM options - run: | - mkdir -p "$HOME/.gradle" - echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties" - - name: Check ${{ matrix.task }} - uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0 - with: - arguments: ${{ matrix.task }} - - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 - if: ${{ always() }} - with: - name: ${{ matrix.task }}-report - path: library/build/reports diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 02030913bc..0000000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,60 +0,0 @@ -# synced from @nextcloud/android-config - -# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2023-2024 Andy Scherzinger -# SPDX-FileCopyrightText: 2022 Tobias Kaminsky -# SPDX-FileCopyrightText: 2022 Álvaro Brey -# SPDX-FileCopyrightText: 2025 Marcel Hibbe -# SPDX-License-Identifier: GPL-3.0-or-later - -name: "CodeQL" - -on: - push: - branches: [ "master", "main", "stable-*" ] - pull_request: - branches: [ "master", "main" ] - schedule: - - cron: '24 18 * * 3' - -permissions: - contents: read - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - strategy: - fail-fast: false - matrix: - language: [ 'java' ] - steps: - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - name: Set Swap Space - if: runner.environment == 'github-hosted' - uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c # v1.0 - with: - swap-size-gb: 10 - - name: Initialize CodeQL - uses: github/codeql-action/init@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1 - with: - languages: ${{ matrix.language }} - - name: Set up JDK 21 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 - with: - distribution: "temurin" - java-version: 21 - - name: Assemble - run: | - mkdir -p "$HOME/.gradle" - echo "org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties" - ./gradlew --no-daemon assembleDebug - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1 diff --git a/.github/workflows/detectNewJavaFiles.yml b/.github/workflows/detectNewJavaFiles.yml deleted file mode 100644 index 908e3fd288..0000000000 --- a/.github/workflows/detectNewJavaFiles.yml +++ /dev/null @@ -1,43 +0,0 @@ -# synced from @nextcloud/android-config - -# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2023 Andy Scherzinger -# SPDX-FileCopyrightText: 2022 Tobias Kaminsky -# SPDX-FileCopyrightText: 2022 Álvaro Brey -# SPDX-License-Identifier: GPL-3.0-or-later - -name: "Detect new java files" - -on: - pull_request: - branches: [ master, main, stable-* ] - -permissions: read-all - -concurrency: - group: detect-new-java-files-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - detectNewJavaFiles: - runs-on: ubuntu-latest - steps: - - id: file_changes - uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b # v1.2.4 - with: - output: ',' - - name: Detect new java files - run: | - if [ -z '${{ steps.file_changes.outputs.files_added }}' ]; then - echo "No new files added" - exit 0 - fi - new_java=$(echo '${{ steps.file_changes.outputs.files_added }}' | tr ',' '\n' | grep '\.java$' | cat) - if [ -n "$new_java" ]; then - # shellcheck disable=SC2016 - printf 'New java files detected:\n```\n%s\n```\n' "$new_java" | tee "$GITHUB_STEP_SUMMARY" - exit 1 - else - echo "No new java files detected" - exit 0 - fi diff --git a/.github/workflows/detectSnaphost.yml b/.github/workflows/detectSnaphost.yml deleted file mode 100644 index 646c25bf17..0000000000 --- a/.github/workflows/detectSnaphost.yml +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2017 Tobias Kaminsky -# SPDX-License-Identifier: GPL-3.0-or-later -name: "Detect snapshot" - -on: - pull_request: - branches: [ master, stable-* ] - push: - branches: [ master, stable-* ] - -# Declare default permissions as read only. -permissions: read-all - -jobs: - detekt: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Detect SNAPSHOT - run: scripts/analysis/detectSNAPSHOT.sh diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml new file mode 100644 index 0000000000..e66e42b11b --- /dev/null +++ b/.github/workflows/garm.yml @@ -0,0 +1,108 @@ +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +name: "Screenshot Test" + +on: + pull_request: + branches: [ master, stable-* ] + +permissions: + contents: read + pull-requests: write + +jobs: + tests: + runs-on: ubuntu-22.04 # our own GARM does not yet support it + services: + server: + image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest + ports: + - 80:80 + strategy: + fail-fast: false + matrix: + scheme: [ Light ] + color: [ blue ] + api-level: [ 27 ] + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: wait and ping server + run: | + while ! curl http://localhost/status.php 2>&1 | grep installed; do + echo "wait…" + sleep 5 + done + + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: "temurin" + java-version: 17 + + - name: create AVD and generate snapshot for caching + uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + arch: x86_64 + sdcard-path-or-size: 100M + target: google_apis + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 + script: echo "Generated AVD snapshot for caching." + + - name: Configure gradle daemon + run: | + mkdir -p $HOME/.gradle + echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties + echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties + + - name: Build gplay + run: | + sed -i s#http://server#http://10.0.2.2# gradle.properties + sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt + ./gradlew assembleDebug + ./scripts/wait_for_emulator.sh + + - name: Delete old comments + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: ${{ always() }} + run: scripts/deleteOldComments.sh "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} + + - name: Run tests + run: | + ./gradlew jacocoTestDebugUnitTestReport + ./gradlew installDebugAndroidTest + ./gradlew createDebugCoverageReport + - name: gplay + env: + SHOT_TEST: "true" + uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + arch: x86 + sdcard-path-or-size: 100M + target: google_apis + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 + script: scripts/wait_for_emulator.sh && ./gradlew jacocoTestDebugUnitTestReport && ./gradlew installDebugAndroidTest && ./gradlew createDebugCoverageReport./gradlew combinedTestReport + + - name: upload failing results + if: ${{ failure() }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} + - name: Archive Espresso results + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + if: ${{ always() }} + with: + name: Report-${{ matrix.color }}-${{ matrix.scheme }} + path: app/build/reports + retention-days: 4 diff --git a/.github/workflows/pr-feedback.yml b/.github/workflows/pr-feedback.yml deleted file mode 100644 index a3a2d1296c..0000000000 --- a/.github/workflows/pr-feedback.yml +++ /dev/null @@ -1,55 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization - -# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2023 Marcel Klehr -# SPDX-FileCopyrightText: 2023 Joas Schilling <213943+nickvergessen@users.noreply.github.com> -# SPDX-FileCopyrightText: 2023 Daniel Kesselberg -# SPDX-FileCopyrightText: 2023 Florian Steffens -# SPDX-License-Identifier: MIT - -name: 'Ask for feedback on PRs' -on: - schedule: - - cron: '30 1 * * *' - -permissions: - contents: read - pull-requests: write - -jobs: - pr-feedback: - if: ${{ github.repository_owner == 'nextcloud' }} - runs-on: ubuntu-latest - steps: - - name: The get-github-handles-from-website action - uses: marcelklehr/get-github-handles-from-website-action@06b2239db0a48fe1484ba0bfd966a3ab81a08308 # v1.0.1 - id: scrape - with: - website: 'https://nextcloud.com/team/' - - - name: Get blocklist - id: blocklist - run: | - blocklist=$(curl https://raw.githubusercontent.com/nextcloud/.github/master/non-community-usernames.txt | paste -s -d, -) - echo "blocklist=$blocklist" >> "$GITHUB_OUTPUT" - - - uses: nextcloud/pr-feedback-action@5227c55be184087d0aef6338bee210d8620b6297 # main - with: - feedback-message: | - Hello there, - Thank you so much for taking the time and effort to create a pull request to our Nextcloud project. - - We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. - - Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 - - Thank you for contributing to Nextcloud and we hope to hear from you soon! - - (If you believe you should not receive this message, you can add yourself to the [blocklist](https://github.com/nextcloud/.github/blob/master/non-community-usernames.txt).) - days-before-feedback: 14 - start-date: '2024-04-30' - exempt-authors: '${{ steps.blocklist.outputs.blocklist }},${{ steps.scrape.outputs.users }}' - exempt-bots: true diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml deleted file mode 100644 index 3f485f875f..0000000000 --- a/.github/workflows/reuse.yml +++ /dev/null @@ -1,27 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization - -# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. -# -# SPDX-License-Identifier: CC0-1.0 - -name: REUSE Compliance Check - -on: [pull_request] - -permissions: - contents: read - -jobs: - reuse-compliance-check: - runs-on: ubuntu-latest-low - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - name: REUSE Compliance Check - uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml deleted file mode 100644 index 19c608fe1a..0000000000 --- a/.github/workflows/scorecard.yml +++ /dev/null @@ -1,47 +0,0 @@ -# synced from @nextcloud/android-config - -# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2023 Andy Scherzinger -# SPDX-License-Identifier: GPL-3.0-or-later - -name: Scorecard supply-chain security -on: - branch_protection_rule: - schedule: - - cron: '32 23 * * 4' - push: - branches: [ "main", "master" ] - -# Declare default permissions as read only. -permissions: read-all - -concurrency: - group: scorecard-supply-chain-security-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - analysis: - name: Scorecard analysis - runs-on: ubuntu-latest - permissions: - # Needed to upload the results to code-scanning dashboard. - security-events: write - - steps: - - name: "Checkout code" - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - name: "Run analysis" - uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 - with: - results_file: results.sarif - results_format: sarif - publish_results: false - - # Upload the results to GitHub's code scanning dashboard. - - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1 - with: - sarif_file: results.sarif diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index fe125a9a62..0000000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,35 +0,0 @@ -# synced from @nextcloud/android-config - -# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-FileCopyrightText: 2023 Tobias Kaminsky -# SPDX-FileCopyrightText: 2022 Álvaro Brey -# SPDX-License-Identifier: GPL-3.0-or-later - -name: 'Close stale issues' -on: - schedule: - - cron: '0 0 * * *' - -# Declare default permissions as read only. -permissions: read-all - -jobs: - stale: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # v10.1.1 - with: - days-before-stale: 28 - days-before-close: 14 - days-before-pr-close: -1 - only-labels: 'bug,needs info' - exempt-issue-labels: 'no-stale' - stale-issue-message: >- - This bug report did not receive an update in the last 4 weeks. - Please take a look again and update the issue with new details, - otherwise the issue will be automatically closed in 2 weeks. Thank you! - exempt-all-pr-milestones: true - labels-to-remove-when-unstale: 'needs info' From cd2ca12aa788030237b92dcdbde658322c7468f2 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 Apr 2024 07:22:13 +0200 Subject: [PATCH 02/74] Garm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index e66e42b11b..0b8ca2d8ca 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -51,7 +51,7 @@ jobs: with: api-level: ${{ matrix.api-level }} force-avd-creation: false - arch: x86_64 + arch: x86 sdcard-path-or-size: 100M target: google_apis emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 From 40dc26700e6d797878ed6e547fd577256a013a0f Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 Apr 2024 07:33:52 +0200 Subject: [PATCH 03/74] Garm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 0b8ca2d8ca..da76382413 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -68,7 +68,6 @@ jobs: sed -i s#http://server#http://10.0.2.2# gradle.properties sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt ./gradlew assembleDebug - ./scripts/wait_for_emulator.sh - name: Delete old comments env: From ced1c413bba88bee14203ef0aef4a9c6fef62d01 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 Apr 2024 07:41:28 +0200 Subject: [PATCH 04/74] Garm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index da76382413..be252f0be8 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -69,12 +69,6 @@ jobs: sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt ./gradlew assembleDebug - - name: Delete old comments - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: ${{ always() }} - run: scripts/deleteOldComments.sh "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} - - name: Run tests run: | ./gradlew jacocoTestDebugUnitTestReport From f20622c9c0b4c8b5e086b8abefc784ca41c7404e Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 Apr 2024 07:48:56 +0200 Subject: [PATCH 05/74] Garm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index be252f0be8..2ad2ac9981 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -69,11 +69,6 @@ jobs: sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt ./gradlew assembleDebug - - name: Run tests - run: | - ./gradlew jacocoTestDebugUnitTestReport - ./gradlew installDebugAndroidTest - ./gradlew createDebugCoverageReport - name: gplay env: SHOT_TEST: "true" From f6d701b186aef29cd00e7f3188946a6fd5fa2ef1 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 Apr 2024 08:08:04 +0200 Subject: [PATCH 06/74] Garm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 2ad2ac9981..0d66225bd6 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -80,7 +80,7 @@ jobs: sdcard-path-or-size: 100M target: google_apis emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 - script: scripts/wait_for_emulator.sh && ./gradlew jacocoTestDebugUnitTestReport && ./gradlew installDebugAndroidTest && ./gradlew createDebugCoverageReport./gradlew combinedTestReport + script: scripts/wait_for_emulator.sh && ./gradlew jacocoTestDebugUnitTestReport && ./gradlew installDebugAndroidTest && ./gradlew createDebugCoverageReport && ./gradlew combinedTestReport - name: upload failing results if: ${{ failure() }} From 215c334f0bdd7ac1ba549d5aa28577b790a6647b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 Apr 2024 08:17:40 +0200 Subject: [PATCH 07/74] Garm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 0d66225bd6..1131a13560 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -65,7 +65,7 @@ jobs: - name: Build gplay run: | - sed -i s#http://server#http://10.0.2.2# gradle.properties + sed -i s#https://server#https://10.0.2.2# gradle.properties sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt ./gradlew assembleDebug From 2c19591f9f5d8010ce2a000f0371795d3616932c Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 Apr 2024 08:39:41 +0200 Subject: [PATCH 08/74] Garm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 1131a13560..0ea20b5666 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -65,7 +65,7 @@ jobs: - name: Build gplay run: | - sed -i s#https://server#https://10.0.2.2# gradle.properties + sed -i s#https://server#http://10.0.2.2# gradle.properties sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt ./gradlew assembleDebug From 3454cc2f6f3d2365fbe26332dc6eb98a4f5a71bd Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:09:37 +0200 Subject: [PATCH 09/74] config Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 0ea20b5666..fad8982df1 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -35,6 +35,12 @@ jobs: sleep 5 done + - name: configure server + run: | + docker exec --user www-data server OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 + docker exec --user www-data server git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ + docker exec --user www-data server php /var/www/html/occ app:enable activity + - name: Enable KVM group perms run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules From 7ee414482645b5add4a0a64cc446049cca2f5d5a Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:10:31 +0200 Subject: [PATCH 10/74] config Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index fad8982df1..e53499d4be 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: AGPL-3.0-or-later -name: "Screenshot Test" +name: "Garm" on: pull_request: From ccf87040888b98c397955caf2d0daf12551552fe Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:12:44 +0200 Subject: [PATCH 11/74] docker ps Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index e53499d4be..d863a3d112 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -37,6 +37,7 @@ jobs: - name: configure server run: | + docker ps docker exec --user www-data server OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 docker exec --user www-data server git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ docker exec --user www-data server php /var/www/html/occ app:enable activity From ee54b434ddb0b0c51ccba4c488cdee94cb3b8fc9 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:16:49 +0200 Subject: [PATCH 12/74] server Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index d863a3d112..e8187972f1 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -17,6 +17,7 @@ jobs: services: server: image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest + options: --name server ports: - 80:80 strategy: From 8a5bde5549b56b550b4aba6f500380d0657a7772 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:23:36 +0200 Subject: [PATCH 13/74] script Signed-off-by: tobiasKaminsky --- .github/workflows/configServer.sh | 10 ++++++++++ .github/workflows/garm.yml | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/configServer.sh diff --git a/.github/workflows/configServer.sh b/.github/workflows/configServer.sh new file mode 100644 index 0000000000..66a3db74d8 --- /dev/null +++ b/.github/workflows/configServer.sh @@ -0,0 +1,10 @@ +#!bin/sh + +# Nextcloud Android Library +# +# SPDX-FileCopyrightText: 2024 Your Name +# SPDX-License-Identifier: MIT +# + +php /var/www/html/occ list +OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index e8187972f1..aa01fe81f7 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -38,10 +38,10 @@ jobs: - name: configure server run: | - docker ps - docker exec --user www-data server OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 - docker exec --user www-data server git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ - docker exec --user www-data server php /var/www/html/occ app:enable activity + docker cp .github/workflows/config.sh server:/tmp + docker exec server sh -c "chmod +x /tmp/config.sh" + docker exec server sh -c "chown www-data /tmp/config.sh" + docker exec --user www-data sh -c "/tmp/config.sh" - name: Enable KVM group perms run: | From 0c7fcc3acc6b0e1f2543a4f1b87af491249b5813 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:24:17 +0200 Subject: [PATCH 14/74] script Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index aa01fe81f7..180fdd4e9b 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -38,7 +38,7 @@ jobs: - name: configure server run: | - docker cp .github/workflows/config.sh server:/tmp + docker cp .github/workflows/configServer.sh server:/tmp docker exec server sh -c "chmod +x /tmp/config.sh" docker exec server sh -c "chown www-data /tmp/config.sh" docker exec --user www-data sh -c "/tmp/config.sh" From ee9688b9827dde9ec2c8a42796e25db2f704f91d Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:26:17 +0200 Subject: [PATCH 15/74] script Signed-off-by: tobiasKaminsky --- .github/workflows/configServer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/configServer.sh b/.github/workflows/configServer.sh index 66a3db74d8..af326fe38c 100644 --- a/.github/workflows/configServer.sh +++ b/.github/workflows/configServer.sh @@ -1,4 +1,4 @@ -#!bin/sh +#!/bin/sh # Nextcloud Android Library # From 4f9022bb34247f573ad02f0dd7b39d354d5d8bf1 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:28:10 +0200 Subject: [PATCH 16/74] script Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 180fdd4e9b..0a56c91cbb 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -38,10 +38,10 @@ jobs: - name: configure server run: | - docker cp .github/workflows/configServer.sh server:/tmp - docker exec server sh -c "chmod +x /tmp/config.sh" - docker exec server sh -c "chown www-data /tmp/config.sh" - docker exec --user www-data sh -c "/tmp/config.sh" + docker cp .github/workflows/configServer.sh server:/tmp/ + docker exec server sh -c "chmod +x /tmp/configServer.sh" + docker exec server sh -c "chown www-data /tmp/configServer.sh" + docker exec --user www-data sh -c "/tmp/configServer.sh" - name: Enable KVM group perms run: | From 4f53be65eaa331584a8958c0be05ffa20c560721 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:39:49 +0200 Subject: [PATCH 17/74] script Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 0a56c91cbb..938812da48 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -39,8 +39,8 @@ jobs: - name: configure server run: | docker cp .github/workflows/configServer.sh server:/tmp/ - docker exec server sh -c "chmod +x /tmp/configServer.sh" - docker exec server sh -c "chown www-data /tmp/configServer.sh" + docker exec server sh -c chmod +x /tmp/configServer.sh + docker exec server sh -c chown www-data /tmp/configServer.sh docker exec --user www-data sh -c "/tmp/configServer.sh" - name: Enable KVM group perms From b96af5ee64c263b3ff230d7c4eda4fa742594558 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:44:55 +0200 Subject: [PATCH 18/74] script Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 938812da48..c4ad4007e4 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -40,8 +40,7 @@ jobs: run: | docker cp .github/workflows/configServer.sh server:/tmp/ docker exec server sh -c chmod +x /tmp/configServer.sh - docker exec server sh -c chown www-data /tmp/configServer.sh - docker exec --user www-data sh -c "/tmp/configServer.sh" + docker exec --user www-data server /tmp/configServer.sh - name: Enable KVM group perms run: | From bd4635e06aab29d540264922e0416c77a49bcaa7 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 Apr 2024 14:46:30 +0200 Subject: [PATCH 19/74] script Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index c4ad4007e4..d0ffb4d5d0 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -39,7 +39,7 @@ jobs: - name: configure server run: | docker cp .github/workflows/configServer.sh server:/tmp/ - docker exec server sh -c chmod +x /tmp/configServer.sh + docker exec server chmod +x /tmp/configServer.sh docker exec --user www-data server /tmp/configServer.sh - name: Enable KVM group perms From 354abf636181458de72ed85f410098378e3d04e8 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 19 Apr 2024 14:40:30 +0200 Subject: [PATCH 20/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configNC.sh | 50 +++++++++++++++++++++++++++++++ .github/workflows/configServer.sh | 8 +++-- .github/workflows/garm.yml | 6 +++- 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/configNC.sh diff --git a/.github/workflows/configNC.sh b/.github/workflows/configNC.sh new file mode 100644 index 0000000000..0c11266441 --- /dev/null +++ b/.github/workflows/configNC.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# Nextcloud Android Library +# +# SPDX-FileCopyrightText: 2024 Your Name +# SPDX-License-Identifier: MIT +# + +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash +source ~/.bashrc; nvm install node + +php /var/www/html/occ log:manage --level warning +OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 +OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2 +OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3 +OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test@Test' test@test +OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test Spaces' 'test test' +php /var/www/html/occ user:setting user2 files quota 1G +php /var/www/html/occ group:add users +php /var/www/html/occ group:adduser users user1 +php /var/www/html/occ group:adduser users user2 +php /var/www/html/occ group:adduser users test +git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ +php /var/www/html/occ app:enable activity +git clone -b main https://github.com/nextcloud/text.git /var/www/html/apps/text/ +php /var/www/html/occ app:enable text +git clone -b master https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/ +php /var/www/html/occ app:enable end_to_end_encryption +git clone -b master https://github.com/nextcloud/password_policy/ /var/www/html/apps/password_policy/ +php /var/www/html/occ app:enable password_policy +git clone -b master https://github.com/nextcloud/external/ /var/www/html/apps/external/ +cd /var/www/html/apps/external; composer install --no-dev +php /var/www/html/occ app:enable external +php /var/www/html/occ config:app:set external sites --value="{\"1\":{\"id\":1,\"name\":\"Nextcloud\",\"url\":\"https:\/\/www.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false},\"2\":{\"id\":2,\"name\":\"Forum\",\"url\":\"https:\/\/help.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false}}" +git clone -b main https://github.com/nextcloud/files_lock.git /var/www/html/apps/files_lock/ +php /var/www/html/occ app:enable -f files_lock +git clone https://github.com/nextcloud/groupfolders.git /var/www/html/apps/groupfolders/ +php /var/www/html/occ app:enable -f groupfolders +php /var/www/html/occ groupfolders:create groupfolder +php /var/www/html/occ groupfolders:group 1 users +git clone https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ +php /var/www/html/occ app:enable -f notifications +php /var/www/html/occ notification:generate test -d test +git clone https://github.com/nextcloud/photos.git /var/www/html/apps/photos/ +cd /var/www/html/apps/photos; composer install +php /var/www/html/occ app:enable -f photos +git clone https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/ +cd /var/www/html/apps/assistant; source ~/.bashrc; make +php /var/www/html/occ app:enable -f assistant +php /var/www/html/occ app:enable -f testing diff --git a/.github/workflows/configServer.sh b/.github/workflows/configServer.sh index af326fe38c..964f3ae8a0 100644 --- a/.github/workflows/configServer.sh +++ b/.github/workflows/configServer.sh @@ -6,5 +6,9 @@ # SPDX-License-Identifier: MIT # -php /var/www/html/occ list -OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 +apt-get update && apt-get install -y composer +mkdir /var/www/.nvm /var/www/.npm +touch /var/www/.bashrc +chown -R 33:33 /var/www/.nvm /var/www/.npm /var/www/.bashrc + +/usr/local/bin/initnc.sh diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index d0ffb4d5d0..d5bc2a6075 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -40,7 +40,11 @@ jobs: run: | docker cp .github/workflows/configServer.sh server:/tmp/ docker exec server chmod +x /tmp/configServer.sh - docker exec --user www-data server /tmp/configServer.sh + docker exec server /tmp/configServer.sh + docker cp .github/workflows/configNC.sh server:/tmp/ + docker exec server chmod +x /tmp/configNC.sh + docker exec --user www-data server /tmp/configNC.sh + docker exec server /usr/local/bin/run.sh - name: Enable KVM group perms run: | From 28c34e96d62741250b59cbdb29a83a6ca210a79e Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 19 Apr 2024 15:11:42 +0200 Subject: [PATCH 21/74] let one test fail Signed-off-by: tobiasKaminsky --- library/src/androidTest/java/com/owncloud/android/FileIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/androidTest/java/com/owncloud/android/FileIT.java b/library/src/androidTest/java/com/owncloud/android/FileIT.java index a3e87e1962..1328ae544c 100644 --- a/library/src/androidTest/java/com/owncloud/android/FileIT.java +++ b/library/src/androidTest/java/com/owncloud/android/FileIT.java @@ -43,7 +43,7 @@ public void testCreateFolderSuccess() { assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); // verify folder - assertTrue(new ReadFolderRemoteOperation(path).execute(client).isSuccess()); + assertFalse(new ReadFolderRemoteOperation(path).execute(client).isSuccess()); // remove folder assertTrue(new RemoveFileRemoteOperation(path).execute(client).isSuccess()); From 565846dc833f22b02071d940984a05132d4a9d8b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 19 Apr 2024 15:46:15 +0200 Subject: [PATCH 22/74] use script Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 9 ++++++--- scripts/runTests.sh | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100755 scripts/runTests.sh diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index d5bc2a6075..0b9e51b22a 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -91,13 +91,16 @@ jobs: sdcard-path-or-size: 100M target: google_apis emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 - script: scripts/wait_for_emulator.sh && ./gradlew jacocoTestDebugUnitTestReport && ./gradlew installDebugAndroidTest && ./gradlew createDebugCoverageReport && ./gradlew combinedTestReport + script: scripts/runTests.sh - name: upload failing results if: ${{ failure() }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} + LOG_USERNAME: ${{ secrets.LOG_USERNAME }} + LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }} + GIT_USERNAME: ${{ secrets.GIT_USERNAME }} + GIT_TOKEN: ${{ secrets.GIT_TOKEN }} + run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "master" "IT" ${{github.event.number}} "${{ secrets.GIT_USERNAME }}" "${{ secrets.GIT_TOKEN }}" - name: Archive Espresso results uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 if: ${{ always() }} diff --git a/scripts/runTests.sh b/scripts/runTests.sh new file mode 100755 index 0000000000..ebec010133 --- /dev/null +++ b/scripts/runTests.sh @@ -0,0 +1,14 @@ +# +# Nextcloud Android Library +# +# SPDX-FileCopyrightText: 2024 Tobias Kaminsky +# SPDX-License-Identifier: MIT +# + +scripts/wait_for_emulator.sh +adb logcat -c +adb logcat > logcat.txt & +./gradlew jacocoTestDebugUnitTestReport +./gradlew installDebugAndroidTest +./gradlew createDebugCoverageReport +./gradlew combinedTestReport From c646340b39cb005186c704cea57321731aad3824 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 10:24:15 +0200 Subject: [PATCH 23/74] use stable27 and master Signed-off-by: tobiasKaminsky --- .../{configNC.sh => configNC_master.sh} | 0 .github/workflows/configNC_stable27.sh | 50 +++++++++++++++++++ .github/workflows/configServer.sh | 2 +- .github/workflows/garm.yml | 11 ++-- 4 files changed, 57 insertions(+), 6 deletions(-) rename .github/workflows/{configNC.sh => configNC_master.sh} (100%) create mode 100644 .github/workflows/configNC_stable27.sh diff --git a/.github/workflows/configNC.sh b/.github/workflows/configNC_master.sh similarity index 100% rename from .github/workflows/configNC.sh rename to .github/workflows/configNC_master.sh diff --git a/.github/workflows/configNC_stable27.sh b/.github/workflows/configNC_stable27.sh new file mode 100644 index 0000000000..81a54520a6 --- /dev/null +++ b/.github/workflows/configNC_stable27.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# Nextcloud Android Library +# +# SPDX-FileCopyrightText: 2024 Your Name +# SPDX-License-Identifier: MIT +# + +SERVER_VERSION="stable27" + +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash +source ~/.bashrc; nvm install node + +php /var/www/html/occ log:manage --level warning +OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 +OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2 +OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3 +OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test@Test' test@test +OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test Spaces' 'test test' +php /var/www/html/occ user:setting user2 files quota 1G +php /var/www/html/occ group:add users +php /var/www/html/occ group:adduser users user1 +php /var/www/html/occ group:adduser users user2 +php /var/www/html/occ group:adduser users test +git clone -b $SERVER_VERSION https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ +php /var/www/html/occ app:enable activity +git clone -b $SERVER_VERSION https://github.com/nextcloud/text.git /var/www/html/apps/text/ +php /var/www/html/occ app:enable text +git clone -b $SERVER_VERSION https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/ +php /var/www/html/occ app:enable end_to_end_encryption +git clone -b $SERVER_VERSION https://github.com/nextcloud/password_policy/ /var/www/html/apps/password_policy/ +php /var/www/html/occ app:enable password_policy +php /var/www/html/occ app:enable external +php /var/www/html/occ config:app:set external sites --value="{\"1\":{\"id\":1,\"name\":\"Nextcloud\",\"url\":\"https:\/\/www.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false},\"2\":{\"id\":2,\"name\":\"Forum\",\"url\":\"https:\/\/help.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false}}" +git clone -b $SERVER_VERSION https://github.com/nextcloud/files_lock.git /var/www/html/apps/files_lock/ +php /var/www/html/occ app:enable -f files_lock +git clone -b $SERVER_VERSION https://github.com/nextcloud/groupfolders.git /var/www/html/apps/groupfolders/ +php /var/www/html/occ app:enable -f groupfolders +php /var/www/html/occ groupfolders:create groupfolder +php /var/www/html/occ groupfolders:group 1 users +git clone -b $SERVER_VERSION https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ +php /var/www/html/occ app:enable -f notifications +php /var/www/html/occ notification:generate test -d test +git clone -b $SERVER_VERSION https://github.com/nextcloud/photos.git /var/www/html/apps/photos/ +cd /var/www/html/apps/photos; composer install +php /var/www/html/occ app:enable -f photos +git clone https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/ +cd /var/www/html/apps/assistant; git checkout tags/v1.0.2; source ~/.bashrc; make +php /var/www/html/occ app:enable -f assistant +php /var/www/html/occ app:enable -f testing diff --git a/.github/workflows/configServer.sh b/.github/workflows/configServer.sh index 964f3ae8a0..3697c0c81d 100644 --- a/.github/workflows/configServer.sh +++ b/.github/workflows/configServer.sh @@ -11,4 +11,4 @@ mkdir /var/www/.nvm /var/www/.npm touch /var/www/.bashrc chown -R 33:33 /var/www/.nvm /var/www/.npm /var/www/.bashrc -/usr/local/bin/initnc.sh +BRANCH="$1" /usr/local/bin/initnc.sh diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 0b9e51b22a..b4f12e866d 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -12,7 +12,7 @@ permissions: pull-requests: write jobs: - tests: + test-master: runs-on: ubuntu-22.04 # our own GARM does not yet support it services: server: @@ -23,6 +23,7 @@ jobs: strategy: fail-fast: false matrix: + server: [ master, stable27 ] scheme: [ Light ] color: [ blue ] api-level: [ 27 ] @@ -40,10 +41,10 @@ jobs: run: | docker cp .github/workflows/configServer.sh server:/tmp/ docker exec server chmod +x /tmp/configServer.sh - docker exec server /tmp/configServer.sh - docker cp .github/workflows/configNC.sh server:/tmp/ - docker exec server chmod +x /tmp/configNC.sh - docker exec --user www-data server /tmp/configNC.sh + docker exec server /tmp/configServer.sh ${{ matrix.server }} + docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ + docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh + docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh docker exec server /usr/local/bin/run.sh - name: Enable KVM group perms From 841688f78108b1fda07ccff3f74da21536852830 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 10:40:44 +0200 Subject: [PATCH 24/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configServer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/configServer.sh b/.github/workflows/configServer.sh index 3697c0c81d..91f4563f4e 100644 --- a/.github/workflows/configServer.sh +++ b/.github/workflows/configServer.sh @@ -11,4 +11,4 @@ mkdir /var/www/.nvm /var/www/.npm touch /var/www/.bashrc chown -R 33:33 /var/www/.nvm /var/www/.npm /var/www/.bashrc -BRANCH="$1" /usr/local/bin/initnc.sh +BRANCH="stable27" /usr/local/bin/initnc.sh From 79d93bc970256a802965168e29e587fff2fbcda8 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 10:51:03 +0200 Subject: [PATCH 25/74] force new install Signed-off-by: tobiasKaminsky --- .github/workflows/configServer.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/configServer.sh b/.github/workflows/configServer.sh index 91f4563f4e..d74765c266 100644 --- a/.github/workflows/configServer.sh +++ b/.github/workflows/configServer.sh @@ -11,4 +11,6 @@ mkdir /var/www/.nvm /var/www/.npm touch /var/www/.bashrc chown -R 33:33 /var/www/.nvm /var/www/.npm /var/www/.bashrc +rm data -rf +rm config/config.php BRANCH="stable27" /usr/local/bin/initnc.sh From 4e8b59edb0a3ff2b64674f428623dd8d84334898 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 11:30:23 +0200 Subject: [PATCH 26/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configServer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/configServer.sh b/.github/workflows/configServer.sh index d74765c266..f9eef62ae0 100644 --- a/.github/workflows/configServer.sh +++ b/.github/workflows/configServer.sh @@ -13,4 +13,4 @@ chown -R 33:33 /var/www/.nvm /var/www/.npm /var/www/.bashrc rm data -rf rm config/config.php -BRANCH="stable27" /usr/local/bin/initnc.sh +BRANCH="$1" /usr/local/bin/initnc.sh From a2d1f75d66293b1eb0d2f3225017c39e5bc75bed Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 11:59:31 +0200 Subject: [PATCH 27/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 8 +++----- scripts/runTests.sh | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index b4f12e866d..e9459fa0a7 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -12,7 +12,7 @@ permissions: pull-requests: write jobs: - test-master: + test: runs-on: ubuntu-22.04 # our own GARM does not yet support it services: server: @@ -24,9 +24,7 @@ jobs: fail-fast: false matrix: server: [ master, stable27 ] - scheme: [ Light ] - color: [ blue ] - api-level: [ 27 ] + api-level: [ 27 ] # 15 steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -106,6 +104,6 @@ jobs: uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 if: ${{ always() }} with: - name: Report-${{ matrix.color }}-${{ matrix.scheme }} + name: Report-${{ matrix.server }}-${{ matrix.api-level }} path: app/build/reports retention-days: 4 diff --git a/scripts/runTests.sh b/scripts/runTests.sh index ebec010133..51d633814e 100755 --- a/scripts/runTests.sh +++ b/scripts/runTests.sh @@ -11,4 +11,8 @@ adb logcat > logcat.txt & ./gradlew jacocoTestDebugUnitTestReport ./gradlew installDebugAndroidTest ./gradlew createDebugCoverageReport +stat=$? + ./gradlew combinedTestReport + +exit $stat From 1be1862ec04733656691f98e189927cd095394b4 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 12:31:33 +0200 Subject: [PATCH 28/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configNC_master.sh | 16 +++++++++++++++- ...nfigNC_stable27.sh => configNC_stable29.sh} | 18 +++++++++++++++--- .github/workflows/garm.yml | 2 +- scripts/uploadReport.sh | 4 ++-- 4 files changed, 33 insertions(+), 7 deletions(-) rename .github/workflows/{configNC_stable27.sh => configNC_stable29.sh} (93%) diff --git a/.github/workflows/configNC_master.sh b/.github/workflows/configNC_master.sh index 0c11266441..7a9a4fc406 100644 --- a/.github/workflows/configNC_master.sh +++ b/.github/workflows/configNC_master.sh @@ -6,10 +6,13 @@ # SPDX-License-Identifier: MIT # + + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash source ~/.bashrc; nvm install node php /var/www/html/occ log:manage --level warning + OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2 OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3 @@ -20,31 +23,42 @@ php /var/www/html/occ group:add users php /var/www/html/occ group:adduser users user1 php /var/www/html/occ group:adduser users user2 php /var/www/html/occ group:adduser users test + git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ php /var/www/html/occ app:enable activity + git clone -b main https://github.com/nextcloud/text.git /var/www/html/apps/text/ php /var/www/html/occ app:enable text + git clone -b master https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/ php /var/www/html/occ app:enable end_to_end_encryption + git clone -b master https://github.com/nextcloud/password_policy/ /var/www/html/apps/password_policy/ php /var/www/html/occ app:enable password_policy + git clone -b master https://github.com/nextcloud/external/ /var/www/html/apps/external/ cd /var/www/html/apps/external; composer install --no-dev php /var/www/html/occ app:enable external php /var/www/html/occ config:app:set external sites --value="{\"1\":{\"id\":1,\"name\":\"Nextcloud\",\"url\":\"https:\/\/www.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false},\"2\":{\"id\":2,\"name\":\"Forum\",\"url\":\"https:\/\/help.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false}}" + git clone -b main https://github.com/nextcloud/files_lock.git /var/www/html/apps/files_lock/ php /var/www/html/occ app:enable -f files_lock + git clone https://github.com/nextcloud/groupfolders.git /var/www/html/apps/groupfolders/ php /var/www/html/occ app:enable -f groupfolders php /var/www/html/occ groupfolders:create groupfolder php /var/www/html/occ groupfolders:group 1 users + git clone https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ php /var/www/html/occ app:enable -f notifications php /var/www/html/occ notification:generate test -d test + git clone https://github.com/nextcloud/photos.git /var/www/html/apps/photos/ -cd /var/www/html/apps/photos; composer install +cd /var/www/html/apps/photos; composer install --no-dev php /var/www/html/occ app:enable -f photos + git clone https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/ cd /var/www/html/apps/assistant; source ~/.bashrc; make php /var/www/html/occ app:enable -f assistant + php /var/www/html/occ app:enable -f testing diff --git a/.github/workflows/configNC_stable27.sh b/.github/workflows/configNC_stable29.sh similarity index 93% rename from .github/workflows/configNC_stable27.sh rename to .github/workflows/configNC_stable29.sh index 81a54520a6..fdfecab097 100644 --- a/.github/workflows/configNC_stable27.sh +++ b/.github/workflows/configNC_stable29.sh @@ -6,12 +6,13 @@ # SPDX-License-Identifier: MIT # -SERVER_VERSION="stable27" +SERVER_VERSION="stable29" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash source ~/.bashrc; nvm install node php /var/www/html/occ log:manage --level warning + OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2 OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3 @@ -22,29 +23,40 @@ php /var/www/html/occ group:add users php /var/www/html/occ group:adduser users user1 php /var/www/html/occ group:adduser users user2 php /var/www/html/occ group:adduser users test + git clone -b $SERVER_VERSION https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ php /var/www/html/occ app:enable activity + git clone -b $SERVER_VERSION https://github.com/nextcloud/text.git /var/www/html/apps/text/ php /var/www/html/occ app:enable text + git clone -b $SERVER_VERSION https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/ php /var/www/html/occ app:enable end_to_end_encryption + git clone -b $SERVER_VERSION https://github.com/nextcloud/password_policy/ /var/www/html/apps/password_policy/ php /var/www/html/occ app:enable password_policy + php /var/www/html/occ app:enable external php /var/www/html/occ config:app:set external sites --value="{\"1\":{\"id\":1,\"name\":\"Nextcloud\",\"url\":\"https:\/\/www.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false},\"2\":{\"id\":2,\"name\":\"Forum\",\"url\":\"https:\/\/help.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false}}" + git clone -b $SERVER_VERSION https://github.com/nextcloud/files_lock.git /var/www/html/apps/files_lock/ php /var/www/html/occ app:enable -f files_lock + git clone -b $SERVER_VERSION https://github.com/nextcloud/groupfolders.git /var/www/html/apps/groupfolders/ php /var/www/html/occ app:enable -f groupfolders php /var/www/html/occ groupfolders:create groupfolder php /var/www/html/occ groupfolders:group 1 users + git clone -b $SERVER_VERSION https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ php /var/www/html/occ app:enable -f notifications php /var/www/html/occ notification:generate test -d test + git clone -b $SERVER_VERSION https://github.com/nextcloud/photos.git /var/www/html/apps/photos/ -cd /var/www/html/apps/photos; composer install +cd /var/www/html/apps/photos; composer install --no-dev php /var/www/html/occ app:enable -f photos + git clone https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/ -cd /var/www/html/apps/assistant; git checkout tags/v1.0.2; source ~/.bashrc; make +cd /var/www/html/apps/assistant; git checkout tags/v1.0.8; source ~/.bashrc; npm run build; composer install --no-dev php /var/www/html/occ app:enable -f assistant + php /var/www/html/occ app:enable -f testing diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index e9459fa0a7..b08250f73c 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -23,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - server: [ master, stable27 ] + server: [ master, stable29 ] api-level: [ 27 ] # 15 steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 diff --git a/scripts/uploadReport.sh b/scripts/uploadReport.sh index c9b4a0534c..f706f31feb 100755 --- a/scripts/uploadReport.sh +++ b/scripts/uploadReport.sh @@ -19,11 +19,11 @@ URL=https://nextcloud.kaminsky.me/remote.php/dav/files/$USER/android-library-int # upload logcat log_filename=$ID"_logcat.txt.xz" log_file="${log_filename}" -upload_path="https://nextcloud.kaminsky.me/remote.php/webdav/library-logcat/$log_filename" +upload_path="https://nextcloud.kaminsky.me/remote.php/webdav/android-library-logcat/$log_filename" xz logcat.txt mv logcat.txt.xz "$log_file" curl -u "$USER:$PASS" -X PUT "$upload_path" --upload-file "$log_file" -echo >&2 "Uploaded logcat to https://www.kaminsky.me/nc-dev/library-logcat/$log_filename" +echo >&2 "Uploaded logcat to https://www.kaminsky.me/nc-dev/android-library-logcat/$log_filename" if [ $TYPE = "IT" ]; then cd library/build/reports/androidTests/connected From fbfcd5ac10aaaa6c3902d87f945c9ebe306bb30c Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 12:53:48 +0200 Subject: [PATCH 29/74] wip Signed-off-by: tobiasKaminsky --- library/src/androidTest/java/com/owncloud/android/FileIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/androidTest/java/com/owncloud/android/FileIT.java b/library/src/androidTest/java/com/owncloud/android/FileIT.java index 1328ae544c..a3e87e1962 100644 --- a/library/src/androidTest/java/com/owncloud/android/FileIT.java +++ b/library/src/androidTest/java/com/owncloud/android/FileIT.java @@ -43,7 +43,7 @@ public void testCreateFolderSuccess() { assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); // verify folder - assertFalse(new ReadFolderRemoteOperation(path).execute(client).isSuccess()); + assertTrue(new ReadFolderRemoteOperation(path).execute(client).isSuccess()); // remove folder assertTrue(new RemoveFileRemoteOperation(path).execute(client).isSuccess()); From 5323e0a8fb4cc36de28b4eabd74ff1297bc8dee8 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 14:42:18 +0200 Subject: [PATCH 30/74] also test with api 15 Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index b08250f73c..4ca0eab2e7 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -24,7 +24,7 @@ jobs: fail-fast: false matrix: server: [ master, stable29 ] - api-level: [ 27 ] # 15 + api-level: [ 15, 27 ] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 From 610bc79948c0178ba9d6d487f65c3e69034d1a85 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 15:33:26 +0200 Subject: [PATCH 31/74] api 16 Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 99 +++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 4ca0eab2e7..09b4662fb6 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -24,7 +24,7 @@ jobs: fail-fast: false matrix: server: [ master, stable29 ] - api-level: [ 15, 27 ] + api-level: [ 16, 27 ] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -73,7 +73,102 @@ jobs: echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties - - name: Build gplay + - name: Build gplay # TODO build only once! + run: | + sed -i s#https://server#http://10.0.2.2# gradle.properties + sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt + ./gradlew assembleDebug + + - name: gplay + env: + SHOT_TEST: "true" + uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + arch: x86 + sdcard-path-or-size: 100M + target: google_apis + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 + script: scripts/runTests.sh + + - name: upload failing results + if: ${{ failure() }} + env: + LOG_USERNAME: ${{ secrets.LOG_USERNAME }} + LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }} + GIT_USERNAME: ${{ secrets.GIT_USERNAME }} + GIT_TOKEN: ${{ secrets.GIT_TOKEN }} + run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "master" "IT" ${{github.event.number}} "${{ secrets.GIT_USERNAME }}" "${{ secrets.GIT_TOKEN }}" + - name: Archive Espresso results + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + if: ${{ always() }} + with: + name: Report-${{ matrix.server }}-${{ matrix.api-level }} + path: app/build/reports + retention-days: 4 + + stable16: + runs-on: ubuntu-22.04 # our own GARM does not yet support it + services: + server: + image: nextcloudci/server:server-13 + options: --name server + ports: + - 80:80 + strategy: + fail-fast: false + matrix: + api-level: [ 27 ] + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: wait and ping server + run: | + while ! curl http://localhost/status.php 2>&1 | grep installed; do + echo "wait…" + sleep 5 + done + + - name: configure server + run: | + docker cp .github/workflows/configServer.sh server:/tmp/ + docker exec server chmod +x /tmp/configServer.sh + docker exec server /tmp/configServer.sh ${{ matrix.server }} + docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ + docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh + docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh + docker exec server /usr/local/bin/run.sh + + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: "temurin" + java-version: 17 + + - name: create AVD and generate snapshot for caching + uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + arch: x86 + sdcard-path-or-size: 100M + target: google_apis + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 + script: echo "Generated AVD snapshot for caching." + + - name: Configure gradle daemon + run: | + mkdir -p $HOME/.gradle + echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties + echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties + + - name: Build gplay # TODO build only once! run: | sed -i s#https://server#http://10.0.2.2# gradle.properties sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt From a311a925b4850bb177c75838d0444515c0bad56c Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 15:41:00 +0200 Subject: [PATCH 32/74] nc16 Signed-off-by: tobiasKaminsky --- .github/workflows/configNC_stable16.sh | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/configNC_stable16.sh diff --git a/.github/workflows/configNC_stable16.sh b/.github/workflows/configNC_stable16.sh new file mode 100644 index 0000000000..a9ef6d8dd5 --- /dev/null +++ b/.github/workflows/configNC_stable16.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# Nextcloud Android Library +# +# SPDX-FileCopyrightText: 2024 Your Name +# SPDX-License-Identifier: MIT +# + +SERVER_VERSION="stable16" + +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash +source ~/.bashrc; nvm install node + +php /var/www/html/occ log:manage --level warning + +OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 +OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2 +OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3 +OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test@Test' test@test +OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test Spaces' 'test test' +php /var/www/html/occ user:setting user2 files quota 1G +php /var/www/html/occ group:add users +php /var/www/html/occ group:adduser users user1 +php /var/www/html/occ group:adduser users user2 +php /var/www/html/occ group:adduser users test + +php /var/www/html/occ app:enable activity + +php /var/www/html/occ app:enable text + +php /var/www/html/occ app:enable end_to_end_encryption + +php /var/www/html/occ app:enable password_policy + +php /var/www/html/occ app:enable external +php /var/www/html/occ config:app:set external sites --value="{\"1\":{\"id\":1,\"name\":\"Nextcloud\",\"url\":\"https:\/\/www.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false},\"2\":{\"id\":2,\"name\":\"Forum\",\"url\":\"https:\/\/help.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false}}" + +php /var/www/html/occ app:enable groupfolders +php /var/www/html/occ groupfolders:create groupfolder +php /var/www/html/occ groupfolders:group 1 users + +php /var/www/html/occ app:enable notifications + +php /var/www/html/occ app:enable testing From c7619233ce6752f64c81ce989c38f75a4770a9f6 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 15:44:42 +0200 Subject: [PATCH 33/74] nc16 Signed-off-by: tobiasKaminsky --- .github/workflows/configServer16.sh | 11 +++++++++++ .github/workflows/garm.yml | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/configServer16.sh diff --git a/.github/workflows/configServer16.sh b/.github/workflows/configServer16.sh new file mode 100644 index 0000000000..15847e1e7a --- /dev/null +++ b/.github/workflows/configServer16.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# Nextcloud Android Library +# +# SPDX-FileCopyrightText: 2024 Your Name +# SPDX-License-Identifier: MIT +# + +rm data -rf +rm config/config.php +BRANCH="$1" /initnc.sh diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 09b4662fb6..a008512d3f 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -132,9 +132,9 @@ jobs: - name: configure server run: | - docker cp .github/workflows/configServer.sh server:/tmp/ - docker exec server chmod +x /tmp/configServer.sh - docker exec server /tmp/configServer.sh ${{ matrix.server }} + docker cp .github/workflows/configServer16.sh server:/tmp/ + docker exec server chmod +x /tmp/configServer16.sh + docker exec server /tmp/configServer16.sh ${{ matrix.server }} docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh From 3e75507777c93d6367b2c93f9abd681927a793ee Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 15:52:12 +0200 Subject: [PATCH 34/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configServer16.sh | 2 +- .github/workflows/garm.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/configServer16.sh b/.github/workflows/configServer16.sh index 15847e1e7a..cb603e595e 100644 --- a/.github/workflows/configServer16.sh +++ b/.github/workflows/configServer16.sh @@ -8,4 +8,4 @@ rm data -rf rm config/config.php -BRANCH="$1" /initnc.sh +BRANCH="stable16" /initnc.sh diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index a008512d3f..b7a4ec1e1c 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -24,7 +24,7 @@ jobs: fail-fast: false matrix: server: [ master, stable29 ] - api-level: [ 16, 27 ] + api-level: [ 17, 27 ] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -134,10 +134,10 @@ jobs: run: | docker cp .github/workflows/configServer16.sh server:/tmp/ docker exec server chmod +x /tmp/configServer16.sh - docker exec server /tmp/configServer16.sh ${{ matrix.server }} - docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ - docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh - docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh + docker exec server /tmp/configServer16.sh + docker cp .github/workflows/configNC_stable16.sh server:/tmp/ + docker exec server chmod +x /tmp/configNC_stable16.sh + docker exec --user www-data server /tmp/configNC_stable16.sh docker exec server /usr/local/bin/run.sh - name: Enable KVM group perms From 0dda58f2641798acb2060cbacbd7631387f2c749 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Apr 2024 16:02:34 +0200 Subject: [PATCH 35/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configNC_stable16.sh | 4 +--- .github/workflows/garm.yml | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/configNC_stable16.sh b/.github/workflows/configNC_stable16.sh index a9ef6d8dd5..5760844ef5 100644 --- a/.github/workflows/configNC_stable16.sh +++ b/.github/workflows/configNC_stable16.sh @@ -8,9 +8,6 @@ SERVER_VERSION="stable16" -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash -source ~/.bashrc; nvm install node - php /var/www/html/occ log:manage --level warning OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1 @@ -39,6 +36,7 @@ php /var/www/html/occ app:enable groupfolders php /var/www/html/occ groupfolders:create groupfolder php /var/www/html/occ groupfolders:group 1 users +git clone -b $SERVER_VERSION https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ php /var/www/html/occ app:enable notifications php /var/www/html/occ app:enable testing diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index b7a4ec1e1c..f4cee21e85 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -138,7 +138,6 @@ jobs: docker cp .github/workflows/configNC_stable16.sh server:/tmp/ docker exec server chmod +x /tmp/configNC_stable16.sh docker exec --user www-data server /tmp/configNC_stable16.sh - docker exec server /usr/local/bin/run.sh - name: Enable KVM group perms run: | From 4730bbe4ef380239cc67ff41f5f1fccab3a84b69 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 29 Apr 2024 12:03:28 +0200 Subject: [PATCH 36/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index f4cee21e85..215eeabc86 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -24,7 +24,7 @@ jobs: fail-fast: false matrix: server: [ master, stable29 ] - api-level: [ 17, 27 ] + api-level: [ 18, 27 ] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 From b0c86cd81b62a95e99c7530c0def174bc70ac548 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 29 Apr 2024 12:14:25 +0200 Subject: [PATCH 37/74] wip Signed-off-by: tobiasKaminsky --- ...ectEditingCreateFileRemoteOperationIT.java | 7 ++++ ...btainListOfTemplatesRemoteOperationIT.java | 6 +++ .../DirectEditingObtainRemoteOperationIT.kt | 7 ++++ ...irectEditingOpenFileRemoteOperationIT.java | 7 ++++ .../search/UnifiedSearchRemoteOperationIT.kt | 10 +++++ ...rkspaceDirectEditingRemoteOperationIT.java | 6 +++ .../java/com/owncloud/android/FileIT.java | 9 +++++ .../GetCapabilitiesRemoteOperationIT.java | 8 ++-- .../e2ee/UpdateMetadataRemoteOperationIT.java | 2 +- .../files/SearchRemoteOperationIT.java | 39 ++++++++++++++++--- .../files/UploadFileRemoteOperationIT.kt | 33 +++++++++++----- .../shares/GetSharesRemoteOperationIT.java | 3 ++ .../users/AppTokenRemoteOperationIT.kt | 3 ++ 13 files changed, 121 insertions(+), 19 deletions(-) diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java index b8b88a081b..81d8858440 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java @@ -9,13 +9,20 @@ import com.owncloud.android.AbstractIT; import com.owncloud.android.lib.common.operations.RemoteOperationResult; +import com.owncloud.android.lib.resources.status.OwnCloudVersion; +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; public class DirectEditingCreateFileRemoteOperationIT extends AbstractIT { + @BeforeClass + public static void beforeClass() { + testOnlyOnServer(OwnCloudVersion.nextcloud_18); + } + @Test public void createEmptyFile() { RemoteOperationResult result = new DirectEditingCreateFileRemoteOperation("/test.md", diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java index 83540cdbeb..2ca3334a54 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java @@ -10,7 +10,9 @@ import com.owncloud.android.AbstractIT; import com.owncloud.android.lib.common.TemplateList; import com.owncloud.android.lib.common.operations.RemoteOperationResult; +import com.owncloud.android.lib.resources.status.OwnCloudVersion; +import org.junit.BeforeClass; import org.junit.Test; import java.util.Objects; @@ -19,6 +21,10 @@ import static org.junit.Assert.assertTrue; public class DirectEditingObtainListOfTemplatesRemoteOperationIT extends AbstractIT { + @BeforeClass + public static void beforeClass() { + testOnlyOnServer(OwnCloudVersion.nextcloud_18); + } @Test public void testGetAll() { diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainRemoteOperationIT.kt b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainRemoteOperationIT.kt index 4fccbcda29..377384f350 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainRemoteOperationIT.kt @@ -8,13 +8,20 @@ package com.nextcloud.android.lib.resources.directediting import com.owncloud.android.AbstractIT +import com.owncloud.android.lib.resources.status.OwnCloudVersion import junit.framework.Assert.assertEquals import junit.framework.Assert.assertFalse import junit.framework.Assert.assertNotNull import junit.framework.Assert.assertTrue +import org.junit.Before import org.junit.Test class DirectEditingObtainRemoteOperationIT : AbstractIT() { + @Before + fun before() { + testOnlyOnServer(OwnCloudVersion.nextcloud_18) + } + @Test fun testGetAll() { val result = DirectEditingObtainRemoteOperation().run(nextcloudClient) diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java index 9f23bf3a74..aa12df6052 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java @@ -11,9 +11,11 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation; import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation; +import com.owncloud.android.lib.resources.status.OwnCloudVersion; import junit.framework.TestCase; +import org.junit.BeforeClass; import org.junit.Test; import java.io.IOException; @@ -22,6 +24,11 @@ import static org.junit.Assert.assertTrue; public class DirectEditingOpenFileRemoteOperationIT extends AbstractIT { + @BeforeClass + public static void beforeClass() { + testOnlyOnServer(OwnCloudVersion.nextcloud_18); + } + @Test public void openFile() throws IOException { // create file diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt b/library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt index 4691e6ed20..fc76f9c63c 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt @@ -11,10 +11,12 @@ import com.owncloud.android.AbstractIT import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation import com.owncloud.android.lib.resources.files.model.RemoteFile +import com.owncloud.android.lib.resources.status.OwnCloudVersion import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue +import org.junit.BeforeClass import org.junit.Test class UnifiedSearchRemoteOperationIT : AbstractIT() { @@ -77,4 +79,12 @@ class UnifiedSearchRemoteOperationIT : AbstractIT() { assertTrue(data.entries.isNotEmpty()) assertNotNull(data.entries.find { it.title == "test Folder" }) } + + companion object { + @BeforeClass + @JvmStatic + fun before() { + testOnlyOnServer(OwnCloudVersion.nextcloud_20) + } + } } diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/richWorkspace/RichWorkspaceDirectEditingRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/richWorkspace/RichWorkspaceDirectEditingRemoteOperationIT.java index 8d4d2f8c37..eef06c8b5b 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/richWorkspace/RichWorkspaceDirectEditingRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/richWorkspace/RichWorkspaceDirectEditingRemoteOperationIT.java @@ -16,13 +16,19 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation; import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation; +import com.owncloud.android.lib.resources.status.OwnCloudVersion; +import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.io.IOException; public class RichWorkspaceDirectEditingRemoteOperationIT extends AbstractIT { + @BeforeClass + public static void beforeClass() { + testOnlyOnServer(OwnCloudVersion.nextcloud_18); + } @Test public void getEditLinkForRoot() { diff --git a/library/src/androidTest/java/com/owncloud/android/FileIT.java b/library/src/androidTest/java/com/owncloud/android/FileIT.java index a3e87e1962..281459fd95 100644 --- a/library/src/androidTest/java/com/owncloud/android/FileIT.java +++ b/library/src/androidTest/java/com/owncloud/android/FileIT.java @@ -25,6 +25,7 @@ import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation; import com.owncloud.android.lib.resources.status.NextcloudVersion; import com.owncloud.android.lib.resources.status.OCCapability; +import com.owncloud.android.lib.resources.status.OwnCloudVersion; import org.junit.Test; @@ -146,6 +147,8 @@ public void testShareViaLinkSharees() { @Test public void testShareToGroupSharees() { + testOnlyOnServer(OwnCloudVersion.nextcloud_17); + // create & verify folder String path = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); @@ -187,6 +190,8 @@ public void testShareToGroupSharees() { @Test public void testOneSharees() { + testOnlyOnServer(OwnCloudVersion.nextcloud_17); + // create & verify folder String path = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); @@ -222,6 +227,8 @@ public void testOneSharees() { @Test public void testTwoShareesOnParent() { + testOnlyOnServer(OwnCloudVersion.nextcloud_17); + // create & verify folder String path = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); @@ -270,6 +277,8 @@ public void testTwoShareesOnParent() { @Test public void testTwoSharees() { + testOnlyOnServer(OwnCloudVersion.nextcloud_17); + // create & verify folder String path = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); diff --git a/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java index 1c58ed18a8..f2bc0744a4 100644 --- a/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java @@ -101,10 +101,12 @@ private void checkCapability(OCCapability capability, String userId) { assertTrue(capability.getFilesVersioning().isTrue()); assertTrue(capability.getFilesUndelete().isTrue()); assertNotNull(capability.getVersion()); - assertFalse(capability.getEtag().isEmpty()); - assertSame(CapabilityBooleanType.FALSE, capability.getRichDocuments()); - assertFalse(capability.getDirectEditingEtag().isEmpty()); assertSame(CapabilityBooleanType.UNKNOWN, capability.getDropAccount()); + if (capability.getVersion().isNewerOrEqual(OwnCloudVersion.nextcloud_17)) { + assertFalse(capability.getEtag().isEmpty()); + assertFalse(capability.getDirectEditingEtag().isEmpty()); + } + assertSame(CapabilityBooleanType.FALSE, capability.getRichDocuments()); // user status if (capability.getVersion().isNewerOrEqual(OwnCloudVersion.nextcloud_20)) { diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/e2ee/UpdateMetadataRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/e2ee/UpdateMetadataRemoteOperationIT.java index c30d7c13ec..255bffb8bf 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/e2ee/UpdateMetadataRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/e2ee/UpdateMetadataRemoteOperationIT.java @@ -26,7 +26,7 @@ public class UpdateMetadataRemoteOperationIT extends AbstractIT { //@Test public void uploadAndModifyV1() { // tests only for NC19+ - testOnlyOnServer(OwnCloudVersion.nextcloud_20); + testOnlyOnServer(OwnCloudVersion.nextcloud_19); // E2E server app checks for official NC client with >=3.13.0, // and blocks all other clients, e.g. 3rd party apps using this lib diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java index 7ff006ffd4..881cbc3df4 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java @@ -24,7 +24,9 @@ import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation; import com.owncloud.android.lib.resources.shares.ShareType; import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation; +import com.owncloud.android.lib.resources.status.NextcloudVersion; import com.owncloud.android.lib.resources.status.OCCapability; +import com.owncloud.android.lib.resources.status.OwnCloudVersion; import org.junit.BeforeClass; import org.junit.Test; @@ -92,6 +94,12 @@ public void testFileSearchEmpty() throws IOException { @Test public void testFileSearchEverything() throws IOException { + // on newer server we have Talk folder + int offset = 0; + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { + offset = 1; + } + for (int i = 0; i < 10; i++) { String filePath = createFile("image" + i); String remotePath = "/image" + i + ".jpg"; @@ -106,7 +114,7 @@ public void testFileSearchEverything() throws IOException { RemoteOperationResult> result = sut.execute(client); assertTrue(result.isSuccess()); - assertEquals(11, result.getResultData().size()); + assertEquals(offset + 10, result.getResultData().size()); } @Test @@ -200,7 +208,14 @@ public void favoriteFiles() throws IOException { assertEquals(2, result.getResultData().size()); assertEquals(remotePath, result.getResultData().get(0).getRemotePath()); - assertEquals(sharedRemotePath, result.getResultData().get(1).getRemotePath()); + + if (capability.getVersion().isNewerOrEqual(OwnCloudVersion.nextcloud_17)) { + assertEquals(sharedRemotePath, result.getResultData().get(1).getRemotePath()); + } else { + // on NC16 we have a bug that each file ends with "/" + sharedRemotePath += "/"; + assertEquals(sharedRemotePath, result.getResultData().get(1).getRemotePath()); + } } /** @@ -208,6 +223,12 @@ public void favoriteFiles() throws IOException { */ @Test public void testRecentlyModifiedSearch() throws IOException { + // on newer server we have Talk folder + int offset = 0; + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { + offset = 1; + } + long now = System.currentTimeMillis() / MILLI_TO_SECOND; String filePath = createFile("image"); assertTrue(new UploadFileRemoteOperation(filePath, "/image.jpg", "image/jpg", now - 50) @@ -232,7 +253,7 @@ public void testRecentlyModifiedSearch() throws IOException { RemoteOperationResult> result = sut.execute(client); assertTrue(result.isSuccess()); - assertEquals(4, result.getResultData().size()); + assertEquals(offset + 3, result.getResultData().size()); assertEquals("/video.mp4", result.getResultData().get(0).getRemotePath()); assertEquals("/pdf.pdf", result.getResultData().get(1).getRemotePath()); @@ -397,6 +418,8 @@ public void testPhotoSearchLimitAndTimestamp() throws IOException { @Test public void testGallerySearch() throws IOException { + testOnlyOnServer(OwnCloudVersion.nextcloud_18); + for (int i = 0; i < 10; i++) { String filePath = createFile("image" + i); String remotePath = "/image" + i + ".jpg"; @@ -423,6 +446,12 @@ public void testGallerySearch() throws IOException { @Test public void showOnlyFolders() throws IOException { + // on newer server we have Talk folder + int offset = 0; + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { + offset = 1; + } + for (int i = 0; i < 10; i++) { String filePath = createFile("image" + i); String remotePath = "/image" + i + ".jpg"; @@ -436,13 +465,13 @@ public void showOnlyFolders() throws IOException { RemoteOperationResult> result = sut.execute(client); assertTrue(result.isSuccess()); - assertEquals(1, result.getResultData().size()); + assertEquals(0 + offset, result.getResultData().size()); assertTrue(new CreateFolderRemoteOperation("/folder/", false).execute(client).isSuccess()); result = sut.execute(client); assertTrue(result.isSuccess()); - assertEquals(2, result.getResultData().size()); + assertEquals(1 + offset, result.getResultData().size()); assertEquals("/folder/", result.getResultData().get(0).getRemotePath()); } diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt index 56e9196928..7daaa2f90d 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt @@ -11,6 +11,9 @@ import android.os.Build import com.owncloud.android.AbstractIT import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.lib.resources.files.model.RemoteFile +import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation +import com.owncloud.android.lib.resources.status.OCCapability +import com.owncloud.android.lib.resources.status.OwnCloudVersion import junit.framework.TestCase.assertEquals import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue @@ -32,6 +35,10 @@ class UploadFileRemoteOperationIT : AbstractIT() { @Test fun upload() { + val ocCapability = + GetCapabilitiesRemoteOperation() + .execute(nextcloudClient).singleData as OCCapability + // create file val filePath = createFile("text") val remotePath = "/test.md" @@ -59,12 +66,15 @@ class UploadFileRemoteOperationIT : AbstractIT() { var remoteFile = result.data[0] as RemoteFile assertEquals(remotePath, remoteFile.remotePath) - assertEquals(creationTimestamp, remoteFile.creationTimestamp) assertEquals(uploadResult.resultData, remoteFile.etag) - assertTrue( - uploadTimestamp - TIME_OFFSET < remoteFile.uploadTimestamp || - uploadTimestamp + TIME_OFFSET > remoteFile.uploadTimestamp - ) + + if (ocCapability.version.isNewerOrEqual(OwnCloudVersion.nextcloud_18)) { + assertEquals(creationTimestamp, remoteFile.creationTimestamp) + assertTrue( + uploadTimestamp - TIME_OFFSET < remoteFile.uploadTimestamp || + uploadTimestamp + TIME_OFFSET > remoteFile.uploadTimestamp + ) + } // ReadFolderRemoteOperation result = ReadFolderRemoteOperation(remotePath).execute(client) @@ -73,11 +83,14 @@ class UploadFileRemoteOperationIT : AbstractIT() { remoteFile = result.data[0] as RemoteFile assertEquals(remotePath, remoteFile.remotePath) - assertEquals(creationTimestamp, remoteFile.creationTimestamp) - assertTrue( - uploadTimestamp - TIME_OFFSET < remoteFile.uploadTimestamp || - uploadTimestamp + TIME_OFFSET > remoteFile.uploadTimestamp - ) + + if (ocCapability.version.isNewerOrEqual(OwnCloudVersion.nextcloud_18)) { + assertEquals(creationTimestamp, remoteFile.creationTimestamp) + assertTrue( + uploadTimestamp - TIME_OFFSET < remoteFile.uploadTimestamp || + uploadTimestamp + TIME_OFFSET > remoteFile.uploadTimestamp + ) + } } private fun getCreationTimestamp(file: File): Long? { diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/shares/GetSharesRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/shares/GetSharesRemoteOperationIT.java index 4a7fc05c87..cc411bd975 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/shares/GetSharesRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/shares/GetSharesRemoteOperationIT.java @@ -27,6 +27,7 @@ import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation; import com.owncloud.android.lib.resources.status.NextcloudVersion; import com.owncloud.android.lib.resources.status.OCCapability; +import com.owncloud.android.lib.resources.status.OwnCloudVersion; import junit.framework.TestCase; @@ -154,6 +155,8 @@ private void assertFolderAttributes(final OCShare share, final String expectedDi @Test public void sharedWithMe() { + testOnlyOnServer(OwnCloudVersion.nextcloud_19); + GetSharesRemoteOperation sut = new GetSharesRemoteOperation(); GetSharesRemoteOperation sutSharedWithMe = new GetSharesRemoteOperation(true); diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/users/AppTokenRemoteOperationIT.kt b/library/src/androidTest/java/com/owncloud/android/lib/resources/users/AppTokenRemoteOperationIT.kt index 53802ec18e..3642fbf059 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/users/AppTokenRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/users/AppTokenRemoteOperationIT.kt @@ -9,6 +9,7 @@ package com.owncloud.android.lib.resources.users import androidx.test.platform.app.InstrumentationRegistry import com.owncloud.android.AbstractIT +import com.owncloud.android.lib.resources.status.OwnCloudVersion import junit.framework.Assert.assertFalse import junit.framework.Assert.assertTrue import okhttp3.Credentials.basic @@ -57,6 +58,8 @@ class AppTokenRemoteOperationIT : AbstractIT() { @Test fun deleteAppPassword() { + testOnlyOnServer(OwnCloudVersion.nextcloud_17) + val arguments = InstrumentationRegistry.getArguments() val username: String = arguments.getString("TEST_SERVER_USERNAME", "") val password: String = arguments.getString("TEST_SERVER_PASSWORD", "") From bd0e224435190f8709a3e4ffd614c18877c1998f Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 29 Apr 2024 15:23:39 +0200 Subject: [PATCH 38/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configNC_master.sh | 20 +++++++++---------- .github/workflows/configNC_stable16.sh | 5 ++++- ...ashboardGetWidgetItemsRemoteOperationIT.kt | 8 ++++++-- .../files/SearchRemoteOperationIT.java | 10 +++++++--- .../resources/notifications/NotificationIT.kt | 3 +++ scripts/uploadReport.sh | 2 +- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.github/workflows/configNC_master.sh b/.github/workflows/configNC_master.sh index 7a9a4fc406..dd984af970 100644 --- a/.github/workflows/configNC_master.sh +++ b/.github/workflows/configNC_master.sh @@ -24,40 +24,40 @@ php /var/www/html/occ group:adduser users user1 php /var/www/html/occ group:adduser users user2 php /var/www/html/occ group:adduser users test -git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ +git clone --depth=1 -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ php /var/www/html/occ app:enable activity -git clone -b main https://github.com/nextcloud/text.git /var/www/html/apps/text/ +git clone --depth=1 -b main https://github.com/nextcloud/text.git /var/www/html/apps/text/ php /var/www/html/occ app:enable text -git clone -b master https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/ +git clone --depth=1 -b master https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/ php /var/www/html/occ app:enable end_to_end_encryption -git clone -b master https://github.com/nextcloud/password_policy/ /var/www/html/apps/password_policy/ +git clone --depth=1 -b master https://github.com/nextcloud/password_policy/ /var/www/html/apps/password_policy/ php /var/www/html/occ app:enable password_policy -git clone -b master https://github.com/nextcloud/external/ /var/www/html/apps/external/ +git clone --depth=1 -b master https://github.com/nextcloud/external/ /var/www/html/apps/external/ cd /var/www/html/apps/external; composer install --no-dev php /var/www/html/occ app:enable external php /var/www/html/occ config:app:set external sites --value="{\"1\":{\"id\":1,\"name\":\"Nextcloud\",\"url\":\"https:\/\/www.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false},\"2\":{\"id\":2,\"name\":\"Forum\",\"url\":\"https:\/\/help.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false}}" -git clone -b main https://github.com/nextcloud/files_lock.git /var/www/html/apps/files_lock/ +git clone --depth=1 -b main https://github.com/nextcloud/files_lock.git /var/www/html/apps/files_lock/ php /var/www/html/occ app:enable -f files_lock -git clone https://github.com/nextcloud/groupfolders.git /var/www/html/apps/groupfolders/ +git clone --depth=1 https://github.com/nextcloud/groupfolders.git /var/www/html/apps/groupfolders/ php /var/www/html/occ app:enable -f groupfolders php /var/www/html/occ groupfolders:create groupfolder php /var/www/html/occ groupfolders:group 1 users -git clone https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ +git clone --depth=1 https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ php /var/www/html/occ app:enable -f notifications php /var/www/html/occ notification:generate test -d test -git clone https://github.com/nextcloud/photos.git /var/www/html/apps/photos/ +git clone --depth=1 https://github.com/nextcloud/photos.git /var/www/html/apps/photos/ cd /var/www/html/apps/photos; composer install --no-dev php /var/www/html/occ app:enable -f photos -git clone https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/ +git clone --depth=1 https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/ cd /var/www/html/apps/assistant; source ~/.bashrc; make php /var/www/html/occ app:enable -f assistant diff --git a/.github/workflows/configNC_stable16.sh b/.github/workflows/configNC_stable16.sh index 5760844ef5..ea8e53aa55 100644 --- a/.github/workflows/configNC_stable16.sh +++ b/.github/workflows/configNC_stable16.sh @@ -21,12 +21,15 @@ php /var/www/html/occ group:adduser users user1 php /var/www/html/occ group:adduser users user2 php /var/www/html/occ group:adduser users test +git clone --depth=1 -b $SERVER_VERSION https://github.com/nextcloud/activity.git /var/www/html/apps/activity/ php /var/www/html/occ app:enable activity +git clone --depth=1 -b $SERVER_VERSION https://github.com/nextcloud/text.git /var/www/html/apps/text/ php /var/www/html/occ app:enable text php /var/www/html/occ app:enable end_to_end_encryption +git clone --depth=1 -b $SERVER_VERSION https://github.com/nextcloud/password_policy/ /var/www/html/apps/password_policy/ php /var/www/html/occ app:enable password_policy php /var/www/html/occ app:enable external @@ -36,7 +39,7 @@ php /var/www/html/occ app:enable groupfolders php /var/www/html/occ groupfolders:create groupfolder php /var/www/html/occ groupfolders:group 1 users -git clone -b $SERVER_VERSION https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ +git clone --depth=1 -b $SERVER_VERSION https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/ php /var/www/html/occ app:enable notifications php /var/www/html/occ app:enable testing diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/dashboard/DashboardGetWidgetItemsRemoteOperationIT.kt b/library/src/androidTest/java/com/nextcloud/android/lib/resources/dashboard/DashboardGetWidgetItemsRemoteOperationIT.kt index a2e9aed385..b10e8ee8fb 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/dashboard/DashboardGetWidgetItemsRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/dashboard/DashboardGetWidgetItemsRemoteOperationIT.kt @@ -14,14 +14,18 @@ import com.owncloud.android.lib.resources.shares.OCShare import com.owncloud.android.lib.resources.shares.ShareType import com.owncloud.android.lib.resources.status.NextcloudVersion import org.junit.Assert.assertTrue +import org.junit.Before import org.junit.Test class DashboardGetWidgetItemsRemoteOperationIT : AbstractIT() { - @Test - fun getItems() { + @Before + fun before() { // only on NC25+ testOnlyOnServer(NextcloudVersion.nextcloud_25) + } + @Test + fun getItems() { // create folder to have some content assertTrue(CreateFolderRemoteOperation("/testFolder", false).execute(client2).isSuccess) assertTrue( diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java index 881cbc3df4..4cda68d0ac 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java @@ -96,7 +96,8 @@ public void testFileSearchEmpty() throws IOException { public void testFileSearchEverything() throws IOException { // on newer server we have Talk folder int offset = 0; - if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || + capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_16.getMajorVersionNumber()) { offset = 1; } @@ -225,7 +226,8 @@ public void favoriteFiles() throws IOException { public void testRecentlyModifiedSearch() throws IOException { // on newer server we have Talk folder int offset = 0; - if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || + capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_16.getMajorVersionNumber()) { offset = 1; } @@ -447,8 +449,10 @@ public void testGallerySearch() throws IOException { @Test public void showOnlyFolders() throws IOException { // on newer server we have Talk folder + // on NC16 groupfolder is also returned int offset = 0; - if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || + capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_16.getMajorVersionNumber()) { offset = 1; } diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/notifications/NotificationIT.kt b/library/src/androidTest/java/com/owncloud/android/lib/resources/notifications/NotificationIT.kt index ba34b46fba..ecef8e3009 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/notifications/NotificationIT.kt +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/notifications/NotificationIT.kt @@ -8,6 +8,7 @@ package com.owncloud.android.lib.resources.notifications import com.owncloud.android.AbstractIT +import com.owncloud.android.lib.resources.status.OwnCloudVersion import junit.framework.TestCase.assertEquals import junit.framework.TestCase.assertTrue import org.junit.Test @@ -22,6 +23,8 @@ class NotificationIT : AbstractIT() { val count = all.resultData.size // get one + testOnlyOnServer(OwnCloudVersion.nextcloud_17) + val firstNotification = all.resultData[0] val first = GetNotificationRemoteOperation(firstNotification.notificationId).execute(nextcloudClient) assertTrue(first.isSuccess) diff --git a/scripts/uploadReport.sh b/scripts/uploadReport.sh index f706f31feb..868b8aa459 100755 --- a/scripts/uploadReport.sh +++ b/scripts/uploadReport.sh @@ -39,7 +39,7 @@ fi find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \; find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) --upload-file {} \; -echo "Uploaded failing library tests to https://www.kaminsky.me/nc-dev/android-library-integrationTests/$REMOTE_FOLDER" +echo "Uploaded failing library tests to https://www.kaminsky.me/nc-dev/android-library-integrationTests/$REMOTE_FOLDER/debug/" curl -u $GIT_USERNAME:$GIT_TOKEN -X POST https://api.github.com/repos/nextcloud/android-library/issues/$PR_ID/comments -d "{ \"body\" : \"$BRANCH_TYPE test failed: https://www.kaminsky.me/nc-dev/android-library-integrationTests/$REMOTE_FOLDER/debug/ \" }" exit 1 From bfca91a6db0b063bd41a38e2fae9bfee2161eb25 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 20 Jun 2024 08:11:53 +0200 Subject: [PATCH 39/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configNC_master.sh | 3 +++ .github/workflows/configServer.sh | 1 + scripts/createDockerTestContainer.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100755 scripts/createDockerTestContainer.sh diff --git a/.github/workflows/configNC_master.sh b/.github/workflows/configNC_master.sh index dd984af970..8f9530d0cb 100644 --- a/.github/workflows/configNC_master.sh +++ b/.github/workflows/configNC_master.sh @@ -9,6 +9,9 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + source ~/.bashrc; nvm install node php /var/www/html/occ log:manage --level warning diff --git a/.github/workflows/configServer.sh b/.github/workflows/configServer.sh index f9eef62ae0..a444314131 100644 --- a/.github/workflows/configServer.sh +++ b/.github/workflows/configServer.sh @@ -6,6 +6,7 @@ # SPDX-License-Identifier: MIT # +wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg apt-get update && apt-get install -y composer mkdir /var/www/.nvm /var/www/.npm touch /var/www/.bashrc diff --git a/scripts/createDockerTestContainer.sh b/scripts/createDockerTestContainer.sh new file mode 100755 index 0000000000..6ad2af78a2 --- /dev/null +++ b/scripts/createDockerTestContainer.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Nextcloud Android Library +# +# SPDX-FileCopyrightText: 2024 Tobias Kaminsky +# SPDX-License-Identifier: MIT +# + +if [[ $# -ne 1 ]]; then + echo "please specify stable29 or master as first parameter" + exit +fi + +docker stop testNC +docker rm testNC +docker run --name=testNC ghcr.io/nextcloud/continuous-integration-shallow-server:latest & +sleep 60 + +docker cp ../.github/workflows/configServer.sh testNC:/tmp/ +docker exec testNC chmod +x /tmp/configServer.sh +docker exec testNC /tmp/configServer.sh $1 +docker cp ../.github/workflows/configNC_$1.sh testNC:/tmp/ +docker exec testNC chmod +x /tmp/configNC_$1.sh +docker exec --user www-data testNC /tmp/configNC_$1.sh + +echo "Docker IP Address is:" +docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' testNC From 9e6b5f9c380e49c41eb2238b2446d01c441d364c Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 31 Oct 2024 15:24:34 +0100 Subject: [PATCH 40/74] try ubuntu-latest Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 215eeabc86..fbba187ea0 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -13,7 +13,7 @@ permissions: jobs: test: - runs-on: ubuntu-22.04 # our own GARM does not yet support it + runs-on: ubuntu-latest services: server: image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest @@ -109,7 +109,7 @@ jobs: retention-days: 4 stable16: - runs-on: ubuntu-22.04 # our own GARM does not yet support it + runs-on: ubuntu-latest services: server: image: nextcloudci/server:server-13 From 9537d689deb36dd5f143362d1131d81b797b139b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 31 Oct 2024 15:32:55 +0100 Subject: [PATCH 41/74] no kvm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index fbba187ea0..195df33f44 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -139,11 +139,6 @@ jobs: docker exec server chmod +x /tmp/configNC_stable16.sh docker exec --user www-data server /tmp/configNC_stable16.sh - - name: Enable KVM group perms - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: From d02be5d317e824b469e755234f0dc4d04aef18ed Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 31 Oct 2024 16:05:56 +0100 Subject: [PATCH 42/74] no kvm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 195df33f44..277a01f296 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -13,7 +13,7 @@ permissions: jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-kvm services: server: image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest @@ -109,7 +109,7 @@ jobs: retention-days: 4 stable16: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-vkm services: server: image: nextcloudci/server:server-13 From cffb254d368edc789f8e87018cc6d5463ecdafe4 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 31 Oct 2024 16:11:25 +0100 Subject: [PATCH 43/74] re-enable kvm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 277a01f296..3923f2bc5b 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -139,6 +139,11 @@ jobs: docker exec server chmod +x /tmp/configNC_stable16.sh docker exec --user www-data server /tmp/configNC_stable16.sh + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: From 8639a32aa1b37396390d4dc337ad942dcda7cb5b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 31 Oct 2024 16:25:51 +0100 Subject: [PATCH 44/74] again no kvm Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 3923f2bc5b..8a9381def0 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -45,12 +45,6 @@ jobs: docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh docker exec server /usr/local/bin/run.sh - - name: Enable KVM group perms - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: distribution: "temurin" @@ -139,12 +133,6 @@ jobs: docker exec server chmod +x /tmp/configNC_stable16.sh docker exec --user www-data server /tmp/configNC_stable16.sh - - name: Enable KVM group perms - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: distribution: "temurin" From e4cbfc4bf7fef59e551ed0298363fb66f05055aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Thu, 31 Oct 2024 19:49:41 +0100 Subject: [PATCH 45/74] debug kvm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 8a9381def0..2bfaae2174 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -11,20 +11,18 @@ permissions: contents: read pull-requests: write +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-latest-kvm - services: - server: - image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest - options: --name server - ports: - - 80:80 strategy: fail-fast: false matrix: - server: [ master, stable29 ] - api-level: [ 18, 27 ] + server: [ master ] + api-level: [ 18 ] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -37,13 +35,10 @@ jobs: - name: configure server run: | - docker cp .github/workflows/configServer.sh server:/tmp/ - docker exec server chmod +x /tmp/configServer.sh - docker exec server /tmp/configServer.sh ${{ matrix.server }} - docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ - docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh - docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh - docker exec server /usr/local/bin/run.sh + ls -ahl /dev/kvm + apt update && apt install unzip openjdk-21-jdk-headless cpu-checker qemu-kvm --yes + kvm-ok + chmod 666 /dev/kvm - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: From eb0d8058ffd62e19cfd9e515230016acc1678891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Thu, 31 Oct 2024 19:50:29 +0100 Subject: [PATCH 46/74] no ping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 2bfaae2174..c4ed283677 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -26,13 +26,6 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: wait and ping server - run: | - while ! curl http://localhost/status.php 2>&1 | grep installed; do - echo "wait…" - sleep 5 - done - - name: configure server run: | ls -ahl /dev/kvm From 68770d6db4748da4f90e3a6c2f393c1278f9b144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Thu, 31 Oct 2024 19:51:50 +0100 Subject: [PATCH 47/74] sudo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index c4ed283677..dcb4a2f9c6 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -29,9 +29,9 @@ jobs: - name: configure server run: | ls -ahl /dev/kvm - apt update && apt install unzip openjdk-21-jdk-headless cpu-checker qemu-kvm --yes + sudo apt-get update && sudo apt-get install unzip openjdk-21-jdk-headless cpu-checker qemu-kvm --yes kvm-ok - chmod 666 /dev/kvm + sudo chmod 666 /dev/kvm - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: From 4aa951755cfc1f6b6682e804affae55c5612ca98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Thu, 31 Oct 2024 19:58:43 +0100 Subject: [PATCH 48/74] update action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index dcb4a2f9c6..65a69142c8 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -39,7 +39,7 @@ jobs: java-version: 17 - name: create AVD and generate snapshot for caching - uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 with: api-level: ${{ matrix.api-level }} force-avd-creation: false From 7bacdc95ad78a2e24c03d200280ea400ede6ccc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Thu, 31 Oct 2024 20:03:17 +0100 Subject: [PATCH 49/74] put together MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 65a69142c8..f8dcc3503a 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -18,19 +18,37 @@ concurrency: jobs: test: runs-on: ubuntu-latest-kvm + services: + server: + image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest + options: --name server + ports: + - 80:80 strategy: fail-fast: false matrix: - server: [ master ] - api-level: [ 18 ] + server: [ master, stable29 ] + api-level: [ 18, 27 ] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: wait and ping server + run: | + while ! curl http://localhost/status.php 2>&1 | grep installed; do + echo "wait…" + sleep 5 + done + - name: configure server run: | - ls -ahl /dev/kvm + docker cp .github/workflows/configServer.sh server:/tmp/ + docker exec server chmod +x /tmp/configServer.sh + docker exec server /tmp/configServer.sh ${{ matrix.server }} + docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ + docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh + docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh + docker exec server /usr/local/bin/run.sh sudo apt-get update && sudo apt-get install unzip openjdk-21-jdk-headless cpu-checker qemu-kvm --yes - kvm-ok sudo chmod 666 /dev/kvm - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 @@ -64,7 +82,7 @@ jobs: - name: gplay env: SHOT_TEST: "true" - uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 with: api-level: ${{ matrix.api-level }} force-avd-creation: false @@ -91,7 +109,7 @@ jobs: retention-days: 4 stable16: - runs-on: ubuntu-latest-vkm + runs-on: ubuntu-latest-kvm services: server: image: nextcloudci/server:server-13 @@ -127,7 +145,7 @@ jobs: java-version: 17 - name: create AVD and generate snapshot for caching - uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 with: api-level: ${{ matrix.api-level }} force-avd-creation: false @@ -152,7 +170,7 @@ jobs: - name: gplay env: SHOT_TEST: "true" - uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 with: api-level: ${{ matrix.api-level }} force-avd-creation: false From 0d592357d903c82394955667edd818b4a0c8953a Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 1 Nov 2024 11:02:01 +0100 Subject: [PATCH 50/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 183 +++++++++++++++++++------------------ 1 file changed, 92 insertions(+), 91 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index f8dcc3503a..bc176a84c9 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -27,10 +27,10 @@ jobs: strategy: fail-fast: false matrix: - server: [ master, stable29 ] - api-level: [ 18, 27 ] + server: [ master ] # [ master, stable29 ] + api-level: [ 18 ] # [ 18, 27 ] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: wait and ping server run: | @@ -51,7 +51,8 @@ jobs: sudo apt-get update && sudo apt-get install unzip openjdk-21-jdk-headless cpu-checker qemu-kvm --yes sudo chmod 666 /dev/kvm - - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + - name: set up JDK 17 + uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 with: distribution: "temurin" java-version: 17 @@ -108,90 +109,90 @@ jobs: path: app/build/reports retention-days: 4 - stable16: - runs-on: ubuntu-latest-kvm - services: - server: - image: nextcloudci/server:server-13 - options: --name server - ports: - - 80:80 - strategy: - fail-fast: false - matrix: - api-level: [ 27 ] - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: wait and ping server - run: | - while ! curl http://localhost/status.php 2>&1 | grep installed; do - echo "wait…" - sleep 5 - done - - - name: configure server - run: | - docker cp .github/workflows/configServer16.sh server:/tmp/ - docker exec server chmod +x /tmp/configServer16.sh - docker exec server /tmp/configServer16.sh - docker cp .github/workflows/configNC_stable16.sh server:/tmp/ - docker exec server chmod +x /tmp/configNC_stable16.sh - docker exec --user www-data server /tmp/configNC_stable16.sh - - - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 - with: - distribution: "temurin" - java-version: 17 - - - name: create AVD and generate snapshot for caching - uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 - with: - api-level: ${{ matrix.api-level }} - force-avd-creation: false - arch: x86 - sdcard-path-or-size: 100M - target: google_apis - emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 - script: echo "Generated AVD snapshot for caching." - - - name: Configure gradle daemon - run: | - mkdir -p $HOME/.gradle - echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties - echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties - - - name: Build gplay # TODO build only once! - run: | - sed -i s#https://server#http://10.0.2.2# gradle.properties - sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt - ./gradlew assembleDebug - - - name: gplay - env: - SHOT_TEST: "true" - uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 - with: - api-level: ${{ matrix.api-level }} - force-avd-creation: false - arch: x86 - sdcard-path-or-size: 100M - target: google_apis - emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 - script: scripts/runTests.sh - - - name: upload failing results - if: ${{ failure() }} - env: - LOG_USERNAME: ${{ secrets.LOG_USERNAME }} - LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }} - GIT_USERNAME: ${{ secrets.GIT_USERNAME }} - GIT_TOKEN: ${{ secrets.GIT_TOKEN }} - run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "master" "IT" ${{github.event.number}} "${{ secrets.GIT_USERNAME }}" "${{ secrets.GIT_TOKEN }}" - - name: Archive Espresso results - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: ${{ always() }} - with: - name: Report-${{ matrix.server }}-${{ matrix.api-level }} - path: app/build/reports - retention-days: 4 +# stable16: +# runs-on: ubuntu-latest-kvm +# services: +# server: +# image: nextcloudci/server:server-13 +# options: --name server +# ports: +# - 80:80 +# strategy: +# fail-fast: false +# matrix: +# api-level: [ 27 ] +# steps: +# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 +# +# - name: wait and ping server +# run: | +# while ! curl http://localhost/status.php 2>&1 | grep installed; do +# echo "wait…" +# sleep 5 +# done +# +# - name: configure server +# run: | +# docker cp .github/workflows/configServer16.sh server:/tmp/ +# docker exec server chmod +x /tmp/configServer16.sh +# docker exec server /tmp/configServer16.sh +# docker cp .github/workflows/configNC_stable16.sh server:/tmp/ +# docker exec server chmod +x /tmp/configNC_stable16.sh +# docker exec --user www-data server /tmp/configNC_stable16.sh +# +# - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 +# with: +# distribution: "temurin" +# java-version: 17 +# +# - name: create AVD and generate snapshot for caching +# uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 +# with: +# api-level: ${{ matrix.api-level }} +# force-avd-creation: false +# arch: x86 +# sdcard-path-or-size: 100M +# target: google_apis +# emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 +# script: echo "Generated AVD snapshot for caching." +# +# - name: Configure gradle daemon +# run: | +# mkdir -p $HOME/.gradle +# echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties +# echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties +# +# - name: Build gplay # TODO build only once! +# run: | +# sed -i s#https://server#http://10.0.2.2# gradle.properties +# sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt +# ./gradlew assembleDebug +# +# - name: gplay +# env: +# SHOT_TEST: "true" +# uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 +# with: +# api-level: ${{ matrix.api-level }} +# force-avd-creation: false +# arch: x86 +# sdcard-path-or-size: 100M +# target: google_apis +# emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 +# script: scripts/runTests.sh +# +# - name: upload failing results +# if: ${{ failure() }} +# env: +# LOG_USERNAME: ${{ secrets.LOG_USERNAME }} +# LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }} +# GIT_USERNAME: ${{ secrets.GIT_USERNAME }} +# GIT_TOKEN: ${{ secrets.GIT_TOKEN }} +# run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "master" "IT" ${{github.event.number}} "${{ secrets.GIT_USERNAME }}" "${{ secrets.GIT_TOKEN }}" +# - name: Archive Espresso results +# uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 +# if: ${{ always() }} +# with: +# name: Report-${{ matrix.server }}-${{ matrix.api-level }} +# path: app/build/reports +# retention-days: 4 From 86f51818f009a0440a15c64ca696cdfae059ef60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 1 Nov 2024 11:55:45 +0100 Subject: [PATCH 51/74] env sdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index bc176a84c9..c255783b30 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -50,6 +50,7 @@ jobs: docker exec server /usr/local/bin/run.sh sudo apt-get update && sudo apt-get install unzip openjdk-21-jdk-headless cpu-checker qemu-kvm --yes sudo chmod 666 /dev/kvm + export PATH="/usr/local/lib/android/sdk/cmdline-tools/latest/bin:$PATH" - name: set up JDK 17 uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 From 12a7262e56ca14d50034103d1b481824a2ecc429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 1 Nov 2024 12:03:48 +0100 Subject: [PATCH 52/74] no avd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index c255783b30..f0684800f3 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -58,17 +58,6 @@ jobs: distribution: "temurin" java-version: 17 - - name: create AVD and generate snapshot for caching - uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 - with: - api-level: ${{ matrix.api-level }} - force-avd-creation: false - arch: x86 - sdcard-path-or-size: 100M - target: google_apis - emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 - script: echo "Generated AVD snapshot for caching." - - name: Configure gradle daemon run: | mkdir -p $HOME/.gradle From 2e4226a36cd46a746693ab335c2c597d4910586b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 1 Nov 2024 12:16:25 +0100 Subject: [PATCH 53/74] debug run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 54 +++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index f0684800f3..f7d3584981 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -18,12 +18,12 @@ concurrency: jobs: test: runs-on: ubuntu-latest-kvm - services: - server: - image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest - options: --name server - ports: - - 80:80 +# services: +# server: +# image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest +# options: --name server +# ports: +# - 80:80 strategy: fail-fast: false matrix: @@ -32,25 +32,26 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: wait and ping server - run: | - while ! curl http://localhost/status.php 2>&1 | grep installed; do - echo "wait…" - sleep 5 - done - +# - name: wait and ping server +# run: | +# while ! curl http://localhost/status.php 2>&1 | grep installed; do +# echo "wait…" +# sleep 5 +# done +# - name: configure server run: | - docker cp .github/workflows/configServer.sh server:/tmp/ - docker exec server chmod +x /tmp/configServer.sh - docker exec server /tmp/configServer.sh ${{ matrix.server }} - docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ - docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh - docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh - docker exec server /usr/local/bin/run.sh sudo apt-get update && sudo apt-get install unzip openjdk-21-jdk-headless cpu-checker qemu-kvm --yes sudo chmod 666 /dev/kvm export PATH="/usr/local/lib/android/sdk/cmdline-tools/latest/bin:$PATH" +# docker cp .github/workflows/configServer.sh server:/tmp/ +# docker exec server chmod +x /tmp/configServer.sh +# docker exec server /tmp/configServer.sh ${{ matrix.server }} +# docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ +# docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh +# docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh +# docker exec server /usr/local/bin/run.sh + - name: set up JDK 17 uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 @@ -58,6 +59,17 @@ jobs: distribution: "temurin" java-version: 17 +# - name: create AVD and generate snapshot for caching +# uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 +# with: +# api-level: ${{ matrix.api-level }} +# force-avd-creation: false +# arch: x86 +# sdcard-path-or-size: 100M +# target: google_apis +# emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 +# script: echo "Generated AVD snapshot for caching." + - name: Configure gradle daemon run: | mkdir -p $HOME/.gradle @@ -68,7 +80,7 @@ jobs: run: | sed -i s#https://server#http://10.0.2.2# gradle.properties sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt - ./gradlew assembleDebug + ./gradlew assembleDebug --debug - name: gplay env: From 67ffe14690f278d9e2661c85dd0b2a93ecb552c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 1 Nov 2024 12:25:15 +0100 Subject: [PATCH 54/74] gradle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index f7d3584981..a6ed8d772d 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -41,9 +41,9 @@ jobs: # - name: configure server run: | - sudo apt-get update && sudo apt-get install unzip openjdk-21-jdk-headless cpu-checker qemu-kvm --yes + sudo apt-get update && sudo apt-get install unzip cpu-checker qemu-kvm --yes sudo chmod 666 /dev/kvm - export PATH="/usr/local/lib/android/sdk/cmdline-tools/latest/bin:$PATH" +# export PATH="/usr/local/lib/android/sdk/cmdline-tools/latest/bin:$PATH" # docker cp .github/workflows/configServer.sh server:/tmp/ # docker exec server chmod +x /tmp/configServer.sh # docker exec server /tmp/configServer.sh ${{ matrix.server }} @@ -80,7 +80,7 @@ jobs: run: | sed -i s#https://server#http://10.0.2.2# gradle.properties sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt - ./gradlew assembleDebug --debug + ./gradlew assembleDebug --info - name: gplay env: From a04a46f7b3441bd4dd95eadbf5874ecf5d1dce66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 1 Nov 2024 12:28:39 +0100 Subject: [PATCH 55/74] jdk and path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index a6ed8d772d..adf38097e5 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -43,6 +43,7 @@ jobs: run: | sudo apt-get update && sudo apt-get install unzip cpu-checker qemu-kvm --yes sudo chmod 666 /dev/kvm + echo $PATH # export PATH="/usr/local/lib/android/sdk/cmdline-tools/latest/bin:$PATH" # docker cp .github/workflows/configServer.sh server:/tmp/ # docker exec server chmod +x /tmp/configServer.sh @@ -53,11 +54,11 @@ jobs: # docker exec server /usr/local/bin/run.sh - - name: set up JDK 17 - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 - with: - distribution: "temurin" - java-version: 17 +# - name: set up JDK 17 +# uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 +# with: +# distribution: "temurin" +# java-version: 17 # - name: create AVD and generate snapshot for caching # uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 From d8a336b47488accce7629f0ee8fe44d29a817a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 1 Nov 2024 12:32:53 +0100 Subject: [PATCH 56/74] env MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index adf38097e5..1713e2819c 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -44,6 +44,12 @@ jobs: sudo apt-get update && sudo apt-get install unzip cpu-checker qemu-kvm --yes sudo chmod 666 /dev/kvm echo $PATH + export ANDROID_NDK=/usr/local/lib/android/sdk/ndk/27.2.12479018 + export ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/27.2.12479018 + export ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/27.2.12479018 + export ANDROID_HOME=/usr/local/lib/android/sdk + export ANDROID_SDK_ROOT=/usr/local/lib/android/sdk + export ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/27.2.12479018 # export PATH="/usr/local/lib/android/sdk/cmdline-tools/latest/bin:$PATH" # docker cp .github/workflows/configServer.sh server:/tmp/ # docker exec server chmod +x /tmp/configServer.sh From 84e5d9f0941f3d215038a760cc929e98a386bfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 1 Nov 2024 12:35:31 +0100 Subject: [PATCH 57/74] env MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 1713e2819c..6f108b0caf 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -44,6 +44,8 @@ jobs: sudo apt-get update && sudo apt-get install unzip cpu-checker qemu-kvm --yes sudo chmod 666 /dev/kvm echo $PATH + echo $ANDROID_HOME + echo $ANDROID_SDK_ROOT export ANDROID_NDK=/usr/local/lib/android/sdk/ndk/27.2.12479018 export ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/27.2.12479018 export ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/27.2.12479018 From ad5b39aaf643a19254a3535e4e5274e37069019d Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 1 Nov 2024 13:56:45 +0100 Subject: [PATCH 58/74] wip Signed-off-by: tobiasKaminsky --- .../android/lib/resources/files/SearchRemoteOperationIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java index 4cda68d0ac..36bb126d4e 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java @@ -97,7 +97,7 @@ public void testFileSearchEverything() throws IOException { // on newer server we have Talk folder int offset = 0; if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || - capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_16.getMajorVersionNumber()) { + capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_17.getMajorVersionNumber()) { offset = 1; } @@ -227,7 +227,7 @@ public void testRecentlyModifiedSearch() throws IOException { // on newer server we have Talk folder int offset = 0; if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || - capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_16.getMajorVersionNumber()) { + capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_17.getMajorVersionNumber()) { offset = 1; } From 18a5563ad8f822b3a33818f11d712661315e832a Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 1 Nov 2024 14:04:42 +0100 Subject: [PATCH 59/74] wip Signed-off-by: tobiasKaminsky --- .../android/lib/resources/files/SearchRemoteOperationIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java index 36bb126d4e..15e4b30e4b 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java @@ -452,7 +452,7 @@ public void showOnlyFolders() throws IOException { // on NC16 groupfolder is also returned int offset = 0; if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || - capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_16.getMajorVersionNumber()) { + capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_17.getMajorVersionNumber()) { offset = 1; } From 5a8f675a9639665a626d49bfcaf682dd43e90b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Fri, 1 Nov 2024 16:59:38 +0100 Subject: [PATCH 60/74] add services again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .github/workflows/garm.yml | 81 ++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 46 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 6f108b0caf..80113c16be 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -18,12 +18,12 @@ concurrency: jobs: test: runs-on: ubuntu-latest-kvm -# services: -# server: -# image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest -# options: --name server -# ports: -# - 80:80 + services: + server: + image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest + options: --name server + ports: + - 80:80 strategy: fail-fast: false matrix: @@ -32,52 +32,41 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 -# - name: wait and ping server -# run: | -# while ! curl http://localhost/status.php 2>&1 | grep installed; do -# echo "wait…" -# sleep 5 -# done -# + - name: wait and ping server + run: | + while ! curl http://localhost/status.php 2>&1 | grep installed; do + echo "wait…" + sleep 5 + done + - name: configure server run: | sudo apt-get update && sudo apt-get install unzip cpu-checker qemu-kvm --yes sudo chmod 666 /dev/kvm - echo $PATH - echo $ANDROID_HOME - echo $ANDROID_SDK_ROOT - export ANDROID_NDK=/usr/local/lib/android/sdk/ndk/27.2.12479018 - export ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/27.2.12479018 - export ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/27.2.12479018 - export ANDROID_HOME=/usr/local/lib/android/sdk - export ANDROID_SDK_ROOT=/usr/local/lib/android/sdk - export ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/27.2.12479018 -# export PATH="/usr/local/lib/android/sdk/cmdline-tools/latest/bin:$PATH" -# docker cp .github/workflows/configServer.sh server:/tmp/ -# docker exec server chmod +x /tmp/configServer.sh -# docker exec server /tmp/configServer.sh ${{ matrix.server }} -# docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ -# docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh -# docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh -# docker exec server /usr/local/bin/run.sh - + docker cp .github/workflows/configServer.sh server:/tmp/ + docker exec server chmod +x /tmp/configServer.sh + docker exec server /tmp/configServer.sh ${{ matrix.server }} + docker cp .github/workflows/configNC_${{ matrix.server }}.sh server:/tmp/ + docker exec server chmod +x /tmp/configNC_${{ matrix.server }}.sh + docker exec --user www-data server /tmp/configNC_${{ matrix.server }}.sh + docker exec server /usr/local/bin/run.sh -# - name: set up JDK 17 -# uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 -# with: -# distribution: "temurin" -# java-version: 17 + - name: set up JDK 17 + uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 + with: + distribution: "temurin" + java-version: 17 -# - name: create AVD and generate snapshot for caching -# uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 -# with: -# api-level: ${{ matrix.api-level }} -# force-avd-creation: false -# arch: x86 -# sdcard-path-or-size: 100M -# target: google_apis -# emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 -# script: echo "Generated AVD snapshot for caching." + - name: create AVD and generate snapshot for caching + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + arch: x86 + sdcard-path-or-size: 100M + target: google_apis + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833 + script: echo "Generated AVD snapshot for caching." - name: Configure gradle daemon run: | From 25a6048eb98924c673fb5e058d2b11aa86c61c34 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 6 Nov 2024 11:04:05 +0100 Subject: [PATCH 61/74] use API 27 Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 80113c16be..8210949943 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -28,7 +28,7 @@ jobs: fail-fast: false matrix: server: [ master ] # [ master, stable29 ] - api-level: [ 18 ] # [ 18, 27 ] + api-level: [ 27 ] # [ 18, 27 ] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From 81e35f592c117c9a97032cd6e2ac81352e0f0b53 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 6 Nov 2024 11:45:18 +0100 Subject: [PATCH 62/74] change order Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 8210949943..6012b449ef 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -32,13 +32,6 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: wait and ping server - run: | - while ! curl http://localhost/status.php 2>&1 | grep installed; do - echo "wait…" - sleep 5 - done - - name: configure server run: | sudo apt-get update && sudo apt-get install unzip cpu-checker qemu-kvm --yes @@ -80,6 +73,13 @@ jobs: sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt ./gradlew assembleDebug --info + - name: wait and ping server + run: | + while ! curl http://localhost/status.php 2>&1 | grep installed; do + echo "wait…" + sleep 5 + done + - name: gplay env: SHOT_TEST: "true" From bd448804205287122a168ca6679c78b920ac7bdf Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 6 Nov 2024 14:02:11 +0100 Subject: [PATCH 63/74] test on stable30 Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 6012b449ef..aa1636a0dc 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - server: [ master ] # [ master, stable29 ] + server: [ stable30 ] # [ master, stable29 ] api-level: [ 27 ] # [ 18, 27 ] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From a2645c508594973e92fd49d6259aed1a11a723dd Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 6 Nov 2024 14:12:14 +0100 Subject: [PATCH 64/74] test on stable30 Signed-off-by: tobiasKaminsky --- .../workflows/{configNC_stable29.sh => configNC_stable30.sh} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{configNC_stable29.sh => configNC_stable30.sh} (99%) diff --git a/.github/workflows/configNC_stable29.sh b/.github/workflows/configNC_stable30.sh similarity index 99% rename from .github/workflows/configNC_stable29.sh rename to .github/workflows/configNC_stable30.sh index fdfecab097..786768e9ec 100644 --- a/.github/workflows/configNC_stable29.sh +++ b/.github/workflows/configNC_stable30.sh @@ -6,7 +6,7 @@ # SPDX-License-Identifier: MIT # -SERVER_VERSION="stable29" +SERVER_VERSION="stable30" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash source ~/.bashrc; nvm install node From d62c0234af280b8d849fbc6335716721d521d536 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 08:34:04 +0100 Subject: [PATCH 65/74] use master server Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index aa1636a0dc..e6fede6f09 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -27,8 +27,8 @@ jobs: strategy: fail-fast: false matrix: - server: [ stable30 ] # [ master, stable29 ] - api-level: [ 27 ] # [ 18, 27 ] + server: [ master ] # [ stable20, stable32, master ] + api-level: [ 36 ] # [ 21, 36 ] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From 9b010cd96f65de892060b02a6776ce8dbbebfb13 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 08:40:34 +0100 Subject: [PATCH 66/74] baklava Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index e6fede6f09..e8a12bc1bb 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -28,7 +28,7 @@ jobs: fail-fast: false matrix: server: [ master ] # [ stable20, stable32, master ] - api-level: [ 36 ] # [ 21, 36 ] + api-level: [ Baklava ] # [ 21, 36 ] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From ef666217749e2a577a8d227e954bcc8a06c981f3 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 08:44:39 +0100 Subject: [PATCH 67/74] api 35 Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index e8a12bc1bb..375e905297 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -28,7 +28,7 @@ jobs: fail-fast: false matrix: server: [ master ] # [ stable20, stable32, master ] - api-level: [ Baklava ] # [ 21, 36 ] + api-level: [ 35 ] # [ 21, 36 ] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From bb7c6afafb42215e375abfa64d6cdfe0dfabfe8e Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 08:51:47 +0100 Subject: [PATCH 68/74] latest emulator Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 375e905297..d82c62225a 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -51,7 +51,7 @@ jobs: java-version: 17 - name: create AVD and generate snapshot for caching - uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 + uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # v2.35.0 with: api-level: ${{ matrix.api-level }} force-avd-creation: false From 1a38e59f3260c25cff3983e13d4dbc714c4471bb Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 08:57:37 +0100 Subject: [PATCH 69/74] 30 Signed-off-by: tobiasKaminsky --- .drone.yml => .drone_old.yml | 0 .github/workflows/garm.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .drone.yml => .drone_old.yml (100%) diff --git a/.drone.yml b/.drone_old.yml similarity index 100% rename from .drone.yml rename to .drone_old.yml diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index d82c62225a..781cbd9274 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -28,7 +28,7 @@ jobs: fail-fast: false matrix: server: [ master ] # [ stable20, stable32, master ] - api-level: [ 35 ] # [ 21, 36 ] + api-level: [ 30 ] # [ 21, 36 ] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From cbdb8bcbb6669ffb4a865b1f7881698c9e4b27cc Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 09:37:09 +0100 Subject: [PATCH 70/74] wip Signed-off-by: tobiasKaminsky --- ...ectEditingCreateFileRemoteOperationIT.java | 5 ---- ...btainListOfTemplatesRemoteOperationIT.java | 4 --- .../DirectEditingObtainRemoteOperationIT.kt | 7 ----- ...irectEditingOpenFileRemoteOperationIT.java | 5 ---- .../search/UnifiedSearchRemoteOperationIT.kt | 10 ------- ...rkspaceDirectEditingRemoteOperationIT.java | 4 --- .../java/com/owncloud/android/FileIT.java | 8 ----- .../GetCapabilitiesRemoteOperationIT.java | 8 ++--- .../e2ee/UpdateMetadataRemoteOperationIT.java | 4 +-- .../files/SearchRemoteOperationIT.java | 21 +++---------- .../files/UploadFileRemoteOperationIT.kt | 30 ++++++++----------- .../resources/notifications/NotificationIT.kt | 2 -- .../shares/GetSharesRemoteOperationIT.java | 2 -- .../users/AppTokenRemoteOperationIT.kt | 2 -- 14 files changed, 21 insertions(+), 91 deletions(-) diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java index 81d8858440..24eb575eff 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingCreateFileRemoteOperationIT.java @@ -18,11 +18,6 @@ import static org.junit.Assert.assertTrue; public class DirectEditingCreateFileRemoteOperationIT extends AbstractIT { - @BeforeClass - public static void beforeClass() { - testOnlyOnServer(OwnCloudVersion.nextcloud_18); - } - @Test public void createEmptyFile() { RemoteOperationResult result = new DirectEditingCreateFileRemoteOperation("/test.md", diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java index 2ca3334a54..7b5cba922d 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainListOfTemplatesRemoteOperationIT.java @@ -21,10 +21,6 @@ import static org.junit.Assert.assertTrue; public class DirectEditingObtainListOfTemplatesRemoteOperationIT extends AbstractIT { - @BeforeClass - public static void beforeClass() { - testOnlyOnServer(OwnCloudVersion.nextcloud_18); - } @Test public void testGetAll() { diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainRemoteOperationIT.kt b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainRemoteOperationIT.kt index 377384f350..4fccbcda29 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingObtainRemoteOperationIT.kt @@ -8,20 +8,13 @@ package com.nextcloud.android.lib.resources.directediting import com.owncloud.android.AbstractIT -import com.owncloud.android.lib.resources.status.OwnCloudVersion import junit.framework.Assert.assertEquals import junit.framework.Assert.assertFalse import junit.framework.Assert.assertNotNull import junit.framework.Assert.assertTrue -import org.junit.Before import org.junit.Test class DirectEditingObtainRemoteOperationIT : AbstractIT() { - @Before - fun before() { - testOnlyOnServer(OwnCloudVersion.nextcloud_18) - } - @Test fun testGetAll() { val result = DirectEditingObtainRemoteOperation().run(nextcloudClient) diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java index aa12df6052..d98f9d04ed 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/directediting/DirectEditingOpenFileRemoteOperationIT.java @@ -24,11 +24,6 @@ import static org.junit.Assert.assertTrue; public class DirectEditingOpenFileRemoteOperationIT extends AbstractIT { - @BeforeClass - public static void beforeClass() { - testOnlyOnServer(OwnCloudVersion.nextcloud_18); - } - @Test public void openFile() throws IOException { // create file diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt b/library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt index fc76f9c63c..4691e6ed20 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt @@ -11,12 +11,10 @@ import com.owncloud.android.AbstractIT import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation import com.owncloud.android.lib.resources.files.model.RemoteFile -import com.owncloud.android.lib.resources.status.OwnCloudVersion import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue -import org.junit.BeforeClass import org.junit.Test class UnifiedSearchRemoteOperationIT : AbstractIT() { @@ -79,12 +77,4 @@ class UnifiedSearchRemoteOperationIT : AbstractIT() { assertTrue(data.entries.isNotEmpty()) assertNotNull(data.entries.find { it.title == "test Folder" }) } - - companion object { - @BeforeClass - @JvmStatic - fun before() { - testOnlyOnServer(OwnCloudVersion.nextcloud_20) - } - } } diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/richWorkspace/RichWorkspaceDirectEditingRemoteOperationIT.java b/library/src/androidTest/java/com/nextcloud/android/lib/richWorkspace/RichWorkspaceDirectEditingRemoteOperationIT.java index eef06c8b5b..dd513dc939 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/richWorkspace/RichWorkspaceDirectEditingRemoteOperationIT.java +++ b/library/src/androidTest/java/com/nextcloud/android/lib/richWorkspace/RichWorkspaceDirectEditingRemoteOperationIT.java @@ -25,10 +25,6 @@ import java.io.IOException; public class RichWorkspaceDirectEditingRemoteOperationIT extends AbstractIT { - @BeforeClass - public static void beforeClass() { - testOnlyOnServer(OwnCloudVersion.nextcloud_18); - } @Test public void getEditLinkForRoot() { diff --git a/library/src/androidTest/java/com/owncloud/android/FileIT.java b/library/src/androidTest/java/com/owncloud/android/FileIT.java index 281459fd95..93f50e2706 100644 --- a/library/src/androidTest/java/com/owncloud/android/FileIT.java +++ b/library/src/androidTest/java/com/owncloud/android/FileIT.java @@ -147,8 +147,6 @@ public void testShareViaLinkSharees() { @Test public void testShareToGroupSharees() { - testOnlyOnServer(OwnCloudVersion.nextcloud_17); - // create & verify folder String path = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); @@ -190,8 +188,6 @@ public void testShareToGroupSharees() { @Test public void testOneSharees() { - testOnlyOnServer(OwnCloudVersion.nextcloud_17); - // create & verify folder String path = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); @@ -227,8 +223,6 @@ public void testOneSharees() { @Test public void testTwoShareesOnParent() { - testOnlyOnServer(OwnCloudVersion.nextcloud_17); - // create & verify folder String path = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); @@ -277,8 +271,6 @@ public void testTwoShareesOnParent() { @Test public void testTwoSharees() { - testOnlyOnServer(OwnCloudVersion.nextcloud_17); - // create & verify folder String path = "/testFolder/"; assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess()); diff --git a/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java index f2bc0744a4..1c58ed18a8 100644 --- a/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java @@ -101,12 +101,10 @@ private void checkCapability(OCCapability capability, String userId) { assertTrue(capability.getFilesVersioning().isTrue()); assertTrue(capability.getFilesUndelete().isTrue()); assertNotNull(capability.getVersion()); - assertSame(CapabilityBooleanType.UNKNOWN, capability.getDropAccount()); - if (capability.getVersion().isNewerOrEqual(OwnCloudVersion.nextcloud_17)) { - assertFalse(capability.getEtag().isEmpty()); - assertFalse(capability.getDirectEditingEtag().isEmpty()); - } + assertFalse(capability.getEtag().isEmpty()); assertSame(CapabilityBooleanType.FALSE, capability.getRichDocuments()); + assertFalse(capability.getDirectEditingEtag().isEmpty()); + assertSame(CapabilityBooleanType.UNKNOWN, capability.getDropAccount()); // user status if (capability.getVersion().isNewerOrEqual(OwnCloudVersion.nextcloud_20)) { diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/e2ee/UpdateMetadataRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/e2ee/UpdateMetadataRemoteOperationIT.java index 255bffb8bf..9e63e83743 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/e2ee/UpdateMetadataRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/e2ee/UpdateMetadataRemoteOperationIT.java @@ -25,8 +25,8 @@ public class UpdateMetadataRemoteOperationIT extends AbstractIT { //@Test public void uploadAndModifyV1() { - // tests only for NC19+ - testOnlyOnServer(OwnCloudVersion.nextcloud_19); + // tests only for NC20+ + testOnlyOnServer(OwnCloudVersion.nextcloud_20); // E2E server app checks for official NC client with >=3.13.0, // and blocks all other clients, e.g. 3rd party apps using this lib diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java index 15e4b30e4b..37f0e841f3 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java @@ -26,7 +26,6 @@ import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation; import com.owncloud.android.lib.resources.status.NextcloudVersion; import com.owncloud.android.lib.resources.status.OCCapability; -import com.owncloud.android.lib.resources.status.OwnCloudVersion; import org.junit.BeforeClass; import org.junit.Test; @@ -96,8 +95,7 @@ public void testFileSearchEmpty() throws IOException { public void testFileSearchEverything() throws IOException { // on newer server we have Talk folder int offset = 0; - if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || - capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_17.getMajorVersionNumber()) { + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { offset = 1; } @@ -209,14 +207,7 @@ public void favoriteFiles() throws IOException { assertEquals(2, result.getResultData().size()); assertEquals(remotePath, result.getResultData().get(0).getRemotePath()); - - if (capability.getVersion().isNewerOrEqual(OwnCloudVersion.nextcloud_17)) { - assertEquals(sharedRemotePath, result.getResultData().get(1).getRemotePath()); - } else { - // on NC16 we have a bug that each file ends with "/" - sharedRemotePath += "/"; - assertEquals(sharedRemotePath, result.getResultData().get(1).getRemotePath()); - } + assertEquals(sharedRemotePath, result.getResultData().get(1).getRemotePath()); } /** @@ -226,8 +217,7 @@ public void favoriteFiles() throws IOException { public void testRecentlyModifiedSearch() throws IOException { // on newer server we have Talk folder int offset = 0; - if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || - capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_17.getMajorVersionNumber()) { + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { offset = 1; } @@ -420,8 +410,6 @@ public void testPhotoSearchLimitAndTimestamp() throws IOException { @Test public void testGallerySearch() throws IOException { - testOnlyOnServer(OwnCloudVersion.nextcloud_18); - for (int i = 0; i < 10; i++) { String filePath = createFile("image" + i); String remotePath = "/image" + i + ".jpg"; @@ -451,8 +439,7 @@ public void showOnlyFolders() throws IOException { // on newer server we have Talk folder // on NC16 groupfolder is also returned int offset = 0; - if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20) || - capability.getVersion().getMajorVersionNumber() == NextcloudVersion.nextcloud_17.getMajorVersionNumber()) { + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_20)) { offset = 1; } diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt index 7daaa2f90d..5b9ca6d454 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/files/UploadFileRemoteOperationIT.kt @@ -13,7 +13,6 @@ import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.lib.resources.files.model.RemoteFile import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation import com.owncloud.android.lib.resources.status.OCCapability -import com.owncloud.android.lib.resources.status.OwnCloudVersion import junit.framework.TestCase.assertEquals import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue @@ -37,7 +36,8 @@ class UploadFileRemoteOperationIT : AbstractIT() { fun upload() { val ocCapability = GetCapabilitiesRemoteOperation() - .execute(nextcloudClient).singleData as OCCapability + .execute(nextcloudClient) + .singleData as OCCapability // create file val filePath = createFile("text") @@ -66,15 +66,12 @@ class UploadFileRemoteOperationIT : AbstractIT() { var remoteFile = result.data[0] as RemoteFile assertEquals(remotePath, remoteFile.remotePath) + assertEquals(creationTimestamp, remoteFile.creationTimestamp) assertEquals(uploadResult.resultData, remoteFile.etag) - - if (ocCapability.version.isNewerOrEqual(OwnCloudVersion.nextcloud_18)) { - assertEquals(creationTimestamp, remoteFile.creationTimestamp) - assertTrue( - uploadTimestamp - TIME_OFFSET < remoteFile.uploadTimestamp || - uploadTimestamp + TIME_OFFSET > remoteFile.uploadTimestamp - ) - } + assertTrue( + uploadTimestamp - TIME_OFFSET < remoteFile.uploadTimestamp || + uploadTimestamp + TIME_OFFSET > remoteFile.uploadTimestamp + ) // ReadFolderRemoteOperation result = ReadFolderRemoteOperation(remotePath).execute(client) @@ -83,14 +80,11 @@ class UploadFileRemoteOperationIT : AbstractIT() { remoteFile = result.data[0] as RemoteFile assertEquals(remotePath, remoteFile.remotePath) - - if (ocCapability.version.isNewerOrEqual(OwnCloudVersion.nextcloud_18)) { - assertEquals(creationTimestamp, remoteFile.creationTimestamp) - assertTrue( - uploadTimestamp - TIME_OFFSET < remoteFile.uploadTimestamp || - uploadTimestamp + TIME_OFFSET > remoteFile.uploadTimestamp - ) - } + assertEquals(creationTimestamp, remoteFile.creationTimestamp) + assertTrue( + uploadTimestamp - TIME_OFFSET < remoteFile.uploadTimestamp || + uploadTimestamp + TIME_OFFSET > remoteFile.uploadTimestamp + ) } private fun getCreationTimestamp(file: File): Long? { diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/notifications/NotificationIT.kt b/library/src/androidTest/java/com/owncloud/android/lib/resources/notifications/NotificationIT.kt index ecef8e3009..4075dd61db 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/notifications/NotificationIT.kt +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/notifications/NotificationIT.kt @@ -23,8 +23,6 @@ class NotificationIT : AbstractIT() { val count = all.resultData.size // get one - testOnlyOnServer(OwnCloudVersion.nextcloud_17) - val firstNotification = all.resultData[0] val first = GetNotificationRemoteOperation(firstNotification.notificationId).execute(nextcloudClient) assertTrue(first.isSuccess) diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/shares/GetSharesRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/lib/resources/shares/GetSharesRemoteOperationIT.java index cc411bd975..511faf1a31 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/shares/GetSharesRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/shares/GetSharesRemoteOperationIT.java @@ -155,8 +155,6 @@ private void assertFolderAttributes(final OCShare share, final String expectedDi @Test public void sharedWithMe() { - testOnlyOnServer(OwnCloudVersion.nextcloud_19); - GetSharesRemoteOperation sut = new GetSharesRemoteOperation(); GetSharesRemoteOperation sutSharedWithMe = new GetSharesRemoteOperation(true); diff --git a/library/src/androidTest/java/com/owncloud/android/lib/resources/users/AppTokenRemoteOperationIT.kt b/library/src/androidTest/java/com/owncloud/android/lib/resources/users/AppTokenRemoteOperationIT.kt index 3642fbf059..852ed94b66 100644 --- a/library/src/androidTest/java/com/owncloud/android/lib/resources/users/AppTokenRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/owncloud/android/lib/resources/users/AppTokenRemoteOperationIT.kt @@ -58,8 +58,6 @@ class AppTokenRemoteOperationIT : AbstractIT() { @Test fun deleteAppPassword() { - testOnlyOnServer(OwnCloudVersion.nextcloud_17) - val arguments = InstrumentationRegistry.getArguments() val username: String = arguments.getString("TEST_SERVER_USERNAME", "") val password: String = arguments.getString("TEST_SERVER_PASSWORD", "") From 43bdbeec29328f9a47375a161657f582c1229736 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 10:26:25 +0100 Subject: [PATCH 71/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 +- .../recommendations/GetRecommendationsRemoteOperationIT.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 781cbd9274..7c53bc444b 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -83,7 +83,7 @@ jobs: - name: gplay env: SHOT_TEST: "true" - uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 + uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # v2.35.0 with: api-level: ${{ matrix.api-level }} force-avd-creation: false diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/recommendations/GetRecommendationsRemoteOperationIT.kt b/library/src/androidTest/java/com/nextcloud/android/lib/resources/recommendations/GetRecommendationsRemoteOperationIT.kt index ac2d4d343e..1e05ffbb9d 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/recommendations/GetRecommendationsRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/recommendations/GetRecommendationsRemoteOperationIT.kt @@ -19,8 +19,12 @@ class GetRecommendationsRemoteOperationIT : AbstractIT() { testOnlyOnServer(NextcloudVersion.nextcloud_31) assertTrue(CreateFolderRemoteOperation("/test/", true).execute(client).isSuccess) - val result = GetRecommendationsRemoteOperation().execute(nextcloudClient).resultData + val sut = GetRecommendationsRemoteOperation().execute(nextcloudClient) + + assertTrue(sut.exception.message, sut.isSuccess) + val result = sut.resultData + assertTrue(result.enabled) assertTrue(result.recommendations.isNotEmpty()) } From 5082b9c62c0b851e14352a64cbc9f36eed45a78c Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 10:55:30 +0100 Subject: [PATCH 72/74] wip Signed-off-by: tobiasKaminsky --- .github/workflows/configNC_master.sh | 8 ++++++++ .../GetRecommendationsRemoteOperationIT.kt | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/configNC_master.sh b/.github/workflows/configNC_master.sh index 8f9530d0cb..e49050de29 100644 --- a/.github/workflows/configNC_master.sh +++ b/.github/workflows/configNC_master.sh @@ -65,3 +65,11 @@ cd /var/www/html/apps/assistant; source ~/.bashrc; make php /var/www/html/occ app:enable -f assistant php /var/www/html/occ app:enable -f testing + +git clone --depth 1 https://github.com/nextcloud/files_downloadlimit.git /var/www/html/apps/files_downloadlimit/ +php /var/www/html/occ app:enable -f files_downloadlimit + +git clone --depth 1 -b master https://github.com/nextcloud/recommendations.git /var/www/html/apps/recommendations/ +php /var/www/html/occ app:enable -f recommendations + +php /var/www/html/occ config:system:set ratelimit.protection.enabled --value false --type bool diff --git a/library/src/androidTest/java/com/nextcloud/android/lib/resources/recommendations/GetRecommendationsRemoteOperationIT.kt b/library/src/androidTest/java/com/nextcloud/android/lib/resources/recommendations/GetRecommendationsRemoteOperationIT.kt index 1e05ffbb9d..ac2d4d343e 100644 --- a/library/src/androidTest/java/com/nextcloud/android/lib/resources/recommendations/GetRecommendationsRemoteOperationIT.kt +++ b/library/src/androidTest/java/com/nextcloud/android/lib/resources/recommendations/GetRecommendationsRemoteOperationIT.kt @@ -19,12 +19,8 @@ class GetRecommendationsRemoteOperationIT : AbstractIT() { testOnlyOnServer(NextcloudVersion.nextcloud_31) assertTrue(CreateFolderRemoteOperation("/test/", true).execute(client).isSuccess) - val sut = GetRecommendationsRemoteOperation().execute(nextcloudClient) - - assertTrue(sut.exception.message, sut.isSuccess) + val result = GetRecommendationsRemoteOperation().execute(nextcloudClient).resultData - val result = sut.resultData - assertTrue(result.enabled) assertTrue(result.recommendations.isNotEmpty()) } From 8002cc5a1fa948c66b47f86e2fa1c456bdc65f7c Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 13:49:28 +0100 Subject: [PATCH 73/74] test Signed-off-by: tobiasKaminsky --- .github/workflows/garm.yml | 2 -- scripts/runTests.sh | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/garm.yml b/.github/workflows/garm.yml index 7c53bc444b..6bd673b1ab 100644 --- a/.github/workflows/garm.yml +++ b/.github/workflows/garm.yml @@ -81,8 +81,6 @@ jobs: done - name: gplay - env: - SHOT_TEST: "true" uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # v2.35.0 with: api-level: ${{ matrix.api-level }} diff --git a/scripts/runTests.sh b/scripts/runTests.sh index 51d633814e..d2465b2d1d 100755 --- a/scripts/runTests.sh +++ b/scripts/runTests.sh @@ -8,6 +8,7 @@ scripts/wait_for_emulator.sh adb logcat -c adb logcat > logcat.txt & +./gradlew assembleDebug ./gradlew jacocoTestDebugUnitTestReport ./gradlew installDebugAndroidTest ./gradlew createDebugCoverageReport From d21e8482d4c2b79e57614b1f05ab81330eaba8b0 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 5 Feb 2026 14:13:13 +0100 Subject: [PATCH 74/74] delete old tests Signed-off-by: tobiasKaminsky --- .../oldTests/DownloadFileTest.java | 116 ------ .../androidTest/oldTests/GetShareesTest.java | 175 --------- .../androidTest/oldTests/MoveFileTest.java | 354 ------------------ .../oldTests/OwnCloudClientTest.java | 297 --------------- .../androidTest/oldTests/ReadFileTest.java | 64 ---- .../androidTest/oldTests/ReadFolderTest.java | 78 ---- .../androidTest/oldTests/RenameFileTest.java | 245 ------------ .../oldTests/SimpleFactoryManagerTest.java | 82 ---- .../oldTests/SingleSessionManagerTest.java | 80 ---- .../oldTests/UpdatePrivateShareTest.java | 153 -------- .../oldTests/UpdatePublicShareTest.java | 185 --------- .../androidTest/oldTests/UploadFileTest.java | 89 ----- 12 files changed, 1918 deletions(-) delete mode 100644 library/src/androidTest/oldTests/DownloadFileTest.java delete mode 100644 library/src/androidTest/oldTests/GetShareesTest.java delete mode 100644 library/src/androidTest/oldTests/MoveFileTest.java delete mode 100644 library/src/androidTest/oldTests/OwnCloudClientTest.java delete mode 100644 library/src/androidTest/oldTests/ReadFileTest.java delete mode 100644 library/src/androidTest/oldTests/ReadFolderTest.java delete mode 100644 library/src/androidTest/oldTests/RenameFileTest.java delete mode 100644 library/src/androidTest/oldTests/SimpleFactoryManagerTest.java delete mode 100644 library/src/androidTest/oldTests/SingleSessionManagerTest.java delete mode 100644 library/src/androidTest/oldTests/UpdatePrivateShareTest.java delete mode 100644 library/src/androidTest/oldTests/UpdatePublicShareTest.java delete mode 100644 library/src/androidTest/oldTests/UploadFileTest.java diff --git a/library/src/androidTest/oldTests/DownloadFileTest.java b/library/src/androidTest/oldTests/DownloadFileTest.java deleted file mode 100644 index 21d1618a4c..0000000000 --- a/library/src/androidTest/oldTests/DownloadFileTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android.lib.common.operations; - -import com.owncloud.android.AbstractIT; -import com.owncloud.android.lib.resources.files.RemoteFile; - -import org.apache.commons.io.FileUtils; -import org.junit.Test; - -import java.io.File; -import java.io.FileNotFoundException; - -/** - * Class to test Download File Operation - * - * @author masensio - * @author David A. Velasco - */ - -public class DownloadFileTest extends AbstractIT { - 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; - -// @Override -// protected void setUp() throws Exception { -// super.setUp(); -// setActivityInitialTouchMode(false); -// mDownloadedFilePath = null; -// mFullPath2Image = mBaseFolderPath + IMAGE_PATH; -// mFullPath2ImageWitSpecialChars = mBaseFolderPath + IMAGE_PATH_WITH_SPECIAL_CHARS; -// mFullPath2ImageNotFound = mBaseFolderPath + IMAGE_NOT_FOUND; -// -// File imageFile = getFile(TestActivity.ASSETS__IMAGE_FILE_NAME); -// -// RemoteOperationResult result = mActivity.uploadFile(imageFile.getAbsolutePath(), mFullPath2Image, -// "image/png", null); -// -// if (!result.isSuccess()) { -// Utils.logAndThrow(LOG_TAG, result); -// } -// -// result = mActivity.uploadFile(imageFile.getAbsolutePath(), mFullPath2ImageWitSpecialChars, "image/png", null); -// 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 - */ - @Test - public void testDownloadFile() throws FileNotFoundException { - 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() throws FileNotFoundException { - 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() throws FileNotFoundException { - 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()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - } - - File[] files = mActivity.getFilesDir().listFiles(); - for (File file : files) { - if (file.isDirectory()) { - FileUtils.deleteDirectory(file); - } else if (!file.delete()) { - throw new FileNotFoundException(file.getAbsolutePath()); - } - } - super.tearDown(); - } -} diff --git a/library/src/androidTest/oldTests/GetShareesTest.java b/library/src/androidTest/oldTests/GetShareesTest.java deleted file mode 100644 index 6cabbc1fd0..0000000000 --- a/library/src/androidTest/oldTests/GetShareesTest.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import android.util.Log; - -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.testclient.R; - -import junit.framework.AssertionFailedError; - -import org.apache.commons.httpclient.HttpStatus; -import org.json.JSONException; -import org.json.JSONObject; - -/** - * 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(); - - /** - * 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" - RemoteOperationResult result = new GetRemoteShareesOperation("a", 1, 50).execute(mClient); - JSONObject resultItem; - JSONObject value; - int type; - int userCount = 0; - int groupCount = 0; - assertTrue(result.isSuccess() && result.getData().size() > 0); - try { - for (int i = 0; i < result.getData().size(); 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++; - } - } - assertTrue(userCount > 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" - result = new GetRemoteShareesOperation("ad", 1, 50).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 - result = new GetRemoteShareesOperation("bd", 1, 50).execute(mClient); - assertTrue(result.isSuccess() && result.getData().size() == 0); - - - /// failed cases - - // search for sharees including wrong page values - result = new GetRemoteShareesOperation("a", 0, 50).execute(mClient); - assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); - - result = new GetRemoteShareesOperation("a", 1, 0).execute(mClient); - assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_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 "@" - RemoteOperationResult result = new GetRemoteShareesOperation("@", 1, 50).execute(mClient); - JSONObject resultItem; - JSONObject value; - int type; - int fedCount = 0; - assertTrue(result.isSuccess() && result.getData().size() > 0); - try { - for (int i = 0; i < result.getData().size(); i++) { - resultItem = (JSONObject) result.getData().get(i); - value = resultItem.getJSONObject(GetRemoteShareesOperation.NODE_VALUE); - type = value.getInt(GetRemoteShareesOperation.PROPERTY_SHARE_TYPE); - if (type == ShareType.FEDERATED.getValue()) { - fedCount++; - } - } - assertTrue(fedCount > 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 - mServerUri2 = getActivity().getString(R.string.server_base_url_2); - String remoteSharee = "admin@" + mServerUri2.split("//")[1]; - result = new GetRemoteShareesOperation(remoteSharee, 1, 50).execute(mClient); - assertTrue(result.isSuccess() && result.getData().size() > 0); - - - /// failed cases - - // search for sharees including wrong page values - result = new GetRemoteShareesOperation("@", 0, 50).execute(mClient); - assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); - - result = new GetRemoteShareesOperation("@", 1, 0).execute(mClient); - assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); - } - - @Override - protected void tearDown() throws Exception { - Log.v(LOG_TAG, "Deleting remote fixture..."); - super.tearDown(); - Log.v(LOG_TAG, "Remote fixture delete."); - } -} diff --git a/library/src/androidTest/oldTests/MoveFileTest.java b/library/src/androidTest/oldTests/MoveFileTest.java deleted file mode 100644 index 50d4922520..0000000000 --- a/library/src/androidTest/oldTests/MoveFileTest.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import android.util.Log; - -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; -import com.owncloud.android.lib.resources.files.MoveRemoteFileOperation; -import com.owncloud.android.lib.resources.status.OwnCloudVersion; -import com.owncloud.android.lib.testclient.TestActivity; - -import org.apache.commons.httpclient.HttpStatus; - -import java.io.File; - -/** - * Class to test MoveRemoteFileOperation - *

- * 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 MoveFileTest extends AndroidTestCase { -public class MoveFileTest extends RemoteTest { - - private static final String LOG_TAG = MoveFileTest.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_FILE_7 = SRC_BASE_FOLDER + FILE7; - - 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 - }; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - Log.v(LOG_TAG, "Setting up the remote fixture..."); - - RemoteOperationResult result; - for (String folderPath : FOLDERS_IN_FIXTURE) { - result = mActivity.createFolder(mBaseFolderPath + folderPath, true); - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - } - - File txtFile = getFile(TestActivity.ASSETS__TEXT_FILE_NAME); - for (String filePath : FILES_IN_FIXTURE) { - result = mActivity.uploadFile(txtFile.getAbsolutePath(), mBaseFolderPath + filePath, "txt/plain", null); - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - } - - Log.v(LOG_TAG, "Remote fixture created."); - } - - - /** - * Test move folder - */ - public void testMoveRemoteFileOperation() { - Log.v(LOG_TAG, "testMoveFolder in"); - - /// successful cases - - // move file - MoveRemoteFileOperation moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FILE_1, - mBaseFolderPath + TARGET_PATH_TO_FILE_1, - false - ); - RemoteOperationResult result = moveOperation.execute(mClient); - assertTrue("move file", result.isSuccess()); - - // move & rename file, different location - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FILE_2, - mBaseFolderPath + TARGET_PATH_TO_FILE_2_RENAMED, - false - ); - result = moveOperation.execute(mClient); - assertTrue("move & rename file, different location", result.isSuccess()); - - // move & rename file, same location (rename file) - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FILE_3, - mBaseFolderPath + SRC_PATH_TO_FILE_3_RENAMED, - false - ); - result = moveOperation.execute(mClient); - assertTrue("move & rename file, same location (rename file)", result.isSuccess()); - - // move empty folder - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_EMPTY_FOLDER, - mBaseFolderPath + TARGET_PATH_TO_EMPTY_FOLDER, - false - ); - result = moveOperation.execute(mClient); - assertTrue("move empty folder", result.isSuccess()); - - // move non-empty folder - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FULL_FOLDER_1, - mBaseFolderPath + TARGET_PATH_TO_FULL_FOLDER_1, - false - ); - result = moveOperation.execute(mClient); - assertTrue("move non-empty folder", result.isSuccess()); - - // move & rename folder, different location - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FULL_FOLDER_2, - mBaseFolderPath + TARGET_PATH_TO_FULL_FOLDER_2_RENAMED, - false - ); - result = moveOperation.execute(mClient); - assertTrue("move & rename folder, different location", result.isSuccess()); - - // move & rename folder, same location (rename folder) - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FULL_FOLDER_3, - mBaseFolderPath + SRC_PATH_TO_FULL_FOLDER_3_RENAMED, - false - ); - result = moveOperation.execute(mClient); - assertTrue("move & rename folder, same location (rename folder)", result.isSuccess()); - - // move for nothing (success, but no interaction with network) - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FILE_4, - mBaseFolderPath + SRC_PATH_TO_FILE_4, - false - ); - result = moveOperation.execute(mClient); - assertTrue("move for nothing (success, but no interaction with network)", result.isSuccess()); - - // move overwriting - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FULL_FOLDER_4, - mBaseFolderPath + TARGET_PATH_TO_ALREADY_EXISTENT_EMPTY_FOLDER_4, - true - ); - result = moveOperation.execute(mClient); - assertTrue("move overwriting", result.isSuccess()); - - - /// Failed cases - - // file to move does not exist - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_NON_EXISTENT_FILE, - mBaseFolderPath + TARGET_PATH_TO_NON_EXISTENT_FILE, - false - ); - result = moveOperation.execute(mClient); - assertTrue("file to move does not exist", result.getCode() == ResultCode.FILE_NOT_FOUND); - - // folder to move into does no exist - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FILE_5, - mBaseFolderPath + TARGET_PATH_TO_FILE_5_INTO_NON_EXISTENT_FOLDER, - false - ); - result = moveOperation.execute(mClient); - assertTrue("folder to move into does no exist", result.getHttpCode() == HttpStatus.SC_CONFLICT); - - // target location (renaming) has invalid characters - mActivity.getClient().setOwnCloudVersion(null); - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FILE_6, - mBaseFolderPath + TARGET_PATH_RENAMED_WITH_INVALID_CHARS, - false - ); - result = moveOperation.execute(mClient); - assertTrue("target location (renaming) has invalid characters", result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - mActivity.getClient().setOwnCloudVersion(OwnCloudVersion.nextcloud_10); - - // name collision - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_PATH_TO_FILE_7, - mBaseFolderPath + TARGET_PATH_TO_ALREADY_EXISTENT_FILE_7, - false - ); - result = moveOperation.execute(mClient); - assertTrue("name collision", result.getCode() == ResultCode.INVALID_OVERWRITE); - - // move a folder into a descendant - moveOperation = new MoveRemoteFileOperation( - mBaseFolderPath + SRC_BASE_FOLDER, - mBaseFolderPath + SRC_PATH_TO_EMPTY_FOLDER, - false - ); - result = moveOperation.execute(mClient); - assertTrue("move a folder into a descendant", result.getCode() == ResultCode.INVALID_MOVE_INTO_DESCENDANT); - } - - @Override - protected void tearDown() throws Exception { - Log.v(LOG_TAG, "Deleting remote fixture..."); - - String[] mPathsToCleanUp = { - mBaseFolderPath + SRC_BASE_FOLDER, - mBaseFolderPath + TARGET_BASE_FOLDER - }; - - for (String path : mPathsToCleanUp) { - RemoteOperationResult removeResult = mActivity.removeFile(path); - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - } - - super.tearDown(); - - Log.v(LOG_TAG, "Remote fixture delete."); - } -} diff --git a/library/src/androidTest/oldTests/OwnCloudClientTest.java b/library/src/androidTest/oldTests/OwnCloudClientTest.java deleted file mode 100644 index c6435ad9af..0000000000 --- a/library/src/androidTest/oldTests/OwnCloudClientTest.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import android.net.Uri; -import android.test.AndroidTestCase; -import android.util.Log; - -import com.owncloud.android.lib.common.OwnCloudClient; -import com.owncloud.android.lib.common.OwnCloudCredentials; -import com.owncloud.android.lib.common.OwnCloudCredentialsFactory; -import com.owncloud.android.lib.common.accounts.AccountUtils; -import com.owncloud.android.lib.common.network.NetworkUtils; -import com.owncloud.android.lib.testclient.R; - -import junit.framework.AssertionFailedError; - -import org.apache.commons.httpclient.ConnectTimeoutException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.HeadMethod; -import org.apache.jackrabbit.webdav.DavConstants; -import org.apache.jackrabbit.webdav.client.methods.PropFindMethod; - -import java.io.IOException; -import java.io.InputStream; -import java.net.SocketTimeoutException; - - -/** - * Unit test for OwnCloudClient - * - * @author David A. Velasco - */ -public class OwnCloudClientTest extends AndroidTestCase { - - private static final String TAG = OwnCloudClientTest.class.getSimpleName(); - - private Uri mServerUri; - private String mUsername; - private String mPassword; - - @Override - protected void setUp() throws Exception { - super.setUp(); - mServerUri = Uri.parse(getContext().getString(R.string.server_base_url)); - mUsername = getContext().getString(R.string.username); - mPassword = getContext().getString(R.string.password); - } - - - public void testConstructor() { - try { - new OwnCloudClient(null, NetworkUtils.getMultiThreadedConnManager(), false); - throw new AssertionFailedError("Accepted NULL parameter"); - } catch (IllegalArgumentException e) { - assertTrue("Expected exception passing NULL baseUri", true); - } catch (Exception e) { - assertTrue("Unexpected exception", false); - } - - try { - new OwnCloudClient(mServerUri, null, false); - throw new AssertionFailedError("Accepted NULL parameter"); - - } catch (IllegalArgumentException e) { - assertTrue("Expected exception passing NULL connectionMgr", true); - } catch (Exception e) { - assertTrue("Unexpected exception passing NULL connectionMgr", false); - } - - OwnCloudClient client = new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager(), false); - assertNotNull("OwnCloudClient instance not built", client); - } - - - public void testGetSetCredentials() { - OwnCloudClient client = new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager(), false); - - assertNotNull("Returned NULL credentials", client.getCredentials()); - assertEquals("Not instanced without credentials", client.getCredentials(), - OwnCloudCredentialsFactory.getAnonymousCredentials()); - - OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials("user", "pass"); - client.setCredentials(credentials); - assertEquals("Basic credentials not set", credentials, client.getCredentials()); - - credentials = OwnCloudCredentialsFactory.newBearerCredentials("bearerToken"); - client.setCredentials(credentials); - assertEquals("Bearer credentials not set", credentials, client.getCredentials()); - - credentials = OwnCloudCredentialsFactory.newSamlSsoCredentials("user", "samlSessionCookie=124"); - client.setCredentials(credentials); - assertEquals("SAML2 session credentials not set", credentials, client.getCredentials()); - } - - public void testExecuteMethodWithTimeouts() { - OwnCloudClient client = new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager(), false); - int connectionTimeout = client.getConnectionTimeout(); - int readTimeout = client.getDataTimeout(); - - HeadMethod head = new HeadMethod(client.getWebdavUri() + "/"); - try { - client.executeMethod(head, 1, 1000); - throw new AssertionFailedError("Completed HEAD with impossible read timeout"); - } catch (ConnectTimeoutException | SocketTimeoutException e) { - Log.e("OwnCloudClientTest", "EXCEPTION", e); - assertTrue("Expected exception " + e.getLocalizedMessage(), true); - - } catch (IOException e) { - assertFalse("Unexpected exception", false); - } finally { - head.releaseConnection(); - } - - assertEquals("Connection timeout was changed for future requests", connectionTimeout, - client.getConnectionTimeout()); - assertEquals("Read timeout was changed for future requests", readTimeout, client.getDataTimeout()); - - try { - client.executeMethod(head, 1000, 1); - throw new AssertionFailedError("Completed HEAD with impossible connection timeout"); - - } catch (ConnectTimeoutException | SocketTimeoutException e) { - Log.e("OwnCloudClientTest", "EXCEPTION", e); - assertTrue("Expected exception " + e.getLocalizedMessage(), true); - } catch (Exception e) { - Log.e("OwnCloudClientTest", "EXCEPTION", e); - assertTrue("Unexpected exception " + e.getLocalizedMessage(), false); - } finally { - head.releaseConnection(); - } - - assertEquals("Connection timeout was changed for future requests", connectionTimeout, - client.getConnectionTimeout()); - assertEquals("Read timeout was changed for future requests", readTimeout, client.getDataTimeout()); - } - - - public void testExecuteMethod() { - OwnCloudClient client = new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager(), false); - HeadMethod head = new HeadMethod(client.getWebdavUri() + "/"); - int status; - try { - status = client.executeMethod(head); - assertTrue("Wrong status code returned: " + status, status > 99 && status < 600); - - } catch (IOException e) { - Log.e(TAG, "Exception in HEAD method execution", e); - // TODO - make it fail? ; try several times, and make it fail if none - // is right? - - } finally { - head.releaseConnection(); - } - } - - public void testExhaustResponse() { - OwnCloudClient client = new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager(), false); - - PropFindMethod propfind = null; - try { - propfind = new PropFindMethod(client.getWebdavUri() + "/", DavConstants.PROPFIND_ALL_PROP, - DavConstants.DEPTH_0); - client.executeMethod(propfind); - InputStream responseBody = propfind.getResponseBodyAsStream(); - if (responseBody != null) { - client.exhaustResponse(responseBody); - - try { - int character = responseBody.read(); - assertEquals("Response body was not fully exhausted", character, -1); // -1 is acceptable - } catch (IOException e) { - // this is the preferred result - } - } else { - Log.e(TAG, "Could not test exhaustResponse due to wrong response"); - // TODO - make it fail? ; try several times, and make it fail if none - // is right? - } - } catch (IOException e) { - Log.e(TAG, "Exception in PROPFIND method execution", e); - // TODO - make it fail? ; try several times, and make it fail if none - // is right? - } finally { - if (propfind != null) { - propfind.releaseConnection(); - } - } - - client.exhaustResponse(null); // must run with no exception - } - - public void testGetSetDefaultTimeouts() { - OwnCloudClient client = new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager(), false); - - int oldDataTimeout = client.getDataTimeout(); - int oldConnectionTimeout = client.getConnectionTimeout(); - - client.setDefaultTimeouts(oldDataTimeout + 1000, oldConnectionTimeout + 1000); - assertEquals("Data timeout not set", oldDataTimeout + 1000, client.getDataTimeout()); - assertEquals("Connection timeout not set", oldConnectionTimeout + 1000, client.getConnectionTimeout()); - - client.setDefaultTimeouts(0, 0); - assertEquals("Zero data timeout not set", 0, client.getDataTimeout()); - assertEquals("Zero connection timeout not set", 0, client.getConnectionTimeout()); - - client.setDefaultTimeouts(-1, -1); - assertEquals("Negative data timeout not ignored", 0, client.getDataTimeout()); - assertEquals("Negative connection timeout not ignored", 0, client.getConnectionTimeout()); - - client.setDefaultTimeouts(-1, 1000); - assertEquals("Negative data timeout not ignored", 0, client.getDataTimeout()); - assertEquals("Connection timeout not set", 1000, client.getConnectionTimeout()); - - client.setDefaultTimeouts(1000, -1); - assertEquals("Data timeout not set", 1000, client.getDataTimeout()); - assertEquals("Negative connection timeout not ignored", 1000, client.getConnectionTimeout()); - } - - public void testGetWebdavUri() { - OwnCloudClient client = new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager(), false); - client.setCredentials(OwnCloudCredentialsFactory.newBearerCredentials("fakeToken")); - Uri webdavUri = client.getWebdavUri(); - assertTrue("WebDAV URI does not point to the right entry point for OAuth2 authenticated servers", - webdavUri.getPath().endsWith(AccountUtils.ODAV_PATH)); - assertTrue("WebDAV URI is not a sub path of base URI", webdavUri.getAuthority().equals(mServerUri.getAuthority()) - && webdavUri.getPath().startsWith(mServerUri.getPath())); - - client.setCredentials(OwnCloudCredentialsFactory.newBasicCredentials(mUsername, mPassword)); - webdavUri = client.getWebdavUri(); - assertTrue("WebDAV URI does not point to the right entry point", - webdavUri.getPath().endsWith(AccountUtils.WEBDAV_PATH_4_0)); - PropFindMethod propfind = null; - - try { - propfind = new PropFindMethod(webdavUri + "/", DavConstants.PROPFIND_ALL_PROP, DavConstants.DEPTH_0); - int status = client.executeMethod(propfind); - assertEquals("WebDAV request did not work on WebDAV URI", HttpStatus.SC_MULTI_STATUS, status); - - } catch (IOException e) { - Log.e(TAG, "Exception in PROPFIND method execution", e); - // TODO - make it fail? ; try several times, and make it fail if none - // is right? - - } finally { - if (propfind != null) { - propfind.releaseConnection(); - } - } - } - - public void testGetSetBaseUri() { - OwnCloudClient client = new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager(), false); - assertEquals("Returned base URI different that URI passed to constructor", mServerUri, client.getBaseUri()); - - Uri otherUri = Uri.parse("https://whatever.com/basePath/here"); - client.setBaseUri(otherUri); - assertEquals("Returned base URI different that URI passed to constructor", otherUri, client.getBaseUri()); - - try { - client.setBaseUri(null); - throw new AssertionFailedError("Accepted NULL parameter"); - } catch (IllegalArgumentException e) { - assertTrue("Unexpected exception passing NULL base URI", true); - } catch (Exception e) { - assertTrue("Unexpected exception passing NULL base URI", false); - } - } - -// public void testGetCookiesString() { - // TODO implement test body - /*public String getCookiesString(){ - Cookie[] cookies = getState().getCookies(); - String cookiesString =""; - for (Cookie cookie: cookies) { - cookiesString = cookiesString + cookie.toString() + ";"; - - logCookie(cookie); - } - - return cookiesString; - - } - */ -// } - - -// public void testSetFollowRedirects() { -// // TODO - to implement this test we need a redirected server -// } - -} diff --git a/library/src/androidTest/oldTests/ReadFileTest.java b/library/src/androidTest/oldTests/ReadFileTest.java deleted file mode 100644 index e370117e48..0000000000 --- a/library/src/androidTest/oldTests/ReadFileTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.testclient.TestActivity; - -import java.io.File; - -/** - * Class to test Read File Operation - * - * @author masensio - * @author David A. Velasco - */ - -public class ReadFileTest extends RemoteTest { - - private static final String LOG_TAG = ReadFileTest.class.getCanonicalName(); - - private String FILE_PATH = "/fileToRead.txt"; - private String mFullPath2File; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - setActivityInitialTouchMode(false); - mFullPath2File = mBaseFolderPath + FILE_PATH; - - File textFile = getFile(TestActivity.ASSETS__TEXT_FILE_NAME); - RemoteOperationResult uploadResult = mActivity.uploadFile(textFile.getAbsolutePath(), mFullPath2File, - "txt/plain", null); - - if (!uploadResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, uploadResult); - } - } - - /** - * Test Read File - */ - public void testReadFile() { - RemoteOperationResult result = mActivity.readFile(mFullPath2File); - assertTrue(result.getData() != null && result.getData().size() == 1); - assertTrue(result.isSuccess()); - // TODO check more properties of the result - } - - @Override - protected void tearDown() throws Exception { - RemoteOperationResult removeResult = mActivity.removeFile(mFullPath2File); - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - - super.tearDown(); - } -} diff --git a/library/src/androidTest/oldTests/ReadFolderTest.java b/library/src/androidTest/oldTests/ReadFolderTest.java deleted file mode 100644 index f49096c30d..0000000000 --- a/library/src/androidTest/oldTests/ReadFolderTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.testclient.TestActivity; - -import java.io.File; - -/** - * Class to test Read Folder Operation - * - * @author masensio - * @author David A. Velasco - */ - -public class ReadFolderTest extends RemoteTest { - - private static final String LOG_TAG = ReadFolderTest.class.getCanonicalName(); - - private static final String FOLDER_PATH = "/folderToRead"; - private static final String[] FILE_PATHS = { - FOLDER_PATH + "/file1.txt", - FOLDER_PATH + "/file2.txt", - FOLDER_PATH + "/file3.txt", - }; - - - private String mFullPathToFolder; - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(false); - mFullPathToFolder = mBaseFolderPath + FOLDER_PATH; - - File textFile = getFile(TestActivity.ASSETS__TEXT_FILE_NAME); - RemoteOperationResult result = mActivity.createFolder(mFullPathToFolder, true); - if (result.isSuccess()) { - for (int i = 0; i < FILE_PATHS.length && result.isSuccess(); i++) { - result = mActivity.uploadFile(textFile.getAbsolutePath(), mBaseFolderPath + FILE_PATHS[i], "txt/plain", - null); - } - } - - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - } - - /** - * Test Read Folder - */ - public void testReadFolder() { - RemoteOperationResult result = mActivity.readFile(mFullPathToFolder); - assertTrue(result.isSuccess()); - assertTrue(result.getData() != null && result.getData().size() > 1); - assertTrue(result.getData().size() == 4); - // TODO assert more properties about the result - } - - - @Override - protected void tearDown() throws Exception { - RemoteOperationResult removeResult = mActivity.removeFile(mFullPathToFolder); - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - - super.tearDown(); - } - -} diff --git a/library/src/androidTest/oldTests/RenameFileTest.java b/library/src/androidTest/oldTests/RenameFileTest.java deleted file mode 100644 index 41d37e864e..0000000000 --- a/library/src/androidTest/oldTests/RenameFileTest.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; -import com.owncloud.android.lib.resources.files.FileUtils; -import com.owncloud.android.lib.testclient.TestActivity; - -import java.io.File; - -/** - * Class to test Rename File Operation - * - * @author masensio - */ - -public class RenameFileTest extends RemoteTest { - - private static final String LOG_TAG = RenameFileTest.class.getCanonicalName(); - - /* Folder data to rename. This folder must exist on the account */ - private static final String OLD_FOLDER_NAME = "folderToRename"; - private static final String OLD_FOLDER_PATH = FileUtils.PATH_SEPARATOR + OLD_FOLDER_NAME; - private static final String NEW_FOLDER_NAME = "renamedFolder"; - private static final String NEW_FOLDER_PATH = FileUtils.PATH_SEPARATOR + NEW_FOLDER_NAME; - - /* File data to rename. This file must exist on the account */ - private static final String OLD_FILE_NAME = "fileToRename.png"; - private static final String OLD_FILE_PATH = FileUtils.PATH_SEPARATOR + OLD_FILE_NAME; - private static final String NEW_FILE_NAME = "renamedFile.png"; - private static final String NEW_FILE_PATH = FileUtils.PATH_SEPARATOR + NEW_FILE_NAME; - - - private String mToCleanUpInServer; - private String mFullPath2OldFolder; - private String mFullPath2NewFolder; - private String mFullPath2OldFile; - private String mFullPath2NewFile; - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(false); - mFullPath2OldFolder = mBaseFolderPath + OLD_FOLDER_PATH; - mFullPath2NewFolder = mBaseFolderPath + NEW_FOLDER_PATH; - mFullPath2OldFile = mBaseFolderPath + OLD_FILE_PATH; - mFullPath2NewFile = mBaseFolderPath + NEW_FILE_PATH; - - createTestFolder(); - uploadTestFile(); - - mToCleanUpInServer = null; - } - - /** - * Test Rename Folder - */ - public void testRenameFolder() { - - mToCleanUpInServer = mFullPath2OldFolder; - RemoteOperationResult result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME, true); - assertTrue(result.isSuccess()); - mToCleanUpInServer = mFullPath2NewFolder; - } - - /** - * Test Rename Folder with forbidden characters : \ < > : " | ? * - */ - public void testRenameFolderForbiddenCharsOnNewServer() throws Exception { - RemoteOperationResult result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, - NEW_FOLDER_NAME + "\\", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "<", true); - assertTrue(result.isSuccess()); - - createTestFolder(); - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + ">", true); - assertTrue(result.isSuccess()); - - createTestFolder(); - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + ":", true); - assertTrue(result.isSuccess()); - - createTestFolder(); - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "\"", true); - assertTrue(result.isSuccess()); - - createTestFolder(); - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "|", true); - assertTrue(result.isSuccess()); - - createTestFolder(); - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "?", true); - assertTrue(result.isSuccess()); - - createTestFolder(); - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "*", true); - assertTrue(result.isSuccess()); - } - - /** - * Test Rename Folder with forbidden characters : \ < > : " | ? * - */ - public void testRenameFolderForbiddenCharsOnOlderServer() { - mActivity.getClient().setOwnCloudVersion(null); - - RemoteOperationResult result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, - NEW_FOLDER_NAME + "\\", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "<", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + ">", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + ":", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "\"", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "|", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "?", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FOLDER_NAME, mFullPath2OldFolder, NEW_FOLDER_NAME + "*", true); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - } - - /** - * Test Rename File - */ - public void testRenameFile() { - mToCleanUpInServer = mFullPath2OldFile; - RemoteOperationResult result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, NEW_FILE_NAME, false); - assertTrue(result.isSuccess()); - mToCleanUpInServer = mFullPath2NewFile; - } - - - /** - * Test Rename Folder with forbidden characters: \ < > : " | ? * - */ - public void testRenameFileForbiddenCharsOnOlderServer() { - mActivity.getClient().setOwnCloudVersion(null); - RemoteOperationResult result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "\\" + NEW_FILE_NAME, - false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "<" + NEW_FILE_NAME, false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, ">" + NEW_FILE_NAME, false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, ":" + NEW_FILE_NAME, false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "\"" + NEW_FILE_NAME, false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "|" + NEW_FILE_NAME, false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "?" + NEW_FILE_NAME, false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "*" + NEW_FILE_NAME, false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - } - - /** - * Test Rename Folder with forbidden characters: \ < > : " | ? * - */ - public void testRenameFileForbiddenCharsOnNewServer() throws Exception { - RemoteOperationResult result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "\\" + NEW_FILE_NAME, - false); - assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME); - - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "<" + NEW_FILE_NAME, false); - assertTrue(result.isSuccess()); - - uploadTestFile(); - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, ">" + NEW_FILE_NAME, false); - assertTrue(result.isSuccess()); - - uploadTestFile(); - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, ":" + NEW_FILE_NAME, false); - assertTrue(result.isSuccess()); - - uploadTestFile(); - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "\"" + NEW_FILE_NAME, false); - assertTrue(result.isSuccess()); - - uploadTestFile(); - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "|" + NEW_FILE_NAME, false); - assertTrue(result.isSuccess()); - - uploadTestFile(); - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "?" + NEW_FILE_NAME, false); - assertTrue(result.isSuccess()); - - uploadTestFile(); - result = mActivity.renameFile(OLD_FILE_NAME, mFullPath2OldFile, "*" + NEW_FILE_NAME, false); - assertTrue(result.isSuccess()); - } - - @Override - protected void tearDown() throws Exception { - if (mToCleanUpInServer != null) { - RemoteOperationResult removeResult = mActivity.removeFile(mToCleanUpInServer); - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - } - super.tearDown(); - } - - private void uploadTestFile() throws Exception { - File imageFile = getFile(TestActivity.ASSETS__IMAGE_FILE_NAME); - RemoteOperationResult result = mActivity.uploadFile(imageFile.getAbsolutePath(), mFullPath2OldFile, - "image/png", null); - - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - } - - private void createTestFolder() throws Exception { - RemoteOperationResult result = mActivity.createFolder(mFullPath2OldFolder, true); - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - } -} diff --git a/library/src/androidTest/oldTests/SimpleFactoryManagerTest.java b/library/src/androidTest/oldTests/SimpleFactoryManagerTest.java deleted file mode 100644 index d93f640c50..0000000000 --- a/library/src/androidTest/oldTests/SimpleFactoryManagerTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import android.net.Uri; -import android.test.AndroidTestCase; - -import com.owncloud.android.lib.common.OwnCloudAccount; -import com.owncloud.android.lib.common.OwnCloudClient; -import com.owncloud.android.lib.common.OwnCloudCredentialsFactory; -import com.owncloud.android.lib.common.SimpleFactoryManager; -import com.owncloud.android.lib.testclient.R; - -import junit.framework.AssertionFailedError; - -/** - * Unit test for SimpleFactoryManager - * - * @author David A. Velasco - */ - -public class SimpleFactoryManagerTest extends AndroidTestCase { - - private SimpleFactoryManager mSFMgr; - - private OwnCloudAccount mValidAccount; - private OwnCloudAccount mAnonymousAccount; - - @Override - protected void setUp() throws Exception { - super.setUp(); - mSFMgr = new SimpleFactoryManager(); - Uri serverUri = Uri.parse(getContext().getString(R.string.server_base_url)); - String username = getContext().getString(R.string.username); - - mValidAccount = new OwnCloudAccount(serverUri, OwnCloudCredentialsFactory.newBasicCredentials( - username, getContext().getString(R.string.password))); - - mAnonymousAccount = new OwnCloudAccount(serverUri, OwnCloudCredentialsFactory.getAnonymousCredentials()); - } - - public void testGetClientFor() { - try { - OwnCloudClient client = mSFMgr.getClientFor(mValidAccount, getContext()); - - assertNotSame("Got same client instances for same account", client, mSFMgr.getClientFor(mValidAccount, - getContext())); - - assertNotSame("Got same client instances for different accounts", client, - mSFMgr.getClientFor(mAnonymousAccount, getContext())); - - } catch (Exception e) { - throw new AssertionFailedError("Exception getting client for account: " + e.getMessage()); - } - // TODO harder tests - } - - public void testRemoveClientFor() { - try { - OwnCloudClient client = mSFMgr.getClientFor(mValidAccount, getContext()); - mSFMgr.removeClientFor(mValidAccount); - assertNotSame("Got same client instance after removing it from manager", - client, mSFMgr.getClientFor(mValidAccount, getContext())); - } catch (Exception e) { - throw new AssertionFailedError("Exception getting client for account: " + e.getMessage()); - } - // TODO harder tests - } - - -// public void testSaveAllClients() { - // TODO implement test; - // or refactor saveAllClients() method out of OwnCloudClientManager to make - // it independent of AccountManager -// } - -} diff --git a/library/src/androidTest/oldTests/SingleSessionManagerTest.java b/library/src/androidTest/oldTests/SingleSessionManagerTest.java deleted file mode 100644 index 6452ef73da..0000000000 --- a/library/src/androidTest/oldTests/SingleSessionManagerTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import android.net.Uri; -import android.test.AndroidTestCase; - -import com.owncloud.android.lib.common.OwnCloudAccount; -import com.owncloud.android.lib.common.OwnCloudClient; -import com.owncloud.android.lib.common.OwnCloudCredentialsFactory; -import com.owncloud.android.lib.common.SingleSessionManager; -import com.owncloud.android.lib.testclient.R; - -import junit.framework.AssertionFailedError; - -/** - * Unit test for SingleSessionManager - * - * @author David A. Velasco - */ -public class SingleSessionManagerTest extends AndroidTestCase { - - private SingleSessionManager mSSMgr; - - private OwnCloudAccount mValidAccount; - private OwnCloudAccount mAnonymousAccount; - - @Override - protected void setUp() throws Exception { - super.setUp(); - mSSMgr = new SingleSessionManager(); - Uri serverUri = Uri.parse(getContext().getString(R.string.server_base_url)); - String username = getContext().getString(R.string.username); - - mValidAccount = new OwnCloudAccount(serverUri, OwnCloudCredentialsFactory.newBasicCredentials(username, - getContext().getString(R.string.password))); - - mAnonymousAccount = new OwnCloudAccount(serverUri, OwnCloudCredentialsFactory.getAnonymousCredentials()); - } - - public void testGetClientFor() { - try { - OwnCloudClient client1 = mSSMgr.getClientFor(mValidAccount, getContext()); - OwnCloudClient client2 = mSSMgr.getClientFor(mAnonymousAccount, getContext()); - - assertNotSame("Got same client instances for different accounts", client1, client2); - assertSame("Got different client instances for same account", - client1, mSSMgr.getClientFor(mValidAccount, getContext())); - } catch (Exception e) { - throw new AssertionFailedError("Exception getting client for account: " + e.getMessage()); - } - - // TODO harder tests - } - - public void testRemoveClientFor() { - try { - OwnCloudClient client1 = mSSMgr.getClientFor(mValidAccount, getContext()); - mSSMgr.removeClientFor(mValidAccount); - assertNotSame("Got same client instance after removing it from manager", - client1, mSSMgr.getClientFor(mValidAccount, getContext())); - } catch (Exception e) { - throw new AssertionFailedError("Exception getting client for account: " + e.getMessage()); - } - - // TODO harder tests - } - - -// public void testSaveAllClients() { - // TODO implement test; - // or refactor saveAllClients() method out of OwnCloudClientManager to make - // it independent of AccountManager -// } -} diff --git a/library/src/androidTest/oldTests/UpdatePrivateShareTest.java b/library/src/androidTest/oldTests/UpdatePrivateShareTest.java deleted file mode 100644 index 9a480ff75a..0000000000 --- a/library/src/androidTest/oldTests/UpdatePrivateShareTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import android.util.Log; - -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.resources.shares.OCShare; -import com.owncloud.android.lib.resources.shares.RemoveRemoteShareOperation; -import com.owncloud.android.lib.resources.shares.ShareType; -import com.owncloud.android.lib.resources.shares.UpdateRemoteShareOperation; -import com.owncloud.android.lib.testclient.TestActivity; - -import java.io.File; - -/** - * Class to test UpdateRemoteShareOperation - * with private shares - */ -public class UpdatePrivateShareTest extends RemoteTest { - private static final String LOG_TAG = UpdatePrivateShareTest.class.getCanonicalName(); - - /* File to share and update */ - private static final String FILE_TO_SHARE = "/fileToShare.txt"; - - /* Folder to share and update */ - private static final String FOLDER_TO_SHARE = "/folderToShare"; - - /* Sharees */ - private static final String USER_SHAREE = "admin"; - private static final String GROUP_SHAREE = "admin"; - - private String mFullPath2FileToShare; - private String mFullPath2FolderToShare; - - private OCShare mFileShare; - private OCShare mFolderShare; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - Log.v(LOG_TAG, "Setting up the remote fixture..."); - - // Upload the file - mFullPath2FileToShare = mBaseFolderPath + FILE_TO_SHARE; - - File textFile = getFile(TestActivity.ASSETS__TEXT_FILE_NAME); - RemoteOperationResult result = getActivity().uploadFile(textFile.getAbsolutePath(), mFullPath2FileToShare, - "txt/plain", null); - - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - - // Share the file privately with other user - result = getActivity().createShare(mFullPath2FileToShare, ShareType.USER, USER_SHAREE, false, "", - OCShare.MAXIMUM_PERMISSIONS_FOR_FILE); - - if (result.isSuccess()) { - mFileShare = (OCShare) result.getData().get(0); - } else { - mFileShare = null; - } - - // Create the folder - mFullPath2FolderToShare = mBaseFolderPath + FOLDER_TO_SHARE; - result = getActivity().createFolder(mFullPath2FolderToShare, true); - - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - - // Share the folder privately with a group - result = getActivity().createShare(mFullPath2FolderToShare, ShareType.GROUP, GROUP_SHAREE, false, "", - OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER); - - if (result.isSuccess()) { - mFolderShare = (OCShare) result.getData().get(0); - } else { - mFolderShare = null; - } - - Log.v(LOG_TAG, "Remote fixture created."); - } - - public void testUpdateSharePermissions() { - Log.v(LOG_TAG, "testUpdateSharePermissions in"); - - if (mFileShare != null) { - /// successful tests - // Update Share permissions on a shared file - UpdateRemoteShareOperation updateShare = new UpdateRemoteShareOperation(mFileShare.getRemoteId()); - updateShare.setPermissions(OCShare.READ_PERMISSION_FLAG); // minimum permissions - RemoteOperationResult result = updateShare.execute(mClient); - assertTrue(result.isSuccess()); - - // Update Share permissions on a shared folder - updateShare = new UpdateRemoteShareOperation(mFolderShare.getRemoteId()); - updateShare.setPermissions(OCShare.READ_PERMISSION_FLAG + OCShare.DELETE_PERMISSION_FLAG); - result = updateShare.execute(mClient); - assertTrue(result.isSuccess()); - - - /// unsuccessful tests - // Update Share with invalid permissions - updateShare = new UpdateRemoteShareOperation(mFileShare.getRemoteId()); - // greater than maximum value - updateShare.setPermissions(OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER + 1); - result = updateShare.execute(mClient); - assertFalse(result.isSuccess()); - - // Unshare the file before next unsuccessful tests - RemoveRemoteShareOperation unshare = new RemoveRemoteShareOperation((int) mFileShare.getRemoteId()); - result = unshare.execute(mClient); - - if (result.isSuccess()) { - // Update Share permissions on unknown share - UpdateRemoteShareOperation updateNoShare = new UpdateRemoteShareOperation(mFileShare.getRemoteId()); - updateNoShare.setPermissions(OCShare.READ_PERMISSION_FLAG); // minimum permissions - result = updateNoShare.execute(mClient); - assertFalse(result.isSuccess()); - } - } - } - - @Override - protected void tearDown() throws Exception { - Log.v(LOG_TAG, "Deleting remote fixture..."); - - if (mFullPath2FileToShare != null) { - RemoteOperationResult removeResult = getActivity().removeFile(mFullPath2FileToShare); - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - } - - if (mFullPath2FolderToShare != null) { - RemoteOperationResult removeResult = getActivity().removeFile(mFullPath2FolderToShare); - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - } - - super.tearDown(); - Log.v(LOG_TAG, "Remote fixture delete."); - } -} diff --git a/library/src/androidTest/oldTests/UpdatePublicShareTest.java b/library/src/androidTest/oldTests/UpdatePublicShareTest.java deleted file mode 100644 index 7e6d7a6bc9..0000000000 --- a/library/src/androidTest/oldTests/UpdatePublicShareTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import android.util.Log; - -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.resources.shares.OCShare; -import com.owncloud.android.lib.resources.shares.RemoveRemoteShareOperation; -import com.owncloud.android.lib.resources.shares.ShareType; -import com.owncloud.android.lib.resources.shares.UpdateRemoteShareOperation; -import com.owncloud.android.lib.testclient.TestActivity; - -import java.io.File; -import java.util.Calendar; - -/** - * Class to test UpdateRemoteShareOperation - * with public shares - */ -public class UpdatePublicShareTest extends RemoteTest { - private static final String LOG_TAG = UpdatePublicShareTest.class.getCanonicalName(); - - /* File to share and update.*/ - private static final String FILE_TO_SHARE = "/fileToShare.txt"; - - /* Folder to share and update */ - private static final String FOLDER_TO_SHARE = "/folderToShare"; - - // Data for tests - private static final String PASSWORD = "password"; - private static final String PASS_SPECIAL_CHARS = "p@ssw�rd"; - - private String mFullPath2FileToShare; - private String mFullPath2FolderToShare; - - private OCShare mShare; - private OCShare mFolderShare; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - Log.v(LOG_TAG, "Setting up the remote fixture..."); - - // Upload the file - mFullPath2FileToShare = mBaseFolderPath + FILE_TO_SHARE; - - File textFile = getFile(TestActivity.ASSETS__TEXT_FILE_NAME); - RemoteOperationResult result = getActivity().uploadFile(textFile.getAbsolutePath(), mFullPath2FileToShare, - "txt/plain", null); - - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - - // Share the file with a public link - result = getActivity().createShare(mFullPath2FileToShare, ShareType.PUBLIC_LINK, "", false, "", - OCShare.READ_PERMISSION_FLAG); - - if (result.isSuccess()) { - mShare = (OCShare) result.getData().get(0); - } else { - Utils.logAndThrow(LOG_TAG, result); - } - - // Create the folder - mFullPath2FolderToShare = mBaseFolderPath + FOLDER_TO_SHARE; - result = getActivity().createFolder(mFullPath2FolderToShare, true); - - if (!result.isSuccess()) { - Utils.logAndThrow(LOG_TAG, result); - } - - // Share the folder publicly via link - result = getActivity().createShare(mFullPath2FolderToShare, ShareType.PUBLIC_LINK, "", false, "", - OCShare.READ_PERMISSION_FLAG); - - if (result.isSuccess()) { - mFolderShare = (OCShare) result.getData().get(0); - } else { - Utils.logAndThrow(LOG_TAG, result); - } - - Log.v(LOG_TAG, "Remote fixtures created."); - } - - public void testUpdatePublicShare() { - Log.v(LOG_TAG, "testUpdatePublicShare in"); - - if (mShare != null) { - // successful tests - // Update Share with password - UpdateRemoteShareOperation updateShare = new UpdateRemoteShareOperation(mShare.getRemoteId()); - updateShare.setPassword(PASSWORD); - RemoteOperationResult result = updateShare.execute(mClient); - assertTrue(result.isSuccess()); - - // Update Share with password with special characters - updateShare = new UpdateRemoteShareOperation(mShare.getRemoteId()); - updateShare.setPassword(PASS_SPECIAL_CHARS); - result = updateShare.execute(mClient); - assertTrue(result.isSuccess()); - - // Update Share with expiration date - updateShare = new UpdateRemoteShareOperation(mShare.getRemoteId()); - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DAY_OF_MONTH, 7); - long expirationDateInMillis = calendar.getTimeInMillis(); - updateShare.setExpirationDate(expirationDateInMillis); - result = updateShare.execute(mClient); - assertTrue(result.isSuccess()); - - // Update the Folder Share with edit permission - updateShare = new UpdateRemoteShareOperation(mFolderShare.getRemoteId()); - updateShare.setPublicUpload(true); - result = updateShare.execute(mClient); - assertTrue(result.isSuccess()); - - // unsuccessful test - // Update Share with expiration date in the past - updateShare = new UpdateRemoteShareOperation(mShare.getRemoteId()); - calendar.set(Calendar.YEAR, 2014); - expirationDateInMillis = calendar.getTimeInMillis(); - updateShare.setExpirationDate(expirationDateInMillis); - result = updateShare.execute(mClient); - assertFalse(result.isSuccess()); - - // Try to update the file Share with edit permission - updateShare = new UpdateRemoteShareOperation(mShare.getRemoteId()); - updateShare.setPublicUpload(true); - result = updateShare.execute(mClient); - assertFalse(result.isSuccess()); - - // Unshare the file before the unsuccessful tests - result = new RemoveRemoteShareOperation((int) mShare.getRemoteId()).execute(mClient); - - if (result.isSuccess()) { - // Update Share with password on unknown share - UpdateRemoteShareOperation updateNoShare = new UpdateRemoteShareOperation(mShare.getRemoteId()); - updateNoShare.setPassword(PASSWORD); - result = updateNoShare.execute(mClient); - assertFalse(result.isSuccess()); - - // Update Share with expiration date on unknown share - updateNoShare = new UpdateRemoteShareOperation(mShare.getRemoteId()); - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_MONTH, 7); - expirationDateInMillis = cal.getTimeInMillis(); - updateNoShare.setExpirationDate(expirationDateInMillis); - result = updateNoShare.execute(mClient); - assertFalse(result.isSuccess()); - } - } - } - - @Override - protected void tearDown() throws Exception { - Log.v(LOG_TAG, "Deleting remote fixture..."); - - if (mFullPath2FileToShare != null) { - RemoteOperationResult removeResult = getActivity().removeFile(mFullPath2FileToShare); - - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - } - - if (mFullPath2FolderToShare != null) { - RemoteOperationResult removeResult = getActivity().removeFile(mFullPath2FolderToShare); - - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - } - - super.tearDown(); - Log.v(LOG_TAG, "Remote fixture delete."); - } -} diff --git a/library/src/androidTest/oldTests/UploadFileTest.java b/library/src/androidTest/oldTests/UploadFileTest.java deleted file mode 100644 index c59005ff7a..0000000000 --- a/library/src/androidTest/oldTests/UploadFileTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Nextcloud Android Library - * - * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors - * SPDX-FileCopyrightText: 2019 Tobias Kaminsky - * SPDX-License-Identifier: MIT - */ -package com.owncloud.android; - -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.testclient.TestActivity; - -import java.io.File; - -/** - * Class to test Update File Operation - * - * @author masensio - * @author David A. Velasco - */ - -public class UploadFileTest extends RemoteTest { - - private static final String LOG_TAG = UploadFileTest.class.getCanonicalName(); - - private static final String UPLOAD_PATH = "/uploadedImage.png"; - - private static final String CHUNKED_UPLOAD_PATH = "/uploadedVideo.MP4"; - - private static final String FILE_NOT_FOUND_PATH = "/notFoundShouldNotBeHere.png"; - - private File mFileToUpload, mFileToUploadWithChunks; - private String mUploadedFilePath; - - @Override - protected void setUp() throws Exception { - super.setUp(); - setActivityInitialTouchMode(false); - mUploadedFilePath = null; - - mFileToUpload = getFile(TestActivity.ASSETS__IMAGE_FILE_NAME); - mFileToUploadWithChunks = getFile(TestActivity.ASSETS__VIDEO_FILE_NAME); - } - - /** - * Test Upload File without chunks - */ - public void testUploadFile() { - - String fullPath2Upload = mBaseFolderPath + UPLOAD_PATH; - RemoteOperationResult result = mActivity.uploadFile(mFileToUpload.getAbsolutePath(), fullPath2Upload, - "image/png", null); - mUploadedFilePath = fullPath2Upload; - assertTrue(result.isSuccess()); - } - - /** - * Test Upload File with chunks - */ - public void testUploadFileWithChunks() { - - String fullPath2Upload = mBaseFolderPath + CHUNKED_UPLOAD_PATH; - RemoteOperationResult result = mActivity.uploadFile(mFileToUploadWithChunks.getAbsolutePath(), fullPath2Upload, - "video/mp4", null); - mUploadedFilePath = fullPath2Upload; - assertTrue(result.isSuccess()); - } - - /** - * Test Upload Not Found File - */ - public void testUploadFileNotFound() { - String fullPath2Upload = mBaseFolderPath + FILE_NOT_FOUND_PATH; - RemoteOperationResult result = mActivity.uploadFile(FILE_NOT_FOUND_PATH, fullPath2Upload, "image/png", null); - mUploadedFilePath = fullPath2Upload; - assertFalse(result.isSuccess()); - } - - @Override - protected void tearDown() throws Exception { - if (mUploadedFilePath != null) { - RemoteOperationResult removeResult = mActivity.removeFile(mUploadedFilePath); - if (!removeResult.isSuccess()) { - Utils.logAndThrow(LOG_TAG, removeResult); - } - } - super.tearDown(); - } -}